/* =========================================================================
   ISP Casa — NOC shell + telas (layout). Componentes em base.css; tokens em tokens.css.
   ========================================================================= */

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; }

/* ---------- Sidebar (grafite) ---------- */
.side {
  background: var(--side-bg); border-right: 1px solid var(--side-border);
  display: flex; flex-direction: column; padding: var(--sp-4) var(--sp-3);
  position: sticky; top: 0; height: 100vh; gap: 2px;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 8px 10px 6px; color: #fff; font-weight: var(--fw-bold); }
.side-logo { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-300)); color: #fff; box-shadow: 0 4px 12px color-mix(in srgb, var(--brand) 40%, transparent); }
.side-tenant { font-size: var(--fs-2xs); color: var(--side-text-2); background: var(--side-bg-2);
  border: 1px solid var(--side-border); border-radius: var(--r-sm); padding: 8px 10px; margin: 8px 4px 12px; }
.side-group { font-size: var(--fs-2xs); font-weight: var(--fw-semibold); letter-spacing: .08em; text-transform: uppercase;
  color: var(--side-text-2); padding: 14px 12px 6px; }
.side-link { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--r-sm);
  color: var(--side-text); font-size: var(--fs-sm); font-weight: var(--fw-medium); position: relative; }
.side-link:hover { background: color-mix(in srgb, var(--side-active) 60%, transparent); color: #fff; }
.side-link.on { background: var(--side-active); color: #fff; }
.side-link.on::before { content: ''; position: absolute; left: -3px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--brand-500); }
.side-link .ic { width: 18px; height: 18px; flex: none; opacity: .92; }
.side-link.lock { opacity: .55; }
.side-spacer { flex: 1; }
.side-foot { display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-top: 1px solid var(--side-border); margin-top: 6px; }
.side-foot .nm { color: #fff; font-size: var(--fs-sm); font-weight: var(--fw-semibold); }
.side-foot .rl { color: var(--side-text-2); font-size: var(--fs-2xs); }

/* ---------- Main + topbar ---------- */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { height: var(--topbar-h); border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--sp-4); padding: 0 var(--sp-7); }
.topbar .tt { font-size: var(--fs-h3); font-weight: var(--fw-semibold); }
.topbar .ts { font-size: var(--fs-xs); color: var(--text-3); }
.topbar .search { margin-left: auto; display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-sm); color: var(--text-faint); font-size: var(--fs-sm); width: 240px; }
.iconbtn { width: 36px; height: 36px; border-radius: var(--r-sm); display: grid; place-items: center; color: var(--text-2); border: 1px solid transparent; background: transparent; position: relative; }
.iconbtn:hover { background: var(--n-100); }
.iconbtn .badge { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--bad-500); border: 2px solid var(--surface); }

.page { max-width: 1320px; width: 100%; margin: 0 auto; padding: var(--sp-6) var(--sp-7) var(--sp-9); }
.page-eyebrow { margin: var(--sp-6) 2px var(--sp-3); }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-4); }
.kpi { padding: var(--sp-5); position: relative; }
.kpi .chip { width: 36px; height: 36px; border-radius: var(--r-md); display: grid; place-items: center; margin-bottom: var(--sp-3); }
.kpi .delta { position: absolute; top: var(--sp-5); right: var(--sp-5); }
.kpi .v { font-size: 28px; font-weight: var(--fw-bold); line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .v .u { font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text-3); margin-left: 4px; }
.kpi .foot { display: flex; align-items: flex-end; justify-content: space-between; margin-top: var(--sp-4); }
.kpi .foot .lab { font-size: var(--fs-2xs); color: var(--text-3); }

/* ---------- Grids de conteúdo ---------- */
.g-2-1 { display: grid; grid-template-columns: 1.7fr 1fr; gap: var(--sp-4); margin-top: var(--sp-4); }
.g-1-2 { display: grid; grid-template-columns: 1fr 1.9fr; gap: var(--sp-4); margin-top: var(--sp-4); }
.g-1-1 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.radar-item { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-md, 10px); text-decoration: none; color: inherit; transition: background .15s; }
.radar-item:hover { background: var(--n-100); }
.radar-item .meta { display: flex; flex-direction: column; line-height: 1.2; }
.radar-item .meta .nm { font-weight: 600; font-size: var(--fs-sm); }
.radar-item .meta .sub { color: var(--text-faint); font-size: var(--fs-2xs); }
.healthmap { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--sp-3); }
.health-tile { border-radius: var(--radius-md, 12px); padding: var(--sp-3) var(--sp-4); color: #fff; min-height: 92px;
  display: flex; flex-direction: column; justify-content: space-between; box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,.08)); }
.health-tile .ht-name { font-weight: 700; font-size: var(--fs-sm); opacity: .95; }
.health-tile .ht-score { font-size: 30px; font-weight: 800; line-height: 1; }
.health-tile .ht-sub { font-size: var(--fs-2xs); opacity: .9; }
.g-ficha { display: grid; grid-template-columns: 1.5fr 1fr; gap: var(--sp-4); align-items: start; }

/* ---------- Histograma ---------- */
.histo { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding-top: var(--sp-3); }
.histo .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; justify-content: flex-end; height: 100%; }
.histo .bar { width: 100%; border-radius: 6px 6px 3px 3px; min-height: 4px; transition: height .6s cubic-bezier(.2,.7,.2,1); }
.histo .bl { font-size: var(--fs-2xs); color: var(--text-3); }
.histo .bv { font-size: var(--fs-xs); font-weight: var(--fw-bold); }

/* ---------- Leads list ---------- */
.lead { display: flex; align-items: center; gap: var(--sp-3); padding: 11px 0; border-bottom: 1px solid var(--border-subtle); }
.lead:last-child { border-bottom: 0; }
.lead .nm { font-size: var(--fs-sm); font-weight: var(--fw-semibold); text-transform: capitalize; min-width: 96px; }
.lead .track { flex: 1; height: 8px; background: var(--n-100); border-radius: 99px; overflow: hidden; }
.lead .fill { height: 100%; border-radius: 99px; }
.lead .n { font-weight: var(--fw-bold); font-variant-numeric: tabular-nums; width: 30px; text-align: right; }

/* ---------- Tabela: célula cliente ---------- */
.cust { display: flex; align-items: center; gap: 11px; }
.cust .meta { display: flex; flex-direction: column; }
.cust .nm { font-weight: var(--fw-semibold); }
.cust .sub { font-size: var(--fs-2xs); color: var(--text-3); }
.mini-bar { width: 54px; height: 6px; border-radius: 99px; background: var(--n-150); overflow: hidden; display: inline-block; vertical-align: middle; }
.mini-bar i { display: block; height: 100%; border-radius: 99px; }

/* ---------- Ficha ---------- */
.ring-wrap { display: flex; gap: var(--sp-6); align-items: center; }
.subs { display: flex; flex-direction: column; gap: var(--sp-4); flex: 1; }
.onu-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--sp-4) var(--sp-5); margin-top: var(--sp-5); }
.onu-f .k { font-size: var(--fs-2xs); color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.onu-f .v { font-weight: var(--fw-semibold); margin-top: 3px; }
.diag-banner { display: flex; gap: var(--sp-3); padding: var(--sp-4); border-radius: var(--r-md); border: 1px solid transparent; }
.diag-cat { display: flex; align-items: center; gap: var(--sp-3); padding: 10px 0; border-bottom: 1px solid var(--border-subtle); }
.diag-cat:last-child { border-bottom: 0; }
.diag-cat .ci { width: 30px; height: 30px; border-radius: var(--r-sm); display: grid; place-items: center; flex: none; }
.timeline { position: relative; }
.tl-ev { position: relative; padding: 0 0 var(--sp-4) var(--sp-6); }
.tl-ev::before { content: ''; position: absolute; left: 9px; top: 18px; bottom: -2px; width: 1px; background: var(--border); }
.tl-ev:last-child::before { display: none; }
.tl-ev .dot { position: absolute; left: 2px; top: 3px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; }

/* ---------- Login ---------- */
.login { display: grid; grid-template-columns: 1.05fr .95fr; min-height: 100vh; }
.login-brand { background: var(--side-bg); color: #fff; padding: var(--sp-9) var(--sp-8); position: relative; overflow: hidden; display: flex; flex-direction: column; }
.login-brand .motif { position: absolute; inset: 0; opacity: .16; }
.login-brand .hl { font-size: var(--fs-display); font-weight: var(--fw-bold); letter-spacing: -.02em; margin-top: auto; max-width: 420px; }
.login-brand .sb { color: var(--side-text); margin-top: var(--sp-3); max-width: 380px; }
.login-brand .stats { display: flex; gap: var(--sp-7); margin-top: var(--sp-7); }
.login-brand .stat .v { font-size: var(--fs-h1); font-weight: var(--fw-bold); }
.login-brand .stat .l { color: var(--side-text-2); font-size: var(--fs-xs); }
.login-form { display: grid; place-items: center; padding: var(--sp-6); background: var(--surface); }
.login-form .box { width: 100%; max-width: 380px; }
.roles { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.role { border: 1px solid var(--border-strong); border-radius: var(--r-sm); padding: 10px 8px; text-align: center; font-size: var(--fs-2xs); font-weight: var(--fw-semibold); color: var(--text-2); cursor: pointer; }
.role.on { border-color: var(--brand-500); background: var(--brand-50); color: var(--brand-700); }

/* ---------- Estado vazio ---------- */
.empty { text-align: center; padding: var(--sp-9) var(--sp-6); color: var(--text-3); }
.empty .ei { width: 56px; height: 56px; border-radius: var(--r-lg); background: var(--n-100); display: grid; place-items: center; margin: 0 auto var(--sp-4); color: var(--text-faint); }

@media (max-width: 1000px) {
  .app { grid-template-columns: 1fr; }
  .side { display: none; }
  .kpis { grid-template-columns: repeat(2,1fr); }
  .g-2-1, .g-1-2, .g-1-1, .g-ficha { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; } .login-brand { display: none; }
}

/* Pipeline — "Perdido…" recolhido (summary estilizado como botão) */
.perda { display: inline-block; }
.perda > summary { list-style: none; cursor: pointer; }
.perda > summary::-webkit-details-marker { display: none; }
.perda > summary::marker { content: ""; }
.perda[open] > summary { margin-bottom: 6px; }
