:root {
  /* Estilo BI / Executivo */
  --bg: #f4f7f9;
  --surface: #ffffff;
  --surface2: #f0f4f8;
  --line: #e2e8f0;
  --txt: #1e293b;
  --muted: #64748b;
  --faint: #94a3b8;
  --ok: #059669;
  --alert: #dc2626;
  --warn: #d97706;
  --steel: #2563eb;
  --vault: #0f172a; 
  --r: 8px;
  --disp: "Space Grotesk", system-ui, sans-serif;
  --ui: "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0 }
body { background: var(--bg); color: var(--txt); font-family: var(--ui); font-size: 14px; -webkit-font-smoothing: antialiased }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit }
.app { display: none; grid-template-columns: 236px 1fr; min-height: 100vh }
.app.on { display: grid }

/* Recolhimento da sidebar: zero a coluna e escondo o aside sem remover do DOM */
.app.side-off { grid-template-columns: 0 1fr }
.app.side-off .side { display: none }
/* Fixo o .main na coluna 2: com o aside em display:none ele não é mais item do
   grid, e o auto-placement jogava o .main na coluna 1 (=0), colapsando a tela. */
.main { grid-column: 2 }

.side-handle {
  position: fixed; top: 50%; left: 236px; z-index: 40;
  transform: translate(-50%, -50%); display: grid; place-items: center;
  width: 26px; height: 46px; border-radius: 13px;
  background: var(--surface); border: 1px solid var(--line); color: var(--faint);
  box-shadow: 0 2px 10px rgba(15,23,42,.10);
  opacity: .45; transition: opacity .18s, color .18s, border-color .18s, background .18s, left .2s;
}
.side-handle:hover { opacity: 1; color: var(--steel); border-color: var(--steel); background: #fff }
.side-handle:focus-visible { opacity: 1; outline: 2px solid var(--steel); outline-offset: 2px }
.side-handle svg { transition: transform .22s }
/* Recolhido: encosto na borda e viro a seta p/ indicar "abrir" */
.app.side-off .side-handle { left: 0; transform: translate(2px, -50%); opacity: .7 }
.app.side-off .side-handle svg { transform: rotate(180deg) }
/* Mantenho o handle visível enquanto o mouse percorre a divisa */
.app:hover .side-handle { opacity: .8 }

/* Aplico véu translúcido sobre a imagem (1ª camada = overlay, 2ª = imagem) */
#login { position: fixed; inset: 0; display: grid; place-items: center; z-index: 50;
  background: linear-gradient(rgba(219,228,243,.45), rgba(219,228,243,.45)), #dbe4f3 url("/static/ico/fundo-login.png") center/100% 100% no-repeat }
.card { width: 360px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 32px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45) }
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 24px }
/* Contenho a logo dentro do card */
.brand { justify-content: center }
.brand-logo { width: 150px; max-width: 100%; height: auto; display: block }
.logo { width: 34px; height: 34px; border-radius: 8px; object-fit: cover }
.brand b { font-family: var(--disp); font-size: 18px; letter-spacing: -.3px }
.brand span { color: var(--muted); font-size: 11px; display: block; letter-spacing: .5px }
label { display: block; font-size: 11px; color: var(--muted); margin: 14px 0 6px; letter-spacing: .4px; text-transform: uppercase; font-weight: 600 }
input, select { width: 100%; background: var(--surface); border: 1px solid var(--line); color: var(--txt); padding: 11px 12px; border-radius: 6px; font-family: inherit; font-size: 14px; transition: border 0.2s }
input:focus, select:focus { outline: none; border-color: var(--steel); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1) }
.btn { width: 100%; background: var(--vault); color: #fff; font-weight: 500; padding: 12px; border-radius: 6px; margin-top: 22px; font-size: 14px; transition: opacity 0.2s }
.btn:hover { opacity: 0.9 }
.err { color: var(--alert); font-size: 12px; margin-top: 12px; min-height: 16px; text-align: center }
.hint { margin-top: 14px; font-size: 11px; color: var(--faint); text-align: center; line-height: 1.6 }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 16px 10px 8px; display: flex; flex-direction: column; height: 100vh; position: sticky; top: 0; box-shadow: 1px 0 10px rgba(0,0,0,0.02) }
.side .brand { margin: 2px 6px 14px; flex: 0 0 auto }
.side .brand-logo { width: 124px }

.nav-busca { flex: 0 0 auto; padding: 0 4px 10px }
.nav-busca input { padding: 7px 10px; font-size: 12.5px; border-radius: 6px; background: var(--surface2) }

/* Rolagem fica só na lista; logo e rodapé permanecem visíveis */
.nav-menu { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding-right: 2px }
.nav-menu::-webkit-scrollbar { width: 6px }
.nav-menu::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px }

.sect { display: flex; align-items: center; gap: 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .8px;
  color: var(--muted); text-transform: uppercase; padding: 8px 10px; margin: 2px 0 0; border-radius: 6px;
  cursor: pointer; user-select: none; transition: background .15s, color .15s }
.sect::after { content: ""; margin-left: auto; width: 6px; height: 6px; border-right: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor; transform: rotate(-45deg); transition: transform .18s; opacity: .7 }
.sect:hover { background: var(--surface2); color: var(--txt) }
.sect.open { color: var(--vault) }
.sect.open::after { transform: rotate(45deg) }
.sect:focus-visible { outline: 2px solid var(--steel); outline-offset: -2px }

/* Colapso sem max-height mágico: a lista só existe quando aberta */
.nav-group { display: none; flex-direction: column; gap: 1px; padding: 2px 0 6px }
.nav-group.open { display: flex }

.nav { position: relative; font-size: 13px; color: var(--muted); font-weight: 500; padding: 7px 10px 7px 20px;
  border-radius: 6px; display: flex; align-items: center; text-align: left; width: 100%; line-height: 1.3;
  transition: background .15s, color .15s }
.nav::before { content: ""; position: absolute; left: 8px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 0; border-radius: 2px; background: var(--steel); transition: height .18s }
.nav:hover { background: var(--surface2); color: var(--txt) }
.nav.active { background: #e8edff; color: var(--steel); font-weight: 600 }
.nav.active::before { height: 16px }
/* Substituí a bolinha pela barra do item ativo */
.nav .dot { display: none }
.nomatch { display: none !important }

.side-footer { flex: 0 0 auto; border-top: 1px solid var(--line); padding-top: 6px }
.logout { width: 100%; color: var(--faint); font-weight: 500; font-size: 12px; padding: 9px 10px; text-align: left; border-radius: 6px; transition: all .15s }
.logout:hover { background: var(--surface2); color: var(--alert) }
.main { display: flex; flex-direction: column; min-width: 0 }
.top { display: flex; align-items: center; gap: 14px; padding: 14px 22px; border-bottom: 1px solid var(--line); background: var(--surface); box-shadow: 0 1px 4px rgba(0,0,0,0.02) }
.top h1 { font-family: var(--disp); font-size: 18px; font-weight: 600; letter-spacing: -.3px; flex: 1; color: var(--vault) }
.filter { display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px }
.filter span { font-size: 10px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: .5px }
.filter select { width: auto; background: none; border: none; padding: 2px 4px; font-size: 13px; color: var(--txt); font-weight: 600 }
.filter select:focus { box-shadow: none }
.who { font-size: 11px; color: var(--muted); text-align: right; line-height: 1.4 }
.who b { color: var(--txt); font-weight: 600 }
.body { padding: 22px; overflow: auto }
.grid { display: grid; gap: 16px }
.kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)) }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: 0 2px 8px rgba(0,0,0,0.02) }
.kpi .lbl { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .5px }
.kpi .val { font-family: var(--disp); font-size: 32px; font-weight: 700; margin: 8px 0 4px; letter-spacing: -1px; color: var(--vault) }
.kpi .sub { font-size: 11.5px; font-weight: 500; color: var(--muted) }
.kpi .sub.up { color: var(--ok) }
.kpi .sub.down { color: var(--alert) }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.02) }
.panel h3 { font-family: var(--disp); font-size: 15px; font-weight: 600; margin-bottom: 16px; color: var(--vault); display: flex; align-items: center; justify-content: space-between }
.panel h3 small { font-size: 11px; color: var(--faint); font-weight: 500; font-family: var(--ui) }
.bar { display: flex; align-items: center; gap: 10px; margin: 10px 0; font-size: 13px }
.bar .nm { width: 494px; line-height: 1.3; font-weight: 500; color: var(--muted); flex-shrink: 0 }
.bar .track { flex: 1; height: 6px; background: var(--surface2); border-radius: 4px; overflow: hidden }
.bar .fill { height: 100%; border-radius: 4px; background: var(--steel) }
.bar .n { font-family: var(--mono); font-weight: 600; width: 42px; text-align: right; color: var(--vault) }
table { width: 100%; border-collapse: collapse; font-size: 13px }
th { text-align: left; font-size: 10.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; padding: 10px; border-bottom: 2px solid var(--line) }
td { padding: 12px 10px; border-bottom: 1px solid var(--line); color: var(--txt) }
td b { color: var(--vault); font-weight: 600 }
tr:hover td { background: var(--bg) }
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; padding: 4px 10px; border-radius: 20px; font-weight: 600 }
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor }
.t-open { background: rgba(220, 38, 38, 0.1); color: var(--alert) }
.t-ok { background: rgba(5, 150, 105, 0.1); color: var(--ok) }
.t-warn { background: rgba(217, 119, 6, 0.1); color: var(--warn) }
.t-prog { background: rgba(37, 99, 235, 0.1); color: var(--steel) }
#map { height: 520px; border-radius: var(--r); border: 1px solid var(--line) }
.leaflet-container { background: var(--surface2); font-family: var(--ui) }
.maplegend { display: flex; gap: 18px; margin-top: 14px; font-size: 12px; font-weight: 500; color: var(--muted) }
.maplegend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 6px }
.score { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 6px; font-family: var(--mono); font-weight: 700; font-size: 14px }
.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(4px); display: none; place-items: center; z-index: 9999 }
.modal.on { display: grid }
.modal .card { width: 440px; box-shadow: 0 20px 60px rgba(0,0,0,0.15) }
.modal h2 { font-family: var(--disp); font-size: 18px; font-weight: 600; color: var(--vault); margin-bottom: 4px }
.modal p.s { color: var(--muted); font-size: 12px; margin-bottom: 12px }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px }
.hide { display: none !important }
.notice { font-size: 11px; color: var(--muted); background: var(--surface2); border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px; margin-top: 14px; line-height: 1.5 }
.kpi.clickable { cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; border: 1px solid transparent; }
.kpi.clickable:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.06); border-color: var(--steel); }
.modal-lg { width: 80% !important; max-width: 1000px !important; max-height: 90vh; display: flex; flex-direction: column; }
.modal-lg .body-scroll { overflow-y: auto; flex: 1; margin: 16px 0; border: 1px solid var(--line); border-radius: var(--r); }
/* Configuração de SLA — abas grandes segmentadas (UX premium) */
.sla-hero { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 0 0 20px }
.sla-bigtab {
  display: flex; align-items: center; gap: 14px; padding: 18px 20px;
  background: var(--surface); border: 2px solid var(--line); border-radius: 12px;
  cursor: pointer; text-align: left; transition: all .18s; color: inherit; width: 100%;
}
.sla-bigtab:hover { border-color: var(--steel); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(37,99,235,.08) }
.sla-bigtab.on {
  background: linear-gradient(135deg, var(--vault) 0%, #1e293b 100%);
  border-color: var(--vault); color: #fff;
}
.sla-bigtab-ico {
  font-size: 22px; width: 44px; height: 44px; display: grid; place-items: center;
  background: rgba(37,99,235,.1); border-radius: 10px; flex-shrink: 0;
}
.sla-bigtab.on .sla-bigtab-ico { background: rgba(255,255,255,.15) }
.sla-bigtab-tit { font-family: var(--disp); font-size: 15px; font-weight: 600; letter-spacing: -.2px }
.sla-bigtab-sub { font-size: 11.5px; opacity: .7; margin-top: 2px }

/* Sub-navegação pill secundária */
.sla-pills { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 14px }
.sla-pill {
  padding: 8px 14px; border: 1px solid var(--line); border-radius: 24px;
  background: var(--surface); font-size: 12.5px; font-weight: 500; color: var(--muted); cursor: pointer;
  transition: all .15s; margin: 0;
}
.sla-pill:hover { border-color: var(--steel); color: var(--txt) }
.sla-pill.on { background: var(--steel); border-color: var(--steel); color: #fff; font-weight: 600 }
.sla-pill-cnt {
  display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 10px;
  background: rgba(37,99,235,.12); color: var(--steel); font-size: 10px; font-weight: 700;
}
.sla-pill.on .sla-pill-cnt { background: rgba(255,255,255,.24); color: #fff }

/* Bloco de contexto (explicação curta) */
.sla-ctx {
  font-size: 11.5px; color: var(--muted); background: var(--surface2);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin: 0 0 14px;
  line-height: 1.7;
}
.sla-ctx b { color: var(--vault); font-weight: 600 }
.sla-ctx i { font-style: normal; color: var(--steel); font-weight: 600 }

/* Chip visual para modo especial (preventiva) */
.sla-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 12px;
  font-size: 10px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; margin-left: 6px;
  vertical-align: middle;
}
.sla-chip.prev { background: rgba(124,58,237,.12); color: #7c3aed }


.sr-total{opacity:.75;margin:6px 0 10px}
.sr-bars{display:flex;gap:6px;align-items:end;height:180px;padding:8px 4px;overflow-x:auto}
.sr-bar{flex:1 1 60px;min-width:60px;background:transparent;border:0;cursor:pointer;display:flex;flex-direction:column;align-items:center;gap:4px;height:100%}
.sr-bar .v{font-size:11px;opacity:.8}
.sr-bar .col{width:100%;background:var(--down,#c33);border-radius:4px 4px 0 0;transition:opacity .15s}
.sr-bar .lb{font-size:11px;opacity:.7}
.sr-bar.on .col,.sr-bar:hover .col{opacity:.7;outline:2px solid var(--fg,#000)}
.sr-lista .msg{max-width:420px;opacity:.85}

/* --- Responsividade do shell (bloco único) --- */
.app, .main, .body, .panel { min-width: 0 }
.body > *, .panel > * { min-width: 0 }
.body { overflow-x: auto }
.top h1 { min-width: 0 }

@media (max-width: 1024px) {
  .app.on, .app.on.side-off { grid-template-columns: 0 1fr }
  .app .side,
  .app.side-off .side {
    display: flex; position: fixed; top: 0; bottom: 0; left: 0; width: 264px;
    z-index: 60; overflow-y: auto;
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: 4px 0 24px rgba(15,23,42,.12);
  }
  .app:not(.side-off) .side { transform: translateX(0) }

  .app:not(.side-off)::after {
    content: ""; position: fixed; inset: 0; z-index: 55;
    background: rgba(15,23,42,.45); backdrop-filter: blur(2px);
  }

  .side-handle, .app.side-off .side-handle { left: 0; transform: translate(2px, -50%); opacity: .85 }
  .app.side-off .side-handle svg { transform: rotate(180deg) }
  .app:not(.side-off) .side-handle { left: 264px; transform: translate(-50%, -50%); z-index: 61 }
  .app:not(.side-off) .side-handle svg { transform: rotate(0deg) }

  .top { flex-wrap: wrap; gap: 10px; padding: 12px 16px 12px 40px }
  .top h1 { flex: 1 1 100%; font-size: 16px }
  .who { text-align: left }
  .body { padding: 16px }
  .kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) }
  .cols, .sla-hero { grid-template-columns: 1fr }
  .modal .card { width: 92vw }
  .modal-lg { width: 95% !important }
}

@media (max-width: 640px) {
  .kpis { grid-template-columns: repeat(2, 1fr) }
  .kpi { padding: 14px }
  .kpi .val { font-size: 24px }
  .panel { padding: 14px }
  .filter { padding: 5px 8px; flex: 1 1 auto }
  .filter select { width: 100%; min-width: 0 }
  .top { padding: 10px 12px 10px 40px }
  .body { padding: 12px }
}

@media (hover: none) {
  .side-handle { opacity: .9; width: 30px; height: 54px }
  .nav { padding: 12px 11px }
}

@media print {
  .side, .side-handle, .top .filter { display: none !important }
  .app { grid-template-columns: 1fr !important }
}