
/* ============================================================
   Identidade visual do Saturno Cadora (sistema pai).
   Tokens copiados de saturno-cadora/frontend/src/estilos/globais.css
   — mesma paleta, mesma densidade compacta, mesma tipografia.
   ============================================================ */
:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f5f5f5;
  --border: #e5e5e5;
  --border-strong: #d4d4d4;
  --text: #171717;
  --text-muted: #525252;
  --text-faint: #999999;
  /* Acento (texto, icone, borda, item ativo) — azul do Saturno */
  --primary: #007acc;
  --primary-hover: #0062a3;
  --primary-soft: rgba(0, 122, 204, 0.08);
  /* Acao (botao primario) — coral do Saturno, com par hover/ativo */
  --acao: #f97316;
  --acao-hover: #ea580c;
  --acao-ativo: #c2410c;
  --link: #c2410c;
  --success: #16a34a;
  --success-soft: rgba(22, 163, 74, 0.10);
  --warn: #ca8a04;
  --warn-soft: rgba(202, 138, 4, 0.10);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.08);
  --accent: #a855f7;
  --laranja-marca: #ea580c;
  --radius: 8px;
  --radius-sm: 5px;
  --shadow: 0 1px 2px rgba(0,0,0,.05);
  --shadow-lg: 0 4px 14px rgba(0,0,0,.10);
  --sidebar-w: 236px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
}
[data-theme="dark"] {
  /* Cinza NEUTRO ancorado em neutral-950 (regra R6 do Saturno) —
     canais iguais, sem vies azul. Piso levantado, nao preto puro. */
  --bg: #161616;
  --surface: #1e1e1e;
  --surface-2: #262626;
  --border: #363636;
  --border-strong: #3d3d3d;
  --text: #d4d4d4;
  --text-muted: #999999;
  --text-faint: #6f6f6f;
  --primary: #38bdf8;
  --primary-hover: #7dd3fc;
  --primary-soft: rgba(56, 189, 248, 0.12);
  --acao: #c2410c;
  --acao-hover: #9a3412;
  --acao-ativo: #7c2d12;
  --link: #38bdf8;
  --success: #4ade80;
  --success-soft: rgba(74, 222, 128, 0.12);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.10);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.10);
  --accent: #c4b5fd;
  --shadow: 0 1px 2px rgba(0,0,0,.4);
  --shadow-lg: 0 4px 16px rgba(0,0,0,.5);
}

/* ===== Base (densidade compacta do Saturno: 13px) ===== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 15px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.011em; }
h1 { font-size: 21px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0; }
code {
  font-family: var(--mono); font-size: .92em; background: var(--surface-2);
  padding: 1px 5px; border-radius: 4px; color: var(--text);
}
pre {
  font-family: var(--mono); font-size: 13px; background: var(--surface-2);
  padding: 10px 12px; border-radius: var(--radius-sm); margin: 0;
  white-space: pre-wrap; word-break: break-word; overflow-x: auto;
  border: 1px solid var(--border);
}
.mono { font-family: var(--mono); }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.small { font-size: 13.5px; }
.xs { font-size: 12.5px; }
.strong { font-weight: 600; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.hide { display: none !important; }

/* ===== Shell ===== */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.brand-logo {
  width: 30px; height: 30px; border-radius: 50%; flex: 0 0 30px;
  display: grid; place-items: center; overflow: hidden;
  border: 1px solid color-mix(in srgb, #f97316 45%, var(--border));
  background: radial-gradient(circle at 35% 25%, rgba(249, 115, 22, 0.18), var(--surface) 62%);
}
.brand-logo img { width: 22px; height: 22px; object-fit: contain; }
.brand-name { font-weight: 600; font-size: 13px; line-height: 1.2; }
.brand-sub { font-size: 10.5px; color: var(--text-faint); display: flex; align-items: center; gap: 5px; }
.brand-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-faint); flex: 0 0 6px; }
.brand-dot.on { background: var(--success); }
.brand-dot.off { background: var(--danger); }
.brand-dot.wait { background: var(--warn); }
.nav { padding: 10px 8px; overflow-y: auto; flex: 1; }
.nav-group { margin-bottom: 14px; }
.nav-group-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-faint); font-weight: 600; padding: 0 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px;
  border-radius: var(--radius-sm); color: var(--text-muted);
  font-size: 14px; margin-bottom: 2px; text-decoration: none;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item.active {
  background: var(--primary-soft); color: var(--primary); font-weight: 500;
  box-shadow: inset 2px 0 0 var(--primary);
}
.nav-item svg { width: 17px; height: 17px; flex: 0 0 17px; }
.sidebar-foot { padding: 10px; border-top: 1px solid var(--border); }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: 52px; padding: 0 20px; border-bottom: 1px solid var(--border);
  background: var(--surface); position: sticky; top: 0; z-index: 20;
}
.topbar-title { font-weight: 600; font-size: 15.5px; }
.main { padding: 22px 20px 60px; max-width: 1120px; width: 100%; }
.icon-btn {
  background: none; border: 1px solid transparent; color: var(--text-muted);
  cursor: pointer; padding: 5px 8px; border-radius: var(--radius-sm);
  font-size: 14px; line-height: 1; display: inline-flex; align-items: center;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 15px; height: 15px; }
.menu-toggle { display: none; }

/* ===== Cards ===== */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-head {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.card-title { font-size: 15px; font-weight: 600; }
.card-sub { font-size: 13px; color: var(--text-muted); margin-top: 3px; line-height: 1.5; }
.card-body { padding: 18px; }
.card-body.tight { padding: 12px 18px; }
.card-foot {
  padding: 12px 18px; border-top: 1px solid var(--border);
  background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius);
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}

/* ===== Stats ===== */
.stats { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 15px 16px; box-shadow: var(--shadow);
}
.stat-label {
  font-size: 12px; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: .04em; font-weight: 600; margin-bottom: 6px;
}
.stat-value { font-size: 26px; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat-value.sm { font-size: 18px; }
.stat-sub { font-size: 12.5px; color: var(--text-faint); margin-top: 5px; }

/* ===== Badges ===== */
.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px;
  font-weight: 600; padding: 2px 9px; border-radius: 4px; white-space: nowrap;
  background: var(--surface-2); color: var(--text-muted);
}
.badge.ok { background: var(--success-soft); color: var(--success); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--primary-soft); color: var(--primary); }
.dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* ===== Botoes =====
   Primario = coral de ACAO do Saturno, com gradiente de luz no topo e
   sombra — mesma receita do .botao-acao do sistema pai. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-size: 13.5px; font-weight: 500; padding: 7px 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); cursor: pointer;
  text-decoration: none; white-space: nowrap; line-height: 1.5;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  color: #ffffff; border: none; padding: 6px 13px;
  background-image: linear-gradient(180deg, var(--acao) 0%, var(--acao-hover) 100%);
  box-shadow: 0 1px 2px rgba(0,0,0,.18), inset 0 1px 0 rgba(255,255,255,.12);
}
.btn-primary:hover {
  background-image: linear-gradient(180deg, var(--acao-hover) 0%, var(--acao-ativo) 100%);
  box-shadow: 0 2px 6px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.16);
}
.btn-primary:active { box-shadow: inset 0 2px 4px rgba(0,0,0,.25); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); }
.btn-sm { font-size: 12.5px; padding: 5px 11px; }
.btn-link {
  background: none; border: none; color: var(--link); padding: 0;
  cursor: pointer; font: inherit; font-size: 13px;
}
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: var(--danger); }
.btn-link.muted { color: var(--text-muted); }

/* ===== Forms ===== */
.field { display: flex; flex-direction: column; gap: 4px; }
.field-label { font-size: 13px; color: var(--text); font-weight: 500; }
.field-hint { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }
input[type=text], input[type=password], input[type=number], input[type=url],
input[type=search], select, textarea {
  font: inherit; font-size: 14px; padding: 8px 11px; width: 100%;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
}
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea {
  background: #111111;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--text-muted); }
textarea { resize: vertical; font-family: var(--mono); font-size: 13px; line-height: 1.6; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.form-row > .field { flex: 1; min-width: 160px; }
.form-row > .field.narrow { flex: 0 0 120px; min-width: 120px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.check { display: flex; align-items: center; gap: 7px; font-size: 13.5px; cursor: pointer; }
.check input { width: auto; }

/* ===== Tabelas (densidade Saturno: 11px) ===== */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted); font-weight: 600; padding: 9px 14px;
  background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.data td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; font-variant-numeric: tabular-nums; }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data td.right, table.data th.right { text-align: right; }
table.data td.center, table.data th.center { text-align: center; }

/* ===== Diversos ===== */
.flash {
  padding: 12px 14px; border-radius: var(--radius-sm); font-size: 14px;
  border: 1px solid transparent; display: flex; gap: 10px; align-items: flex-start;
  line-height: 1.55;
}
.flash.success { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, currentColor 40%, transparent); }
.flash.error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, currentColor 40%, transparent); }
.flash.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, currentColor 40%, transparent); }
.flash.info { background: var(--primary-soft); color: var(--primary); border-color: color-mix(in srgb, currentColor 40%, transparent); }
.empty { padding: 40px 24px; text-align: center; color: var(--text-muted); font-size: 14px; line-height: 1.6; }
.empty-icon { font-size: 26px; display: block; margin-bottom: 10px; opacity: .5; }
.progress { height: 5px; background: var(--surface-2); border-radius: 20px; overflow: hidden; }
.progress > div { height: 100%; border-radius: 20px; transition: width .3s; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.grid-2 { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.divider { height: 1px; background: var(--border); border: 0; margin: 0; }
.kv { display: grid; grid-template-columns: minmax(150px, auto) 1fr; gap: 10px 20px; font-size: 14px; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .axis-text { fill: var(--text-faint); font-size: 10px; font-family: var(--font); }
.chart .bar { fill: var(--primary); opacity: .85; }
.chart .bar.alt { fill: var(--success); opacity: .85; }
.chart .bar.accent { fill: var(--accent); opacity: .85; }
.chart .line { fill: none; stroke: var(--primary); stroke-width: 1.8; stroke-linejoin: round; }
.chart .area { fill: var(--primary); opacity: .08; }

/* ===== Componentes didaticos =====
 * O painel e usado por quem toca a loja, nao por quem escreveu o codigo.
 * Cada tela precisa dizer, sem jargao, o que ela e e quando serve — e mostrar
 * exemplo sempre que a explicacao sozinha for abstrata.
 */
.intro {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius); padding: 16px 18px;
}
.intro-titulo { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.intro-texto { font-size: 14.5px; line-height: 1.65; color: var(--text-muted); }
.intro-texto strong { color: var(--text); }

/* Bloco de exemplo — sempre visualmente diferente da explicacao */
.exemplo {
  background: var(--surface-2); border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm); padding: 11px 13px; margin-top: 10px;
  font-size: 13.5px; line-height: 1.6;
}
.exemplo-rotulo {
  font-size: 11.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-faint); display: block; margin-bottom: 5px;
}

/* Passo a passo numerado */
.passos { list-style: none; margin: 0; padding: 0; counter-reset: passo; }
.passos li {
  counter-increment: passo; position: relative; padding: 0 0 12px 34px;
  font-size: 14px; line-height: 1.6;
}
.passos li:last-child { padding-bottom: 0; }
.passos li::before {
  content: counter(passo); position: absolute; left: 0; top: 0;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary);
  font-size: 12px; font-weight: 700; display: grid; place-items: center;
}

/* Estado vazio com proximo passo sugerido */
.empty-acao { margin-top: 14px; }
.empty-dica { font-size: 13px; color: var(--text-faint); margin-top: 8px; }

/* Termo com explicacao curta logo abaixo, sem depender de tooltip */
.termo { font-weight: 600; }
.termo-def { font-size: 13px; color: var(--text-muted); line-height: 1.55; }

/* ===== Login ===== */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 350px; }
.login-brand { text-align: center; margin-bottom: 18px; }
.login-logo {
  width: 76px; height: 76px; border-radius: 50%; margin: 0 auto 10px;
  display: grid; place-items: center; overflow: hidden;
  border: 1px solid color-mix(in srgb, #f97316 45%, var(--border));
  background: radial-gradient(circle at 35% 25%, rgba(249, 115, 22, 0.18), var(--surface) 62%);
}
.login-logo img { width: 54px; height: 54px; object-fit: contain; }
.login-brand-name { font-weight: 600; font-size: 15.5px; }

/* ===== Responsivo ===== */
@media (max-width: 860px) {
  .sidebar {
    position: fixed; z-index: 50; left: 0; top: 0; transform: translateX(-100%);
    transition: transform .18s ease; box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .scrim {
    position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 40;
  }
  .menu-toggle { display: inline-flex; }
  .main { padding: 14px 12px 44px; }
  .topbar { padding: 0 12px; }
  .stats { grid-template-columns: repeat(auto-fit, minmax(136px, 1fr)); }
}
@media print {
  .sidebar, .topbar, .btn, form { display: none !important; }
  .main { padding: 0; }
}
