/* =====================================================================
   ImovelOne ERP — Design system
   Marca "Casa + 1": navy #14213D · teal #0E8C7F · mint #3DD6C3
   Layout inspirado em painéis de operação (header fixo, abas, cards glass)
   ===================================================================== */

:root {
    --navy: #14213D;
    --teal: #0E8C7F;
    --mint: #3DD6C3;

    /* Tema escuro (padrão) */
    --bg-base: #0A111F;
    --bg-surface: #0F1829;
    --bg-elevated: #15213A;
    --bg-card: rgba(18, 28, 48, .78);
    --bg-card-hover: rgba(24, 37, 62, .9);
    --bg-input: #0B1323;
    --border-subtle: rgba(255, 255, 255, .08);
    --border-light: rgba(255, 255, 255, .15);
    --text-primary: #F1F5F9;
    --text-secondary: #A3B1C6;
    --text-muted: #7C8BA3;

    --brand: #3DD6C3;
    --brand-hover: #5FE0D0;
    --on-brand: #052421;
    --brand-text: #3DD6C3;
    --brand-subtle: rgba(61, 214, 195, .12);
    --brand-border: rgba(61, 214, 195, .3);
    --brand-glow: rgba(61, 214, 195, .28);

    --green: #34D399;  --green-bg: rgba(52, 211, 153, .13);
    --teal-t: #2DD4BF; --teal-bg: rgba(45, 212, 191, .13);
    --blue: #60A5FA;   --blue-bg: rgba(96, 165, 250, .14);
    --purple: #A78BFA; --purple-bg: rgba(167, 139, 250, .14);
    --amber: #FBBF24;  --amber-bg: rgba(251, 191, 36, .13);
    --rose: #FB7185;   --rose-bg: rgba(251, 113, 133, .13);
    --gray: #94A3B8;   --gray-bg: rgba(148, 163, 184, .13);

    --positive: #34D399;
    --negative: #FB7185;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, .25);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, .35);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, .45);

    --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-display: "Space Grotesk", var(--font-sans);
    --font-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;

    --r-xs: 4px; --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-pill: 9999px;
    --t-fast: .15s cubic-bezier(.4, 0, .2, 1);
    --t-norm: .25s cubic-bezier(.4, 0, .2, 1);
    color-scheme: dark;
}

[data-theme="light"] {
    --bg-base: #F3F5F7;
    --bg-surface: #FFFFFF;
    --bg-elevated: #EEF2F6;
    --bg-card: #FFFFFF;
    --bg-card-hover: #FAFBFC;
    --bg-input: #FFFFFF;
    --border-subtle: #E2E8F0;
    --border-light: #CBD5E1;
    --text-primary: #14213D;
    --text-secondary: #475569;
    --text-muted: #64748B;

    --brand: #0B7A6F;
    --brand-hover: #09665D;
    --on-brand: #FFFFFF;
    --brand-text: #0B7A6F;
    --brand-subtle: rgba(14, 140, 127, .10);
    --brand-border: rgba(14, 140, 127, .3);
    --brand-glow: rgba(14, 140, 127, .18);

    --green: #047857;  --green-bg: #D1FAE5;
    --teal-t: #0F766E; --teal-bg: #CCFBF1;
    --blue: #1D4ED8;   --blue-bg: #DBEAFE;
    --purple: #6D28D9; --purple-bg: #EDE9FE;
    --amber: #B45309;  --amber-bg: #FEF3C7;
    --rose: #BE123C;   --rose-bg: #FFE4E6;
    --gray: #475569;   --gray-bg: #E2E8F0;

    --positive: #047857;
    --negative: #BE123C;

    --shadow-sm: 0 1px 3px rgba(20, 33, 61, .06), 0 1px 2px rgba(20, 33, 61, .04);
    --shadow-md: 0 6px 20px rgba(20, 33, 61, .08);
    --shadow-lg: 0 14px 36px rgba(20, 33, 61, .12);
    color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font-sans);
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 15px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    transition: background-color var(--t-norm), color var(--t-norm);
}
a { color: var(--brand-text); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--brand-subtle); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 99px; border: 2px solid var(--bg-base); }

.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; }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 999; background: var(--brand); color: var(--on-brand); padding: 8px 14px; border-radius: var(--r-sm); font-weight: 700; }
.skip-link:focus { top: 12px; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--text-secondary); }
.small { font-size: .82rem; }
.strong { font-weight: 700; }
.nowrap { white-space: nowrap; }
.positive { color: var(--positive); }
.negative { color: var(--negative); }
.text-rose { color: var(--rose); }
.icon { flex-shrink: 0; }

/* ---------- Header ---------- */
.header-global {
    position: sticky; top: 0; z-index: 100;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    backdrop-filter: blur(12px);
}
.header-top {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 12px 28px;
    border-bottom: 1px solid var(--border-subtle);
}
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-badge {
    display: grid; place-items: center;
    width: 42px; height: 42px; border-radius: var(--r-sm);
    background: var(--navy); color: #fff;
    box-shadow: 0 2px 12px var(--brand-glow);
}
[data-theme="light"] .brand-badge { background: var(--navy); }
.logo-mark .logo-one { stroke: var(--mint); }
.brand-info { display: flex; flex-direction: column; }
.brand-title { display: flex; align-items: center; gap: 8px; font-size: 1.15rem; }
.wordmark { font-weight: 500; letter-spacing: -.02em; color: var(--text-primary); }
.wordmark b { font-weight: 800; color: var(--brand-text); }
.platform-tag {
    font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
    color: var(--brand-text); background: var(--brand-subtle); border: 1px solid var(--brand-border);
    border-radius: var(--r-pill); padding: 1px 8px;
}
.brand-sub { font-size: .76rem; color: var(--text-secondary); }

.status-capsule {
    display: flex; align-items: center; gap: 12px;
    padding: 6px 18px; border-radius: var(--r-pill);
    background: linear-gradient(180deg, rgba(30, 41, 59, .75), rgba(15, 23, 42, .85));
    border: 1px solid rgba(255, 255, 255, .12);
    box-shadow: 0 4px 16px rgba(0, 0, 0, .25), inset 0 1px rgba(255, 255, 255, .08);
    font-size: .8rem;
}
[data-theme="light"] .status-capsule { background: var(--bg-elevated); border-color: var(--border-subtle); box-shadow: none; }
.capsule-item { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.capsule-divider { width: 1px; height: 14px; background: var(--border-light); }
.capsule-ok { color: var(--green); font-weight: 600; }
.capsule-label { color: var(--text-secondary); font-size: .74rem; }
.capsule-val { font-family: var(--font-display); font-weight: 700; }
.capsule-val.accent { color: var(--brand-text); }
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, .6); } 70% { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); } 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); } }

.header-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn {
    display: inline-grid; place-items: center;
    width: 36px; height: 36px; border-radius: var(--r-sm);
    background: var(--bg-elevated); border: 1px solid var(--border-subtle); color: var(--text-secondary);
    cursor: pointer; transition: all var(--t-fast);
}
.icon-btn:hover { color: var(--text-primary); border-color: var(--border-light); text-decoration: none; }
.icon-btn-danger:hover { color: var(--rose); border-color: var(--rose); }
[data-theme="dark"] .only-light, :root:not([data-theme="light"]) .only-light { display: none; }
[data-theme="light"] .only-dark { display: none; }
[data-theme="light"] .only-light { display: inline-flex; }
.profile-box {
    display: flex; align-items: center; gap: 8px;
    padding: 4px 12px 4px 5px; border-radius: var(--r-md);
    background: var(--bg-elevated); border: 1px solid var(--border-subtle);
}
.avatar {
    display: inline-grid; place-items: center; flex-shrink: 0;
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, var(--teal), var(--mint)); color: #052421;
    font-size: .76rem; font-weight: 800;
}
.avatar-xs { width: 20px; height: 20px; font-size: .58rem; }
.avatar-sm { width: 30px; height: 30px; font-size: .7rem; }
.avatar-lg { width: 52px; height: 52px; font-size: 1.05rem; }
.profile-info { display: flex; flex-direction: column; line-height: 1.15; }
.profile-name { font-size: .8rem; font-weight: 700; }
.profile-link { font-size: .7rem; color: var(--text-secondary); }

.nav-tabs-wrapper { padding: 0 28px; overflow-x: auto; scrollbar-width: none; }
.nav-tabs-wrapper::-webkit-scrollbar { display: none; }
.nav-tabs { display: flex; gap: 4px; list-style: none; }
.tab-btn {
    position: relative; display: flex; align-items: center; gap: 8px;
    padding: 13px 16px; font-size: .88rem; font-weight: 600; white-space: nowrap;
    color: var(--text-secondary); transition: color var(--t-fast);
}
.tab-btn:hover { color: var(--text-primary); text-decoration: none; }
.tab-btn.active { color: var(--brand-text); }
.tab-btn.active::after {
    content: ""; position: absolute; left: 0; bottom: 0; width: 100%; height: 3px;
    background: var(--brand); border-radius: 3px 3px 0 0; box-shadow: 0 -2px 10px var(--brand-glow);
}

/* ---------- Página ---------- */
.page { width: 100%; max-width: 1440px; margin: 0 auto; padding: 28px; flex: 1; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-title { font-family: var(--font-display); font-size: 1.65rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.page-sub { color: var(--text-secondary); font-size: .88rem; margin-top: 4px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--text-secondary); margin-bottom: 6px; }
.title-with-avatar { display: flex; align-items: center; gap: 14px; }
.app-footer {
    display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding: 16px 28px; border-top: 1px solid var(--border-subtle);
    font-size: .76rem; color: var(--text-secondary);
}

/* ---------- Botões ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 38px; padding: 8px 16px; border-radius: var(--r-sm);
    font-size: .86rem; font-weight: 650; line-height: 1.2; white-space: nowrap;
    border: 1px solid transparent; cursor: pointer; transition: all var(--t-fast);
    text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand); color: var(--on-brand); border-color: var(--brand); box-shadow: 0 2px 12px var(--brand-glow); }
.btn-primary:hover { background: var(--brand-hover); transform: translateY(-1px); }
.btn-secondary { background: var(--bg-elevated); color: var(--text-primary); border-color: var(--border-light); }
.btn-secondary:hover { border-color: var(--text-muted); background: var(--bg-card-hover); }
.btn-ghost { background: transparent; color: var(--text-secondary); border-color: transparent; }
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-elevated); }
.btn-danger-ghost { background: transparent; color: var(--rose); border-color: var(--rose-bg); }
.btn-danger-ghost:hover { background: var(--rose-bg); }
.btn-sm { min-height: 32px; padding: 6px 12px; font-size: .8rem; }
.btn-xs { min-height: 28px; padding: 4px 10px; font-size: .76rem; }
.btn-block { width: 100%; }
.link-sm { font-size: .8rem; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.inline-form { display: inline-flex; }
.mini-btn {
    display: inline-grid; place-items: center; width: 26px; height: 26px;
    border-radius: var(--r-xs); border: 1px solid var(--border-subtle);
    background: var(--bg-elevated); color: var(--text-secondary); cursor: pointer;
}
.mini-btn:hover { color: var(--brand-text); border-color: var(--brand-border); }

/* ---------- Alertas ---------- */
.alert {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 14px; margin-bottom: 18px; border-radius: var(--r-md);
    border: 1px solid; font-size: .88rem; font-weight: 500;
}
.alert > span { flex: 1; }
.alert-success { background: var(--green-bg); border-color: color-mix(in srgb, var(--green) 35%, transparent); color: var(--green); }
.alert-error { background: var(--rose-bg); border-color: color-mix(in srgb, var(--rose) 35%, transparent); color: var(--rose); }
.alert-warning { background: var(--amber-bg); border-color: color-mix(in srgb, var(--amber) 35%, transparent); color: var(--amber); }
.alert-info { background: var(--blue-bg); border-color: color-mix(in srgb, var(--blue) 35%, transparent); color: var(--blue); }
.alert-close { background: none; border: 0; color: inherit; cursor: pointer; opacity: .7; display: grid; place-items: center; }
.alert-close:hover { opacity: 1; }
.secret-box > div { display: flex; flex-direction: column; gap: 6px; color: var(--text-primary); }
.secret-box p { color: var(--text-secondary); font-size: .84rem; }
.secret { font-family: var(--font-mono); font-size: 1.1rem; padding: 8px 12px; background: var(--bg-input); border: 1px dashed var(--border-light); border-radius: var(--r-sm); width: fit-content; user-select: all; color: var(--text-primary); }

/* ---------- KPIs ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin-bottom: 22px; }
.kpi-grid.compact { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.kpi-card {
    --tone: var(--brand-text); --tone-bg: var(--brand-subtle);
    position: relative; overflow: hidden; display: block;
    padding: 20px; border-radius: var(--r-md);
    background: var(--bg-card); border: 1px solid var(--border-subtle);
    backdrop-filter: blur(8px); color: inherit;
    transition: transform var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
}
.kpi-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--tone); }
a.kpi-card:hover { transform: translateY(-2px); border-color: var(--border-light); box-shadow: var(--shadow-md); text-decoration: none; }
.tone-teal { --tone: var(--teal-t); --tone-bg: var(--teal-bg); }
.tone-blue { --tone: var(--blue); --tone-bg: var(--blue-bg); }
.tone-purple { --tone: var(--purple); --tone-bg: var(--purple-bg); }
.tone-amber { --tone: var(--amber); --tone-bg: var(--amber-bg); }
.tone-rose { --tone: var(--rose); --tone-bg: var(--rose-bg); }
.tone-green { --tone: var(--green); --tone-bg: var(--green-bg); }
.tone-gray { --tone: var(--gray); --tone-bg: var(--gray-bg); }
.kpi-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.kpi-title { font-size: .74rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-secondary); }
.kpi-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--r-sm); background: var(--tone-bg); color: var(--tone); }
.kpi-value { font-family: var(--font-mono); font-size: 1.7rem; font-weight: 700; letter-spacing: -.03em; line-height: 1.15; margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.kpi-value.small { font-size: 1.3rem; }
.kpi-sub { font-size: .78rem; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; padding: 1px 7px; border-radius: var(--r-xs); font-size: .72rem; font-weight: 700; }
.badge-purple { background: var(--purple-bg); color: var(--purple); }

.fin-strip {
    display: flex; align-items: center; gap: 12px 28px; flex-wrap: wrap;
    padding: 14px 20px; margin-bottom: 22px; border-radius: var(--r-md);
    background: var(--bg-card); border: 1px solid var(--border-subtle);
}
.fin-item { display: flex; flex-direction: column; gap: 2px; }
.fin-label { display: flex; align-items: center; gap: 6px; font-size: .76rem; color: var(--text-secondary); font-weight: 600; }
.fin-value { font-family: var(--font-mono); font-size: 1.15rem; font-weight: 700; }
.fin-strip .btn { margin-left: auto; }

/* ---------- Cards e grids ---------- */
.card {
    background: var(--bg-card); border: 1px solid var(--border-subtle);
    border-radius: var(--r-md); box-shadow: var(--shadow-sm);
    backdrop-filter: blur(8px); overflow: hidden;
}
.card-header {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding: 14px 20px; border-bottom: 1px solid var(--border-subtle);
}
.card-title { display: flex; align-items: center; gap: 8px; font-size: 1rem; font-weight: 700; }
.card-title .icon { color: var(--brand-text); }
.count-badge {
    font-size: .72rem; font-weight: 700; padding: 1px 8px; border-radius: var(--r-pill);
    color: var(--brand-text); background: var(--brand-subtle); border: 1px solid var(--brand-border);
}
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 18px; margin-bottom: 18px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.empty { padding: 22px 20px; color: var(--text-secondary); font-size: .88rem; }
.empty-state {
    display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
    padding: 56px 20px; border: 1px dashed var(--border-light); border-radius: var(--r-lg); color: var(--text-secondary);
}
.empty-state h2 { color: var(--text-primary); font-size: 1.1rem; }
.prose { padding: 16px 20px; color: var(--text-secondary); font-size: .92rem; }
.danger-zone { display: flex; justify-content: flex-end; }

/* Barras (dashboard) */
.bar-list { list-style: none; padding: 14px 20px 18px; display: flex; flex-direction: column; gap: 10px; }
.bar-list li { display: grid; grid-template-columns: 120px 1fr 44px; align-items: center; gap: 12px; }
.bar-label { font-size: .84rem; color: var(--text-secondary); }
.bar-value { font-family: var(--font-mono); font-weight: 700; text-align: right; font-size: .9rem; }
.hbar-track { display: block; height: 12px; border-radius: 4px; background: var(--bg-elevated); overflow: hidden; }
.hbar { display: block; width: 100%; height: 100%; }
.hbar rect { fill: var(--brand); }
.hbar.tone-green rect { fill: var(--green); }
.hbar.tone-gray rect { fill: var(--gray); }

/* Listas de itens */
.item-list { list-style: none; }
.item-list li {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 20px; border-bottom: 1px solid var(--border-subtle);
}
.item-list li:last-child { border-bottom: 0; }
.item-main { display: flex; flex-direction: column; min-width: 0; color: inherit; }
a.item-main:hover { text-decoration: none; }
a.item-main:hover .item-title { color: var(--brand-text); }
.item-title { font-weight: 600; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-sub { font-size: .76rem; color: var(--text-secondary); }
.item-side { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; flex-shrink: 0; }

/* Pares chave/valor */
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 10px 14px; padding: 16px 20px; font-size: .88rem; }
.kv dt { color: var(--text-secondary); }
.kv dd { min-width: 0; overflow-wrap: anywhere; }
.spec-grid { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--border-subtle); }
.spec-grid > div { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px 6px; text-align: center; color: var(--text-secondary); }
.spec-grid > div + div { border-left: 1px solid var(--border-subtle); }
.spec-grid b { font-family: var(--font-mono); color: var(--text-primary); font-size: 1.05rem; }
.spec-grid small { font-size: .7rem; }
.spec-grid .icon { color: var(--brand-text); }

/* ---------- Pills e tags ---------- */
.pill {
    --c: var(--gray); --bg: var(--gray-bg);
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 10px; border-radius: var(--r-pill);
    font-size: .72rem; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; white-space: nowrap;
    color: var(--c); background: var(--bg);
}
.pill-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-green { --c: var(--green); --bg: var(--green-bg); }
.pill-teal { --c: var(--teal-t); --bg: var(--teal-bg); }
.pill-blue { --c: var(--blue); --bg: var(--blue-bg); }
.pill-purple { --c: var(--purple); --bg: var(--purple-bg); }
.pill-amber { --c: var(--amber); --bg: var(--amber-bg); }
.pill-rose { --c: var(--rose); --bg: var(--rose-bg); }
.pill-gray { --c: var(--gray); --bg: var(--gray-bg); }
.tag {
    display: inline-block; padding: 2px 8px; margin: 1px 2px 1px 0; border-radius: var(--r-xs);
    font-size: .72rem; font-weight: 600; background: var(--bg-elevated); color: var(--text-secondary); border: 1px solid var(--border-subtle);
}
.tags { white-space: normal; }

/* ---------- Tabelas ---------- */
.table-container {
    background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--r-md);
    box-shadow: var(--shadow-sm); overflow: hidden; margin-bottom: 22px;
}
.table-container.flat { background: transparent; border: 0; box-shadow: none; }
.table-header {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 14px 18px; background: var(--bg-surface); border-bottom: 1px solid var(--border-subtle);
}
.table-responsive { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.data-table th {
    text-align: left; padding: 11px 16px; white-space: nowrap;
    font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
    color: var(--text-secondary); background: var(--bg-surface); border-bottom: 1px solid var(--border-subtle);
}
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; }
.data-table tfoot th { font-size: .86rem; letter-spacing: 0; text-transform: none; color: var(--text-primary); border-top: 1px solid var(--border-subtle); border-bottom: 0; }
.data-table tbody tr { transition: background var(--t-fast); }
.data-table tbody tr:hover { background: var(--bg-card-hover); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table.compact td { padding: 8px 14px; }
.data-table .num { text-align: right; white-space: nowrap; }
.data-table small { display: inline-block; font-size: .74rem; }
.data-table tr.is-muted td { opacity: .55; }
.actions-col { width: 1%; white-space: nowrap; text-align: right; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.cell-person { display: flex; align-items: center; gap: 10px; color: inherit; }
a.cell-person:hover { text-decoration: none; }
a.cell-person:hover b { color: var(--brand-text); }
.cell-person > span:last-child { display: flex; flex-direction: column; line-height: 1.25; }
.details-cell details summary { cursor: pointer; color: var(--brand-text); font-size: .8rem; }
.details-cell pre { font-family: var(--font-mono); font-size: .72rem; white-space: pre-wrap; max-width: 420px; margin-top: 6px; color: var(--text-secondary); }
.table-footer {
    display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 12px 18px; background: var(--bg-surface); border-top: 1px solid var(--border-subtle);
    font-size: .8rem; color: var(--text-secondary);
}
.table-container.flat .table-footer { background: transparent; border: 0; padding: 12px 0; }
.pager { display: flex; gap: 6px; }
.page-btn {
    display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 8px;
    border-radius: var(--r-xs); background: var(--bg-elevated); border: 1px solid var(--border-subtle);
    color: var(--text-primary); font-size: .8rem; font-weight: 600;
}
.page-btn:hover { border-color: var(--border-light); text-decoration: none; }
.page-btn.active { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }

/* ---------- Filtros ---------- */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 20px; }
.search-box {
    display: flex; align-items: center; gap: 8px; flex: 1 1 260px; min-width: 200px;
    padding: 0 12px; height: 38px; border-radius: var(--r-sm);
    background: var(--bg-input); border: 1px solid var(--border-light); color: var(--text-muted);
}
.search-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-subtle); }
.search-box input { flex: 1; min-width: 0; height: 100%; background: transparent; border: 0; outline: none; color: var(--text-primary); }
.filter-bar select, .table-header select { height: 38px; }
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--r-sm); background: var(--bg-elevated); border: 1px solid var(--border-subtle); margin-bottom: 16px; flex-wrap: wrap; }
.page-actions .segmented { margin-bottom: 0; }
.seg { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 6px; font-size: .82rem; font-weight: 600; color: var(--text-secondary); }
.seg:hover { color: var(--text-primary); text-decoration: none; }
.seg.active { background: var(--bg-surface); color: var(--brand-text); box-shadow: var(--shadow-sm); }

/* ---------- Formulários ---------- */
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="date"],
input[type="number"], input[type="month"], input[type="tel"], input:not([type]), select, textarea {
    width: 100%; min-height: 38px; padding: 8px 12px;
    background: var(--bg-input); color: var(--text-primary);
    border: 1px solid var(--border-light); border-radius: var(--r-sm);
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.search-box input { min-height: 0; padding: 0; border: 0; }
select { appearance: none; padding-right: 32px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center; }
.filter-bar select, .table-header select { width: auto; min-width: 150px; }
textarea { resize: vertical; min-height: 80px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-subtle); }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--rose); }
input::placeholder, textarea::placeholder { color: var(--text-muted); }
.form-stack { display: flex; flex-direction: column; gap: 18px; }
.form-stack.narrow { max-width: 520px; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding: 18px 20px; }
.form-grid.cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.form-grid.cols-1 { grid-template-columns: 1fr; }
.span-2 { grid-column: span 2; }
.span-full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .label-like { font-size: .8rem; font-weight: 650; color: var(--text-secondary); }
.req { color: var(--rose); }
.hint { font-size: .74rem; color: var(--text-muted); }
.field-error { font-size: .76rem; color: var(--rose); font-weight: 600; }
.field.has-error label { color: var(--rose); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: .88rem; min-height: 38px; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
fieldset.roles { border: 0; border-top: 1px solid var(--border-subtle); padding: 14px 20px 18px; display: flex; gap: 8px 24px; flex-wrap: wrap; }
fieldset.roles legend { float: left; width: 100%; font-size: .8rem; font-weight: 650; color: var(--text-secondary); margin-bottom: 2px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; }
.form-actions-inline { display: flex; justify-content: flex-end; }
.input-group { display: flex; }
.input-group input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-addon {
    display: grid; place-items: center; width: 44px; flex-shrink: 0;
    background: var(--bg-elevated); border: 1px solid var(--border-light); border-left: 0;
    border-radius: 0 var(--r-sm) var(--r-sm) 0; color: var(--text-secondary); cursor: pointer;
}
.field.is-hidden { display: none; }
.strength { display: flex; flex-direction: column; gap: 4px; margin-top: -8px; }
.strength-bar { height: 6px; border-radius: 3px; background: var(--bg-elevated); overflow: hidden; }
.strength-bar span { display: block; height: 100%; width: 0; background: var(--rose); transition: width var(--t-norm), background var(--t-norm); }

/* Popover (details) */
.popover { position: relative; }
.popover > summary { list-style: none; }
.popover > summary::-webkit-details-marker { display: none; }
.popover-body {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; width: 300px;
    display: flex; flex-direction: column; gap: 8px; padding: 16px; text-align: left;
    background: var(--bg-surface); border: 1px solid var(--border-light); border-radius: var(--r-md); box-shadow: var(--shadow-lg);
}
.popover-body label { font-size: .78rem; font-weight: 650; color: var(--text-secondary); }

/* ---------- Imóveis ---------- */
.property-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.property-card {
    display: flex; flex-direction: column; overflow: hidden; color: inherit;
    background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--r-md);
    transition: transform var(--t-fast), box-shadow var(--t-fast), border-color var(--t-fast);
}
.property-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-light); text-decoration: none; }
.property-cover { position: relative; aspect-ratio: 16 / 10; background: var(--bg-elevated); }
.property-cover img { width: 100%; height: 100%; object-fit: cover; }
.property-noimg { display: grid; place-items: center; height: 100%; color: var(--text-muted); }
.property-status { position: absolute; top: 10px; left: 10px; }
.property-status .pill { backdrop-filter: blur(6px); box-shadow: var(--shadow-sm); }
[data-theme="dark"] .property-status .pill, :root:not([data-theme="light"]) .property-status .pill { background: rgba(10, 17, 31, .82); }
.property-body { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px 16px; }
.property-code { font-size: .72rem; color: var(--text-secondary); }
.property-title { font-weight: 700; font-size: .98rem; line-height: 1.3; }
.property-addr { display: flex; align-items: center; gap: 4px; font-size: .8rem; color: var(--text-secondary); }
.property-specs { display: flex; gap: 14px; font-size: .8rem; color: var(--text-secondary); }
.property-specs span { display: inline-flex; align-items: center; gap: 4px; }
.property-prices { display: flex; gap: 18px; margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--border-subtle); }
.property-prices span { display: flex; flex-direction: column; }
.property-prices small { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); font-weight: 700; }
.property-prices b { color: var(--brand-text); font-size: .95rem; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 16px 20px; }
.gallery-item { position: relative; aspect-ratio: 4 / 3; border-radius: var(--r-sm); overflow: hidden; background: var(--bg-elevated); }
.gallery-item.is-cover { grid-column: span 2; grid-row: span 2; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--t-norm); }
.gallery-item:hover img { transform: scale(1.04); }
.cover-tag { position: absolute; left: 8px; top: 8px; padding: 2px 8px; border-radius: var(--r-xs); background: var(--brand); color: var(--on-brand); font-size: .7rem; font-weight: 700; }
.gallery-item .inline-form { position: absolute; right: 6px; top: 6px; opacity: 0; transition: opacity var(--t-fast); }
.gallery-del.icon-btn { width: 30px; height: 30px; background: rgba(10, 17, 31, .8); color: #fff; border-color: transparent; }
.gallery-item:hover .inline-form, .gallery-item .inline-form:focus-within { opacity: 1; }
@media (hover: none) { .gallery-item .inline-form { opacity: 1; } }
.upload-box { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 0 20px 18px; }
.upload-drop {
    flex: 1 1 280px; display: flex; align-items: center; gap: 10px; cursor: pointer;
    padding: 12px 14px; border: 1px dashed var(--border-light); border-radius: var(--r-sm);
    color: var(--text-secondary); font-size: .84rem; transition: border-color var(--t-fast);
}
.upload-drop:hover { border-color: var(--brand); color: var(--text-primary); }
.upload-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-drop:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-subtle); }

/* ---------- CRM / Kanban ---------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.kanban-col { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--r-md); padding: 12px; min-height: 200px; }
.kanban-head { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 8px; border-bottom: 2px solid var(--brand); margin-bottom: 8px; }
.col-ganho .kanban-head { border-color: var(--green); }
.col-perdido .kanban-head { border-color: var(--gray); }
.col-proposta .kanban-head, .col-negociacao .kanban-head { border-color: var(--amber); }
.kanban-title { font-weight: 700; font-size: .86rem; }
.kanban-sum { font-size: .76rem; color: var(--text-secondary); padding: 0 4px 8px; }
.kanban-cards { display: flex; flex-direction: column; gap: 10px; }
.kanban-empty { font-size: .8rem; color: var(--text-muted); text-align: center; padding: 18px 0; }
.lead-card {
    display: flex; flex-direction: column; gap: 5px; padding: 12px;
    background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--r-sm);
    box-shadow: var(--shadow-sm); transition: border-color var(--t-fast);
}
.lead-card:hover { border-color: var(--border-light); }
.lead-card.is-late { border-left: 3px solid var(--rose); }
.lead-name { font-weight: 700; font-size: .9rem; color: var(--text-primary); }
.lead-meta, .lead-imovel, .lead-next { font-size: .74rem; color: var(--text-secondary); display: flex; align-items: center; gap: 4px; }
.lead-late { font-size: .74rem; color: var(--rose); font-weight: 600; display: flex; align-items: center; gap: 4px; }
.lead-foot { display: flex; justify-content: space-between; align-items: center; gap: 4px 8px; margin-top: 4px; flex-wrap: wrap; }
.lead-owner { display: flex; align-items: center; gap: 6px; font-size: .74rem; color: var(--text-secondary); min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.lead-value { font-size: .76rem; font-weight: 700; color: var(--green); white-space: nowrap; }
.lead-move { display: flex; justify-content: flex-end; gap: 6px; margin-top: 4px; }

.stepper { display: flex; gap: 4px; margin-bottom: 20px; overflow-x: auto; padding-bottom: 4px; }
.stepper form { flex: 1; min-width: 110px; }
.step {
    width: 100%; padding: 9px 10px; cursor: pointer; font-size: .78rem; font-weight: 650;
    background: var(--bg-elevated); color: var(--text-secondary); border: 1px solid var(--border-subtle);
    clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%);
}
.stepper form:first-child .step { clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); }
.step:hover { color: var(--text-primary); }
.step.current { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.step.current.step-perdido { background: var(--gray); color: var(--bg-base); }

.timeline { list-style: none; padding: 16px 20px; display: flex; flex-direction: column; gap: 4px; }
.timeline-item { display: flex; gap: 12px; position: relative; padding-bottom: 14px; }
.timeline-item:not(:last-child)::before { content: ""; position: absolute; left: 15px; top: 34px; bottom: 0; width: 2px; background: var(--border-subtle); }
.timeline-icon { display: grid; place-items: center; width: 32px; height: 32px; flex-shrink: 0; border-radius: 50%; background: var(--brand-subtle); color: var(--brand-text); }
.timeline-body { flex: 1; min-width: 0; }
.timeline-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: .84rem; }
.timeline-head .muted { font-size: .76rem; }
.timeline-body p { font-size: .88rem; color: var(--text-secondary); margin-top: 2px; overflow-wrap: anywhere; }

/* ---------- Financeiro ---------- */
.month-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.month-nav { display: flex; align-items: center; gap: 10px; }
.month-name { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; min-width: 170px; text-align: center; justify-content: center; }
.month-tools { display: flex; align-items: center; gap: 14px; }
.gen-form { gap: 8px; align-items: center; }
.gen-form input { width: auto; min-height: 32px; padding: 4px 8px; }
.roles-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; padding: 18px 20px; }
.roles-grid p { font-size: .84rem; color: var(--text-secondary); margin-top: 8px; }

/* ---------- Configurações ---------- */
.subsection { padding: 16px 20px 18px; border-top: 1px solid var(--border-subtle); }
.subsection > p { margin: 4px 0 4px; }
.sub-title { display: flex; align-items: center; gap: 8px; font-size: .92rem; font-weight: 700; }
.sub-title .icon { color: var(--brand-text); }
.form-grid.compact-grid { padding: 12px 0 0; }
.kv.kv-tight { padding: 12px 0 6px; grid-template-columns: 120px 1fr; }
.code-inline {
    display: inline-block; font-family: var(--font-mono); font-size: .8rem; padding: 4px 8px; border-radius: var(--r-xs);
    background: var(--bg-input); border: 1px solid var(--border-subtle); color: var(--text-primary); overflow-wrap: anywhere;
}
code { font-family: var(--font-mono); font-size: .85em; }
.pad-x { padding: 0 20px 16px; }

/* ---------- Modelos de contrato ---------- */
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.editor-wrap { padding: 0 20px; }
.template-editor {
    font-family: var(--font-mono); font-size: .84rem; line-height: 1.65; min-height: 520px;
    background: var(--bg-input); tab-size: 4;
}
.editor-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 20px 18px; }
.preview-box { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.preview-box select { width: auto; max-width: 320px; }
.help-panel { position: sticky; top: 130px; max-height: calc(100vh - 150px); display: flex; flex-direction: column; }
.help-body { padding: 14px 16px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.syntax { list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: .8rem; color: var(--text-secondary); }
.syntax code { color: var(--brand-text); background: var(--brand-subtle); padding: 1px 6px; border-radius: 4px; margin-right: 4px; }
.var-group { border: 1px solid var(--border-subtle); border-radius: var(--r-sm); }
.var-group summary { cursor: pointer; padding: 8px 12px; font-size: .82rem; font-weight: 700; }
.var-list { list-style: none; padding: 0 6px 8px; display: flex; flex-direction: column; gap: 2px; }
.var-chip {
    width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; text-align: left; cursor: pointer;
    padding: 6px 8px; border-radius: 6px; background: transparent; border: 1px solid transparent; color: inherit;
}
.var-chip:hover { background: var(--brand-subtle); border-color: var(--brand-border); }
.var-chip code { font-size: .74rem; color: var(--brand-text); }
.var-chip span { font-size: .72rem; color: var(--text-secondary); }

/* Folha de pré-visualização (sempre clara, como o papel) */
.paper {
    max-width: 820px; margin: 0 auto; padding: 64px 72px; background: #fff; color: #1a1f29;
    border-radius: 4px; box-shadow: var(--shadow-lg); font-size: .95rem; line-height: 1.6;
}
.paper h1 { text-align: center; font-size: 1.15rem; color: #14213D; margin-bottom: 14px; }
.paper h2 { font-size: .95rem; color: #0B7A6F; margin: 18px 0 6px; }
.paper p { text-align: justify; margin-bottom: 10px; }
.paper p.center { text-align: center; }
.paper mark { background: #FEF3C7; color: #92400E; padding: 0 2px; }
.paper .spacer { height: 12px; }
.paper .signs { display: grid; grid-template-columns: 1fr 1fr; gap: 44px 40px; margin-top: 36px; }
.paper .sign { display: flex; flex-direction: column; align-items: center; text-align: center; font-size: .8rem; }
.paper .sign span { width: 100%; border-top: 1px solid #5a6577; margin-bottom: 6px; }
.paper .sign small { color: #5a6577; }

/* Documentos do contrato */
.doc-gen { display: flex; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border-subtle); flex-wrap: wrap; }
.doc-gen select { flex: 1 1 240px; width: auto; }
.doc-warning { margin: 16px 20px 0; padding: 12px 14px; border-radius: var(--r-sm); background: var(--amber-bg); color: var(--amber); display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; font-size: .86rem; }
.doc-warning p { display: flex; gap: 6px; align-items: flex-start; }

/* ---------- Cobrança ---------- */
.pay-card { display: flex; flex-direction: column; }
.pay-amount { display: flex; flex-direction: column; gap: 4px; padding: 22px 24px; border-bottom: 1px solid var(--border-subtle); }
.pay-label { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-secondary); }
.pay-value { font-size: 2.1rem; font-weight: 700; letter-spacing: -.03em; color: var(--brand-text); line-height: 1.1; }
.pay-due { font-size: .86rem; color: var(--text-secondary); }
.pay-paid { width: fit-content; margin-top: 6px; text-transform: none; }
.pix-block { display: flex; gap: 22px; padding: 22px 24px; border-bottom: 1px solid var(--border-subtle); align-items: center; flex-wrap: wrap; }
.qr-frame { padding: 10px; background: #fff; border-radius: var(--r-md); box-shadow: var(--shadow-sm); line-height: 0; flex-shrink: 0; }
.qr-frame svg { display: block; width: 220px; height: 220px; }
.pix-info { flex: 1 1 260px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.code-box { font-family: var(--font-mono); font-size: .74rem; line-height: 1.5; resize: none; word-break: break-all; }
.boleto-block { padding: 18px 24px; border-bottom: 1px solid var(--border-subtle); display: flex; flex-direction: column; gap: 10px; }
.copy-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pay-links { display: flex; gap: 10px; padding: 16px 24px; flex-wrap: wrap; }

/* Conciliação */
.upload-box-top { padding: 18px 20px 10px; }
.match-form select { min-width: 280px; font-size: .82rem; }

/* ---------- Login ---------- */
.auth-body { background: var(--bg-base); }
.auth-shell { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.auth-brand {
    position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; padding: 48px;
    background: radial-gradient(1200px 600px at 10% 0%, rgba(61, 214, 195, .18), transparent 60%),
                radial-gradient(800px 500px at 100% 100%, rgba(14, 140, 127, .25), transparent 60%), var(--navy);
    color: #fff;
}
.auth-brand::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background-image: linear-gradient(rgba(255, 255, 255, .04) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .04) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(circle at 30% 40%, #000 0%, transparent 70%);
}
.auth-brand-inner { position: relative; z-index: 1; max-width: 460px; }
.auth-logo { display: flex; align-items: center; gap: 16px; color: #fff; }
.wordmark-xl { font-size: 2.6rem; color: #fff; }
.auth-brand .wordmark b { color: var(--mint); }
.auth-tagline { margin-top: 22px; font-size: 1.35rem; line-height: 1.45; font-weight: 500; color: rgba(255, 255, 255, .9); }
.auth-points { list-style: none; margin-top: 32px; display: flex; flex-direction: column; gap: 14px; }
.auth-points li { display: flex; align-items: center; gap: 12px; color: rgba(255, 255, 255, .78); font-size: .95rem; }
.auth-points .icon { color: var(--mint); }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.auth-card {
    width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 16px;
    padding: 32px; background: var(--bg-card); border: 1px solid var(--border-subtle);
    border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
}
.auth-card-head h1 { font-family: var(--font-display); font-size: 1.6rem; }
.auth-card-head p { font-size: .88rem; }
.auth-card .alert { margin-bottom: 0; }
.auth-mobile-logo { display: none; color: var(--text-primary); margin-bottom: 10px; }
.auth-foot { display: flex; gap: 6px; align-items: flex-start; font-size: .74rem; }
.error-page { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 40px 20px; }
.error-logo { color: var(--text-primary); }
.error-code { font-family: var(--font-mono); font-size: 4rem; font-weight: 700; color: var(--brand-text); line-height: 1; }
.error-page h1 { font-size: 1.3rem; }

/* ---------- Responsivo ---------- */
@media (max-width: 1100px) {
    .grid-main, .editor-layout { grid-template-columns: 1fr; }
    .help-panel { position: static; max-height: none; }
    .paper { padding: 40px 32px; }
    .status-capsule { display: none; }
    .form-grid.cols-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
    body { font-size: 14.5px; }
    .header-top { padding: 10px 16px; }
    .brand-sub, .profile-info { display: none; }
    .profile-box { padding: 3px; }
    .nav-tabs-wrapper { padding: 0 8px; }
    .tab-btn { padding: 12px 12px; }
    .page { padding: 18px 16px; }
    .page-title { font-size: 1.35rem; }
    .grid-2 { grid-template-columns: 1fr; }
    .form-grid, .form-grid.cols-6 { grid-template-columns: 1fr 1fr; padding: 16px; }
    .span-2 { grid-column: 1 / -1; }
    .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .kpi-card { padding: 14px; }
    .kpi-value { font-size: 1.25rem; }
    .bar-list li { grid-template-columns: 90px 1fr 36px; }
    .kv { grid-template-columns: 110px 1fr; }
    .auth-shell { grid-template-columns: 1fr; }
    .auth-brand { display: none; }
    .auth-mobile-logo { display: block; }
    .auth-card { padding: 24px; }
    .fin-strip .btn { margin-left: 0; }
    .gallery-item.is-cover { grid-column: span 2; grid-row: span 1; }
    .filter-bar select, .table-header select { flex: 1 1 140px; min-width: 0; }
    .popover-body { width: min(300px, calc(100vw - 32px)); }
    .page-actions { width: 100%; }
}
@media (max-width: 460px) {
    .form-grid, .form-grid.cols-6 { grid-template-columns: 1fr; }
    .kpi-grid { grid-template-columns: 1fr; }
    .spec-grid { grid-template-columns: repeat(2, 1fr); }
    .spec-grid > div:nth-child(3) { border-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
    .header-global, .app-footer, .page-actions, .filter-bar, .row-actions, .danger-zone, .alert, .skip-link { display: none !important; }
    body { background: #fff; color: #000; }
    .paper { box-shadow: none; padding: 0; max-width: none; }
}

/* ---------- Reajustes, relatórios e afins ---------- */
.segmented.seg-compact { margin-bottom: 0; }
.popover-body form { display: flex; flex-direction: column; gap: 8px; }
.popover-body form + form { padding-top: 12px; margin-top: 4px; border-top: 1px solid var(--border-subtle); }
.card > form.form-stack { padding: 4px 20px 18px; }
.card > form.form-stack .form-actions { margin-top: 0; }
.doc-warning.dash-alert { margin: 0 0 18px; }
.doc-gen .input-sm { width: 120px; flex: 0 0 auto; }
.doc-gen .small { align-self: center; flex: 1 1 100%; }
.card-note { padding: 0 20px 14px; }
.card > .danger-zone { padding: 0 20px 16px; }
.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-bottom: 22px; }
.report-card {
    display: flex; flex-direction: column; gap: 8px; padding: 18px 20px; color: inherit;
    background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--r-md);
    transition: border-color var(--t-fast), transform var(--t-fast);
}
.report-card:hover { text-decoration: none; border-color: var(--border-light); transform: translateY(-1px); }
.report-card .kpi-icon { width: 36px; height: 36px; }
.report-title { font-weight: 700; font-size: 1rem; }
.report-sub { font-size: .82rem; color: var(--text-secondary); }
.check-list { list-style: none; margin: 0; padding: 4px 20px 16px; display: flex; flex-direction: column; gap: 6px; font-size: .86rem; }
.check-list li { padding-left: 18px; position: relative; }
.check-list li::before { content: ""; position: absolute; left: 4px; top: .55em; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .5; }
.card-alert { border-color: var(--rose); }
.lgpd-box { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px 20px 18px; }
.btn-danger { background: var(--rose); color: #fff; border-color: var(--rose); }
.btn-danger:hover { filter: brightness(1.08); }
.config-extra { margin-top: 22px; }
.otp-input { font-family: var(--font-mono); font-size: 1.5rem; letter-spacing: .3em; text-align: center; }
.codes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; padding: 0 20px 12px; }
.codes-grid code { font-family: var(--font-mono); font-size: .95rem; padding: 8px 10px; text-align: center; border-radius: var(--r-sm); background: var(--bg-elevated); border: 1px solid var(--border-subtle); }
.twofa-setup { display: grid; grid-template-columns: auto 1fr; gap: 18px 24px; padding: 16px 20px 20px; align-items: start; }
.twofa-setup .qr-frame { grid-row: span 2; }
.twofa-steps { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; font-size: .88rem; }
.twofa-form { max-width: 360px; }
.inner-grid { padding: 0 20px 18px; margin-bottom: 0; }
@media (max-width: 640px) { .twofa-setup { grid-template-columns: 1fr; } .twofa-setup .qr-frame { grid-row: auto; justify-self: center; } }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 2px 16px; }
.check-grid .check { min-height: 32px; font-size: .84rem; }
.api-doc { padding: 4px 20px 18px; display: flex; flex-direction: column; gap: 10px; font-size: .88rem; }
.api-doc .data-table td { vertical-align: top; }
.code-block { margin: 0; padding: 12px 14px; overflow-x: auto; font-family: var(--font-mono); font-size: .78rem; line-height: 1.5; white-space: pre; background: var(--bg-elevated); border: 1px solid var(--border-subtle); border-radius: var(--r-sm); }

/* ---------- Páginas públicas (assinatura) ---------- */
.public-body { min-height: 100vh; background: var(--bg-base); }
.public-shell { max-width: 640px; margin: 0 auto; padding: 32px 16px 48px; }
.public-card { padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.public-head { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text-secondary); font-size: .86rem; }
.public-doc { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border-subtle); border-radius: var(--r-md); background: var(--bg-elevated); }
.public-doc .btn { margin-left: auto; }
.public-status { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-radius: var(--r-md); font-weight: 600; }
.public-status.ok { background: var(--green-bg); color: var(--green); }
.public-status.bad { background: var(--rose-bg); color: var(--rose); }
.public-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 18px; }
.public-steps li { display: flex; flex-direction: column; gap: 8px; }
.public-steps li.done > b::after { content: " ✓"; color: var(--green); }
.check.consent { align-items: flex-start; font-size: .84rem; line-height: 1.45; }
.check.consent input { margin-top: 2px; flex-shrink: 0; }
.public-refuse summary { cursor: pointer; }
.public-refuse form { margin-top: 10px; }
.public-foot { border-top: 1px solid var(--border-subtle); padding-top: 12px; }
.item-list li { flex-wrap: wrap; }
.sign-block { flex: 1 1 100%; display: flex; flex-direction: column; gap: 6px; font-size: .84rem; }
.sign-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--text-secondary); }
.sign-list { list-style: none; margin: 0; padding: 0 0 0 18px; display: flex; flex-direction: column; gap: 4px; }
.sign-list li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 0; border: 0; }
.sign-form { display: flex; flex-direction: column; gap: 8px; padding: 10px 0 4px; }
.sign-row { display: grid; grid-template-columns: 180px 1.4fr 1.4fr 140px; gap: 8px; align-items: center; }
@media (max-width: 760px) { .sign-row { grid-template-columns: 1fr; } }
.file-btn { position: relative; cursor: pointer; }
.file-btn input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
