:root {
    --navy: #0e1116;
    --blue: #e31e24;
    --cyan: #1e3a5f;
    --green: #16a34a;
    --orange: #b7791f;
    --accent-hover: #b5161b;
    --accent-soft: rgba(227, 30, 36, .08);
    --surface: #ffffff;
    --surface-2: #f1f5f9;
    --background: #f8fafc;
    --text: #0e1116;
    --muted: #667085;
    --line: #e5e7eb;
    --nav-text: #344054;
    --field: #ffffff;
    --table-head: #f8fafc;
    --table-head-text: #718096;
    --table-text: #506176;
    --table-line: #edf1f4;
    --context-bg: #f4f8fc;
    --context-line: #dbe5ef;
    --admin-context-bg: #fff7f7;
    --admin-context-line: #f3c7c9;
    color-scheme: light;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--background);
}

html[data-theme="dark"] {
    --navy: #f4f7fb;
    --blue: #00afef;
    --accent-hover: #008fc7;
    --surface: #1a2028;
    --surface-2: #222a35;
    --background: #0d1117;
    --text: #f4f7fb;
    --muted: #9aa8ba;
    --line: #303846;
    --nav-text: #d7dee8;
    --field: #171d25;
    --table-head: #141a21;
    --table-head-text: #9aabc0;
    --table-text: #bec9d6;
    --table-line: #2a323e;
    --context-bg: #182331;
    --context-line: #33485f;
    --admin-context-bg: #251b20;
    --admin-context-line: #573038;
    --cyan: #91b7dc;
    --accent-soft: rgba(0, 175, 239, .16);
    color-scheme: dark;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--background); }
.app-shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.sidebar { display: flex; flex-direction: column; gap: 24px; padding: 24px 18px; color: var(--text); background: var(--surface); border-right: 1px solid var(--line); }
.brand { display: flex; flex-direction: column; gap: 7px; padding: 0 12px 24px; border-bottom: 1px solid var(--line); }
.brand img { width: 156px; height: auto; object-fit: contain; object-position: left center; }
.brand span { color: var(--muted); font-size: .74rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
nav { display: grid; gap: 5px; }
.nav-section { margin: 14px 10px 5px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.nav-section:first-child { margin-top: 0; }
.nav-item { display: grid; grid-template-columns: 18px 1fr auto; align-items: center; gap: 11px; min-height: 40px; padding: 0 10px; border-radius: 6px; color: var(--nav-text); font-size: 13px; font-weight: 500; text-decoration: none; }
.nav-item svg, .metric-icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav-item.active { color: var(--blue); background: var(--accent-soft); }
.nav-item.disabled { cursor: not-allowed; opacity: .65; }
.nav-item small { padding: 3px 6px; border-radius: 12px; color: var(--muted); background: var(--surface-2); font-size: .61rem; }
.sidebar-note { margin-top: auto; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.sidebar-note strong { font-size: .83rem; }
.sidebar-note p { margin: 6px 0 0; color: var(--muted); font-size: .73rem; line-height: 1.5; }
.main-content { min-width: 0; padding: 28px clamp(24px, 3vw, 40px); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.page-actions { display: flex; justify-content: flex-end; margin: -14px 0 22px; }
.eyebrow { margin: 0 0 6px; color: var(--blue); font-size: .7rem; font-weight: 800; letter-spacing: .13em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 7px; color: var(--navy); font-size: 22px; font-weight: 600; line-height: 1.15; }
h2 { margin: 0; color: var(--navy); font-size: 16px; font-weight: 600; }
.subtitle { margin-bottom: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.topbar-end { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.utility-actions { display: flex; align-items: center; gap: 3px; }
.utility-menu { position: relative; }
.utility-button { position: relative; display: grid; width: 36px; height: 36px; padding: 8px; place-items: center; border: 0; border-radius: 7px; color: var(--nav-text); background: transparent; cursor: pointer; }
.utility-button:hover, .utility-button:focus-visible, .utility-button[aria-expanded="true"] { color: var(--blue); background: var(--accent-soft); outline: 0; }
.utility-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.notification-badge { position: absolute; top: 1px; right: 0; display: grid; width: 16px; height: 16px; place-items: center; border: 2px solid var(--background); border-radius: 50%; color: #fff; background: var(--blue); font-size: 8px; font-weight: 800; }
.utility-panel { position: absolute; top: calc(100% + 10px); right: 0; z-index: 30; width: min(340px, calc(100vw - 32px)); overflow: hidden; border: 1px solid var(--line); border-radius: 9px; color: var(--text); background: var(--surface); box-shadow: 0 18px 48px rgba(4,10,18,.2); }
.utility-panel[hidden] { display: none; }
.utility-panel header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.utility-panel header strong { font-size: 13px; }
.utility-panel header small { color: var(--muted); font-size: 10px; }
.notification-list article { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--table-line); }
.notification-list article:last-child { border-bottom: 0; }
.notification-list span { display: block; margin-bottom: 4px; font-size: 12px; font-weight: 700; }
.notification-list small { color: var(--muted); font-size: 11px; }
.notification-read-form button { padding: 6px 8px; border: 1px solid var(--line); border-radius: 5px; color: var(--blue); background: var(--field); font: inherit; font-size: 9px; font-weight: 700; cursor: pointer; }
.notification-read-form button:hover, .notification-read-form button:focus-visible { border-color: var(--blue); background: var(--accent-soft); outline: 0; }
.notification-empty { margin: 0; padding: 18px 16px; color: var(--muted); font-size: 11px; text-align: center; }
.notification-center-link { display: block; padding: 11px 16px; border-top: 1px solid var(--line); color: var(--blue); background: var(--surface-2); font-size: 11px; font-weight: 750; text-align: center; text-decoration: none; }
.notification-center-link:hover, .notification-center-link:focus-visible { color: var(--accent-hover); background: var(--accent-soft); outline: 0; }
.help-panel { width: min(320px, calc(100vw - 32px)); }
.help-panel ol { display: grid; gap: 9px; margin: 0; padding: 15px 18px 5px 34px; color: var(--table-text); font-size: 11px; line-height: 1.5; }
.help-panel p { margin: 10px 16px 16px; padding: 10px; border-radius: 6px; color: var(--muted); background: var(--surface-2); font-size: 10px; line-height: 1.5; }
.theme-icon-sun { display: none; }
html[data-theme="dark"] .theme-icon-moon { display: none; }
html[data-theme="dark"] .theme-icon-sun { display: block; }
.account { display: flex; align-items: center; gap: 10px; min-width: 175px; padding: 9px 10px 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--field); box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 1px 3px rgba(15,23,42,.06); }
.account > span:nth-child(2) { display: grid; gap: 2px; }
.account strong { font-size: .82rem; }
.account small { color: var(--muted); font-size: .69rem; }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 50%; color: #fff; background: var(--blue); font-size: .72rem; font-weight: 800; }
.logout-form { margin-left: auto; }
.logout-form button { display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 6px; color: var(--muted); background: transparent; cursor: pointer; }
.logout-form button:hover, .logout-form button:focus-visible { color: var(--blue); background: var(--accent-soft); outline: 2px solid transparent; }
.logout-form svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.admin-context-control { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: -10px 0 22px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.admin-context-control > div { display: grid; gap: 4px; }
.admin-context-control span { color: var(--text); font-size: 13px; font-weight: 700; }
.admin-context-control small { color: var(--muted); font-size: 12px; }
.admin-context-control form { display: flex; align-items: center; gap: 8px; }
.admin-context-control select { min-width: 210px; height: 38px; padding: 0 34px 0 11px; border: 1px solid var(--line); border-radius: 6px; color: var(--text); background: var(--field); font: inherit; font-size: 13px; }
.admin-context-control button, .admin-context-active button, .admin-open-portal { min-height: 38px; padding: 0 14px; border: 0; border-radius: 6px; color: #fff; background: var(--blue); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.admin-context-control button:hover, .admin-context-control button:focus-visible { background: var(--accent-hover); }
.admin-open-portal { display: inline-flex; align-items: center; margin-left: auto; text-decoration: none; }
.admin-open-portal:hover, .admin-open-portal:focus-visible { background: var(--accent-hover); }
.tenant-context { display: flex; align-items: center; gap: 12px; margin: -10px 0 22px; padding: 12px 16px; border: 1px solid var(--context-line); border-radius: 8px; color: var(--cyan); background: var(--context-bg); }
.tenant-context span { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.tenant-context strong { color: var(--text); font-size: 14px; }
.tenant-context small { margin-left: auto; color: var(--muted); font-size: 12px; }
.admin-context-active { margin-top: -12px; border-color: var(--admin-context-line); background: var(--admin-context-bg); }
.admin-context-active form { margin-left: 4px; }
.admin-context-active button { min-height: 32px; border: 1px solid var(--admin-context-line); color: var(--blue); background: var(--field); }
.admin-context-active button:hover, .admin-context-active button:focus-visible { background: var(--accent-soft); }
.admin-view-context { border-color: var(--admin-context-line); background: var(--admin-context-bg); }
.context-return { flex: none; padding: 7px 10px; border: 1px solid var(--admin-context-line); border-radius: 6px; color: var(--blue); background: var(--field); font-size: 11px; font-weight: 700; text-decoration: none; }
.context-return:hover, .context-return:focus-visible { background: var(--accent-soft); }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.summary-card { position: relative; min-height: 146px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 1px 3px rgba(15,23,42,.06); }
.metric-icon { display: grid; place-items: center; width: 36px; height: 36px; margin-bottom: 12px; padding: 8px; border-radius: 8px; color: var(--blue); background: var(--accent-soft); }
.summary-label { display: block; color: var(--muted); font-size: 13px; font-weight: 500; }
.summary-card strong { display: block; margin: 5px 0; color: var(--navy); font-size: 24px; font-weight: 600; line-height: 1.15; }
.summary-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.panel { overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 1px 3px rgba(15,23,42,.06); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 24px; border-bottom: 1px solid var(--line); }
.panel-heading-actions { display: flex; align-items: center; gap: 12px; }
.updated { color: var(--muted); font-size: .72rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { padding: 12px 24px; color: var(--table-head-text); background: var(--table-head); font-size: .67rem; letter-spacing: .07em; text-transform: uppercase; }
td { padding: 17px 24px; border-top: 1px solid var(--table-line); color: var(--table-text); font-size: .8rem; vertical-align: middle; }
tbody tr:first-child td { border-top: 0; }
td:first-child strong, td:nth-child(3) strong { display: block; color: var(--text); font-size: .8rem; }
td small { display: block; margin-top: 3px; color: var(--muted); }
.type-tag { display: inline-block; margin-bottom: 5px; color: var(--blue); font-size: .64rem; font-weight: 800; text-transform: uppercase; }
.status { display: inline-block; min-width: 78px; padding: 6px 9px; border-radius: 999px; text-align: center; font-size: .68rem; font-weight: 750; }
.status-urgente { color: #a43d1f; background: #ffebe3; }.status-atencao { color: #9a5a16; background: #fff0d8; }.status-programado { color: #196a51; background: #e3f6ef; }
.status-valido { color: #196a51; background: #e3f6ef; }
.status-vence-em-breve { color: #9a5a16; background: #fff0d8; }
.status-vencido { color: #a43d1f; background: #ffebe3; }
.status-sem-registro { color: #667085; background: #eef2f6; }
.table-action, .breadcrumb-link { color: var(--blue); font-weight: 700; text-decoration: none; }
.table-action { white-space: nowrap; font-size: 12px; }
.table-action:hover, .table-action:focus-visible, .breadcrumb-link:hover, .breadcrumb-link:focus-visible { color: var(--accent-hover); }
.table-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.inline-action-form { margin: 0; }
.inline-action-form button { padding: 0; border: 0; background: transparent; cursor: pointer; }
.danger-action { color: #b4232e; }
.danger-action:hover, .danger-action:focus-visible { color: #8f1721; }
.action-unavailable { color: var(--muted); font-size: 11px; white-space: nowrap; }
.breadcrumb-link { display: inline-block; margin-bottom: 12px; font-size: 12px; }
.collaborator-name { font-size: 13px !important; }
.empty-state { padding: 34px 24px; color: var(--muted); text-align: center; }
.file-pending { display: inline-block; max-width: 130px; color: var(--muted); font-size: 11px; line-height: 1.35; }
.collaborator-summary .summary-card { min-height: 118px; }
.primary-action, .secondary-action { display: inline-flex; min-height: 38px; padding: 0 15px; align-items: center; justify-content: center; border-radius: 6px; font: inherit; font-size: 12px; font-weight: 700; text-decoration: none; cursor: pointer; }
.primary-action { border: 1px solid var(--blue); color: #fff; background: var(--blue); }
.primary-action:hover, .primary-action:focus-visible { border-color: var(--accent-hover); background: var(--accent-hover); }
.secondary-action { border: 1px solid var(--line); color: var(--nav-text); background: var(--field); }
.secondary-action:hover, .secondary-action:focus-visible { color: var(--blue); border-color: var(--blue); }
.flash-message { display: flex; align-items: center; gap: 10px; margin: -10px 0 22px; padding: 12px 15px; border: 1px solid #a8dec9; border-radius: 8px; color: #126047; background: #edf9f4; font-size: 12px; font-weight: 650; }
.flash-message svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.flash-warning { border-color: #f2d39c; color: #8a570d; background: #fff8e8; }
.flash-error { border-color: #f1b5ba; color: #9b1c24; background: #fff1f2; }
.form-card { max-width: 820px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 1px 3px rgba(15,23,42,.06); }
.form-card-heading { padding: 22px 24px; border-bottom: 1px solid var(--line); }
.form-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.form-card-heading p:last-child { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.form-card form { padding: 24px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.client-create-card { max-width: 980px; margin: 0 auto; }
.form-section-title { display: flex; align-items: baseline; gap: 10px; margin: 4px 0 16px; }
.form-section-title:not(:first-of-type) { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.form-section-title strong { color: var(--text); font-size: 13px; }
.form-section-title span { color: var(--muted); font-size: 11px; }
.security-callout { margin-top: 22px; padding: 14px 16px; border: 1px solid var(--context-line); border-radius: 7px; color: var(--table-text); background: var(--context-bg); }
.security-callout strong { color: var(--text); font-size: 12px; }
.security-callout p { margin: 5px 0 0; font-size: 11px; line-height: 1.5; }
.form-errors { max-width: 980px; margin: -10px auto 20px; padding: 13px 16px; border: 1px solid #efb8bd; border-radius: 8px; color: #9f1f25; background: #fff1f1; font-size: 12px; }
.form-errors ul { margin: 6px 0 0; padding-left: 18px; }
.activation-page { display: grid; min-height: 100vh; padding: 24px; place-items: center; background: var(--background); }
.activation-card { width: min(520px, 100%); padding: 38px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 14px 45px rgba(14,17,22,.1); }
.activation-card > img { width: 190px; height: auto; margin-bottom: 34px; }
.activation-card h1 { font-size: 28px; }
.activation-card > p:not(.eyebrow) { color: var(--muted); font-size: 14px; line-height: 1.55; }
.activation-card form { display: grid; gap: 18px; margin-top: 24px; }
.activation-card .primary-action { width: 100%; margin-top: 4px; }
.form-field { display: grid; align-content: start; gap: 7px; }
.form-field-wide { grid-column: 1 / -1; }
.form-field label { color: var(--text); font-size: 12px; font-weight: 700; }
.form-field input, .form-field select, .form-field textarea { width: 100%; min-height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 6px; color: var(--text); background: var(--field); font: inherit; font-size: 13px; outline: 0; }
.upload-field { margin-top: 20px; padding: 16px; border: 1px dashed var(--context-line); border-radius: 8px; background: var(--context-bg); }
.upload-field input[type="file"] { min-height: 44px; padding: 8px; background: var(--field); }
.upload-field input[type="file"]::file-selector-button { margin-right: 10px; padding: 7px 10px; border: 0; border-radius: 5px; color: #fff; background: var(--blue); font: inherit; font-size: 11px; font-weight: 700; cursor: pointer; }
.form-field textarea { min-height: 128px; padding-top: 11px; padding-bottom: 11px; line-height: 1.5; resize: vertical; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-field input[aria-invalid="true"], .form-field select[aria-invalid="true"], .form-field textarea[aria-invalid="true"] { border-color: #c43b46; }
.form-field > small { color: var(--muted); font-size: 10px; line-height: 1.45; }
.field-error { color: #b4232e; font-size: 11px; font-weight: 650; }
.origin-locked { display: flex; min-height: 42px; padding: 8px 12px; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 6px; color: var(--text); background: var(--surface-2); font-size: 12px; font-weight: 700; }
.origin-locked small { color: var(--muted); font-size: 10px; font-weight: 500; }
.form-note { display: grid; gap: 4px; margin-top: 20px; padding: 13px 14px; border: 1px solid var(--context-line); border-radius: 7px; color: var(--table-text); background: var(--context-bg); }
.form-note strong { color: var(--text); font-size: 11px; }
.form-note span { font-size: 10px; line-height: 1.5; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.filters-panel { margin-bottom: 22px; }
.filters-form { display: grid; grid-template-columns: minmax(240px, 1.7fr) minmax(150px, .7fr) minmax(150px, .7fr) auto; align-items: end; gap: 14px; padding: 18px 24px 22px; }
.notification-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.notification-filters { grid-template-columns: repeat(2, minmax(180px, 280px)) 1fr; }
.notification-filters .filter-actions { align-self: end; }
.notification-unread-row { background: var(--context-bg); }
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 18px 24px; border-top: 1px solid var(--line); }
.pagination > span:not(.secondary-action) { color: var(--muted); font-size: 12px; font-weight: 650; }
.pagination-disabled { opacity: .48; cursor: default; pointer-events: none; }
.notification-preference-note { margin: -8px 0 22px; }
.notification-preference-note p:last-child { margin-bottom: 0; }
.preference-table th:not(:first-child), .preference-table td:not(:first-child) { width: 16%; text-align: center; }
.preference-check { display: inline-flex; align-items: center; gap: 7px; color: var(--table-text); font-size: 12px; font-weight: 650; cursor: pointer; }
.preference-check input { width: 17px; height: 17px; accent-color: var(--blue); cursor: pointer; }
.preference-actions { margin: 0; padding: 18px 24px; }
.filter-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.proposal-detail-summary .summary-card { min-height: 122px; }
.detail-status-text { font-size: 18px !important; overflow-wrap: anywhere; }
.proposal-detail-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, .75fr); gap: 22px; margin-bottom: 22px; }
.proposal-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; margin: 0; }
.proposal-details > div { padding: 18px 24px; border-top: 1px solid var(--table-line); }
.proposal-details > div:nth-child(2) { border-top: 0; }
.proposal-details .proposal-description { grid-column: 1 / -1; border-top: 0; }
.proposal-details dt { margin-bottom: 6px; color: var(--table-head-text); font-size: .67rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.proposal-details dd { margin: 0; color: var(--table-text); font-size: .8rem; line-height: 1.6; overflow-wrap: anywhere; }
.proposal-review form { padding: 22px 24px; }
.proposal-adjustment, .proposal-adjustment-state { margin-bottom: 22px; }
.proposal-adjustment form { padding: 22px 24px; }
.proposal-review .form-actions { margin-top: 18px; padding-top: 18px; }
.commercial-draft { margin-bottom: 22px; }
.commercial-draft-details { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.commercial-draft-details .proposal-description { grid-column: 1 / -1; }
.commercial-draft-empty, .commercial-draft-warning { margin: 0; padding: 18px 24px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.commercial-draft-warning { border-top: 1px solid var(--table-line); color: var(--orange); background: var(--surface-2); font-weight: 650; }
.commercial-review-state { display: grid; gap: 4px; padding: 16px 24px; border-top: 1px solid var(--table-line); color: var(--table-text); background: var(--context-bg); }
.commercial-review-state strong { color: var(--text); font-size: 12px; }
.commercial-review-state span { color: var(--muted); font-size: 10px; }
.commercial-review-state p { margin: 5px 0 0; font-size: 12px; line-height: 1.5; }
.commercial-version-history { border-top: 1px solid var(--table-line); }
.commercial-version-history h3 { margin: 0; padding: 16px 24px 4px; color: var(--navy); font-size: 13px; font-weight: 650; }
.commercial-publish-form { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 24px; border-top: 1px solid var(--table-line); background: var(--context-bg); }
.commercial-publish-form p { margin: 0; color: var(--table-text); font-size: 12px; line-height: 1.5; }
.commercial-publish-form p strong { display: block; margin-bottom: 3px; color: var(--text); }
.commercial-publish-form .form-actions { flex: 0 0 auto; margin: 0; padding: 0; border: 0; }
.commercial-decision-form { padding: 20px 24px; border-top: 1px solid var(--table-line); background: var(--surface); }
.commercial-decision-form .form-actions { margin-top: 16px; padding-top: 16px; }
.commercial-decision-actions { justify-content: flex-end; gap: 10px; }
.commercial-review-history { border-top: 1px solid var(--table-line); }
.commercial-review-history h3 { margin: 0; padding: 16px 24px 4px; color: var(--navy); font-size: 13px; font-weight: 650; }
.commercial-review-history td small { display: block; margin-top: 4px; }
.commercial-published-state, .client-commercial-proposal-note { margin: 0; padding: 16px 24px; border-top: 1px solid var(--table-line); color: var(--table-text); font-size: 11px; line-height: 1.5; background: var(--context-bg); }
.client-commercial-proposal { border-color: var(--context-line); }
.proposal-history { margin-bottom: 0; }
footer { padding: 22px 2px 0; color: #8190a2; font-size: .7rem; text-align: center; }

html[data-theme="dark"] .status-urgente,
html[data-theme="dark"] .status-vencido { color: #ffb4a4; background: #49251f; }
html[data-theme="dark"] .status-atencao,
html[data-theme="dark"] .status-vence-em-breve { color: #f6ca7a; background: #46351d; }
html[data-theme="dark"] .status-programado,
html[data-theme="dark"] .status-valido { color: #83dfbd; background: #173b31; }
html[data-theme="dark"] .status-sem-registro { color: #bdc7d3; background: #303844; }
html[data-theme="dark"] .login-error { border-color: #663038; color: #ffb5bd !important; background: #321d22; }
html[data-theme="dark"] .security-notice { color: var(--muted) !important; }
html[data-theme="dark"] .input-shell input { color: var(--text); }
html[data-theme="dark"] .flash-message { border-color: #285846; color: #88dfbe; background: #163228; }
html[data-theme="dark"] .flash-warning { border-color: #60491f; color: #f6ca7a; background: #332817; }
html[data-theme="dark"] .flash-error { border-color: #6f3037; color: #ffadb5; background: #351b20; }
html[data-theme="dark"] .field-error { color: #ff9ca7; }
html[data-theme="dark"] .form-errors { border-color: #663038; color: #ffb5bd; background: #321d22; }
html[data-theme="dark"] .danger-action { color: #ff8f98; }
html[data-theme="dark"] footer { color: #748397; }

@media (max-width: 1050px) { .summary-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 980px) { .proposal-detail-layout { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
    .app-shell { display: block; }
    .sidebar { gap: 16px; padding: 18px; }
    .brand { padding-bottom: 14px; }
    nav { grid-template-columns: 1fr 1fr; }
    .sidebar-note { display: none; }
    .main-content { padding: 24px 16px; }
    .topbar { align-items: flex-start; }
    .page-actions { margin-top: -12px; }
    .topbar-end { width: 100%; justify-content: flex-end; }
    .account { min-width: 0; }
    .account > span:nth-child(2) { display: none; }
    .admin-context-control { align-items: stretch; flex-direction: column; }
    .admin-context-control form { align-items: stretch; flex-direction: column; }
    .admin-context-control select { width: 100%; min-width: 0; }
    .tenant-context { align-items: flex-start; flex-direction: column; gap: 4px; }
    .tenant-context small { margin-left: 0; }
    .context-return { margin-top: 4px; }
    .admin-context-active form { width: 100%; margin: 6px 0 0; }
    .summary-grid { grid-template-columns: 1fr; }
    .panel-heading { align-items: flex-start; }
    .panel-heading-actions { align-items: flex-end; flex-direction: column; }
    .updated { display: none; }
    .form-grid { grid-template-columns: 1fr; }
    .form-card-heading, .form-section-title { align-items: flex-start; flex-direction: column; }
    .proposal-details { grid-template-columns: 1fr; }
    .commercial-draft-details { grid-template-columns: 1fr 1fr; }
    .commercial-publish-form { align-items: stretch; flex-direction: column; }
    .commercial-publish-form .primary-action { width: 100%; }
    .proposal-details > div:nth-child(2) { border-top: 1px solid var(--table-line); }
    .form-field-wide { grid-column: auto; }
    .filters-form { grid-template-columns: 1fr 1fr; }
    .filter-search { grid-column: 1 / -1; }
    th, td { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 520px) { .commercial-draft-details { grid-template-columns: 1fr; } }
@media (max-width: 460px) { nav { grid-template-columns: 1fr; }.topbar { gap: 12px; }.form-card form, .form-card-heading { padding: 18px; }.form-actions { flex-direction: column-reverse; }.form-actions > * { width: 100%; }.filters-form { grid-template-columns: 1fr; padding: 18px; }.filter-search { grid-column: auto; }.filter-actions > * { flex: 1; } }

.login-page { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(360px, 1fr); gap: 20px; min-height: 100vh; padding: 24px; background: var(--background); }
.login-intro, .login-panel { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 1px 3px rgba(15,23,42,.06); }
.login-intro { display: flex; flex-direction: column; padding: 32px; }
.login-logo { width: 220px; height: auto; object-fit: contain; object-position: left center; }
.login-overview { max-width: 650px; margin-top: clamp(34px, 8vh, 86px); padding: 2px 0 2px 16px; border-left: 3px solid var(--blue); }
.login-overview strong { display: block; margin-bottom: 6px; color: var(--text); font-size: 16px; font-weight: 600; }
.login-overview p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.login-message { margin: auto 0 24px; max-width: 760px; }
.login-kicker { margin-bottom: 10px; color: var(--blue); font-size: 11px; font-weight: 700; letter-spacing: .13em; }
.login-message h1 { max-width: 720px; margin: 0 0 18px; font-size: clamp(38px, 4.2vw, 58px); font-weight: 700; line-height: 1.05; letter-spacing: -.035em; }
.login-message h1 span { color: var(--blue); }
.login-description { max-width: 700px; margin-bottom: 0; color: var(--muted); font-size: 15px; line-height: 1.55; }
.login-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.login-steps article { min-height: 92px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.login-steps strong { font-size: 13px; font-weight: 600; }
.login-steps p { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.login-panel { display: grid; align-items: center; padding: clamp(28px, 4vw, 48px); }
.login-form-wrap h2 { margin-bottom: 6px; font-size: 23px; font-weight: 600; }
.login-form-wrap > p { margin-bottom: 22px; color: var(--muted); font-size: 14px; }
.google-button, .login-submit { width: 100%; min-height: 42px; border-radius: 6px; font: inherit; font-size: 14px; font-weight: 600; }
.google-button { display: flex; align-items: center; justify-content: center; gap: 9px; border: 1px solid var(--line); color: var(--text); background: var(--surface); }
.google-button span { display: grid; place-items: center; width: 20px; height: 20px; border: 1px solid var(--line); border-radius: 50%; color: #4285f4; font-size: 11px; }
.google-button small { padding: 3px 6px; border-radius: 999px; color: var(--muted); background: var(--surface-2); font-size: 10px; }
.login-divider { display: flex; align-items: center; gap: 12px; margin: 22px 0; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.login-divider::before, .login-divider::after { height: 1px; flex: 1; content: ""; background: var(--line); }
.field-group { margin-bottom: 15px; }
.field-group label { display: block; margin-bottom: 7px; font-size: 13px; font-weight: 600; }
.input-shell { display: grid; grid-template-columns: 20px 1fr 20px; align-items: center; gap: 8px; min-height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--field); }
.input-shell svg { width: 18px; height: 18px; fill: none; stroke: #667085; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.input-shell input { min-width: 0; border: 0; outline: 0; color: var(--text); background: transparent; font: inherit; font-size: 14px; opacity: 1; }
.input-shell input::placeholder { color: #98a2b3; }
.input-shell:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-shell .input-action { grid-column: 3; }
.login-options { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 4px 0 16px; font-size: 12px; }
.login-options label { display: flex; align-items: center; gap: 7px; color: var(--nav-text); }
.login-options span, .login-register span { color: var(--blue); }
.login-options small, .login-register small { color: var(--muted); font-size: 9px; }
.login-submit { display: flex; align-items: center; justify-content: center; gap: 12px; border: 0; color: #fff; background: var(--blue); cursor: pointer; }
.login-submit:hover { background: var(--accent-hover); }
.login-error, .security-notice { margin: 0 0 12px !important; padding: 9px 11px; border-radius: 6px; font-size: 11px !important; line-height: 1.45; }
.login-error { border: 1px solid #f6d7d8; color: #9f1f25 !important; background: #fff1f1; }
.security-notice { margin-top: 12px !important; margin-bottom: 0 !important; border: 1px solid var(--line); color: #475467 !important; background: var(--surface-2); }
.login-register { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; text-align: center; }
.login-page button:disabled, .login-page input:disabled { cursor: not-allowed; }

.mfa-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--background); }
.mfa-card { width: min(820px, 100%); padding: clamp(28px, 5vw, 54px); border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 18px 48px rgba(15,23,42,.10); }
.mfa-card-compact { width: min(500px, 100%); }
.mfa-logo { display: block; width: 190px; max-height: 82px; margin: 0 auto 28px; object-fit: contain; }
.mfa-card .login-kicker { margin-bottom: 8px; text-align: center; }
.mfa-card h1 { margin: 0; color: var(--text); text-align: center; font-size: clamp(26px, 4vw, 38px); line-height: 1.12; }
.mfa-lead { max-width: 650px; margin: 12px auto 26px; color: var(--muted); text-align: center; line-height: 1.55; }
.mfa-setup-grid { display: grid; grid-template-columns: 280px 1fr; gap: 28px; align-items: center; margin: 24px 0; }
.mfa-qr { padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.mfa-qr img { display: block; width: 100%; height: auto; }
.mfa-steps { display: grid; gap: 12px; margin: 0; padding-left: 22px; color: var(--text); line-height: 1.45; }
.mfa-manual { margin-top: 18px; color: var(--muted); font-size: 13px; }
.mfa-manual summary { cursor: pointer; color: var(--blue); font-weight: 700; }
.mfa-manual code { display: block; margin-top: 8px; padding: 10px; border-radius: 6px; background: var(--surface-2); color: var(--text); overflow-wrap: anywhere; user-select: all; }
.mfa-form { display: grid; gap: 9px; max-width: 420px; margin: 22px auto 0; }
.mfa-form label { color: var(--text); font-size: 13px; font-weight: 700; }
.mfa-form input { width: 100%; height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--text); font-size: 20px; letter-spacing: .18em; text-align: center; }
.mfa-form input:focus { border-color: var(--blue); outline: 3px solid rgba(237,28,36,.12); }
.mfa-form button, .mfa-primary-link { min-height: 46px; display: grid; place-items: center; padding: 0 18px; border: 0; border-radius: 7px; background: var(--blue); color: #fff; font-weight: 700; text-decoration: none; cursor: pointer; }
.mfa-primary-link { width: fit-content; margin: 24px auto 0; }
.mfa-footnote { margin: 18px 0 0; color: var(--muted); text-align: center; font-size: 12px; }
.mfa-cancel-form { margin-top: 12px; text-align: center; }
.mfa-cancel-form button { border: 0; background: transparent; color: var(--muted); text-decoration: underline; cursor: pointer; }
.recovery-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 520px; margin: 24px auto; }
.recovery-codes code { padding: 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-2); color: var(--text); text-align: center; font-size: 16px; user-select: all; }
.mfa-warning { max-width: 600px; margin: 0 auto; padding: 12px 14px; border: 1px solid #f5c2c7; border-radius: 7px; background: #fff5f5; color: #842029; font-size: 13px; }
html[data-theme="dark"] .mfa-warning { border-color: #6c2b31; background: #2a191b; color: #ffb4bb; }

@media (max-width: 700px) {
    .mfa-page { padding: 12px; }
    .mfa-setup-grid { grid-template-columns: 1fr; }
    .mfa-qr { width: min(280px, 100%); margin: 0 auto; }
    .recovery-codes { grid-template-columns: 1fr; }
}

@media (min-width: 941px) and (max-height: 720px) {
    .login-page { gap: 14px; padding: 12px; }
    .login-intro { padding: 20px 28px; }
    .login-logo { width: 174px; }
    .login-overview { margin-top: auto; }
    .login-overview strong { font-size: 14px; }
    .login-overview p { font-size: 12px; line-height: 1.35; }
    .login-message { margin-bottom: 14px; }
    .login-message h1 { margin-bottom: 10px; font-size: clamp(38px, 3.6vw, 48px); }
    .login-description { font-size: 13px; line-height: 1.4; }
    .login-steps article { min-height: 72px; padding: 10px 12px; }
    .login-steps p { margin-top: 5px; line-height: 1.35; }
    .login-panel { padding: 22px 36px; }
    .login-form-wrap h2 { font-size: 21px; }
    .login-form-wrap > p { margin-bottom: 14px; }
    .google-button, .login-submit { min-height: 38px; }
    .login-divider { margin: 14px 0; }
    .field-group { margin-bottom: 10px; }
    .input-shell { min-height: 38px; }
    .login-options { margin: 2px 0 10px; }
    .security-notice { margin-top: 9px !important; padding: 7px 10px; }
    .login-register { margin-top: 10px; padding-top: 10px; }
}

@media (max-width: 940px) {
    .login-page { grid-template-columns: 1fr; }
    .login-message { margin-top: 70px; }
    .login-panel { min-height: 520px; }
}
@media (max-width: 620px) {
    .login-page { gap: 12px; padding: 12px; }
    .login-intro, .login-panel { padding: 24px 20px; }
    .login-logo { width: 180px; }
    .login-overview { margin-top: 36px; }
    .login-message { margin-top: 52px; }
    .login-message h1 { font-size: 36px; }
    .login-steps { grid-template-columns: 1fr 1fr; }
}

.error-page { display: grid; min-height: 100vh; padding: 24px; place-items: center; background: var(--background); }
.error-card { width: min(100%, 590px); padding: clamp(32px, 6vw, 56px); border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 10px 40px -10px rgba(14,17,22,.12); text-align: center; }
.error-card img { width: 190px; height: auto; margin-bottom: 30px; }
.error-code { display: block; margin-bottom: 10px; color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: .14em; }
.error-card h1 { margin-bottom: 14px; font-size: clamp(24px, 4vw, 34px); }
.error-card p { margin: 0 auto 24px; color: var(--muted); font-size: 14px; line-height: 1.65; }
.error-action { display: inline-flex; min-height: 42px; padding: 0 18px; align-items: center; justify-content: center; border-radius: 6px; color: #fff; background: var(--blue); font-size: 13px; font-weight: 700; text-decoration: none; }
.error-action:hover, .error-action:focus-visible { background: var(--accent-hover); }
.error-card small { display: block; margin-top: 20px; color: var(--muted); font-size: 11px; }
