/* Contábil IA 2.0 — sistema visual (somente ambiente de TESTES).
   Camada carregada por último: redefine tokens e padroniza componentes sem alterar a lógica nem os ids existentes. */

/* ============ Tokens ============ */
:root{
 --bg:#f2f4f7;--surface:#ffffff;--surface-2:#f8fafc;--surface-3:#eef2f6;
 --ink:#0f1b2d;--ink-2:#334155;--muted:#64748b;--line:#e3e8ef;--line-2:#cfd8e3;
 --brand:#0f766e;--brand-ink:#0d5f59;--brand-soft:#e7f4f2;--brand-line:#a7d8cf;
 --nav:#0b1424;--nav-2:#111d33;--nav-ink:#9fb0c6;--nav-active:rgba(45,212,191,.12);
 --warn:#9a5b00;--warn-soft:#fff6e5;--warn-line:#f2d39b;
 --bad:#b42318;--bad-soft:#fef1f0;--bad-line:#f6c4be;
 --info:#1d4ed8;--info-soft:#eef3ff;--info-line:#c7d6fb;
 --ok:#067647;--ok-soft:#ecfaf2;--ok-line:#a6e4c2;
 --neutral:#475467;--neutral-soft:#f2f4f7;--neutral-line:#d0d5dd;
 --shadow:0 1px 2px rgba(16,24,40,.05),0 1px 3px rgba(16,24,40,.06);
 --shadow-md:0 4px 12px rgba(16,24,40,.08),0 1px 3px rgba(16,24,40,.06);
 --shadow-lg:0 24px 48px rgba(16,24,40,.18);
 --brand-contrast:#ffffff;--r:12px;--r-sm:8px;--ui-focus:0 0 0 3px rgba(15,118,110,.22);
}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]){
 --bg:#0a0f1a;--surface:#111827;--surface-2:#0f1623;--surface-3:#1a2333;
 --ink:#e7ecf3;--ink-2:#c3cdda;--muted:#8d9ab0;--line:#1f2a3c;--line-2:#2c3a51;
 --brand:#2dd4bf;--brand-ink:#5eead4;--brand-contrast:#04201d;--brand-soft:#0f2a2a;--brand-line:#1d5550;
 --nav:#070c16;--nav-2:#0d1526;--nav-ink:#8e9db4;--nav-active:rgba(45,212,191,.12);
 --warn:#fbbf24;--warn-soft:#2a210c;--warn-line:#5c4614;
 --bad:#f97066;--bad-soft:#2d1512;--bad-line:#5f2a24;
 --info:#84adff;--info-soft:#121d36;--info-line:#26406f;
 --ok:#47cd89;--ok-soft:#0e2a1d;--ok-line:#1f5a3c;
 --neutral:#a4afc0;--neutral-soft:#1a2333;--neutral-line:#2c3a51;
 --shadow:0 1px 2px rgba(0,0,0,.35);--shadow-md:0 4px 14px rgba(0,0,0,.35);--ui-focus:0 0 0 3px rgba(45,212,191,.25)}}
:root[data-theme="dark"]{
 --bg:#0a0f1a;--surface:#111827;--surface-2:#0f1623;--surface-3:#1a2333;
 --ink:#e7ecf3;--ink-2:#c3cdda;--muted:#8d9ab0;--line:#1f2a3c;--line-2:#2c3a51;
 --brand:#2dd4bf;--brand-ink:#5eead4;--brand-contrast:#04201d;--brand-soft:#0f2a2a;--brand-line:#1d5550;
 --nav:#070c16;--nav-2:#0d1526;--nav-ink:#8e9db4;--nav-active:rgba(45,212,191,.12);
 --warn:#fbbf24;--warn-soft:#2a210c;--warn-line:#5c4614;
 --bad:#f97066;--bad-soft:#2d1512;--bad-line:#5f2a24;
 --info:#84adff;--info-soft:#121d36;--info-line:#26406f;
 --ok:#47cd89;--ok-soft:#0e2a1d;--ok-line:#1f5a3c;
 --neutral:#a4afc0;--neutral-soft:#1a2333;--neutral-line:#2c3a51;
 --shadow:0 1px 2px rgba(0,0,0,.35);--shadow-md:0 4px 14px rgba(0,0,0,.35);--ui-focus:0 0 0 3px rgba(45,212,191,.25)}

/* ============ Base e tipografia ============ */
body.ui-ready{font-size:14px;line-height:1.55;font-feature-settings:"cv11","ss01";background:var(--bg)}
body.ui-ready h1{font-size:24px;letter-spacing:-.4px;font-weight:800}
body.ui-ready h2{font-size:15px;letter-spacing:-.1px;font-weight:700;color:var(--ink)}
body.ui-ready h3{font-size:14px;font-weight:700}
body.ui-ready .muted,body.ui-ready .small.muted{color:var(--muted)}
body.ui-ready td,body.ui-ready .num,body.ui-ready .v2-metric strong{font-variant-numeric:tabular-nums}
body.ui-ready :focus-visible{outline:none;box-shadow:var(--ui-focus)}
body.ui-ready a{color:var(--brand-ink)}


/* ============ Layout: sidebar ============ */
body.ui-ready{--v2-sidebar:272px}
body.ui-ready.v2-collapsed{--v2-sidebar:72px}
body.ui-ready aside{background:linear-gradient(180deg,var(--nav) 0%,var(--nav-2) 100%);padding:14px 10px 12px;gap:0;border-right:1px solid rgba(255,255,255,.04);scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.15) transparent}
body.ui-ready aside .logo{padding:4px 10px 16px;margin-bottom:6px;border-bottom:1px solid rgba(255,255,255,.06)}
.ui-nav{display:flex;flex-direction:column;gap:2px;flex:1;min-height:0}
.ui-group{display:flex;flex-direction:column;margin-top:6px}
.ui-group-head{display:flex;align-items:center;gap:10px;width:100%;padding:8px 10px;border:0;background:transparent;color:#d8e1ee;border-radius:8px;font-size:12px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;text-align:left}
.ui-group-head .ui-gicon{width:16px;height:16px;opacity:.75}
.ui-group-head .ui-glabel{flex:1;font-size:11px}
.ui-group-head .ui-chev{width:14px;height:14px;transition:transform .18s;opacity:.6;transform:rotate(90deg)}
.ui-group.collapsed .ui-chev{transform:rotate(0deg)}
.ui-group-head:hover{background:rgba(255,255,255,.04)}
.ui-group.has-active .ui-group-head{color:#fff}
.ui-items{display:flex;flex-direction:column;gap:1px;padding:2px 0 4px;overflow:hidden}
.ui-group.collapsed .ui-items{display:none}
.ui-item{position:relative;display:flex;align-items:center;gap:10px;width:100%;min-height:36px;padding:7px 10px 7px 14px;border:0;background:transparent;color:var(--nav-ink);border-radius:8px;font-size:13px;font-weight:500;text-align:left;transition:background .15s,color .15s}
.ui-item .i{width:16px;height:16px;opacity:.8}
.ui-item .ui-label{flex:1;line-height:1.3}
.ui-item:hover{background:rgba(255,255,255,.05);color:#e6edf7}
.ui-item.active{background:var(--nav-active);color:#fff;font-weight:600}
.ui-item.active::before{content:"";position:absolute;left:2px;top:8px;bottom:8px;width:3px;border-radius:3px;background:#2dd4bf}
.ui-item .ui-dot{width:7px;height:7px;border-radius:50%;flex:0 0 auto}
.ui-dot.ready{background:#34d399}.ui-dot.partial{background:#fbbf24}.ui-dot.pending{background:#64748b}
.ui-side-foot{margin-top:10px;padding:10px 10px 2px;border-top:1px solid rgba(255,255,255,.06);display:flex;flex-direction:column;gap:8px;color:var(--nav-ink);font-size:11px}
.ui-legend{display:flex;flex-wrap:wrap;gap:10px}
.ui-legend span{display:inline-flex;align-items:center;gap:5px}
.ui-collapse{display:flex;align-items:center;gap:8px;border:1px solid rgba(255,255,255,.08);background:rgba(255,255,255,.03);color:var(--nav-ink);border-radius:8px;padding:7px 10px;font-size:12px}
.ui-collapse:hover{color:#fff;background:rgba(255,255,255,.07)}
.ui-collapse .i{width:15px;height:15px;transform:rotate(180deg);transition:transform .2s}
body.v2-collapsed .ui-collapse .i{transform:none}
/* Recolhida: só ícones, grupos separados por linha, tooltip ao passar o mouse. */
body.v2-collapsed .ui-group-head{justify-content:center;padding:8px 0;pointer-events:none}
body.v2-collapsed .ui-group-head .ui-glabel,body.v2-collapsed .ui-group-head .ui-chev,body.v2-collapsed .ui-group-head .ui-gicon{display:none}
body.v2-collapsed .ui-group-head::after{content:"";display:block;width:28px;height:1px;background:rgba(255,255,255,.12)}
body.v2-collapsed .ui-group.collapsed .ui-items{display:flex}
body.v2-collapsed .ui-item{justify-content:center;padding:9px 0}
body.v2-collapsed .ui-item .ui-label,body.v2-collapsed .ui-item .ui-dot,body.v2-collapsed .ui-legend,body.v2-collapsed .ui-collapse span{display:none}
body.v2-collapsed .ui-item.active::before{left:0}
body.v2-collapsed .ui-item[data-tip]:hover::after{content:attr(data-tip);position:fixed;left:calc(var(--v2-sidebar) + 6px);transform:translateY(-2px);background:#0b1424;color:#fff;font-size:12px;font-weight:500;padding:6px 10px;border-radius:7px;white-space:nowrap;box-shadow:var(--shadow-lg);z-index:200;pointer-events:none}
body.v2-collapsed .ui-collapse{justify-content:center}
body.ui-ready aside .v2-nav-label,body.ui-ready aside .v2-side-note,body.ui-ready aside>.nav{display:none!important}
@media(max-width:900px){body.ui-ready aside .ui-label,body.ui-ready aside .ui-glabel,body.ui-ready aside .ui-chev,body.ui-ready aside .ui-dot,body.ui-ready aside .ui-legend{display:inline-flex!important}body.ui-ready aside .ui-item{justify-content:flex-start;padding:9px 10px 9px 14px}body.ui-ready aside .ui-group-head{pointer-events:auto;justify-content:flex-start;padding:8px 10px}body.ui-ready aside .ui-group-head::after{display:none}.ui-collapse{display:none}}

/* ============ Topo ============ */
body.ui-ready header{background:color-mix(in srgb,var(--surface) 92%,transparent);backdrop-filter:saturate(1.4) blur(8px);border-bottom:1px solid var(--line);min-height:58px;padding:8px 24px}
body.ui-ready header .crumb{font-size:13px;color:var(--muted);display:flex;align-items:center;gap:7px;min-width:0}
body.ui-ready header .crumb strong{color:var(--ink);font-size:15px;font-weight:700;font-family:var(--display);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#uiCrumbGroup{color:var(--muted);font-weight:500}
body.ui-ready .head-actions{gap:10px}
body.ui-ready .company-pick{border:1px solid var(--line-2);background:var(--surface);border-radius:10px;padding:4px 6px 4px 10px;box-shadow:var(--shadow)}
body.ui-ready .company-pick select{font-weight:700;border:0;background:transparent;max-width:280px}
body.ui-ready .user-chip{display:flex;align-items:center;gap:8px;border:1px solid var(--line);background:var(--surface-2);border-radius:999px;padding:3px 4px 3px 10px;font-size:12px}
.ui-sync{display:inline-flex;align-items:center;gap:6px;font-size:11px;font-weight:600;color:var(--ok)}
.ui-sync.busy{color:var(--warn)}.ui-sync.err{color:var(--bad)}
body.ui-ready .badge.local{background:var(--neutral-soft);border:1px solid var(--neutral-line);color:var(--neutral)}
/* Faixa de contexto: empresa e competência em destaque. */
body.ui-ready .v2-context{gap:0;padding:0 24px;min-height:62px;align-items:stretch;background:var(--surface);border-bottom:1px solid var(--line);box-shadow:0 1px 0 rgba(16,24,40,.02)}
body.ui-ready .v2-context-item{justify-content:center;padding:10px 18px;border-right:1px solid var(--line);min-width:0;gap:3px}
body.ui-ready .v2-context-item:first-child{padding-left:0}
body.ui-ready .v2-context-item>span{font-size:10px;font-weight:600;letter-spacing:.08em;color:var(--muted)}
body.ui-ready .v2-context-item b{font-size:13px;font-weight:600}
.ui-ctx-company b{font-size:15px!important;font-weight:800!important;font-family:var(--display);max-width:320px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block}
body.ui-ready .v2-context-item input[type=month]{font-weight:700;font-size:14px;border:1px solid var(--brand-line);background:var(--brand-soft);color:var(--brand-ink);border-radius:8px;padding:5px 9px;max-width:170px}
body.ui-ready .v2-context .ui-ctx-actions{margin-left:auto;display:flex;align-items:center;gap:8px;padding:10px 0}
body.ui-ready .v2-context-note{display:none}
body.ui-ready #v2Notifications{display:inline-flex;align-items:center;gap:8px;border-radius:999px;padding:7px 12px}
body.ui-ready #v2Notifications b{min-width:22px;height:22px;display:inline-grid;place-items:center;border-radius:999px;background:var(--neutral-soft);color:var(--neutral);font-size:12px;padding:0 6px}
body.ui-ready #v2Notifications.has-pending b{background:var(--warn);color:#fff}
body.ui-ready .ui-assistant-btn{background:var(--brand);color:var(--brand-contrast);border:1px solid var(--brand)}
body.ui-ready .ui-assistant-btn:hover{filter:brightness(1.05)}
@media(max-width:1100px){body.ui-ready .v2-context{padding:0 16px;flex-wrap:wrap}body.ui-ready .v2-context-item{padding:8px 12px}}
@media(max-width:700px){body.ui-ready .v2-context-item{border-right:0;padding:6px 10px}body.ui-ready .v2-context .ui-ctx-actions{margin-left:0;width:100%;padding:6px 0 10px}body.ui-ready header{padding:8px 14px}}

/* ============ Área principal, cabeçalhos de seção ============ */
body.ui-ready main .wrap{max-width:1560px;padding:24px 28px 40px}
body.ui-ready .v2-window-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:4px 0 18px;margin-bottom:18px;border-bottom:1px solid var(--line)}
body.ui-ready .v2-window-heading{gap:14px}
body.ui-ready .v2-window-icon{width:44px;height:44px;border-radius:11px;background:var(--brand-soft);color:var(--brand-ink);border:1px solid var(--brand-line);display:grid;place-items:center}
body.ui-ready .v2-window-head h1{font-size:22px;margin-bottom:4px}
body.ui-ready .v2-window-head p{color:var(--muted);max-width:860px;margin:0;font-size:13px}
body.ui-ready .v2-toolbar{border-radius:var(--r);box-shadow:var(--shadow);padding:10px 12px}
body.ui-ready .v2-toolbar input[type=search]{min-width:280px;padding-left:34px;background:var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m14 14-3.2-3.2'/%3E%3C/svg%3E") 11px center no-repeat}

/* ============ Cards ============ */
body.ui-ready .card{background:var(--surface);border:1px solid var(--line);border-radius:var(--r);box-shadow:var(--shadow);padding:20px 22px}
body.ui-ready .card>h2:first-child,body.ui-ready .card .dp-head h2,body.ui-ready .card .v2-section-title h2{font-size:15px}
body.ui-ready .card h2{display:flex;align-items:center;gap:8px}
body.ui-ready details.card>summary{font-weight:700;font-size:14px;cursor:pointer;list-style:none;display:flex;align-items:center;gap:8px}
body.ui-ready details.card>summary::before{content:"";width:8px;height:8px;border-right:2px solid var(--muted);border-bottom:2px solid var(--muted);transform:rotate(-45deg);transition:transform .15s;margin-right:4px}
body.ui-ready details.card[open]>summary::before{transform:rotate(45deg)}
body.ui-ready details.card>summary::-webkit-details-marker{display:none}

/* ============ Botões ============ */
body.ui-ready .btn{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:36px;padding:8px 14px;border-radius:var(--r-sm);border:1px solid var(--brand);background:var(--brand);color:var(--brand-contrast);font-weight:600;font-size:13px;line-height:1.2;box-shadow:0 1px 2px rgba(16,24,40,.08);transition:background .15s,border-color .15s,box-shadow .15s,filter .15s}
body.ui-ready .btn:hover{filter:brightness(1.06)}
body.ui-ready .btn.alt{background:var(--surface);color:var(--ink-2);border-color:var(--line-2)}
body.ui-ready .btn.alt:hover{background:var(--surface-2);border-color:var(--muted);filter:none}
body.ui-ready .btn.ghost,body.ui-ready .btn.dp-link{background:transparent;border-color:transparent;color:var(--brand-ink);box-shadow:none}
body.ui-ready .btn.ghost:hover,body.ui-ready .btn.dp-link:hover{background:var(--brand-soft)}
body.ui-ready .btn:disabled,body.ui-ready .btn.v2-disabled{opacity:.55;cursor:not-allowed;filter:none}
body.ui-ready .btn.dp-big{min-height:46px;padding:12px 24px;font-size:14px;letter-spacing:.3px;border-radius:10px;box-shadow:var(--shadow-md)}
body.ui-ready .icon-btn{border-radius:9px;border:1px solid var(--line);background:var(--surface)}

/* ============ Campos ============ */
body.ui-ready input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=range]),body.ui-ready select,body.ui-ready textarea{border:1px solid var(--line-2);border-radius:var(--r-sm);background:var(--surface);transition:border-color .15s,box-shadow .15s}
body.ui-ready input:not([type=checkbox]):not([type=radio]):focus,body.ui-ready select:focus,body.ui-ready textarea:focus{border-color:var(--brand);box-shadow:var(--ui-focus);outline:none}
body.ui-ready label{color:var(--ink-2)}
body.ui-ready input[type=file]{font-size:12px}

/* ============ Abas internas ============ */
body.ui-ready .v2-tabs{gap:2px;padding:4px;background:var(--surface-3);border:1px solid var(--line);border-radius:11px;width:auto;display:inline-flex;flex-wrap:wrap;max-width:100%}
body.ui-ready .v2-tabs button{border:0;background:transparent;color:var(--ink-2);font-weight:600;font-size:13px;padding:8px 14px;border-radius:8px;display:inline-flex;align-items:center;gap:6px}
body.ui-ready .v2-tabs button:hover{color:var(--ink);background:color-mix(in srgb,var(--surface) 60%,transparent)}
body.ui-ready .v2-tabs button.active{background:var(--surface);color:var(--brand-ink);box-shadow:var(--shadow)}

/* ============ Tabelas ============ */
body.ui-ready .table-wrap{border:1px solid var(--line);border-radius:10px;background:var(--surface);max-height:620px}
body.ui-ready .table-wrap table{border-collapse:separate;border-spacing:0;width:100%}
body.ui-ready .table-wrap thead th{position:sticky;top:0;z-index:2;background:var(--surface-2);color:var(--muted);font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.05em;padding:10px 12px;border-bottom:1px solid var(--line-2);text-align:left;white-space:nowrap}
body.ui-ready .table-wrap tbody td{padding:10px 12px;border-bottom:1px solid var(--line);vertical-align:middle}
body.ui-ready .table-wrap tbody tr:last-child td{border-bottom:0}
body.ui-ready .table-wrap tbody tr:hover td{background:color-mix(in srgb,var(--brand-soft) 45%,transparent)}
body.ui-ready .table-wrap tbody tr:nth-child(even) td{background-color:color-mix(in srgb,var(--surface-2) 70%,transparent)}
body.ui-ready .table-wrap tbody tr.dp-warnrow td{background:var(--warn-soft)}
body.ui-ready .table-wrap tbody tr.dp-okrow td{background:var(--ok-soft)}
body.ui-ready .table-wrap tbody tr[id^="dpDet-"] td,body.ui-ready .table-wrap tbody tr[id^="ecdD-"] td,body.ui-ready .table-wrap tbody tr[id^="dpHist-"] td{background:var(--surface-2)}
body.ui-ready .dp-mini th{font-size:11px;text-transform:uppercase;letter-spacing:.05em;color:var(--muted)}
.ui-pager{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;padding:8px 2px 0;font-size:12px;color:var(--muted)}
.ui-pager .ui-pages{display:flex;gap:4px;align-items:center}
.ui-pager button{border:1px solid var(--line-2);background:var(--surface);color:var(--ink-2);border-radius:7px;min-width:32px;height:30px;padding:0 9px;font-size:12px;font-weight:600}
.ui-pager button.on{background:var(--brand);border-color:var(--brand);color:var(--brand-contrast)}
.ui-pager button:disabled{opacity:.45;cursor:default}

/* ============ Badges e status ============ */
body.ui-ready .badge{display:inline-flex;align-items:center;gap:6px;border-radius:999px;padding:3px 10px;font-size:11.5px;font-weight:600;line-height:1.5;border:1px solid var(--neutral-line);background:var(--neutral-soft);color:var(--neutral);white-space:nowrap}
body.ui-ready .badge.ok{background:var(--ok-soft);border-color:var(--ok-line);color:var(--ok)}
body.ui-ready .badge.warn{background:var(--warn-soft);border-color:var(--warn-line);color:var(--warn)}
body.ui-ready .badge.err{background:var(--bad-soft);border-color:var(--bad-line);color:var(--bad)}
body.ui-ready .badge.info{background:var(--info-soft);border-color:var(--info-line);color:var(--info)}
body.ui-ready .badge::before{content:"";width:6px;height:6px;border-radius:50%;background:currentColor;opacity:.85}
body.ui-ready .badge.local::before{display:none}
body.ui-ready .v2-status{border-radius:999px;font-size:11.5px;padding:4px 11px;font-weight:600}
body.ui-ready .v2-status.ready{background:var(--ok-soft);border-color:var(--ok-line);color:var(--ok)}
body.ui-ready .v2-status.partial{background:var(--warn-soft);border-color:var(--warn-line);color:var(--warn)}
body.ui-ready .v2-status.pending{background:var(--neutral-soft);border-color:var(--neutral-line);color:var(--neutral)}
body.ui-ready .v2-state-dot.ready{background:var(--ok)}body.ui-ready .v2-state-dot.partial{background:var(--warn)}body.ui-ready .v2-state-dot.pending{background:var(--neutral)}
body.ui-ready .notice{border-radius:10px;border:1px solid var(--info-line);background:var(--info-soft);color:var(--ink-2);padding:11px 14px}
body.ui-ready .dp-status{border-radius:10px}

/* ============ Indicadores (cards de números) ============ */
body.ui-ready .v2-metrics{gap:14px}
body.ui-ready .v2-metric{position:relative;padding:16px 18px 16px 20px;border-radius:var(--r);border:1px solid var(--line);background:var(--surface);box-shadow:var(--shadow);text-align:left;overflow:hidden;transition:box-shadow .15s,transform .15s,border-color .15s}
body.ui-ready button.v2-metric:hover{box-shadow:var(--shadow-md);border-color:var(--brand-line);transform:translateY(-1px)}
body.ui-ready .v2-metric::before{content:"";position:absolute;left:0;top:0;bottom:0;width:4px;background:var(--brand-line)}
body.ui-ready .v2-metric.ok::before{background:var(--ok)}body.ui-ready .v2-metric.err::before{background:var(--bad)}body.ui-ready .v2-metric.warn::before{background:var(--warn)}
body.ui-ready .v2-metric span{font-size:12px;font-weight:600;color:var(--muted);letter-spacing:.01em}
body.ui-ready .v2-metric strong{font-size:28px;font-weight:800;font-family:var(--display);letter-spacing:-.5px;color:var(--ink);margin-top:4px}
body.ui-ready .v2-metric small{display:block;font-size:11.5px;color:var(--muted);margin-top:4px;line-height:1.4}
body.ui-ready #v2DashboardMetrics{grid-template-columns:repeat(4,minmax(0,1fr))}
@media(max-width:1200px){body.ui-ready #v2DashboardMetrics{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:560px){body.ui-ready #v2DashboardMetrics{grid-template-columns:minmax(0,1fr)}}

/* ============ Painel Geral ============ */
.ui-dash-grid{display:grid;grid-template-columns:minmax(0,1.35fr) minmax(0,1fr);gap:16px;margin-top:16px}
.ui-status-list{display:flex;flex-direction:column}
.ui-status-row{display:flex;align-items:center;gap:12px;padding:11px 2px;border-bottom:1px solid var(--line)}
.ui-status-row:last-child{border-bottom:0}
.ui-status-row .ui-srow-ico{width:34px;height:34px;border-radius:9px;display:grid;place-items:center;background:var(--surface-3);color:var(--ink-2);flex:0 0 auto}
.ui-status-row .ui-srow-ico .i{width:17px;height:17px}
.ui-status-row .ui-srow-main{flex:1;min-width:0}
.ui-status-row b{display:block;font-size:13px}
.ui-status-row small{display:block;color:var(--muted);font-size:12px;line-height:1.4}
.ui-status-row .btn{min-height:30px;padding:5px 10px;font-size:12px}
.ui-alerts{display:flex;flex-direction:column;gap:8px}
.ui-alert{display:flex;gap:10px;align-items:flex-start;padding:10px 12px;border-radius:10px;border:1px solid var(--warn-line);background:var(--warn-soft);font-size:13px;color:var(--ink-2)}
.ui-alert.err{border-color:var(--bad-line);background:var(--bad-soft)}
.ui-alert.ok{border-color:var(--ok-line);background:var(--ok-soft)}
.ui-alert .i{width:16px;height:16px;margin-top:2px;color:var(--warn);flex:0 0 auto}
.ui-alert.err .i{color:var(--bad)}.ui-alert.ok .i{color:var(--ok)}
.ui-areas{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}
.ui-area{border:1px solid var(--line);border-radius:11px;padding:14px;background:var(--surface-2)}
.ui-area h3{display:flex;align-items:center;gap:8px;margin:0 0 8px;font-size:13px;text-transform:uppercase;letter-spacing:.05em;color:var(--ink-2)}
.ui-area h3 .i{width:16px;height:16px;color:var(--brand-ink)}
.ui-area button{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;border:0;background:transparent;padding:6px 4px;border-radius:7px;font-size:13px;color:var(--ink);text-align:left}
.ui-area button:hover{background:var(--surface)}
.ui-area button .v2-state-dot{width:8px;height:8px}
@media(max-width:1200px){.ui-dash-grid{grid-template-columns:minmax(0,1fr)}.ui-areas{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:700px){.ui-areas{grid-template-columns:minmax(0,1fr)}}

/* ============ Modais ============ */
body.ui-ready dialog{border:1px solid var(--line);border-radius:14px;box-shadow:var(--shadow-lg);padding:22px;background:var(--surface);color:var(--ink)}
body.ui-ready dialog::backdrop{background:rgba(10,15,26,.45);backdrop-filter:blur(2px)}

/* ============ Ajustes de responsividade (desktop primeiro) ============ */
@media(min-width:1600px){body.ui-ready main .wrap{padding:28px 36px 48px}}
@media(max-width:900px){body.ui-ready main .wrap{padding:18px 16px 32px}body.ui-ready .v2-toolbar input[type=search]{min-width:0;width:100%}}
body.ui-ready .card.ui-flash{box-shadow:0 0 0 3px var(--brand-line),var(--shadow-md);transition:box-shadow .3s}

.ops-apur{border-top:1px solid var(--line);margin-top:16px;padding-top:12px}.ops-apur h3{display:flex;gap:8px;align-items:center}.ops-apur ol{padding-left:20px;line-height:1.6}

.ai-answer{margin-top:10px;padding:12px 14px;border:1px solid var(--info-line);background:var(--info-soft);border-radius:10px;font-size:13px;line-height:1.6}.ai-answer .ai-head{font-weight:700;margin-bottom:6px;color:var(--info)}.ai-btn{margin-top:8px}

.perm-mods{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px 14px;margin:8px 0}#permCompanies{width:100%;max-width:520px;margin-top:6px}@media(max-width:700px){.perm-mods{grid-template-columns:minmax(0,1fr)}}
