:root {
  --vermelho: #ED1C24;
  --accent: #F0283A;
  --surface: #17181B;
  --raised: #222327;
  --raised-2: #2A2C31;
  --faixa: #3E4147;
  --ink: #F5F5F6;
  --muted: #B4B6BB;
  --line: #34363C;
  --ok: #3DBE7A;
  --aviso: #F2B23A;
  --radius-sm: 6px; --radius-md: 12px; --radius-lg: 16px;
  --font-text: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Montserrat", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
#app { height: 100%; }
html, body { margin: 0; height: 100%; background: var(--surface); color: var(--ink); font: 14px/20px var(--font-text); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--ink); }
.hidden { display: none !important; }

/* ---------- login ---------- */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px; background: radial-gradient(1200px 600px at 10% -10%, #2a1416 0%, transparent 60%), var(--surface); }
.auth-card { width: 380px; max-width: 100%; background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 32px; }
.marca { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.marca img { width: 40px; height: 40px; }
.eyebrow { font: 700 11px/16px var(--font-display); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.marca-nome { font: 800 18px/22px var(--font-display); letter-spacing: .02em; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; }
h1 { font-size: 26px; line-height: 32px; font-weight: 800; }
h2 { font-size: 18px; line-height: 24px; font-weight: 700; }
h3 { font-size: 15px; line-height: 20px; font-weight: 700; }
.campo { display: grid; gap: 6px; margin-bottom: 14px; }
.campo label { font-size: 12px; color: var(--muted); font-weight: 600; }
input[type=text], input[type=email], input[type=password], input[type=search], select, textarea {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 10px 12px; outline: none; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 70px; }
.btn { border: 1px solid var(--line); background: var(--raised-2); border-radius: var(--radius-md); padding: 9px 14px; cursor: pointer; font-weight: 600; white-space: nowrap; }
.btn:hover { border-color: #4a4d55; }
.btn.prim { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.btn.prim:hover { filter: brightness(1.08); }
.btn.ok { background: #1f4a33; border-color: #2c6b4a; }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.full { width: 100%; }
.link { background: none; border: 0; color: var(--muted); cursor: pointer; text-decoration: underline; padding: 0; }
.msg { font-size: 13px; margin-top: 10px; color: var(--muted); }
.msg.erro { color: #ff8a8f; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); height: 100%; }
.side { background: #111214; border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 12px; gap: 4px; }
.side .marca { padding: 0 8px; margin-bottom: 18px; }
.nav { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; cursor: pointer; color: var(--muted); font-weight: 600; border: 0; background: none; text-align: left; width: 100%; }
.nav:hover { background: var(--raised); color: var(--ink); }
.nav.ativo { background: var(--raised-2); color: var(--ink); box-shadow: inset 3px 0 0 var(--accent); }
.nav .badge { margin-left: auto; }
.side-rodape { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); display: grid; gap: 6px; }
.main { overflow: auto; padding: 24px 28px 40px; }
.topo { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.topo .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* ---------- componentes ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi { background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; cursor: default; }
.kpi.clicavel { cursor: pointer; }
.kpi.clicavel:hover { border-color: #4a4d55; }
.kpi .v { font: 800 30px/34px var(--font-display); font-variant-numeric: tabular-nums; }
.kpi .r { color: var(--muted); font-size: 12px; font-weight: 600; margin-top: 4px; }
.kpi.alerta .v { color: var(--accent); }
.grade2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; }
.card { background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px; min-width: 0; }
.card h3 { margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.vazio { color: var(--muted); padding: 14px 0; font-size: 13px; }
.lista { display: grid; gap: 2px; }
.item { display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-radius: 8px; cursor: pointer; }
.item:hover { background: var(--raised-2); }
.item .t { flex: 1; min-width: 0; }
.item .t b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .t span { color: var(--muted); font-size: 12px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 2px 8px; font-size: 11px; font-weight: 700; background: var(--raised-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge.red { background: rgba(240,40,58,.15); color: #ff8a8f; border-color: rgba(240,40,58,.35); }
.badge.green { background: rgba(61,190,122,.12); color: #7fe0ad; border-color: rgba(61,190,122,.35); }
.badge.amber { background: rgba(242,178,58,.12); color: #f5c76c; border-color: rgba(242,178,58,.35); }
.badge.cheio { background: var(--accent); color: #fff; border-color: var(--accent); }

.filtros { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filtros input[type=search] { width: 260px; }
.filtros select { width: auto; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--raised); border-radius: 999px; padding: 6px 12px; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--muted); }
.chip.on { background: var(--ink); color: #111; border-color: var(--ink); }
.abas { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.aba { padding: 10px 14px; cursor: pointer; color: var(--muted); font-weight: 600; border: 0; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.aba.on { color: var(--ink); border-bottom-color: var(--accent); }

table.tab { width: 100%; border-collapse: collapse; }
.tabela { background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: auto; }
.tab th { text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--raised); cursor: pointer; white-space: nowrap; }
.tab td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tab tr:last-child td { border-bottom: 0; }
.tab tbody tr { cursor: pointer; }
.tab tbody tr:hover td { background: var(--raised-2); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.contagem { color: var(--muted); font-size: 12px; margin-left: auto; }

/* ---------- ficha (gaveta) ---------- */
.veu { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 10; }
.gaveta { position: fixed; top: 0; right: 0; bottom: 0; width: min(720px, 92vw); background: var(--surface); border-left: 1px solid var(--line); z-index: 11; overflow: auto; padding: 22px 24px 40px; }
.gaveta .cab { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
.acoes { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 18px; }
.secao { margin-bottom: 22px; }
.secao > h3 { margin-bottom: 10px; }
.dados { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.dado { background: var(--raised); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.dado .r { font-size: 11px; color: var(--muted); font-weight: 600; }
.dado .v { font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.dia { background: var(--raised); border: 1px solid var(--line); border-radius: 10px; padding: 6px; min-height: 62px; font-size: 11px; }
.dia.hoje { border-color: var(--accent); }
.dia .d { color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.tr { border-radius: 6px; padding: 2px 5px; margin-bottom: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr.feito { background: rgba(61,190,122,.18); }
.tr.faltou { background: rgba(240,40,58,.2); }
.tr.plan { background: var(--raised-2); }
.tr.extra { background: rgba(242,178,58,.18); }
.legenda { display: flex; gap: 12px; font-size: 11px; color: var(--muted); margin-top: 8px; flex-wrap: wrap; }
.legenda i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.nota { background: var(--raised); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.nota.regra { border-left: 3px solid #9b7bff; }
.nota .meta { font-size: 11px; color: var(--muted); margin-top: 4px; display: flex; gap: 8px; align-items: center; }
.msgbox { background: var(--raised); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.msgbox .meta { font-size: 11px; color: var(--muted); margin-bottom: 4px; }

/* ---------- aprovações ---------- */
.sug { background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; margin-bottom: 10px; }
.sug .linha { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.sug .desc { color: var(--ink); margin: 8px 0 12px; white-space: pre-wrap; }
.sug .rodape { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sug .rodape input { flex: 1; min-width: 200px; padding: 7px 10px; }

.aviso-topo { background: rgba(242,178,58,.1); border: 1px solid rgba(242,178,58,.35); color: #f5c76c; border-radius: 12px; padding: 10px 14px; margin-bottom: 16px; font-size: 13px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #111; padding: 10px 16px; border-radius: 10px; font-weight: 600; z-index: 50; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.carregando { color: var(--muted); padding: 30px 0; text-align: center; }
.ponto { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--muted); }
.ponto.ok { background: var(--ok); } .ponto.erro { background: var(--accent); } .ponto.aviso { background: var(--aviso); }
.servico { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.servico:last-child { border-bottom: 0; }
.servico .t { flex: 1; }
.servico .t span { display: block; color: var(--muted); font-size: 12px; }
.pref { display: flex; align-items: center; gap: 10px; padding: 10px 0; }
code { background: var(--surface); padding: 2px 6px; border-radius: 6px; font-size: 12px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #3a3c42; border-radius: 10px; border: 2px solid var(--surface); }
.lista { grid-template-columns: minmax(0, 1fr); }
.kpi .v { font-size: 28px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- v0.2 ---------- */
.modal { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 21; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px 22px; max-height: 90vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.modal .cab { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.previa { white-space: pre-wrap; background: var(--raised); border: 1px solid var(--line); border-radius: 10px; padding: 10px; font: 13px/19px var(--font-text); }
.pil { border: 1px dashed var(--line); background: none; color: var(--muted); border-radius: 999px; padding: 3px 10px; font-size: 11px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.pil:hover { border-color: #5b5e66; color: var(--ink); }
.pil.green { border-style: solid; background: rgba(61,190,122,.12); color: #7fe0ad; border-color: rgba(61,190,122,.35); }
.pil.red { border-style: solid; background: rgba(240,40,58,.12); color: #ff8a8f; border-color: rgba(240,40,58,.35); }
.pop { position: fixed; z-index: 30; width: 240px; background: var(--raised); border: 1px solid var(--line); border-radius: 12px; padding: 8px; box-shadow: 0 12px 40px rgba(0,0,0,.5); display: grid; gap: 2px; }
.pop-t { font-size: 12px; color: var(--muted); padding: 4px 8px 6px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop-i { text-align: left; border: 0; background: none; padding: 7px 8px; border-radius: 8px; cursor: pointer; font-weight: 600; }
.pop-i:hover { background: var(--raised-2); }
.pop-i.on { background: var(--raised-2); box-shadow: inset 3px 0 0 var(--accent); }
.pop input { margin-top: 6px; padding: 7px 9px; font-size: 12px; }
.badge.roxo { background: rgba(155,123,255,.15); color: #c3b2ff; border-color: rgba(155,123,255,.35); }
.mesnav { display: flex; align-items: center; gap: 12px; margin: 6px 0 12px; }
.calmes { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cab-sem { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 0 4px; }
.cdia { background: var(--raised); border: 1px solid var(--line); border-radius: 10px; min-height: 96px; padding: 6px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cdia.fora { opacity: .4; } .cdia.hoje { border-color: var(--accent); }
.cdia .d { font-size: 11px; color: var(--muted); font-weight: 700; }
.ev { text-align: left; border: 0; background: var(--raised-2); color: var(--ink); border-radius: 6px; padding: 3px 6px; font-size: 11px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev b { color: var(--accent); margin-right: 2px; } .ev:hover { background: #33363c; } .ev.passou { opacity: .6; }
.tab.turma td.bol { padding: 4px 2px; text-align: center; }
.tab.turma th { padding: 6px 2px; text-align: center; font-size: 10px; line-height: 12px; }
.tab.turma th:first-child { text-align: left; padding-left: 12px; }
.tab.turma th.hj { color: var(--accent); }
.bol i { display: inline-block; width: 14px; height: 14px; border-radius: 50%; }
.b0 { background: var(--raised-2); } .bok { background: var(--ok); } .bfalta { background: var(--accent); } .bextra { background: var(--aviso); } .bplan { background: #5b5e66; }
.barras { display: flex; align-items: flex-end; gap: 4px; }
.barra { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-end; height: 100%; }
.pilha { display: flex; flex-direction: column-reverse; border-radius: 4px 4px 0 0; overflow: hidden; min-height: 1px; }
.barra .rot { font-size: 10px; color: var(--muted); text-align: center; margin-top: 4px; }
.tempo { display: grid; gap: 4px; }
.tl { font-size: 13px; padding: 6px 10px; background: var(--raised); border-radius: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-d { color: var(--muted); font-size: 11px; margin-right: 8px; font-variant-numeric: tabular-nums; }
details summary { cursor: pointer; font-size: 12px; }

.kpi .v { font-size: 26px; }
.abas { overflow-x: auto; }
.aba { white-space: nowrap; }

/* ---------- tema claro (0.8) ---------- */
html[data-theme="light"] {
  --accent: #E3202F;
  --surface: #F4F4F6;
  --raised: #FFFFFF;
  --raised-2: #ECEDF0;
  --faixa: #D5D7DC;
  --ink: #17181B;
  --muted: #5F626A;
  --line: #DCDEE2;
  --ok: #2EA866;
  --aviso: #C98A10;
  color-scheme: light;
}
html[data-theme="dark"] { color-scheme: dark; }
html[data-theme="light"] .side { background: #FFFFFF; }
html[data-theme="light"] .auth { background: radial-gradient(1200px 600px at 10% -10%, #fbe3e5 0%, transparent 60%), var(--surface); }
html[data-theme="light"] img[src="logo.svg"] { filter: invert(1) hue-rotate(180deg); }
html[data-theme="light"] .chip.on, html[data-theme="light"] .toast { color: #fff; }
html[data-theme="light"] .btn.ok { background: #dff3e8; border-color: #9fd6b8; }
html[data-theme="light"] .badge.red { background: rgba(227,32,47,.10); color: #b3121f; border-color: rgba(227,32,47,.35); }
html[data-theme="light"] .badge.green { background: rgba(46,168,102,.12); color: #1d7a48; border-color: rgba(46,168,102,.35); }
html[data-theme="light"] .badge.amber { background: rgba(224,155,18,.14); color: #8a5a00; border-color: rgba(224,155,18,.4); }
html[data-theme="light"] .badge.roxo { background: rgba(125,90,230,.12); color: #5b3cc4; border-color: rgba(125,90,230,.35); }
html[data-theme="light"] .mo-itens .ok { color: #1d7a48; }
html[data-theme="light"] .mo-itens .no { color: #b3121f; }
html[data-theme="light"] .toast { box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.tema-sel { display: flex; gap: 4px; }
.tema-sel button { flex: 1; border: 1px solid var(--line); background: var(--raised-2); color: var(--muted); border-radius: 8px; padding: 4px 6px; font-size: 11px; font-weight: 700; cursor: pointer; }
.tema-sel button.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
