/* Shared visual contract for FiscalFlow pages. Keep domain status colors intact. */
:root {
  --flow-action: var(--ff-acao, #087b5c);
  --flow-action-hover: #05634c;
  --flow-surface: #f5f8f7;
  --flow-ink: var(--ff-texto, #18343e);
  --flow-muted: #637982;
  --border: var(--ff-linha, #dfe8e5);
  --border-light: #edf3f0;
  --radius: 12px;
  --radius-sm: 7px;
  --shadow: 0 2px 6px rgb(25 46 53 / 4%);
}
body { background: var(--flow-surface); color: var(--flow-ink); font-size: 14px; }
button, input, select, textarea { font: inherit; }
a, button, input, select, textarea, summary { touch-action: manipulation; }
:focus-visible { outline: 3px solid #17a680; outline-offset: 3px; }
.skip-link { position: fixed; left: 16px; top: -80px; z-index: 1000; padding: 12px 18px; background: #fff; color: #05634c; border-radius: 8px; }
.skip-link:focus { top: 12px; }
.topbar { height: 68px; padding: 0 24px; background: #033f35; box-shadow: none; border-bottom: 1px solid #176151; }
.topbar-inner, .topbar-brand, .topbar-right { min-width: 0; }
.topbar-inner { gap: 24px; }
.topbar-brand { flex-shrink: 0; }
.health-brand-logo { width: 126px; height: 38px; }
.topbar-right { gap: 12px; }
.topbar-right .empresa-nome { max-width: 30vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 500; }
.usuario-nome { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; opacity: 1; }
.topbar-avatar { flex: 0 0 34px; background: #e1f4ed; border: 2px solid #4bb792; object-position: center 20%; }
.btn-topbar { background: transparent; border: 1px solid #538f7e; min-height: 34px; }
.btn-topbar:hover { background: #176151; }
.layout { min-height: calc(100vh - 68px); }
.sidebar { width: 224px; top: 68px; height: calc(100vh - 68px); padding: 16px 12px 28px; background: #043f35; border-right: 1px solid #165e4e; scrollbar-width: thin; scrollbar-color: #387663 transparent; }
.sidebar-nav .nav-section { padding: 24px 12px 8px; font-size: 10px; letter-spacing: 1px; color: #89afa3; }
.sidebar .nav-link { display: flex; align-items: center; gap: 10px; padding: 9px 12px; margin: 2px 0; border-radius: 7px; border-left: 3px solid transparent; color: #d1e4df; font-size: 13px; font-weight: 500; }
.sidebar .nav-link:hover { background: #105847; color: #ffffff; }
.sidebar .nav-link.active { background: #126653; color: #ffffff; border-left-color: #22d6a0; font-weight: 700; }
.main-content { padding: 30px clamp(18px, 2.5vw, 40px) 48px; min-width: 0; }
.main-content > * { min-width: 0; }
.main-content h1, .pg h1 { font-size: clamp(23px, 2vw, 29px); letter-spacing: -.7px; line-height: 1.25; color: var(--flow-ink); }
.main-content h2 { color: var(--flow-ink); letter-spacing: -.25px; text-transform: none; }
.main-content > [class^="page-"] > .card-header-row > h2 { font-size: 26px; margin: 0; }
.card-header-row, .dashboard-heading { flex-wrap: wrap; gap: 16px; margin-bottom: 24px; }
.dashboard-heading h1 { margin: 0 0 8px; }
.dashboard-heading p, .text-muted { color: var(--flow-muted); }
.dashboard-eyebrow, .card-kicker { color: var(--flow-action); font-size: 10px; font-weight: 700; letter-spacing: 1px; }
.card, .portal-module { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); background: #fff; }
.card h2 { font-size: 17px; }
.portal-home { max-width: none; }
.portal-modules { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.portal-module { padding: 24px; min-width: 0; min-height: 320px; }
.portal-module-head { gap: 12px; min-width: 0; }
.portal-module-head > div { min-width: 0; }
.portal-module h2 { font-size: 21px; }
.portal-module-icon { flex: 0 0 42px; width: 42px; height: 42px; background: #e5f5ee; color: #087b5c; font-weight: 700; border: 0; }
.portal-module-simples .portal-module-icon, .portal-module-vault .portal-module-icon { background: #e5f5ee; color: #087b5c; border: 0; }
.portal-module > p { color: var(--flow-muted); }
.portal-module-stats { gap: 8px; }
.portal-module-stats div { min-width: 0; padding: 12px 10px; background: #f4f8f6; border: 1px solid #e3ece8; }
.portal-module-stats strong { font-size: 25px; font-variant-numeric: tabular-nums; }
.portal-module-stats span { font-size: 10px; }
.portal-module-actions { gap: 8px; }
.portal-module-actions a { display: inline-flex; justify-content: center; align-items: center; min-height: 38px; font-size: 12px; border-radius: 7px; color: var(--flow-action); background: #fff; border: 1px solid #bdddd1; }
.portal-module-actions .module-action-primary, .btn.btn-primary { background: var(--flow-action); color: #fff; border-color: var(--flow-action); }
.portal-module-actions .module-action-primary:hover, .btn.btn-primary:hover { background: var(--flow-action-hover); border-color: var(--flow-action-hover); }
.vault-latest, .dashboard-invoice-item, .dashboard-invoice-top, .dashboard-list-main { min-width: 0; overflow-wrap: anywhere; }
.dashboard-card-header { padding: 20px 24px; }
.dashboard-card-header a { color: var(--flow-action); }
.compact-pending-card > #dash-recent-requests { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 18px 24px 24px; }
.compact-pending-card .summary-row { background: #fafcfb; }
.form-grid { gap: 16px 24px; }
.form-grid > *, .form-group { min-width: 0; }
.form-group label { color: #49665d; text-transform: none; letter-spacing: 0; font-size: 13px; margin-bottom: 7px; }
.form-group :is(input, select, textarea):not([type="checkbox"]):not([type="radio"]) { min-width: 0; min-height: 42px; border-color: #ceddd7; border-radius: 7px; background-color: #fff; color: var(--flow-ink); }
.form-group :is(input, textarea)[readonly] { background: #f2f6f4; color: var(--flow-muted); }
.form-group input[type="color"] { padding: 5px; max-width: 160px; }
.form-group input[type="checkbox"], .form-group input[type="radio"] { width: auto; accent-color: var(--flow-action); }
.form-group small { display: block; margin-top: 6px; color: var(--flow-muted); line-height: 1.5; }
.btn { min-height: 38px; border-radius: 7px; font-size: 13px; font-weight: 600; }
.btn.btn-outline { color: var(--flow-action); border-color: #bdddd1; background: #fff; }
.btn.btn-outline:hover { background: #edf8f2; }
button:disabled, .btn:disabled { opacity: .55; cursor: not-allowed; }
.form-actions { flex-wrap: wrap; gap: 10px; }
.table-container, .table-responsive, .mc-table { max-width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.client-table, .mc-table table { margin: 0; width: 100%; border-collapse: collapse; font-size: 13px; }
.client-table th, .mc-table th { background: #f2f7f4; color: #536d64; font-size: 11px; font-weight: 600; padding: 13px 16px; }
.client-table td, .mc-table td { padding: 14px 16px; border-bottom: 1px solid var(--border-light); }
.client-table tbody tr:hover, .mc-table tbody tr:hover { background: #f3faf6; }
.health-personal-card { grid-template-columns: 86px minmax(0, 1fr) auto; background: #fff; }
.health-avatar-preview img { display: block; background: #e5f5ee; }
.health-personal-card h2 { margin-top: 0; }
.modal-card { max-width: calc(100vw - 32px); border-radius: 14px; }
@media (max-width: 1200px) {
  .topbar-right .empresa-nome, .topbar-right > .topbar-sep:first-of-type { display: none; }
  .portal-modules { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portal-module-nf { grid-column: 1 / -1; min-height: 0; }
  .compact-pending-card > #dash-recent-requests { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .topbar { padding: 0 16px; }
  .topbar-inner { gap: 12px; }
  .brand-page, .brand-sep, .topbar-right .user-role, .usuario-nome, .topbar-sep { display: none; }
  .layout { display: block; }
  .sidebar { width: 100%; height: auto; max-height: 62px; top: 68px; padding: 5px 10px; border-bottom: 1px solid var(--border); overflow-x: auto; }
  .sidebar-nav { display: flex; min-width: max-content; }
  .sidebar-nav .nav-section { display: none; }
  .sidebar .nav-link { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 0; }
  .main-content { padding: 24px 16px; }
  .portal-modules { grid-template-columns: minmax(0, 1fr); }
  .portal-module { min-height: 0; padding: 20px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .health-personal-card { grid-template-columns: 64px minmax(0, 1fr); gap: 16px; }
  .health-avatar-preview img { width: 64px; height: 64px; border-radius: 14px; }
  .health-personal-card > .btn { grid-column: 1 / -1; justify-self: start; }
  .dashboard-card-header { padding: 18px; }
  .compact-pending-card > #dash-recent-requests { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* Emerald identity, inspired by the reference dashboard and login. */
.flow-icon { width: 30px; height: 30px; flex-shrink: 0; }
.flow-nav-icon { width: 19px; height: 19px; flex-shrink: 0; opacity: .9; }
.sidebar { background: linear-gradient(165deg, #043f35, #02382f); }
.sidebar .nav-link.active { background: linear-gradient(100deg, #11715a, #105646); box-shadow: inset 0 1px 0 rgb(255 255 255 / 5%); }
.sidebar .nav-link.active .flow-nav-icon { color: #a0f2cf; }
.topbar { background: linear-gradient(100deg, #034236, #053e36); }
.portal-home .dashboard-heading { padding: 8px 0 10px; margin-bottom: 24px; }
.portal-home .dashboard-heading h1 { font-size: clamp(25px, 2.5vw, 34px); margin: 8px 0 12px; }
.portal-home .dashboard-heading p { font-size: 15px; }
.portal-home .dashboard-eyebrow { color: #087b5c; }
.portal-module { --module-accent: #008564; --module-dark: #005641; position: relative; padding: 26px; border-radius: 16px; box-shadow: 0 4px 16px rgb(17 68 51 / 5%); }
.portal-module-simples { --module-accent: #008d7a; --module-dark: #005547; }
.portal-module-vault { --module-accent: #17665e; --module-dark: #023f39; }
.portal-module .portal-module-icon { width: 76px; height: 76px; flex-basis: 76px; border-radius: 21px; color: #fff; background: radial-gradient(circle at 20% 0%, rgb(116 255 201 / 28%), transparent 55%), linear-gradient(140deg, var(--module-accent), var(--module-dark)); box-shadow: inset 0 1px 1px rgb(255 255 255 / 35%), inset 0 -2px 4px rgb(0 0 0 / 12%), 0 0 0 6px #eef7f3, 0 10px 18px rgb(0 83 60 / 16%); }
.portal-module-head { gap: 20px; min-height: 88px; }
.portal-module .portal-module-icon .flow-icon { width: 40px; height: 40px; stroke-width: 1.6; }
.portal-module > p { font-size: 14px; line-height: 1.65; margin: 22px 0 24px; }
.portal-module .card-kicker { color: #168469; }
.portal-module-actions { padding-top: 12px; }
.portal-module-actions .module-action-primary, .btn.btn-primary { background: linear-gradient(125deg, #008565, #006b50); border-color: #007a5c; box-shadow: inset 0 1px 0 rgb(255 255 255 / 15%); }
.portal-module-actions .module-action-primary:hover, .btn.btn-primary:hover { background: #005e48; border-color: #005e48; }
.portal-module-actions-stacked a { justify-content: flex-start; gap: 10px; padding: 11px 14px; }
.portal-module-actions-stacked .flow-icon { width: 19px; height: 19px; }
.portal-module-actions-stacked a::after { content: "→"; margin-left: auto; font-size: 18px; }
.compact-pending-card > #dash-recent-requests { grid-template-columns: minmax(0, 1fr); }
.compact-pending-card .dashboard-list-item { align-items: center; padding: 18px; }
.compact-pending-card .dashboard-list-main { flex: 1; }
.health-personal-card { --flow-icon-bg: #fff; }
/* Login uses CSS geometry, so it stays crisp without an image dependency. */
.login-institutional { position: relative; overflow: hidden; isolation: isolate; background: #033e35; color: #fff; }
.login-institutional::before { content: ""; position: absolute; z-index: -1; width: 720px; height: 720px; right: -140px; top: 12%; border-radius: 50%; background: radial-gradient(circle at 24% 50%, #043c34 45%, #005a46 70%, #0baa71 86%, #4de5a1 96%); box-shadow: 25px 0 90px rgb(0 221 139 / 12%); opacity: .65; }
.login-institutional::after { content: ""; position: absolute; z-index: -1; inset: 0; background: repeating-linear-gradient(145deg, transparent 0 39px, rgb(72 216 168 / 9%) 40px, transparent 41px 65px); mask-image: linear-gradient(#000, transparent 30%, transparent 75%, #000); }
.login-institutional .institutional-content { max-width: 600px; }
.login-institutional .health-login-logo { filter: brightness(0) invert(1); width: 200px; margin-bottom: 70px; }
.login-institutional h1 { color: #fff; font-size: clamp(34px, 3.3vw, 54px); line-height: 1.15; }
.login-institutional h1 span { color: #5cdda5; }
.login-institutional p { color: #bed8ce; }
.login-benefits li { color: #e4f4ed; }
.login-benefits li::before { width: 28px; height: 28px; background: linear-gradient(135deg, #23ba7f, #006d4e); color: #fff; box-shadow: 0 0 0 3px rgb(119 246 188 / 10%); }
.login-form-panel { background: radial-gradient(ellipse at 100% 100%, #e6f4ec, transparent 70%), #f6f9f7; }
.login-card { border: 1px solid #e1e9e5; border-top: 5px solid #09895d; box-shadow: 0 18px 50px rgb(22 72 48 / 10%); border-radius: 18px; }
.login-header h1 { color: #073f34; }
.login-card .form-group input { min-height: 48px; background: #f8faf9; }
.login-card .btn-full { min-height: 48px; }
.login-links a, .login-logo { color: #087b5c; }
.environment-indicator { color: #087354; border-color: #d1e9dd; background: #eaf6ef; }
@media (max-width: 768px) {
  .portal-module { padding: 20px; }
  .portal-home .dashboard-heading { padding: 0; }
  .portal-module .portal-module-icon { width: 64px; height: 64px; flex-basis: 64px; border-radius: 18px; }
  .compact-pending-card .dashboard-list-item { align-items: flex-start; flex-wrap: wrap; }
}

/* Sector navigation and dashboard share the same permission-filtered catalog. */
.sidebar { width: 250px; }
.nav-sector { margin: 6px 0; color: #d1e4df; }
.nav-sector summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; padding: 12px; font-size: 13px; border-radius: 8px; }
.nav-sector summary::-webkit-details-marker { display: none; }
.nav-sector summary::after { content: '›'; margin-left: auto; }
.nav-sector[open] > summary { background: #125744; color: #fff; }
.nav-sector[open] > summary::after { transform: rotate(90deg); }
.sector-submenu { margin: 6px 8px 12px 21px; border-left: 1px solid #38705e; padding-left: 10px; }
.sector-subheading { color: #91b9a9; font-size: 10px; letter-spacing: .4px; padding: 12px 6px 4px; }
.sidebar .sector-submenu .nav-link { font-size: 12px; padding: 8px; line-height: 1.5; }
.overview-stats { margin: 0 0 24px; }
.overview-stats > div { padding: 16px 20px; background: #fff; }
.sector-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-bottom: 24px; align-items: start; }
.sector-card { min-height: 0; padding: 24px; }
.sector-card h2 { font-size: 20px; }
.sector-card .portal-module-head { gap: 16px; }
.sector-card .portal-module-icon { width: 64px; height: 64px; flex-basis: 64px; }
.sector-card .portal-module-icon .flow-icon { width: 34px; height: 34px; }
.sector-card-groups { border-top: 1px solid var(--border-light); }
.sector-card-groups h3 { font-size: 12px; color: #087b5c; margin: 18px 0 8px; }
.sector-card-groups ul { list-style: none; padding: 0; margin: 0; }
.sector-card-groups a { display: flex; align-items: center; justify-content: space-between; gap: 12px; text-decoration: none; color: #3e574c; font-size: 13px; padding: 9px 6px; border-radius: 6px; }
.sector-card-groups a:hover { background: #edf7f1; color: #05634c; }
.sector-card-groups a > span { color: #168469; }
@media (max-width: 1200px) { .sector-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 768px) {
  .sidebar { width: 100%; height: auto; max-height: none; position: static; padding: 10px; overflow: visible; }
  .sector-nav { display: block; min-width: 0; }
  .sector-grid { grid-template-columns: minmax(0, 1fr); }
  .overview-stats { grid-template-columns: minmax(0, 1fr); }
}

.action-metrics { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,175px),1fr)); gap:14px; margin:18px 0 10px; }
.metric-link { display:flex; flex-direction:column; gap:12px; min-width:0; padding:20px; border:1px solid var(--border); border-radius:12px; background:#fff; text-decoration:none; color:#18343e; box-shadow:var(--shadow); }
.metric-link:hover { border-color:#168469; box-shadow:0 4px 14px #087b5c14; }
.metric-link > span { font-size:12px; font-weight:600; }
.metric-link strong { font-size:clamp(20px,2.4vw,32px); overflow-wrap:anywhere; }
.metric-link small { display:flex; justify-content:space-between; gap:8px; color:#087b5c; font-size:11px; }
.metric-attention { border-top:3px solid #b45309; }
.dashboard-scope { font-size:12px; color:#637982; margin-bottom:24px; }
.operational-queue { padding:0; overflow:hidden; margin-top:24px; }
.operational-queue .dashboard-card-header { flex-wrap:wrap; }
.operational-queue .dashboard-card-header p { margin:6px 0 0; }
.queue-row { display:grid; grid-template-columns:minmax(0,1fr) 155px 170px 20px; align-items:center; gap:18px; padding:18px 24px; border-bottom:1px solid var(--border-light); text-decoration:none; color:var(--flow-ink); }
.queue-row:hover { background:#f2f8f5; }
.queue-row strong { font-size:13px; overflow-wrap:anywhere; }
.queue-row p { font-size:12px; color:var(--flow-muted); margin:5px 0 0; overflow-wrap:anywhere; }
.queue-meta { font-size:13px; }.queue-meta small { display:block; margin-top:5px; color:var(--flow-muted); font-size:11px; }
.queue-empty,.queue-warning { padding:24px; margin:0; }.queue-warning { color:#92400e; background:#fffbeb; }
.dashboard-shortcuts { display:flex; flex-wrap:wrap; gap:12px; margin:24px 0; }
.dashboard-shortcuts .btn { display:inline-flex; align-items:center; gap:8px; text-decoration:none; }.dashboard-shortcuts .flow-icon { width:18px; height:18px; }
.dashboard-modules > summary { cursor:pointer; font-weight:600; color:#087b5c; padding:14px 0; }
.dashboard-modules .sector-grid { margin-top:16px; }
@media(max-width:1100px) { .queue-row { grid-template-columns:minmax(0,1fr) 140px; }.queue-row > span:last-child { display:none; } }
@media(max-width:550px) { .queue-row { grid-template-columns:minmax(0,1fr); gap:10px; }.metric-link { padding:16px; } }

.queue-row .status-badge { white-space: normal; text-align: center; line-height: 1.4; max-width: 100%; }
