/* castelar · tema grafite e azul */
:root {
  --bg: #0D1117;
  --surface: #151B24;
  --surface-2: #1A2B4A;
  --border: #232C38;
  --text: #E6EDF3;
  --muted: #8B98A8;
  --accent: #4C8DFF;
  --accent-soft: #27395A;
  --accent-text: #6EA8FF;
  --nav-active: #1B2330;
  --warn-bg: #2A1F08;
  --warn-border: #5C4310;
  --warn-text: #FDE68A;
  --danger: #F87171;
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 14px; line-height: 1.45; }
a { color: var(--accent-text); }
a:hover { color: #9CC3FF; }
h1, h2 { margin: 0; letter-spacing: -0.02em; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }

/* --- estrutura ----------------------------------------------------------- */
.app { display: flex; min-height: 100vh; }
.nav { width: 248px; flex: none; border-right: 1px solid var(--border); padding: 24px 14px; display: flex; flex-direction: column; gap: 4px; }
.nav .logo { padding: 4px 12px 20px; }
.nav .logo img { display: block; height: 28px; }
.nav a.item { display: flex; align-items: center; justify-content: space-between; min-height: 42px; padding: 0 12px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 500; }
.nav a.item:hover { background: var(--nav-active); color: var(--text); }
.nav a.item.ativo { background: var(--nav-active); color: var(--text); font-weight: 600; }
.nav .tag { font-size: 10px; font-weight: 600; letter-spacing: 0.04em; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 1px 7px; }
.nav .rodape { margin-top: auto; padding: 16px 12px 0; display: flex; flex-direction: column; gap: 8px; font-size: 12px; color: var(--muted); }

.seletor { position: relative; margin-bottom: 14px; }
.seletor summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.seletor summary::-webkit-details-marker { display: none; }
.seletor .ini { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--bg); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; flex: none; }
.seletor .nome { display: flex; flex-direction: column; min-width: 0; }
.seletor .nome strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seletor .nome span { font-size: 11px; color: var(--muted); }
.seletor .lista { position: absolute; z-index: 10; top: 58px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 6px; box-shadow: 0 12px 32px rgba(0,0,0,.4); }
.seletor .lista a { display: block; padding: 10px; border-radius: 8px; color: var(--text); text-decoration: none; }
.seletor .lista a:hover { background: var(--nav-active); }
.seletor .lista a.gerenciar { color: var(--accent-text); border-top: 1px solid var(--border); border-radius: 0 0 8px 8px; margin-top: 4px; }

.conteudo { flex: 1; min-width: 0; padding: 28px 36px 48px; display: flex; flex-direction: column; gap: 18px; }
.topo { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.topo h1 { font-size: 30px; font-weight: 600; }
.topo .sub { font-size: 13px; color: var(--muted); margin-bottom: 4px; }

.faixa-ambiente { background: #3B2A05; color: var(--warn-text); text-align: center; font-size: 12px; font-weight: 600; padding: 6px; letter-spacing: 0.02em; }
.aviso { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--radius); background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn-text); font-size: 13px; }
.erro { padding: 12px 16px; border-radius: var(--radius); background: #2A1214; border: 1px solid #5C2226; color: #FCA5A5; font-size: 13px; }

/* --- cartões ------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card.pad { padding: 22px 24px; }
.linha { display: flex; flex-wrap: wrap; gap: 16px; align-items: stretch; }
.grade { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.kpi .rot { font-size: 12px; color: var(--muted); }
.kpi .val { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

.hero { flex: 999 1 460px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.hero .cab { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.hero .grandes { display: flex; flex-wrap: wrap; gap: 24px 48px; }
.grande { display: flex; flex-direction: column; gap: 8px; }
.grande .val { font-size: 46px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.grande .val.lucro { color: var(--accent-text); }
.periodos { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }
.periodos a { min-height: 36px; min-width: 72px; padding: 0 14px; display: flex; align-items: center; justify-content: center; border-radius: 7px; color: var(--muted); text-decoration: none; font-weight: 500; font-size: 13px; }
.periodos a.ativo { background: var(--nav-active); color: var(--text); font-weight: 600; }
.barras { display: flex; align-items: flex-end; gap: 6px; height: 104px; }
.barras span { flex: 1; border-radius: 3px 3px 0 0; background: var(--accent-soft); min-height: 2px; }
.barras span.atual { background: var(--accent); }
.eixo { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.projecao { flex: 1 1 260px; min-width: 0; background: var(--surface-2); padding: 24px; display: flex; flex-direction: column; gap: 10px; }
.projecao .val { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }

/* --- tabelas ------------------------------------------------------------- */
.tabela-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding: 12px 18px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px 18px; border-bottom: 1px solid #1A2230; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.dir, th.dir { text-align: right; }
td a { color: var(--text); text-decoration: none; font-weight: 500; }
td a:hover { color: var(--accent-text); }
tr.clicavel { cursor: pointer; }
tr.clicavel:hover td { background: #18202B; }
.sub-linha { display: block; font-size: 12px; color: var(--muted); }
.selo { display: inline-flex; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--nav-active); color: var(--muted); }
.selo.alerta { background: var(--warn-bg); color: var(--warn-text); }
.vazio { padding: 40px 24px; text-align: center; color: var(--muted); }

/* --- formulários --------------------------------------------------------- */
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.campo { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 500; color: #C2CCD6; }
.campo.largo { grid-column: 1 / -1; }
input[type=text], input[type=email], input[type=password], input[type=search], select {
  font: inherit; font-size: 15px; color: var(--text); min-height: 46px; padding: 0 12px;
  border: 1px solid #2D3846; border-radius: 10px; background: #0F141B; width: 100%;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); min-height: 44px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.botoes { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn { font: inherit; font-size: 14px; font-weight: 600; min-height: 44px; padding: 0 18px; border-radius: 10px; border: 0; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.prim { background: var(--accent); color: #071226; }
.btn.prim:hover { background: #6EA8FF; color: #071226; }
.btn.sec { background: transparent; color: var(--text); border: 1px solid #2D3846; }
.btn.sec:hover { background: var(--nav-active); color: var(--text); }
.btn.link { background: none; color: var(--muted); padding: 0; min-height: 0; font-weight: 500; }

/* --- login ---------------------------------------------------------------- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login .caixa { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 20px; }
.login .caixa img { height: 34px; align-self: flex-start; }

/* --- celular ------------------------------------------------------------- */
@media (max-width: 760px) {
  .app { flex-direction: column; }
  .nav { width: auto; border-right: 0; border-bottom: 1px solid var(--border); flex-direction: row; flex-wrap: nowrap; overflow-x: auto; align-items: center; padding: 10px 12px; gap: 4px; }
  .nav .logo { padding: 0 8px 0 2px; flex: none; }
  .nav .logo img { height: 22px; }
  .nav a.item { white-space: nowrap; flex: none; min-height: 38px; }
  .nav .tag, .nav .rodape { display: none; }
  .seletor { margin: 0; flex: none; }
  .seletor summary { min-height: 38px; }
  .seletor .nome span { display: none; }
  .seletor .lista { position: fixed; top: 60px; left: 12px; right: 12px; }
  .conteudo { padding: 18px 16px 40px; }
  .grande .val { font-size: 36px; }
  .topo h1 { font-size: 24px; }
  .ocultar-cel { display: none; }
  td, th { padding: 12px 14px; }
}
