/* ===========================================================
   DeclaIR — design system (derivado do protótipo Lovable)
   =========================================================== */
:root {
    --radius: .75rem;
    --background: oklch(0.977 0.003 247);
    --foreground: oklch(0.24 0.038 258);
    --card: #fff;
    --primary: oklch(0.42 0.105 254);
    --primary-fg: oklch(0.985 0.005 247);
    --navy: oklch(0.243 0.062 258);
    --secondary: oklch(0.955 0.008 250);
    --secondary-fg: oklch(0.32 0.05 258);
    --muted: oklch(0.958 0.006 250);
    --muted-fg: oklch(0.545 0.028 256);
    --accent: oklch(0.945 0.02 248);
    --destructive: oklch(0.55 0.19 25);
    --success: oklch(0.52 0.088 158);
    --warning: oklch(0.75 0.14 72);
    --warning-text: oklch(0.45 0.1 66);
    --info: oklch(0.55 0.1 250);
    --border: oklch(0.912 0.008 253);
    --input: oklch(0.9 0.01 253);
    --ring: oklch(0.55 0.09 254);
    --chart-1: oklch(0.42 0.105 254);
    --chart-2: oklch(0.6 0.09 232);
    --chart-3: oklch(0.52 0.088 158);
    --chart-4: oklch(0.75 0.14 72);
    --chart-5: oklch(0.55 0.19 25);
    --chart-6: oklch(0.68 0.03 253);
    --sidebar: oklch(0.243 0.062 258);
    --sidebar-fg: oklch(0.9 0.015 250);
    --sidebar-primary: oklch(0.62 0.12 240);
    --sidebar-accent: oklch(0.305 0.06 257);
    --sidebar-border: oklch(0.33 0.05 257);
    --shadow-card: 0 1px 3px oklch(0.22 0.06 258 / .07);
    --shadow-elev: 0 1px 2px oklch(0.22 0.06 258 / .06), 0 8px 24px oklch(0.22 0.06 258 / .08);
    --font-sans: "Public Sans", ui-sans-serif, system-ui, sans-serif;
    --font-display: "Fraunces", "Public Sans", serif;
}

* { box-sizing: border-box; border-color: var(--border); }
html, body { margin: 0; padding: 0; }
body {
    background: var(--background); color: var(--foreground); font-family: var(--font-sans);
    font-size: 13px; line-height: 1.45; -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { letter-spacing: -.015em; margin: 0; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
table { border-collapse: collapse; }
.font-display { font-family: var(--font-display); }
.tabular { font-variant-numeric: tabular-nums; }

/* ---------- Shell do escritório ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
    position: sticky; top: 0; height: 100vh; width: 248px; flex-shrink: 0; display: flex; flex-direction: column;
    background: var(--sidebar); padding: 20px 16px; color: var(--sidebar-fg);
}
.sidebar nav { margin-top: 28px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.sidebar .nav-sec { margin: 14px 12px 4px; font-size: 10px; text-transform: uppercase; letter-spacing: .14em; color: oklch(0.9 0.015 250 / .45); }
.nav-link {
    display: flex; align-items: center; gap: 10px; border-radius: 8px; padding: 8px 12px; font-size: 13px; font-weight: 500;
    color: oklch(0.9 0.015 250 / .75); transition: background .15s, color .15s;
}
.nav-link i { font-size: 15px; width: 16px; text-align: center; }
.nav-link:hover { background: oklch(0.305 0.06 257 / .6); color: #fff; }
.nav-link.active { background: var(--sidebar-accent); color: #fff; box-shadow: inset 2px 0 0 0 var(--sidebar-primary); }
.nav-link .count { margin-left: auto; border-radius: 99px; background: oklch(0.75 0.14 72 / .25); color: var(--warning); font-size: 10px; font-weight: 600; padding: 1px 6px; }
.nav-link .count.info { background: oklch(0.62 0.12 240 / .3); color: oklch(0.85 0.08 240); }
.sidebar-foot { margin-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.sidebar-box { border-radius: 8px; background: oklch(0.305 0.06 257 / .5); padding: 12px; }
.sidebar-box p:first-child { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; }
.sidebar-box p:last-child { margin-top: 4px; font-size: 10.5px; line-height: 1.5; color: oklch(0.9 0.015 250 / .65); }
.sidebar-btn { display: flex; align-items: center; gap: 8px; border: 1px solid var(--sidebar-border); border-radius: 8px; padding: 8px 12px; font-size: 12px; font-weight: 500; color: oklch(0.9 0.015 250 / .8); background: transparent; width: 100%; }
.sidebar-btn:hover { background: oklch(0.305 0.06 257 / .6); }

.main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--border); background: oklch(1 0 0 / .86); backdrop-filter: blur(8px); }
.topbar-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 32px; }
.topbar h1 { font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .desc { font-size: 12.5px; color: var(--muted-fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .titles { flex: 1; min-width: 0; }
.mobile-nav { display: none; gap: 4px; overflow-x: auto; border-top: 1px solid var(--border); padding: 8px 12px; }
.mobile-nav a { white-space: nowrap; border-radius: 6px; padding: 6px 10px; font-size: 12px; font-weight: 500; color: var(--muted-fg); }
.mobile-nav a.active { background: oklch(0.42 0.105 254 / .1); color: var(--primary); }
.content { flex: 1; padding: 24px 32px; }
.user-chip { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--background); padding: 5px 8px; }
.user-chip .n { font-size: 12px; font-weight: 600; line-height: 1.2; }
.user-chip .c { font-size: 10.5px; color: var(--muted-fg); line-height: 1.2; }
.icon-btn { position: relative; display: grid; place-items: center; height: 36px; width: 36px; border: 1px solid var(--border); border-radius: 8px; background: var(--background); color: var(--muted-fg); }
.icon-btn:hover { color: var(--foreground); }
.icon-btn .dot { position: absolute; right: 8px; top: 8px; height: 6px; width: 6px; border-radius: 99px; background: var(--destructive); }
.search { position: relative; }
.search i { position: absolute; left: 10px; top: 9px; font-size: 13px; color: var(--muted-fg); }
.search input { height: 36px; width: 288px; padding-left: 30px; }

@media (max-width: 1023px) {
    .sidebar { display: none; }
    .mobile-nav { display: flex; }
    .topbar-inner, .content { padding-left: 16px; padding-right: 16px; }
    .search { display: none; }
    .hide-mobile { display: none !important; }
}

/* ---------- Superfícies e grid ---------- */
.surface { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-card); }
.surface-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--border); padding: 14px 20px; }
.surface-head h2, .surface-head h3 { font-size: 13.5px; font-weight: 600; }
.surface-head p { font-size: 11.5px; color: var(--muted-fg); }
.p-4 { padding: 16px; } .p-5 { padding: 20px; } .p-3 { padding: 12px; }
.grid { display: grid; gap: 16px; }
.grid-kpi { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.grid-2 { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
.grid-3 { display: grid; gap: 12px; grid-template-columns: repeat(3, 1fr); }
.grid-4 { display: grid; gap: 12px; grid-template-columns: repeat(4, 1fr); }
.grid-main { display: grid; gap: 16px; grid-template-columns: 1.55fr 1fr; }
.grid-main-r { display: grid; gap: 16px; grid-template-columns: 1.4fr 1fr; }
@media (max-width: 1279px) { .grid-main, .grid-main-r, .grid-2 { grid-template-columns: 1fr; } .grid-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .grid-3, .grid-4 { grid-template-columns: 1fr; } }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-5 { margin-top: 20px; } .mt-6 { margin-top: 24px; }
.mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.flex { display: flex; } .items-center { align-items: center; } .items-start { align-items: flex-start; } .justify-between { justify-content: space-between; } .justify-end { justify-content: flex-end; }
.wrap { flex-wrap: wrap; } .gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.flex-1 { flex: 1; min-width: 0; } .shrink-0 { flex-shrink: 0; } .w-full { width: 100%; }
.space-y > * + * { margin-top: 16px; }
.space-y-sm > * + * { margin-top: 8px; }
.text-right { text-align: right; } .text-center { text-align: center; }
.muted { color: var(--muted-fg); } .small { font-size: 11.5px; } .xs { font-size: 10.5px; } .strong { font-weight: 600; } .medium { font-weight: 500; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-primary { color: var(--primary); } .t-success { color: var(--success); } .t-danger { color: var(--destructive); } .t-warning { color: var(--warning-text); } .t-info { color: var(--info); }
.h-title { font-size: 14px; font-weight: 600; }
.divide > * + * { border-top: 1px solid var(--border); }
.link { color: var(--primary); font-weight: 500; font-size: 12px; }
.link:hover { text-decoration: underline; }

/* ---------- KPI ---------- */
.kpi { padding: 16px; }
.kpi .lbl { font-size: 12px; font-weight: 500; color: var(--muted-fg); }
.kpi .val { margin-top: 8px; font-family: var(--font-display); font-size: 30px; font-weight: 600; line-height: 1; letter-spacing: -.02em; }
.kpi .val.sm { font-size: 22px; }
.kpi .delta { margin-top: 6px; font-size: 11px; color: var(--muted-fg); }
.kpi-icon { display: grid; place-items: center; height: 28px; width: 28px; border-radius: 6px; font-size: 14px; }
.tone-primary { background: oklch(0.42 0.105 254 / .1); color: var(--primary); }
.tone-success { background: oklch(0.52 0.088 158 / .1); color: var(--success); }
.tone-warning { background: oklch(0.75 0.14 72 / .15); color: oklch(0.5 0.11 66); }
.tone-danger { background: oklch(0.55 0.19 25 / .1); color: var(--destructive); }
.tone-info { background: oklch(0.55 0.1 250 / .1); color: var(--info); }
.tone-muted { background: var(--muted); color: var(--muted-fg); }

/* ---------- Botões e formulários ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 8px; padding: 8px 12px; font-size: 12.5px; font-weight: 500;
       border: 1px solid var(--border); background: var(--background); transition: background .15s, border-color .15s, opacity .15s; white-space: nowrap; }
.btn:hover { background: var(--accent); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); }
.btn-primary:hover { background: oklch(0.42 0.105 254 / .9); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: oklch(0.52 0.088 158 / .9); }
.btn-danger { color: var(--destructive); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: 4px 9px; font-size: 11.5px; border-radius: 6px; }
.btn-lg { padding: 11px 18px; font-size: 14px; border-radius: 10px; }
.input, .select, .textarea {
    height: 36px; width: 100%; border: 1px solid var(--input); border-radius: 8px; background: var(--background); padding: 0 12px;
    font-size: 12.5px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; padding: 8px 12px; resize: vertical; }
.select { padding: 0 8px; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--ring); box-shadow: 0 0 0 3px oklch(0.55 0.09 254 / .2); }
.input-sm { height: 32px; font-size: 12px; }
.field { display: block; }
.field > span { display: block; margin-bottom: 4px; font-size: 11.5px; font-weight: 500; color: var(--muted-fg); }
.form-grid { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; cursor: pointer; }
.check input { width: 15px; height: 15px; accent-color: var(--primary); }
.validation-message { color: var(--destructive); font-size: 11px; margin-top: 3px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters .select, .filters .input { width: auto; min-width: 150px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; border: 1px solid; border-radius: 99px; padding: 2px 10px; font-size: 11px; font-weight: 500; white-space: nowrap; }
.badge .dot { height: 6px; width: 6px; border-radius: 99px; background: currentColor; opacity: .7; }
.b-muted { border-color: var(--border); background: var(--muted); color: var(--muted-fg); }
.b-warning { border-color: oklch(0.75 0.14 72 / .35); background: oklch(0.75 0.14 72 / .14); color: var(--warning-text); }
.b-info { border-color: oklch(0.55 0.1 250 / .25); background: oklch(0.55 0.1 250 / .1); color: var(--info); }
.b-danger { border-color: oklch(0.55 0.19 25 / .25); background: oklch(0.55 0.19 25 / .08); color: var(--destructive); }
.b-primary { border-color: oklch(0.42 0.105 254 / .25); background: oklch(0.42 0.105 254 / .08); color: var(--primary); }
.b-success { border-color: oklch(0.52 0.088 158 / .25); background: oklch(0.52 0.088 158 / .1); color: var(--success); }
.b-secondary { border-color: var(--border); background: var(--secondary); color: var(--secondary-fg); }

/* ---------- Avatar e progresso ---------- */
.avatar { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; height: 32px; width: 32px; border-radius: 99px;
          background: oklch(0.42 0.105 254 / .1); color: var(--primary); font-size: 11px; font-weight: 600; box-shadow: 0 0 0 1px oklch(0.42 0.105 254 / .15); }
.avatar.sm { height: 24px; width: 24px; font-size: 9.5px; }
.avatar.lg { height: 48px; width: 48px; font-size: 13px; }
.progress { height: 6px; width: 100%; overflow: hidden; border-radius: 99px; background: var(--muted); }
.progress > div { height: 100%; border-radius: 99px; background: var(--primary); transition: width .5s; }
.progress.success > div { background: var(--success); }
.progress.warning > div { background: var(--warning); }

/* ---------- Tabelas ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; font-size: 12.5px; }
.table thead { background: oklch(0.955 0.008 250 / .6); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted-fg); }
.table th { padding: 10px 16px; text-align: left; font-weight: 600; white-space: nowrap; }
.table td { padding: 11px 16px; border-top: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover { background: oklch(0.945 0.02 248 / .4); }
.table tr.clickable { cursor: pointer; }
.row-link { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 13px 20px; transition: background .15s; }
.row-link:hover { background: oklch(0.945 0.02 248 / .4); }

/* ---------- Abas ---------- */
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--border); }
.tab { margin-bottom: -1px; white-space: nowrap; border: 0; border-bottom: 2px solid transparent; background: none; padding: 10px 14px; font-size: 12.5px; font-weight: 500; color: var(--muted-fg); }
.tab:hover { color: var(--foreground); }
.tab.active { border-bottom-color: var(--primary); color: var(--primary); }
.tab .n { margin-left: 4px; border-radius: 99px; background: var(--muted); padding: 0 6px; font-size: 10px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; padding: 2px; background: var(--background); }
.seg button { border: 0; background: transparent; border-radius: 6px; padding: 5px 10px; font-size: 12px; font-weight: 500; color: var(--muted-fg); display: inline-flex; gap: 6px; align-items: center; }
.seg button.on { background: var(--card); color: var(--foreground); box-shadow: var(--shadow-card); }

/* ---------- Kanban ---------- */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.kcol { width: 272px; flex-shrink: 0; border-radius: 12px; background: oklch(0.955 0.008 250 / .7); border: 1px solid var(--border); padding: 10px; min-height: 200px; transition: background .15s, box-shadow .15s; }
.kcol.over { background: oklch(0.42 0.105 254 / .07); box-shadow: inset 0 0 0 2px oklch(0.42 0.105 254 / .3); }
.kcol-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 10px; font-size: 12px; font-weight: 600; }
.kcol-head .n { border-radius: 99px; background: var(--card); border: 1px solid var(--border); padding: 0 7px; font-size: 11px; color: var(--muted-fg); }
.kcard { display: block; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 12px; box-shadow: var(--shadow-card); cursor: grab; transition: box-shadow .15s, transform .15s; }
.kcard + .kcard { margin-top: 8px; }
.kcard:hover { box-shadow: var(--shadow-elev); }
.kcard.dragging { opacity: .5; }
.kcard .nome { font-size: 12.5px; font-weight: 600; }
.kcard .meta { font-size: 11px; color: var(--muted-fg); }

/* ---------- Etapas (stepper) ---------- */
.steps { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; }
.steps > div { flex: 1; min-width: 80px; }
.steps .bar { height: 6px; border-radius: 99px; background: var(--muted); }
.steps .bar.done { background: var(--success); } .steps .bar.cur { background: var(--primary); }
.steps .lbl { margin-top: 6px; white-space: nowrap; font-size: 10px; color: var(--muted-fg); }
.steps .lbl.on { color: var(--foreground); font-weight: 500; }

/* ---------- Linha do tempo ---------- */
.timeline { border-left: 1px solid var(--border); padding-left: 16px; }
.timeline li { position: relative; }
.timeline li + li { margin-top: 16px; }
.timeline li::before { content: ""; position: absolute; left: -22px; top: 4px; height: 10px; width: 10px; border-radius: 99px; background: var(--primary); box-shadow: 0 0 0 4px var(--card); }
.timeline li.t-ok::before { background: var(--success); } .timeline li.t-warn::before { background: var(--warning); } .timeline li.t-danger::before { background: var(--destructive); }
.timeline .tt { font-size: 12.5px; font-weight: 500; }
.timeline .td { font-size: 11.5px; color: var(--muted-fg); }
.timeline .tw { margin-top: 2px; font-size: 10.5px; color: var(--muted-fg); }
.activity li { display: flex; gap: 12px; }
.activity li + li { margin-top: 16px; }
.activity .ic { margin-top: 2px; display: grid; place-items: center; height: 24px; width: 24px; flex-shrink: 0; border-radius: 99px; font-size: 12px; }

/* ---------- Chat ---------- */
.chat { display: flex; flex-direction: column; height: 560px; }
.chat-body { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.bubble { max-width: 78%; border-radius: 16px; padding: 10px 14px; font-size: 12.5px; }
.bubble .a { font-size: 10.5px; opacity: .7; }
.bubble .t { margin-top: 2px; line-height: 1.45; white-space: pre-wrap; }
.bubble .h { margin-top: 4px; font-size: 10px; opacity: .65; }
.bubble.me { align-self: flex-end; border-bottom-right-radius: 4px; background: var(--primary); color: var(--primary-fg); }
.bubble.other { align-self: flex-start; border-bottom-left-radius: 4px; border: 1px solid var(--border); background: var(--secondary); }
.bubble .anexo { margin-top: 6px; display: inline-flex; align-items: center; gap: 6px; border-radius: 6px; padding: 4px 8px; background: oklch(1 0 0 / .15); font-size: 11px; }
.bubble.other .anexo { background: var(--card); border: 1px solid var(--border); }
.chat-form { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--border); padding: 12px 16px; }
.conv-list { max-height: 560px; overflow-y: auto; }
.conv { display: flex; gap: 10px; padding: 12px 16px; cursor: pointer; border-left: 2px solid transparent; }
.conv:hover { background: oklch(0.945 0.02 248 / .4); }
.conv.on { background: oklch(0.42 0.105 254 / .06); border-left-color: var(--primary); }
.unread { border-radius: 99px; background: var(--primary); color: #fff; font-size: 10px; font-weight: 600; padding: 1px 6px; }

/* ---------- Upload ---------- */
.dropzone { position: relative; display: block; width: 100%; border: 2px dashed var(--border); border-radius: 12px; background: oklch(0.955 0.008 250 / .4); padding: 36px 16px; text-align: center; transition: border-color .15s, background .15s; cursor: pointer; }
.dropzone:hover, .dropzone.over { border-color: oklch(0.42 0.105 254 / .4); background: oklch(0.42 0.105 254 / .05); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.dropzone i { font-size: 24px; color: var(--primary); }

/* ---------- Alertas ---------- */
.alert { border-radius: 8px; border: 1px solid; padding: 12px 16px; font-size: 12px; display: flex; gap: 10px; align-items: flex-start; }
.alert i { margin-top: 1px; }
.alert-warning { border-color: oklch(0.75 0.14 72 / .35); background: oklch(0.75 0.14 72 / .1); color: oklch(0.42 0.1 60); }
.alert-info { border-color: oklch(0.55 0.1 250 / .25); background: oklch(0.55 0.1 250 / .07); color: oklch(0.38 0.09 254); }
.alert-danger { border-color: oklch(0.55 0.19 25 / .25); background: oklch(0.55 0.19 25 / .06); color: var(--destructive); }
.alert-success { border-color: oklch(0.52 0.088 158 / .25); background: oklch(0.52 0.088 158 / .08); color: oklch(0.4 0.08 158); }
.note { border-radius: 8px; border: 1px solid var(--border); background: oklch(0.958 0.006 250 / .5); padding: 12px; font-size: 11px; line-height: 1.6; color: var(--muted-fg); }
.box { border-radius: 8px; border: 1px solid var(--border); background: oklch(0.955 0.008 250 / .5); padding: 14px; }
.box.primary { border-color: oklch(0.42 0.105 254 / .25); background: oklch(0.42 0.105 254 / .06); }
.empty { padding: 56px 20px; text-align: center; color: var(--muted-fg); font-size: 12.5px; }
.empty i { display: block; font-size: 28px; margin-bottom: 8px; opacity: .6; }

/* ---------- Modal / drawer ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: oklch(0.243 0.062 258 / .4); padding: 16px; backdrop-filter: blur(3px); animation: fade .15s; }
.modal { width: 100%; max-width: 480px; max-height: calc(100vh - 32px); overflow-y: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--card); padding: 20px; box-shadow: var(--shadow-elev); animation: up .18s; }
.modal.lg { max-width: 680px; }
.modal h3 { font-size: 15px; font-weight: 600; }
.modal .sub { margin-top: 2px; font-size: 11.5px; color: var(--muted-fg); }
.modal-foot { margin-top: 20px; display: flex; justify-content: flex-end; gap: 8px; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Toasts ---------- */
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.toast { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border); border-radius: 10px; background: var(--card); padding: 12px 14px; box-shadow: var(--shadow-elev); font-size: 12.5px; animation: up .2s; }
.toast i { font-size: 15px; margin-top: 1px; }
.toast.ok i { color: var(--success); } .toast.err i { color: var(--destructive); } .toast.warn i { color: var(--warning-text); } .toast.inf i { color: var(--info); }

/* ---------- Gráficos ---------- */
.chart-bars { display: flex; align-items: flex-end; gap: 10px; height: 220px; padding-top: 8px; }
.chart-bars .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart-bars .pair { display: flex; gap: 3px; align-items: flex-end; width: 100%; justify-content: center; flex: 1; }
.chart-bars .bar { width: 40%; max-width: 22px; border-radius: 4px 4px 0 0; background: var(--chart-1); min-height: 2px; transition: height .5s; }
.chart-bars .bar.b2 { background: var(--chart-3); }
.chart-bars .lbl { font-size: 10.5px; color: var(--muted-fg); }
.chart-bars .v { font-size: 10px; color: var(--muted-fg); }
.legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--muted-fg); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; height: 8px; width: 8px; border-radius: 2px; }
.hbar { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.hbar + .hbar { margin-top: 10px; }
.hbar .name { width: 170px; flex-shrink: 0; }
.hbar .track { flex: 1; height: 8px; border-radius: 99px; background: var(--muted); overflow: hidden; display: flex; }
.hbar .fill { height: 100%; background: var(--chart-1); }
.hbar .fill.f2 { background: var(--chart-2); }
.hbar .num { width: 54px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero { background: var(--navy); color: oklch(0.95 0.01 250); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-hero::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 420px; height: 420px; border-radius: 50%; background: radial-gradient(circle, oklch(0.62 0.12 240 / .35), transparent 70%); }
.auth-hero h2 { font-family: var(--font-display); font-size: 38px; font-weight: 600; line-height: 1.12; max-width: 460px; }
.auth-hero p { color: oklch(0.9 0.015 250 / .75); max-width: 440px; font-size: 14px; line-height: 1.6; }
.auth-form { display: grid; place-items: center; padding: 32px; }
.auth-card { width: 100%; max-width: 380px; }
@media (max-width: 900px) { .auth { grid-template-columns: 1fr; } .auth-hero { display: none; } }

/* ---------- Portal do cliente ---------- */
.portal-top { background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.portal-top .inner { max-width: 1040px; margin: 0 auto; display: flex; align-items: center; gap: 16px; padding: 12px 20px; }
.portal-nav { max-width: 1040px; margin: 0 auto; display: flex; gap: 4px; overflow-x: auto; padding: 0 16px 8px; }
.portal-nav a { white-space: nowrap; border-radius: 8px; padding: 7px 12px; font-size: 12.5px; font-weight: 500; color: var(--muted-fg); display: inline-flex; gap: 6px; align-items: center; }
.portal-nav a:hover { background: var(--accent); color: var(--foreground); }
.portal-nav a.active { background: oklch(0.42 0.105 254 / .1); color: var(--primary); }
.portal-main { max-width: 1040px; margin: 0 auto; padding: 24px 20px 48px; }
.portal-tabbar, .portal-so-mobile { display: none; }
@media (max-width: 767px) {
    .portal-nav { display: none; }
    .portal-so-mobile { display: grid; }
    .portal-top .inner { gap: 10px; padding: 10px 16px; }
    .portal-main { padding: 20px 16px calc(88px + env(safe-area-inset-bottom)); }
    .portal-tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; inset: auto 0 0 0; z-index: 30; background: var(--card); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); }
    .portal-tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 2px 8px; font-size: 11px; font-weight: 500; color: var(--muted-fg); min-width: 0; }
    .portal-tabbar a i { font-size: 19px; line-height: 1; }
    .portal-tabbar a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .portal-tabbar a.active { color: var(--primary); }
    .portal-tabbar a.active::before { content: ""; position: absolute; top: 0; left: 25%; right: 25%; height: 2px; border-radius: 0 0 2px 2px; background: var(--primary); }
    .portal-tabbar .unread { position: absolute; top: 4px; left: calc(50% + 6px); font-size: 9.5px; padding: 0 5px; line-height: 15px; }
    .portal-tabbar ~ .toasts { bottom: calc(76px + env(safe-area-inset-bottom)); left: 16px; right: 16px; max-width: none; }
}
.hero-card { border-radius: 16px; background: linear-gradient(135deg, var(--navy), oklch(0.36 0.09 255)); color: #fff; padding: 24px; position: relative; overflow: hidden; }
.hero-card::after { content: ""; position: absolute; right: -60px; top: -60px; width: 240px; height: 240px; border-radius: 50%; background: oklch(1 0 0 / .06); }
.hero-card .progress { background: oklch(1 0 0 / .15); }
.hero-card .progress > div { background: oklch(0.8 0.1 200); }

/* ---------- Impressão ---------- */
@media print {
    .sidebar, .topbar, .no-print, .toasts { display: none !important; }
    .content { padding: 0; }
    body { background: #fff; }
    .surface { box-shadow: none; }
}

/* Blazor */
#blazor-error-ui { color-scheme: light only; background: lightyellow; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2); box-sizing: border-box; display: none; left: 0; padding: .6rem 1.25rem .7rem 1.25rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }
.blazor-error-boundary { background: oklch(0.55 0.19 25 / .08); border: 1px solid oklch(0.55 0.19 25 / .3); border-radius: 8px; padding: 1rem; color: var(--destructive); }
.blazor-error-boundary::after { content: "Ocorreu um erro ao exibir este conteúdo."; }
