/* Layout: uma coluna de leitura; cartões por empresa; tabela de ações com rolagem lateral só nela. */
:root {
  --bg: #f6f5f8;
  --panel: #ffffff;
  --fg: #1f1b2e;
  --muted: #6b6580;
  --line: #e3e0ec;
  --accent: #6a4fb3;
  --accent-fg: #ffffff;
  --ok: #1f7a4d;
  --warn: #9a6200;
  --bad: #b3261e;
  --radius: 10px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14111d;
    --panel: #1d1929;
    --fg: #ece9f5;
    --muted: #9d97b3;
    --line: #2f2a40;
    --accent: #a591e6;
    --accent-fg: #14111d;
    --ok: #5fc490;
    --warn: #e0a640;
    --bad: #f08a82;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  padding-block: 24px 48px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
main { max-width: 1100px; margin: 0 auto; display: flex; flex-direction: column; gap: 28px; }
h1 { font-size: 26px; margin: 0; font-weight: 600; letter-spacing: -0.01em; text-wrap: balance; }
h2 { font-size: 17px; margin: 0; font-weight: 600; }
h3 { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
p { margin: 0; }
.mudo { color: var(--muted); font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }

button, select, input {
  font: inherit;
  color: inherit;
}
button {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
}
button:hover { border-color: var(--accent); }
button.principal { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
button.pequeno { padding: 3px 9px; font-size: 13px; }
button.perigo:hover { border-color: var(--bad); color: var(--bad); }
button:disabled { opacity: 0.55; cursor: default; }
input, select {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  min-width: 0;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.topo { display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; align-items: flex-end; }
.topo .botoes { display: flex; gap: 8px; flex-wrap: wrap; }

.aviso {
  border: 1px solid var(--warn);
  color: var(--warn);
  border-radius: var(--radius);
  padding: 10px 14px;
}
.aviso.erro { border-color: var(--bad); color: var(--bad); }

.secao { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

.proximos { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.proximos li {
  display: grid;
  grid-template-columns: 3.6em 1fr auto;
  gap: 12px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
}
.proximos .quando { font-weight: 600; }
.proximos .corpo { min-width: 0; display: flex; flex-direction: column; gap: 4px; }

.grade { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 14px; }
.cartao {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.lista { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.linha {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}
.linha dt { color: var(--muted); font-size: 13px; min-width: 0; }
.linha dd { margin: 0; text-align: right; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; justify-content: flex-end; }
.valor { font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; }
.edicao { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.edicao input { width: 7.5em; }

.chip {
  display: inline-block;
  font-size: 12px;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.chip.alta { color: var(--fg); font-weight: 600; }
.chip.ok { color: var(--ok); border-color: var(--ok); }
.chip.atraso { color: var(--bad); border-color: var(--bad); }
.chip.aviso-chip { color: var(--warn); border-color: var(--warn); }

.grafico { width: 100%; height: 56px; display: block; }
.grafico .linha-g { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.grafico .ponto { fill: var(--accent); }

.barra { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.barra > span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }

.rolagem { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; font-size: 13px; }
td.nowrap { white-space: nowrap; }
tr.feito td { color: var(--muted); }
tr.feito td.texto { text-decoration: line-through; }

.nova { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.nova input[type='text'] { flex: 1 1 260px; }

.login { max-width: 360px; margin: 12vh auto 0; display: flex; flex-direction: column; gap: 16px; }
.login form { display: flex; flex-direction: column; gap: 12px; }
.login .erro-msg { color: var(--bad); min-height: 1.4em; font-size: 14px; }

@media (max-width: 560px) {
  .proximos li { grid-template-columns: 1fr auto; }
  .proximos .quando { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: no-preference) {
  button { transition: border-color 0.15s; }
}
