@font-face { font-family: Sora; font-weight: 600; font-display: swap; src: url(/fonts/sora-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: Sora; font-weight: 700; font-display: swap; src: url(/fonts/sora-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: Inter; font-weight: 400; font-display: swap; src: url(/fonts/inter-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: Inter; font-weight: 600; font-display: swap; src: url(/fonts/inter-latin-600-normal.woff2) format('woff2'); }

:root {
  --navy: #0F2D6B; --blue: #2563EB; --blue-soft: #EFF4FE;
  --ink: #111827; --ink2: #374151; --muted: #6B7280;
  --line: #E5E7EB; --bg: #F9FAFB; --surface: #FFFFFF;
  --amber: #D97706; --amber-soft: #FEF3E2; --emerald: #059669; --danger: #DC2626;
  --th-bg: var(--navy); --th-fg: #FFFFFF; --zebra: #F9FAFB;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --blue: #5B8DEF; --blue-soft: #16244A;
    --ink: #F3F4F6; --ink2: #D1D5DB; --muted: #9CA3AF;
    --line: #273244; --bg: #0B1220; --surface: #111A2C;
    --amber: #F59E0B; --amber-soft: #2E2210; --emerald: #34D399; --danger: #F87171;
    --th-bg: #0F2D6B; --zebra: #0E1626;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink2); font: 14px/1.5 Inter, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
h1, h2 { font-family: Sora, Inter, sans-serif; color: var(--ink); margin: 0; letter-spacing: -0.01em; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* botões */
.btn { border: 1px solid transparent; border-radius: 8px; padding: 7px 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.secondary { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn.secondary:hover { border-color: var(--blue); }
.btn.ghost-inv { background: transparent; color: #fff; border-color: rgb(255 255 255 / 0.3); padding: 5px 12px; }
.btn.ghost-inv:hover { background: rgb(255 255 255 / 0.1); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px; display: flex; flex-direction: column; gap: 12px; }
.logo-login { height: 34px; width: auto; align-self: flex-start; object-fit: contain; }
.login-card h1 { font-size: 22px; margin-top: 8px; }
.login-card p { margin: 0; }
.login-card label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--ink); }
input, select { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; min-width: 0; }
input:focus, select:focus { border-color: var(--blue); outline: none; }
.erro { color: var(--danger); font-size: 13px; min-height: 1em; }

/* topo */
.topbar { position: sticky; top: 0; z-index: 5; background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 24px; }
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand img { height: 26px; width: auto; object-fit: contain; flex-shrink: 0; }
.brand-title { font-family: Sora, sans-serif; font-weight: 600; font-size: 15px; padding-left: 14px; border-left: 1px solid rgb(255 255 255 / 0.25); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.atualizado { font-size: 12px; color: rgb(255 255 255 / 0.75); white-space: nowrap; }

.wrap { max-width: 1320px; margin: 0 auto; padding: 20px 24px 80px; display: flex; flex-direction: column; gap: 18px; }

/* cartões */
.cards { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; min-width: 0; }
.card.soft { background: var(--blue-soft); border-color: transparent; }
.kl { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.k { font-family: Sora, sans-serif; font-weight: 700; font-size: 22px; color: var(--ink); margin-top: 4px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ks { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* painéis */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; min-width: 0; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-head h2 { font-size: 15px; font-weight: 600; }

/* gráfico */
.chart { width: 100%; overflow-x: auto; }
.chart svg { display: block; width: 100%; min-width: 560px; height: auto; }
.chart .axis { fill: var(--muted); font-size: 10px; font-family: Inter, sans-serif; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 12px; color: var(--ink2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.vazio { padding: 28px 0; text-align: center; color: var(--muted); }

/* computadores */
.machines { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.machine { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; gap: 10px; align-items: flex-start; }
.machine .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex-shrink: 0; background: var(--emerald); }
.machine.atraso { border-color: var(--amber); background: var(--amber-soft); }
.machine.atraso .dot { background: var(--amber); }
.machine.revogado { opacity: 0.55; }
.machine.revogado .dot { background: var(--muted); }
.machine b { color: var(--ink); display: block; }
.machine small { color: var(--muted); }

/* filtros */
.filtros { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.filtros input[type=search] { flex: 1 1 220px; }
.filtros label { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.filtros select { max-width: 220px; }

/* tabela */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { background: var(--th-bg); color: var(--th-fg); text-align: left; font-weight: 600; font-size: 12px; padding: 9px 10px; white-space: nowrap; }
td { padding: 8px 10px; border-top: 1px solid var(--line); white-space: nowrap; color: var(--ink2); }
tbody tr.sess:nth-child(4n+1), tbody tr.sess:nth-child(4n+2) { background: var(--zebra); }
tbody tr.sess { cursor: pointer; }
tbody tr.sess:hover td { background: var(--blue-soft); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.custo { font-weight: 600; color: var(--ink); }
td.proj { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
tr.detalhe td { background: var(--bg); padding: 10px 14px 14px; white-space: normal; }
tr.detalhe table { width: auto; min-width: 60%; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
tr.detalhe th { background: var(--surface); color: var(--muted); border-bottom: 1px solid var(--line); }
.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; margin-left: 4px; }
.tag.fable { background: var(--amber-soft); color: var(--amber); border: 1px solid var(--amber); }

.rodape { position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; padding: 8px 24px; text-align: center; }

@media (max-width: 1100px) { .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .topbar { padding: 10px 16px; }
  .brand-title { display: none; }
  .wrap { padding: 16px 16px 96px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .k { font-size: 18px; }
  .filtros select, .filtros label { flex: 1 1 45%; max-width: none; }
  .rodape { padding: 6px 16px; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* cores por família de modelo (Fable em âmbar: consome créditos desde o primeiro uso) */
:root { --m-opus: #0F2D6B; --m-sonnet: #2563EB; --m-haiku: #2FD3C0; --m-fable: #D97706; --m-outro: #9CA3AF; }
@media (prefers-color-scheme: dark) { :root { --m-opus: #8FB0F5; --m-sonnet: #3B6FE0; --m-haiku: #2FD3C0; --m-fable: #F59E0B; --m-outro: #6B7280; } }
.m-opus { fill: var(--m-opus); background: var(--m-opus); }
.m-sonnet { fill: var(--m-sonnet); background: var(--m-sonnet); }
.m-haiku { fill: var(--m-haiku); background: var(--m-haiku); }
.m-fable { fill: var(--m-fable); background: var(--m-fable); }
.m-outro { fill: var(--m-outro); background: var(--m-outro); }
.sess-id { margin-bottom: 6px; }

.tag.hermes { background: var(--blue-soft); color: var(--blue); border: 1px solid var(--blue); }
