/* Layout: folha central com abas tipo pasta; cada aba é uma tabela editável com rodapé de totais */
:root {
  --bg: #eef1f3;
  --sheet: #ffffff;
  --fg: #1c2328;
  --muted: #5f6b73;
  --line: #d9dfe3;
  --soft: #f5f7f8;
  --accent: #c8352c;
  --accent-soft: #fbe9e7;
  --good: #1f7a4d;
  --bad: #b3261e;
  --focus: #2f6fb0;
  --f-display: "Chakra Petch", "Segoe UI", system-ui, sans-serif;
  --f-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --f-num: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12171a; --sheet: #1a2125; --fg: #e4e9ec; --muted: #94a1a9; --line: #2c363c;
    --soft: #20292e; --accent: #ef6a5f; --accent-soft: #3a2220; --good: #5cc992; --bad: #ff8a80; --focus: #6fa8e0;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--f-body); font-size: 15px; line-height: 1.45; }
.wrap { max-width: 900px; margin: 0 auto; padding-inline: 16px; padding-block: 28px 48px; display: grid; gap: 18px; }
header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
h1 { font-family: var(--f-display); font-size: 1.7rem; margin: 0; letter-spacing: .01em; }
h1 span { color: var(--accent); }
.who { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: .85rem; }
.email { color: var(--muted); overflow-wrap: anywhere; }
.status { font-size: .8rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status.live .dot { background: var(--good); }
.status.err .dot { background: var(--bad); }

button { font: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.ghost { color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; }
.ghost:hover { color: var(--fg); }

/* ---------- login ---------- */
.card { background: var(--sheet); border: 1px solid var(--line); border-radius: 12px; padding: 24px; }
.auth { max-width: 380px; width: 100%; margin: 24px auto 0; display: grid; gap: 10px; }
.auth h2 { font-family: var(--f-display); margin: 0; font-size: 1.3rem; }
.auth form { display: grid; gap: 6px; }
.auth label { font-size: .8rem; font-weight: 600; color: var(--muted); margin-top: 6px; }
.auth input { font: inherit; color: var(--fg); background: var(--soft); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.auth input:focus { outline: none; border-color: var(--focus); }
.primary { margin-top: 12px; font-weight: 600; color: #fff; background: var(--accent); border: none; border-radius: 8px; padding: 11px 14px; }
.primary:disabled { opacity: .6; cursor: wait; }
.link { justify-self: start; background: none; border: none; color: var(--focus); padding: 0; font-size: .88rem; }
.link:hover { text-decoration: underline; }

/* ---------- abas e tabelas ---------- */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: -1px; position: relative; z-index: 1; }
.tab { font-weight: 600; font-size: .9rem; color: var(--muted); background: transparent; border: 1px solid transparent;
  border-bottom: none; border-radius: 8px 8px 0 0; padding: 10px 16px; }
.tab:hover { color: var(--fg); }
.tab[aria-selected="true"] { background: var(--sheet); color: var(--fg); border-color: var(--line); }
.sheet { background: var(--sheet); border: 1px solid var(--line); border-radius: 0 10px 10px 10px; }
.panel-head { padding: 16px 18px 6px; display: grid; gap: 2px; }
.panel-head h2 { font-family: var(--f-display); font-size: 1.15rem; margin: 0; }
.panel-head p { margin: 0; color: var(--muted); font-size: .88rem; }

.tablebox { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 420px; }
table.wide { min-width: 660px; }
th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
  font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th.num, td.num { text-align: right; }
td { border-bottom: 1px solid var(--line); padding: 2px 4px; vertical-align: middle; }
tbody tr:hover td { background: var(--soft); }
tr.flash td { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: var(--accent-soft); } to { background: transparent; } }
td input { width: 100%; font: inherit; color: var(--fg); background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 8px; }
td.num input { text-align: right; font-family: var(--f-num); font-variant-numeric: tabular-nums; }
td input:hover { border-color: var(--line); }
td input:focus { outline: none; border-color: var(--focus); background: var(--sheet); }
.poke-cell { display: flex; align-items: center; gap: 4px; padding-left: 4px; }
.sprite { width: 40px; height: 40px; flex: none; image-rendering: pixelated; object-fit: contain; }
.sprite.vazio { visibility: hidden; }
td.calc { font-family: var(--f-num); font-variant-numeric: tabular-nums; padding-inline: 12px; white-space: nowrap; }
.neg { color: var(--bad); }
.pos { color: var(--good); }
td.act { width: 1%; white-space: nowrap; text-align: right; padding-right: 8px; }
.del { font-size: .8rem; font-weight: 500; color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 6px 9px; }
.del:hover { color: var(--bad); border-color: var(--line); }
.del.confirm { color: #fff; background: var(--bad); border-color: var(--bad); }
tfoot td { border-bottom: none; padding: 12px; font-weight: 600; }
tfoot td.num { font-family: var(--f-num); font-variant-numeric: tabular-nums; }
.foot { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 12px 14px 16px; }
.add { font-weight: 600; font-size: .88rem; color: var(--accent); background: var(--accent-soft); border: 1px solid transparent; border-radius: 8px; padding: 9px 14px; }
.add:hover { border-color: var(--accent); }
.add:disabled { opacity: .5; cursor: not-allowed; }
.hint { font-size: .8rem; color: var(--muted); }
.empty td { padding: 28px 12px; text-align: center; color: var(--muted); }
.bar { height: 6px; border-radius: 3px; background: var(--soft); overflow: hidden; min-width: 60px; flex: 1; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.pct { display: flex; align-items: center; gap: 8px; padding-inline: 8px; }
.pct span { min-width: 3ch; text-align: right; }

/* ---------- calculadora ---------- */
.calc-box { border-top: 1px solid var(--line); padding: 16px 18px 20px; display: grid; gap: 12px; }
.calc-box h3 { font-family: var(--f-display); font-size: 1.05rem; margin: 0; }
.calc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.calc-cell { background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: grid; gap: 4px; align-content: start; min-width: 0; }
.lbl { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; }
.big { font-family: var(--f-num); font-variant-numeric: tabular-nums; font-size: 1.45rem; }
.big-input { font-family: var(--f-num); font-variant-numeric: tabular-nums; font-size: 1.3rem; color: var(--fg); background: var(--sheet);
  border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; width: 100%; }
.big-input:focus { outline: none; border-color: var(--focus); }
.verdict.good { border-color: var(--good); }
.verdict.good .big { color: var(--good); }
.verdict.bad { border-color: var(--bad); }
.verdict.bad .big { color: var(--bad); }

.notice { font-size: .88rem; padding: 10px 14px; border-radius: 8px; background: var(--accent-soft); color: var(--fg); }
.notice.ok { background: var(--soft); border: 1px solid var(--good); }

@media (prefers-reduced-motion: reduce) { tr.flash td { animation: none; } }
@media (prefers-reduced-motion: no-preference) { td input, .del, .add { transition: border-color .12s, background .12s; } }
