/* Painel do Etrios — mesmo desenho do app (fundo #0F1115, âmbar #FFB020, Inter + Space Grotesk).
   Só tema escuro, como o app. Foco sempre visível; no botão âmbar o anel é branco (âmbar some no âmbar). */

@font-face { font-family: Inter; src: url(/static/fonts/Inter_400Regular.ttf) format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: Inter; src: url(/static/fonts/Inter_500Medium.ttf) format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: Inter; src: url(/static/fonts/Inter_600SemiBold.ttf) format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: Inter; src: url(/static/fonts/Inter_700Bold.ttf) format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Space Grotesk'; src: url(/static/fonts/SpaceGrotesk_700Bold.ttf) format('truetype'); font-weight: 700; font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #0F1115;
  --surface: #14171D;
  --card: #181B22;
  --chip: #222631;
  --line: #2C3140;
  --text: #F2F3F5;
  --soft: #E3E5EA;
  --muted: #A3A9B8;
  --accent: #FFB020;
  --on-accent: #1A1300;
  --ok: #3DDC97;
  --bad: #FF8A7F;
  --warn: #FFB020;
  --info: #7FB8FF;
  --radius: 14px;
  --display: 'Space Grotesk', Inter, system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  accent-color: var(--accent);
  scrollbar-color: #4A5163 var(--surface);
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 Inter, system-ui, sans-serif; }
a { color: var(--accent); }
a:hover { color: #FFC75A; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn-primary:focus-visible, .chip[aria-current="true"]:focus-visible { outline-color: var(--text); }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; z-index: 10; background: var(--accent); color: var(--on-accent); padding: 8px 12px; border-radius: 8px; }
.mono { font-family: var(--mono); overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
form.inline { display: inline; margin: 0; }

/* Cabeçalho e menu */
header.top { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; padding: 14px 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand:hover { color: var(--text); }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); display: inline-flex; align-items: center; justify-content: center; }
.brand-name { font-family: var(--display); font-weight: 700; font-size: 22px; }
.area { font-weight: 600; color: var(--soft); }
.code-chip { font-family: var(--mono); font-size: 13px; font-weight: 600; background: var(--chip); border-radius: 6px; padding: 3px 8px; }
.grow { flex: 1 1 auto; }
.who { color: var(--muted); font-size: 14px; text-decoration: none; }
.who:hover { color: var(--text); text-decoration: underline; }

.shell { display: flex; flex-wrap: wrap; align-items: flex-start; }
nav.side { flex: 1 1 220px; padding: 18px 12px; }
nav.side ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
nav.side a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 10px 14px; border-radius: 10px; color: var(--soft); text-decoration: none; font-weight: 600; }
nav.side a:hover { background: rgba(255, 255, 255, .05); color: var(--text); }
nav.side a[aria-current="page"] { background: rgba(255, 176, 32, .14); color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
main.content { flex: 999 1 560px; min-width: 0; padding: 22px 26px 56px; display: flex; flex-direction: column; gap: 18px; }

/* Abaixo de 780 px (220 do menu + 560 do conteúdo) o menu vira uma faixa que rola de lado.
   min-width: 0 impede a faixa de alargar a página inteira no celular. */
@media (max-width: 779px) {
  header.top { padding: 12px 16px; }
  nav.side { flex-basis: 100%; min-width: 0; padding: 8px 12px 0; }
  nav.side ul { flex-direction: row; overflow-x: auto; scroll-snap-type: inline proximity; }
  nav.side li { flex: none; scroll-snap-align: start; }
  nav.side a { white-space: nowrap; }
  nav.side a[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--accent); }
  main.content { padding: 16px; }
}

/* Títulos e cartões */
.heading h1 { margin: 0; font-family: var(--display); font-size: 30px; line-height: 1.15; }
.sub { margin: 4px 0 0; color: var(--muted); }
.heading-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.card h2 { margin: 0 0 8px; font-size: 16px; }
.card p { margin: 6px 0; }
.card-accent { border-color: rgba(255, 176, 32, .45); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-head h2 { margin: 0; }
.narrow { max-width: 440px; width: 100%; margin: 0 auto; }
.narrow-left { max-width: 560px; }
.secret { border-color: rgba(61, 220, 151, .5); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); gap: 14px; }
.kpi { padding: 16px 18px; }
.kpi-label { color: var(--muted); font-size: 13px; font-weight: 600; }
.kpi-value { font-family: var(--display); font-size: 32px; font-weight: 700; margin-top: 4px; }
.kpi-note { font-size: 13px; margin-top: 2px; }
.tone-ok { color: var(--ok); }
.tone-bad { color: var(--bad); }
.tone-warn { color: var(--warn); }
.tone-muted { color: var(--muted); }
.tone-info { color: var(--info); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 14px; }
.grid4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr)); gap: 14px; }
.big-code { margin: 4px 0 6px; font-family: var(--display); font-size: 44px; font-weight: 700; color: var(--accent); letter-spacing: .04em; overflow-wrap: anywhere; }
.pairs { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 12px 0 0; }
.pairs dt { color: var(--muted); }
.pairs dd { margin: 0; }

/* Etiquetas */
.pill { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.pill-ok { color: var(--ok); background: rgba(61, 220, 151, .12); }
.pill-bad { color: var(--bad); background: rgba(255, 107, 94, .14); }
.pill-warn { color: var(--warn); background: rgba(255, 176, 32, .14); }
.pill-muted { color: #C9CEDA; background: rgba(255, 255, 255, .07); }
.pill-info { color: var(--info); background: rgba(127, 184, 255, .12); }

/* Gráficos */
.cols { display: flex; align-items: flex-end; gap: 10px; height: 190px; margin: 14px 0 0; }
.col { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.col-val { font-size: 12px; color: var(--soft); }
.col-bar { display: block; width: 100%; max-width: 44px; border-radius: 6px 6px 2px 2px; background: rgba(255, 176, 32, .42); }
.col-now { background: var(--accent); }
.col-label { font-size: 12px; color: var(--muted); }
.hbars { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 11px; }
.hbars li { display: grid; grid-template-columns: minmax(0, 160px) minmax(0, 1fr) 56px; align-items: center; gap: 12px; }
.hb-label { font-size: 14px; }
.hb-track { height: 10px; background: var(--chip); border-radius: 999px; overflow: hidden; }
.hb-fill { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.hb-val { text-align: right; font-size: 14px; color: var(--soft); }

/* Listas e alertas */
ul.rows { list-style: none; margin: 0; padding: 0; }
ul.rows li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; padding: 10px 0; border-top: 1px solid var(--chip); }
ul.rows li:first-child { border-top: 0; }
ul.rows a { color: var(--text); text-decoration: none; }
ul.rows a:hover { text-decoration: underline; }
.empty { color: var(--muted); margin: 0; }
.alerts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.alert { padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); font-size: 14px; }
.alert-dns { border-color: rgba(255, 107, 94, .4); background: rgba(255, 107, 94, .07); }
.alert-limit { border-color: rgba(255, 176, 32, .4); background: rgba(255, 176, 32, .06); }

/* Filtros */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; min-height: 40px; border-radius: 999px; padding: 8px 14px; font-size: 14px; font-weight: 600; background: var(--chip); color: var(--soft); text-decoration: none; }
.chip:hover { color: var(--text); }
.chip[aria-current="true"] { background: var(--accent); color: var(--on-accent); }
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; }
.inline-field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--soft); }

/* Formulários e botões */
input, select { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 44px; max-width: 100%; }
input:hover, select:hover { border-color: #3A4152; }
input[aria-invalid="true"] { border-color: var(--bad); }
input::placeholder { color: #7D8495; }
.form { display: flex; flex-direction: column; gap: 8px; }
.form label { font-size: 13px; font-weight: 600; color: var(--soft); margin-top: 6px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-error { margin: 0; color: var(--bad); font-size: 13px; }
.hint { margin: 0; color: var(--muted); font-size: 13px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 6px 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 16px; border-radius: 10px; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; border: 1px solid var(--line); background: transparent; color: var(--text); }
.btn:hover { background: rgba(255, 255, 255, .05); color: var(--text); }
.btn-ghost { background: transparent; }
.btn-primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 700; }
.btn-primary:hover { background: #FFC14D; color: var(--on-accent); }
.btn-wide { width: 100%; margin-top: 10px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-small { min-height: 36px; padding: 6px 12px; font-size: 13px; }
.btn-danger { background: #C2412D; border-color: #C2412D; color: #FFFFFF; font-weight: 700; }
.btn-danger:hover { background: #D4513C; color: #FFFFFF; }
.btn-danger-ghost { color: var(--bad); border-color: rgba(255, 107, 94, .45); }
.btn-danger-ghost:hover { background: rgba(255, 107, 94, .1); color: var(--bad); }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.card.danger { border-color: rgba(255, 107, 94, .45); }
.add-client summary { cursor: pointer; font-weight: 700; min-height: 32px; display: list-item; }
.add-client[open] summary { margin-bottom: 10px; }
.add-client .hint { margin-top: 8px; }
.alert-nodns { border-color: rgba(255, 176, 32, .4); background: rgba(255, 176, 32, .06); }
.flash { margin: 0; padding: 11px 14px; border-radius: 10px; font-size: 14px; }
.flash-ok { color: var(--ok); background: rgba(61, 220, 151, .1); }
.flash-bad { color: var(--bad); background: rgba(255, 107, 94, .12); }
.flash-info { color: var(--soft); background: rgba(255, 255, 255, .06); }
.flash-warn { color: var(--warn); background: rgba(255, 176, 32, .12); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--soft); }
.check input { margin-top: 3px; }
.banner { margin: 0; padding: 10px 14px; border-radius: 10px; background: rgba(127, 184, 255, .1); color: var(--soft); font-size: 14px; }
.pager { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; }

/* Tabelas: cabeçalhos de verdade; em caixa estreita viram cartões com o rótulo antes do valor */
.table-wrap { overflow: auto; max-inline-size: 100%; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); container-type: inline-size; }
.table-wrap table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
caption { text-align: left; padding: 14px 16px 6px; font-weight: 600; color: var(--soft); }
thead th { text-align: left; font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--card); }
tbody th, tbody td { text-align: left; padding: 12px 14px; border-top: 1px solid var(--chip); vertical-align: middle; }
tbody tr:first-child th, tbody tr:first-child td { border-top: 0; }
tbody th { font-weight: 600; }
.cell-sub { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
td .mono, th .mono { font-size: 13px; }
@container (width < 640px) {
  .table-wrap table, .table-wrap thead, .table-wrap tbody, .table-wrap tr, .table-wrap th, .table-wrap td { display: block; }
  .table-wrap thead { display: none; }
  .table-wrap caption { display: block; }
  .table-wrap tbody tr { padding: 10px 14px; border-top: 1px solid var(--line); }
  .table-wrap tbody tr:first-child { border-top: 0; }
  .table-wrap tbody th, .table-wrap tbody td { border: 0; padding: 3px 0; }
  .table-wrap tbody td::before { content: attr(data-label) ": "; color: var(--muted); font-size: 12px; }
}

/* Telas sem menu (entrar) */
body.bare { min-height: 100dvh; }
.bare-main { padding: 48px 16px; display: flex; flex-direction: column; gap: 20px; }
.bare-brand { display: flex; justify-content: center; }
.bare-main h1 { margin: 0 0 6px; font-family: var(--display); font-size: 26px; }

@media (forced-colors: active) {
  nav.side a[aria-current="page"], .chip[aria-current="true"] { outline: 2px solid CanvasText; }
}
