/* ============================ DESIGN TOKENS ============================ */
:root{
  --font-sans:"Fira Sans",-apple-system,"Segoe UI",Roboto,system-ui,sans-serif;
  --font-mono:"Fira Code",ui-monospace,"SF Mono",Menlo,monospace;
  --bg-grad-1:#eef2f8; --bg-grad-2:#e7ebf2;
  --surface:#ffffff; --surface-2:#f7f9fc; --surface-inset:#f1f4f9;
  --border:#e2e8f0; --border-strong:#cbd5e1;
  --text:#0f172a; --text-muted:#64748b; --text-faint:#94a3b8;
  --primary:#1e3a5f; --primary-600:#254b7a; --on-primary:#ffffff;
  --brand:#2563eb;
  --ok:#059669; --ok-soft:#d1fae5; --ok-text:#047857;
  --warn:#b45309; --warn-soft:#fef3c7;
  --bad:#dc2626; --bad-soft:#fee2e2; --bad-text:#b91c1c;
  --ring:rgba(37,99,235,.35);
  --shadow-sm:0 1px 2px rgba(15,23,42,.06),0 1px 3px rgba(15,23,42,.04);
  --shadow-md:0 4px 12px -2px rgba(15,23,42,.10),0 2px 6px -2px rgba(15,23,42,.06);
  --shadow-lg:0 12px 32px -8px rgba(15,23,42,.18);
  --radius:14px; --radius-sm:9px; --radius-xs:6px;
  --s1:4px; --s2:8px; --s3:12px; --s4:16px; --s5:24px; --s6:32px; --s7:48px;
}
:root[data-theme="dark"]{
  --bg-grad-1:#0b1120; --bg-grad-2:#0a0e19;
  --surface:#111a2e; --surface-2:#0f1727; --surface-inset:#0c1424;
  --border:#1e293b; --border-strong:#2b3a52;
  --text:#e6edf7; --text-muted:#94a3b8; --text-faint:#64748b;
  --primary:#3b82f6; --primary-600:#2563eb; --on-primary:#ffffff;
  --brand:#60a5fa;
  --ok:#10b981; --ok-soft:#0c3b2f; --ok-text:#34d399;
  --warn:#f59e0b; --warn-soft:#3a2c0a;
  --bad:#ef4444; --bad-soft:#3a1414; --bad-text:#f87171;
  --ring:rgba(96,165,250,.4);
  --shadow-sm:0 1px 2px rgba(0,0,0,.4);
  --shadow-md:0 6px 16px -4px rgba(0,0,0,.5);
  --shadow-lg:0 14px 40px -10px rgba(0,0,0,.6);
}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{
  margin:0; font-family:var(--font-sans); color:var(--text); line-height:1.55; min-height:100vh;
  background:
    radial-gradient(1200px 600px at 100% -10%, color-mix(in srgb,var(--brand) 8%,transparent), transparent 60%),
    linear-gradient(180deg,var(--bg-grad-1),var(--bg-grad-2));
  -webkit-font-smoothing:antialiased;
}
a{color:var(--brand); text-decoration:none}
a:hover{text-decoration:underline}
h1,h2,h3{margin:0; font-weight:600; letter-spacing:-.01em}
[hidden]{display:none!important}

/* ============================ APP SHELL ============================ */
.shell{display:grid; grid-template-columns:240px minmax(0,1fr); min-height:100vh}
.sidebar{position:sticky; top:0; height:100vh; display:flex; flex-direction:column;
  background:var(--surface); border-right:1px solid var(--border); overflow-y:auto}
.side-brand{padding:var(--s4) var(--s4) var(--s3)}
.brand{display:flex; align-items:center; gap:var(--s3); font-weight:700; font-size:16px; letter-spacing:-.02em; color:var(--text)}
.brand:hover{text-decoration:none}
.logo{width:32px; height:32px; border-radius:9px; display:grid; place-items:center; flex:none;
  background:linear-gradient(145deg,var(--primary),var(--brand)); color:#fff;
  box-shadow:var(--shadow-sm),inset 0 1px 0 rgba(255,255,255,.25)}
.logo svg{width:18px; height:18px}
.brand small{display:block; font-weight:500; font-size:11px; color:var(--text-muted); letter-spacing:0}
.side-nav{padding:var(--s2) var(--s3) var(--s4); display:flex; flex-direction:column; gap:2px}
.side-item{display:flex; align-items:center; gap:10px; padding:9px 11px; border-radius:var(--radius-sm);
  font-size:13.5px; font-weight:500; color:var(--text-muted); text-decoration:none; transition:.14s}
.side-item:hover{background:var(--surface-2); color:var(--text); text-decoration:none}
.side-item.active{background:color-mix(in srgb,var(--brand) 12%,transparent); color:var(--brand); font-weight:600}
.side-item svg{width:17px; height:17px; flex:none}
.side-item .mono{font-size:12.5px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.side-chip{margin-left:auto; min-width:20px; height:20px; padding:0 6px; border-radius:999px; background:var(--bad);
  color:#fff; font-size:11px; font-weight:700; display:grid; place-items:center; font-variant-numeric:tabular-nums}
.side-group-label{margin:var(--s4) 11px 6px}
.side-empty{padding:4px 11px; font-size:12px; color:var(--text-faint)}
.side-foot{margin-top:auto; padding:var(--s4); border-top:1px solid var(--border);
  display:flex; align-items:center; gap:var(--s2); flex-wrap:wrap}
.content{min-width:0; display:flex; flex-direction:column}

/* ============================ MOBILE TOPBAR + DRAWER ============================ */
.mobile-topbar{display:none; align-items:center; gap:var(--s3); position:sticky; top:0; z-index:30;
  height:56px; padding:0 var(--s4);
  background:color-mix(in srgb,var(--surface) 88%,transparent);
  backdrop-filter:saturate(160%) blur(14px); -webkit-backdrop-filter:saturate(160%) blur(14px);
  border-bottom:1px solid var(--border)}
.nav-backdrop{position:fixed; inset:0; z-index:40; background:rgba(8,12,22,.5);
  opacity:0; pointer-events:none; transition:opacity .2s}
html.nav-open .nav-backdrop{opacity:1; pointer-events:auto}

.pill{display:inline-flex; align-items:center; gap:6px; height:28px; padding:0 11px; border-radius:999px;
  font-size:12px; font-weight:500; border:1px solid var(--border); background:var(--surface-2);
  color:var(--text-muted); white-space:nowrap; text-decoration:none}
a.pill:hover{text-decoration:none; border-color:var(--border-strong); color:var(--text)}
.pill.env{color:var(--ok-text); border-color:color-mix(in srgb,var(--ok) 30%,var(--border)); background:var(--ok-soft)}
.pill svg{width:14px; height:14px}
.dot{width:8px; height:8px; border-radius:50%; background:currentColor; flex:none}
.dot.live{background:var(--ok); animation:pulse 2s infinite}
@keyframes pulse{0%{box-shadow:0 0 0 0 color-mix(in srgb,var(--ok) 55%,transparent)}70%{box-shadow:0 0 0 6px transparent}100%{box-shadow:0 0 0 0 transparent}}
.icon-btn{width:34px; height:34px; border-radius:9px; border:1px solid var(--border); background:var(--surface-2);
  color:var(--text-muted); cursor:pointer; display:grid; place-items:center; transition:.16s; flex:none}
.icon-btn:hover{color:var(--text); border-color:var(--border-strong); box-shadow:var(--shadow-sm)}
.icon-btn svg{width:17px; height:17px}
:root[data-theme="dark"] #ico-sun{display:none}
:root:not([data-theme="dark"]) #ico-moon{display:none}

/* ============================ LAYOUT ============================ */
main{width:100%; max-width:1120px; margin:0 auto; padding:var(--s6) var(--s5) var(--s7)}
.page-head{margin-bottom:var(--s5)}
.page-head h1{font-size:22px}
.page-head p{margin:6px 0 0; color:var(--text-muted); font-size:14px}
.section{margin-top:var(--s6)}
.section-head{display:flex; align-items:baseline; justify-content:space-between; gap:var(--s3); margin-bottom:var(--s3)}
.section-head h2{font-size:15px; color:var(--text)}
.eyebrow{font-size:11px; font-weight:600; text-transform:uppercase; letter-spacing:.08em; color:var(--text-faint)}

/* breadcrumb */
.crumbs{display:flex; align-items:center; gap:8px; font-size:13px; color:var(--text-muted); margin-bottom:var(--s4)}
.crumbs a{color:var(--text-muted)}
.crumbs a:hover{color:var(--brand); text-decoration:none}
.crumbs .sep{color:var(--text-faint)}
.crumbs .cur{color:var(--text); font-weight:600; font-family:var(--font-mono); font-size:12.5px}

/* ============================ TABS ============================ */
.tabs{display:flex; gap:2px; border-bottom:1px solid var(--border); margin-bottom:var(--s5); overflow-x:auto}
.tabs [role="tab"]{appearance:none; background:none; border:none; border-bottom:2px solid transparent;
  margin-bottom:-1px; padding:10px 14px; font:inherit; font-size:13.5px; font-weight:500;
  color:var(--text-muted); cursor:pointer; white-space:nowrap; transition:.14s}
.tabs [role="tab"]:hover{color:var(--text)}
.tabs [role="tab"][aria-selected="true"]{color:var(--brand); border-bottom-color:var(--brand); font-weight:600}
.tabs [role="tab"]:focus-visible{outline:none; box-shadow:0 0 0 3px var(--ring); border-radius:6px 6px 0 0}
[role="tabpanel"] > .section:first-child{margin-top:0}
[role="tabpanel"] > .kpi-grid + .section{margin-top:var(--s5)}

/* ============================ CAMPANHAS (atribuição) ============================ */
.range-group{display:inline-flex; border:1px solid var(--border-strong); border-radius:var(--radius-sm); overflow:hidden}
.range-btn{appearance:none; background:var(--surface); border:none; padding:7px 14px; font:inherit;
  font-size:12.5px; font-weight:500; color:var(--text-muted); cursor:pointer; transition:.14s}
.range-btn + .range-btn{border-left:1px solid var(--border)}
.range-btn:hover{color:var(--text); background:var(--surface-2)}
.range-btn[aria-pressed="true"]{background:var(--brand); color:var(--on-primary); font-weight:600}
.range-btn:focus-visible{outline:none; box-shadow:inset 0 0 0 3px var(--ring)}
.bars{display:flex; align-items:flex-end; gap:2px; height:130px}
.bars .bar{flex:1; min-width:2px; border-radius:3px 3px 0 0; cursor:default; transition:filter .14s;
  background:linear-gradient(180deg,color-mix(in srgb,var(--ok) 80%,var(--brand)),var(--ok))}
.bars .bar.zero{background:var(--surface-inset)}
.bars .bar:hover{filter:brightness(1.15)}
.bars-x{display:flex; justify-content:space-between; font-size:11px; color:var(--text-faint);
  margin-top:7px; font-variant-numeric:tabular-nums}
th.num,td.num{text-align:right; font-variant-numeric:tabular-nums}

/* ============================ CARDS ============================ */
.card{background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  box-shadow:var(--shadow-sm); overflow:hidden}
.card-pad{padding:var(--s5)}
.card-head{padding:var(--s4) var(--s5); border-bottom:1px solid var(--border); display:flex;
  align-items:center; justify-content:space-between; gap:var(--s3)}
.card-head h2{font-size:14px; display:flex; align-items:center; gap:8px}
.card-head h2 svg{width:16px; height:16px; color:var(--text-muted)}
.card-head .sub{font-size:12px; color:var(--text-faint); font-weight:400}
.hint{color:var(--text-muted); font-size:12.5px; margin:var(--s3) 0 0}
.hint:first-child{margin-top:0}

/* ============================ KPI GRID ============================ */
.kpi-grid{display:grid; grid-template-columns:repeat(4,1fr); gap:var(--s4)}
.kpi{background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  padding:var(--s4) var(--s4) calc(var(--s4) + 2px); box-shadow:var(--shadow-sm);
  position:relative; overflow:hidden; transition:.18s}
.kpi:hover{box-shadow:var(--shadow-md); transform:translateY(-1px)}
.kpi::before{content:""; position:absolute; inset:0 auto 0 0; width:3px; background:var(--kpi-accent,var(--brand)); opacity:.9}
.kpi.ok{--kpi-accent:var(--ok)} .kpi.warn{--kpi-accent:var(--warn)} .kpi.bad{--kpi-accent:var(--bad)}
.kpi.neutral{--kpi-accent:var(--border-strong)}
.kpi-label{display:flex; align-items:center; gap:7px; font-size:12px; color:var(--text-muted); font-weight:500}
.kpi-label svg{width:15px; height:15px; color:var(--text-faint)}
.kpi-value{font-size:26px; font-weight:600; letter-spacing:-.02em; margin-top:6px; line-height:1.1; font-variant-numeric:tabular-nums}
.kpi-value small{font-size:14px; color:var(--text-muted); font-weight:500}
.kpi-value.sm{font-size:17px; margin-top:8px}
.kpi-sub{font-size:12px; color:var(--text-muted); margin-top:3px}
.meter{background:var(--surface-inset); border-radius:999px; height:7px; margin-top:9px; overflow:hidden}
.meter-fill{height:100%; border-radius:999px; transition:width .5s ease;
  background:linear-gradient(90deg,var(--ok),color-mix(in srgb,var(--ok) 70%,var(--brand)))}
.meter-fill.warn{background:linear-gradient(90deg,var(--warn),#f59e0b)}
.meter-fill.bad{background:linear-gradient(90deg,var(--bad),#f87171)}

/* ============================ SKELETON ============================ */
.skeleton{display:inline-block; min-width:64px; max-width:100%; height:1em; border-radius:6px; vertical-align:middle;
  color:transparent!important; user-select:none; overflow:hidden;
  background:linear-gradient(90deg,var(--surface-inset) 25%,var(--border) 45%,var(--surface-inset) 65%);
  background-size:200% 100%; animation:shimmer 1.4s linear infinite}
.skeleton *{visibility:hidden}
@keyframes shimmer{to{background-position:-200% 0}}
@media (prefers-reduced-motion:reduce){ .skeleton{animation:none; background:var(--surface-inset)} }

/* ============================ BADGES ============================ */
.badge{display:inline-flex; align-items:center; gap:6px; padding:3px 9px; border-radius:999px;
  font-size:12px; font-weight:500; line-height:1.4; white-space:nowrap; border:1px solid transparent}
.badge .dot{width:7px; height:7px}
.badge svg{width:14px; height:14px}
.badge.ok{background:var(--ok-soft); color:var(--ok-text); border-color:color-mix(in srgb,var(--ok) 22%,transparent)}
.badge.bad{background:var(--bad-soft); color:var(--bad-text); border-color:color-mix(in srgb,var(--bad) 22%,transparent)}
.badge.warn{background:var(--warn-soft); color:var(--warn); border-color:color-mix(in srgb,var(--warn) 22%,transparent)}
.badge.neutral{background:var(--surface-inset); color:var(--text-muted); border-color:var(--border)}

/* ============================ TABLE ============================ */
.table-wrap{overflow-x:auto}
table{width:100%; border-collapse:collapse; font-size:13.5px}
thead th{text-align:left; padding:10px var(--s4); font-size:11px; font-weight:600; text-transform:uppercase;
  letter-spacing:.05em; color:var(--text-faint); border-bottom:1px solid var(--border); white-space:nowrap; background:var(--surface-2)}
tbody td{padding:13px var(--s4); border-bottom:1px solid var(--border); vertical-align:middle}
tbody tr:last-child td{border-bottom:none}
tbody tr{transition:background .14s}
tbody tr:hover{background:var(--surface-2)}
.cell-title{font-weight:600; color:var(--text)}
.cell-sub{font-size:12px; color:var(--text-faint); margin-top:2px}
.kv th{width:210px; text-align:left; padding:11px var(--s4); font-size:12px; color:var(--text-muted);
  font-weight:500; border-bottom:1px solid var(--border); background:transparent; text-transform:none; letter-spacing:0}
.kv td{padding:11px var(--s4); border-bottom:1px solid var(--border)}
.kv tr:last-child th,.kv tr:last-child td{border-bottom:none}
code,.mono{font-family:var(--font-mono); font-size:.88em}
td code,.chip-code{background:var(--surface-inset); border:1px solid var(--border); padding:1.5px 7px;
  border-radius:6px; font-size:12px; color:var(--text)}
.chip-code{display:inline-block}

/* ============================ FORMS ============================ */
.form-grid{display:grid; grid-template-columns:1fr 1fr; gap:var(--s4)}
.field{margin-bottom:var(--s4)}
label{display:block; font-size:13px; font-weight:500; color:var(--text); margin-bottom:6px}
label .opt{color:var(--text-faint); font-weight:400}
.help{font-size:12px; color:var(--text-muted); margin:5px 0 0}
input,textarea,select{width:100%; padding:10px 12px; border:1px solid var(--border-strong); border-radius:var(--radius-sm);
  font:inherit; font-size:14px; background:var(--surface); color:var(--text); transition:.14s}
input::placeholder,textarea::placeholder{color:var(--text-faint)}
input:focus,textarea:focus,select:focus{outline:none; border-color:var(--brand); box-shadow:0 0 0 3px var(--ring)}
textarea{font-family:var(--font-mono); font-size:12.5px; min-height:82px; resize:vertical; line-height:1.5}
.filter-input{width:220px; padding:7px 11px; font-size:13px}

/* ============================ BUTTONS ============================ */
.btn{display:inline-flex; align-items:center; justify-content:center; gap:8px; cursor:pointer;
  border:1px solid transparent; border-radius:var(--radius-sm); padding:10px 18px; font:inherit;
  font-size:14px; font-weight:600; transition:.16s; white-space:nowrap; text-decoration:none}
.btn:hover{text-decoration:none}
.btn svg{width:16px; height:16px}
.btn-primary{background:linear-gradient(180deg,var(--primary-600),var(--primary)); color:var(--on-primary);
  box-shadow:var(--shadow-sm),inset 0 1px 0 rgba(255,255,255,.14)}
.btn-primary:hover{filter:brightness(1.08); box-shadow:var(--shadow-md)}
.btn-primary:active{transform:translateY(1px)}
.btn-ghost{background:var(--surface); color:var(--text); border-color:var(--border-strong)}
.btn-ghost:hover{border-color:var(--brand); color:var(--brand); background:var(--surface-2)}
.btn-danger{background:var(--surface); color:var(--bad-text); border-color:color-mix(in srgb,var(--bad) 35%,var(--border))}
.btn-danger:hover{background:var(--bad); color:#fff; border-color:var(--bad)}
.btn-sm{padding:7px 13px; font-size:13px; border-radius:var(--radius-xs)}
.btn:focus-visible{outline:none; box-shadow:0 0 0 3px var(--ring)}

/* ============================ BANNER ============================ */
.banner{background:linear-gradient(180deg,var(--bad-soft),color-mix(in srgb,var(--bad-soft) 60%,var(--surface)));
  border:1px solid color-mix(in srgb,var(--bad) 30%,var(--border)); border-radius:var(--radius);
  padding:var(--s4) var(--s5); margin-bottom:var(--s5); display:flex; gap:var(--s4)}
.banner .b-ico{width:36px; height:36px; border-radius:10px; background:var(--bad); color:#fff; display:grid; place-items:center; flex:none}
.banner .b-ico svg{width:20px; height:20px}
.banner h3{font-size:14px; color:var(--bad-text)}
.banner ul{margin:6px 0 0; padding-left:18px; color:var(--text); font-size:13px}
.banner li{margin:2px 0}

/* ============================ STEPPER ============================ */
.steps{list-style:none; margin:0; padding:0; counter-reset:step}
.steps li{position:relative; padding:0 0 var(--s4) 42px; counter-increment:step}
.steps li:last-child{padding-bottom:0}
.steps li::before{content:counter(step); position:absolute; left:0; top:-1px; width:28px; height:28px; border-radius:50%;
  background:var(--surface); border:1.5px solid var(--border-strong); color:var(--text-muted); font-size:13px;
  font-weight:600; display:grid; place-items:center; font-variant-numeric:tabular-nums}
.steps li::after{content:""; position:absolute; left:14px; top:29px; bottom:6px; width:1.5px; background:var(--border)}
.steps li:last-child::after{display:none}
.steps .s-body{font-size:13.5px}
.steps .s-body b{font-weight:600}
.steps .s-body .hint{margin-top:3px}

/* ============================ TERMINAL / PRE ============================ */
.terminal{background:#0b1120; border:1px solid #1e293b; border-radius:var(--radius-sm); overflow:hidden; box-shadow:var(--shadow-sm)}
.terminal + .terminal{margin-top:var(--s3)}
.terminal-bar{display:flex; align-items:center; gap:7px; padding:9px 13px; background:#0f172a; border-bottom:1px solid #1e293b}
.terminal-bar .tdot{width:11px; height:11px; border-radius:50%}
.terminal-bar span:last-child{margin-left:8px; font-family:var(--font-mono); font-size:11.5px; color:#94a3b8}
pre.log{margin:0; padding:14px 16px; font-family:var(--font-mono); font-size:12px; line-height:1.6; color:#cbd5e1;
  overflow-x:auto; white-space:pre-wrap; word-break:break-word; max-height:360px}
pre.out{margin:var(--s3) 0; padding:14px 16px; background:var(--surface-inset); border:1px solid var(--border);
  border-radius:var(--radius-sm); font-family:var(--font-mono); font-size:12px; line-height:1.55; color:var(--text);
  overflow-x:auto; white-space:pre-wrap; word-break:break-word}

/* ============================ RESULT (operação concluída) ============================ */
.result-wrap{max-width:640px; margin:0 auto}
.result-hero{text-align:center; padding:var(--s6) var(--s5) var(--s4)}
.result-hero h1{font-size:20px}
.result-hero p{margin:8px 0 0}
.result-ico{width:64px; height:64px; border-radius:50%; display:grid; place-items:center; margin:0 auto var(--s4)}
.result-ico.ok{background:var(--ok-soft); color:var(--ok-text)}
.result-ico.bad{background:var(--bad-soft); color:var(--bad-text)}
.result-ico svg{width:30px; height:30px}
details.tech{margin:var(--s4) 0 0}
details.tech summary{cursor:pointer; font-size:13px; font-weight:500; color:var(--text-muted); user-select:none}
details.tech summary:hover{color:var(--text)}
.result-actions{display:flex; gap:var(--s3); justify-content:center; flex-wrap:wrap; margin-top:var(--s5)}

/* danger + misc */
.danger-zone{border-color:color-mix(in srgb,var(--bad) 25%,var(--border))}
.danger-zone .card-head{border-bottom-color:color-mix(in srgb,var(--bad) 20%,var(--border))}
.danger-zone .card-head h2{color:var(--bad-text)}
.danger-zone .card-head h2 svg{color:var(--bad-text)}
.row-split{display:flex; align-items:center; justify-content:space-between; gap:var(--s4); flex-wrap:wrap}
.empty{text-align:center; padding:var(--s6) var(--s4); color:var(--text-muted)}
.empty svg{width:34px; height:34px; color:var(--text-faint); margin-bottom:8px}
.status-ok{color:var(--ok-text); font-weight:600}
.status-bad{color:var(--bad-text); font-weight:600}
.muted{color:var(--text-muted)}

/* ============================ ORIGENS (breakdown/drill-down) ============================ */
.kpi-grid.six{grid-template-columns:repeat(3,1fr)}
.dim-pills{display:inline-flex; flex-wrap:wrap; gap:4px}
.dim-btn{appearance:none; background:var(--surface-2); border:1px solid var(--border);
  border-radius:999px; padding:5px 12px; font:inherit; font-size:12px; font-weight:500;
  color:var(--text-muted); cursor:pointer; transition:.14s}
.dim-btn:hover{color:var(--text); border-color:var(--border-strong)}
.dim-btn.active{background:var(--brand); border-color:var(--brand); color:var(--on-primary); font-weight:600}
.dim-btn:focus-visible{outline:none; box-shadow:0 0 0 3px var(--ring)}
.row-bar{position:relative}
.row-bar::before{content:""; position:absolute; inset:4px auto 4px 4px; width:var(--bar,0%);
  max-width:calc(100% - 8px); background:color-mix(in srgb,var(--brand) 13%,transparent);
  border-radius:4px; pointer-events:none}
.row-bar > *{position:relative}
tr.row-click{cursor:pointer}
tr.row-click:hover td{background:var(--surface-2)}
tr.row-click:focus-visible{outline:none; box-shadow:inset 0 0 0 2px var(--ring)}
.delta{font-size:11.5px; font-weight:600; white-space:nowrap}
.delta.up{color:var(--ok-text)}
.delta.down{color:var(--bad-text)}
.filter-chip{appearance:none; display:inline-flex; align-items:center; gap:6px;
  background:color-mix(in srgb,var(--brand) 10%,var(--surface)); border:1px solid var(--brand);
  border-radius:999px; padding:6px 14px; font:inherit; font-size:12.5px; color:var(--text);
  cursor:pointer; transition:.14s}
.filter-chip:hover{background:color-mix(in srgb,var(--bad) 10%,var(--surface)); border-color:var(--bad)}
dialog.attr-modal{border:1px solid var(--border); border-radius:var(--radius);
  background:var(--surface); color:var(--text); box-shadow:var(--shadow-lg);
  padding:var(--s5); width:min(680px,92vw); max-height:80vh}
dialog.attr-modal::backdrop{background:rgba(10,18,30,.55)}
dialog.attr-modal .table-wrap{max-height:60vh; overflow-y:auto}
.pill.live{color:var(--ok-text); border-color:color-mix(in srgb,var(--ok) 40%,var(--border)); display:inline-flex; align-items:center; gap:6px}
.live-dot{width:7px; height:7px; border-radius:50%; background:var(--ok); animation:livepulse 1.6s ease-in-out infinite}
@keyframes livepulse{0%,100%{opacity:1; transform:scale(1)} 50%{opacity:.45; transform:scale(.8)}}

/* ============================ RESPONSIVE ============================ */
@media (max-width:900px){
  .shell{display:block}
  .mobile-topbar{display:flex}
  .sidebar{position:fixed; top:0; left:0; bottom:0; height:100vh; width:min(280px,82vw); z-index:50;
    transform:translateX(-105%); transition:transform .22s ease}
  html.nav-open .sidebar{transform:none; box-shadow:var(--shadow-lg)}
  .kpi-grid,.kpi-grid.six{grid-template-columns:repeat(2,1fr)}
  .form-grid{grid-template-columns:1fr}
}
@media (max-width:560px){
  .kpi-grid,.kpi-grid.six{grid-template-columns:1fr}
  main{padding:var(--s5) var(--s4) var(--s6)}
  .mobile-topbar .brand small{display:none}
  .filter-input{width:150px}
}
@media (prefers-reduced-motion:reduce){ *{animation:none!important; transition:none!important} }

/* ============================ LOGIN / AUTH ============================ */
.auth-body{display:flex; align-items:center; justify-content:center; padding:var(--s5)}
.auth-wrap{width:min(400px,100%)}
.auth-card{background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  box-shadow:var(--shadow-lg); padding:var(--s6) var(--s6) var(--s5)}
.auth-brand{display:flex; align-items:center; gap:12px; margin-bottom:var(--s5); font-weight:700; line-height:1.15}
.auth-brand small{display:block; font-size:11.5px; font-weight:400; color:var(--text-muted)}
.auth-brand .logo{width:40px; height:40px; border-radius:11px; flex:none; display:flex; align-items:center; justify-content:center;
  background:linear-gradient(145deg,var(--primary),var(--brand)); color:#fff}
.auth-brand .logo svg{width:22px; height:22px}
.auth-card h1{font-size:19px; margin:0 0 var(--s4)}
.auth-card label{margin-top:var(--s3)}
.auth-check{display:flex; align-items:center; gap:8px; margin:var(--s4) 0 0; font-weight:400; font-size:13px; color:var(--text-muted)}
.auth-check input{width:auto; margin:0}
.auth-submit{width:100%; margin-top:var(--s4)}
.auth-msg{border-radius:var(--radius-sm); padding:10px 12px; font-size:13px; margin-bottom:var(--s4); border:1px solid}
.auth-msg.ok{background:var(--ok-soft); color:var(--ok-text); border-color:color-mix(in srgb,var(--ok) 30%,transparent)}
.auth-msg.bad{background:var(--bad-soft); color:var(--bad-text); border-color:color-mix(in srgb,var(--bad) 30%,transparent)}
.auth-hint{color:var(--text-muted); font-size:13.5px; margin:0 0 var(--s4)}
.auth-hint-inline{color:var(--text-faint); font-weight:400}
.auth-foot{margin:var(--s5) 0 0; font-size:13px; text-align:center}
.auth-below{text-align:center; color:var(--text-faint); font-size:12px; margin-top:var(--s4)}
