/* JULIUS webapp v0 — tokens do design system (design/DESIGN.md) */
:root {
  --bg: #0d0f12; --surface: #15181e; --surface-2: #1e2128; --border: #2a2d35;
  --text: #f5f6f8; --text-muted: #9aa1ac;
  --primary: #2563eb; --positive: #22c55e; --negative: #ef4444;
  --warning: #f97316; --accent: #8b5cf6; --radius: 12px;
}
* { box-sizing: border-box; margin: 0; }
html { color-scheme: dark; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.5 Inter, system-ui, sans-serif; -webkit-font-smoothing: antialiased;
}
.tnum { font-variant-numeric: tabular-nums; }
a { color: var(--primary); text-decoration: none; }

/* skip-link: visível só ao receber foco (teclado) */
.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 100;
  background: var(--primary); color: #fff; padding: 8px 14px; border-radius: 8px;
  transition: top 0.15s;
}
.skip-link:focus { top: 8px; outline: 2px solid #fff; }

.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center;
  gap: 16px; padding: 0 20px; height: 56px;
  background: rgb(13 15 18 / 0.92); border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}
.brand { font-weight: 900; font-size: 18px; letter-spacing: -0.02em; }
.tabs { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.tab {
  padding: 6px 12px; border-radius: 8px; font-weight: 600; cursor: pointer;
  color: var(--text-muted); border: none; background: none; font: inherit;
}
.tab:hover { color: var(--text); background: var(--surface-2); }
.tab.active { color: #fff; background: var(--primary); }
.tab:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.ws-name { font-size: 12px; color: var(--text-muted); }

/* mobile: a mesma nav vira bottom-nav fixa, itens de largura igual, sem
   transbordo horizontal (US-W01 / DB-28) */
@media (max-width: 640px) {
  /* backdrop-filter cria containing-block e prenderia a nav fixa ao topbar;
     removê-lo em mobile deixa a bottom-nav ancorar na viewport */
  .topbar { gap: 10px; padding: 0 12px; backdrop-filter: none; }
  .ws-name { display: none; }
  .tabs {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
    flex-wrap: nowrap; gap: 0; padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--border);
  }
  .tab {
    flex: 1 1 0; min-width: 0; text-align: center; padding: 8px 2px;
    font-size: 11px; border-radius: 8px; overflow: hidden; text-overflow: ellipsis;
  }
  main { padding-bottom: 84px; }
}

main { max-width: 1080px; margin: 0 auto; padding: 20px 16px 60px; }
h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.sub { color: var(--text-muted); font-size: 13px; margin-bottom: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.spread { justify-content: space-between; }
.mt { margin-top: 16px; } .mb { margin-bottom: 12px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card.pad { padding: 16px; }
.kpi-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); }
.kpi-value { font-size: 22px; font-weight: 800; margin-top: 2px; }

.list { list-style: none; padding: 0; }
.list li { display: flex; gap: 12px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--border); }
.list li:first-child { border-top: none; }
.item-main { flex: 1; min-width: 0; }
.item-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-meta { font-size: 12px; color: var(--text-muted); }

.badge {
  display: inline-block; font-size: 11px; font-weight: 700;
  padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-muted);
}
.badge.red { background: rgb(239 68 68 / 0.15); color: var(--negative); }
.badge.green { background: rgb(34 197 94 / 0.15); color: var(--positive); }
.badge.orange { background: rgb(249 115 22 / 0.15); color: var(--warning); }
.badge.blue { background: rgb(37 99 235 / 0.18); color: #7ca6ff; }
.badge.purple { background: rgb(139 92 246 / 0.15); color: var(--accent); }

.pos { color: var(--positive); } .neg { color: var(--negative); }
.muted { color: var(--text-muted); }

button.btn, .btn {
  font: inherit; font-weight: 600; cursor: pointer; border: none;
  border-radius: 8px; padding: 8px 14px; background: var(--primary); color: #fff;
}
.btn:hover { filter: brightness(1.1); }
.btn.ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn.small { padding: 3px 10px; font-size: 12px; border-radius: 999px; }
.btn.confirm { background: none; border: 1px solid rgb(34 197 94 / 0.4); color: var(--positive); }
.btn.danger-ghost { background: none; border: none; color: var(--text-muted); font-size: 12px; }
.btn.danger-ghost:hover { color: var(--negative); }
.btn:disabled { opacity: 0.5; cursor: default; }

input, select {
  font: inherit; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px;
}
input:focus, select:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
label.field { display: block; }
label.field > span { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; }
label.field > input, label.field > select { width: 100%; }
.fields { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.fields .full { grid-column: 1 / -1; }

.modal-back {
  position: fixed; inset: 0; z-index: 50; background: rgb(0 0 0 / 0.7);
  display: flex; align-items: flex-end; justify-content: center; padding: 0;
}
@media (min-width: 640px) { .modal-back { align-items: center; padding: 24px; } }
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0; width: 100%; max-width: 520px;
  max-height: 92vh; overflow-y: auto;
}
@media (min-width: 640px) { .modal { border-radius: var(--radius); } }
.modal header, .modal footer { display: flex; gap: 12px; align-items: center; padding: 14px 20px; }
.modal header { border-bottom: 1px solid var(--border); font-weight: 700; }
.modal header .x { margin-left: auto; background: none; border: none; color: var(--text-muted); font-size: 18px; cursor: pointer; }
.modal .body { padding: 20px; display: grid; gap: 14px; }
.modal footer { border-top: 1px solid var(--border); }
.modal footer .btn { flex: 1; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); padding: 10px 12px; border-bottom: 1px solid var(--border); }
td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr.dup { opacity: 0.45; }

.bars { display: grid; grid-auto-flow: column; gap: 10px; align-items: end; height: 150px; padding: 8px 4px 0; }
.bar-col { display: flex; flex-direction: column; align-items: center; gap: 2px; height: 100%; justify-content: flex-end; font-size: 10px; color: var(--text-muted); }
.bar-col .in { width: 22px; background: var(--positive); border-radius: 3px 3px 0 0; }
.bar-col .out { width: 22px; background: rgb(239 68 68 / 0.8); border-radius: 0 0 3px 3px; }

.toast {
  position: fixed; right: 16px; bottom: 16px; z-index: 90; max-width: min(360px, calc(100vw - 32px));
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 16px; font-size: 13px; box-shadow: 0 8px 24px rgb(0 0 0 / 0.4);
}
.toast.err { border-color: rgb(239 68 68 / 0.5); }
/* mobile: acima da bottom-nav p/ não cobrir os destinos */
@media (max-width: 640px) { .toast { bottom: 92px; right: 12px; left: 12px; } }

/* banner de aviso não-modal (ex.: confirme seu e-mail) — no topo, dispensável,
   não sobrepõe o conteúdo como o toast fazia */
.banner {
  display: flex; align-items: center; gap: 12px; margin: 0 auto; max-width: 1080px;
  padding: 10px 16px; background: rgb(249 115 22 / 0.12); border: 1px solid rgb(249 115 22 / 0.4);
  border-radius: 10px; color: var(--text); font-size: 13px; margin-top: 12px;
}
.banner .x { margin-left: auto; background: none; border: none; color: var(--text-muted); font-size: 18px; cursor: pointer; }
.banner .x:hover { color: var(--text); }

/* ranking por categoria (Relatórios / DB-11) */
.catbar-row { padding: 10px 16px; border-top: 1px solid var(--border); cursor: pointer; }
.catbar-row:first-child { border-top: none; }
.catbar-row:hover, .catbar-row:focus-visible { background: var(--surface-2); outline: none; }
.catbar-track { height: 8px; border-radius: 999px; background: var(--surface-2); margin-top: 6px; overflow: hidden; }
.catbar-fill { height: 100%; background: var(--primary); border-radius: 999px; }

.empty { text-align: center; padding: 36px 16px; color: var(--text-muted); }
.tag-chip { font-size: 11px; color: var(--accent); }

/* auth */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.auth-card { width: 100%; max-width: 400px; display: grid; gap: 14px; padding: 24px; }
.logo-mark {
  width: 52px; height: 52px; border-radius: 14px; margin: 0 auto;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 900; color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--accent));
}
