/* Layout: central de operações da frota — barra de comando, painel de indicadores, linha do tempo de 12 meses com trilho de meses na base, registro de lançamentos */
:root {
  --bg: #eef0f3;
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --ink: #141a24;
  --ink-2: #3a4352;
  --muted: #6b7484;
  --line: #dde1e7;
  --line-strong: #c4cad3;
  --brand: #1a3e9a;          /* azul da placa Mercosul */
  --brand-ink: #ffffff;
  --brand-soft: #e7ecf8;
  --ok: #1f8a4c;   --ok-soft: #e3f4ea;   --ok-ink: #135c32;
  --warn: #e0a106; --warn-soft: #fdf2d2; --warn-ink: #6f4f00;
  --bad: #d23a2f;  --bad-soft: #fce4e1;  --bad-ink: #8b1f17;
  --plate-bg: #ffffff; --plate-ink: #111111; --plate-band: #1a3e9a;
  --overlay: rgba(14, 19, 28, .5);
  --shadow: 0 1px 2px rgba(20, 26, 36, .05), 0 4px 14px rgba(20, 26, 36, .06);
  --shadow-lg: 0 24px 60px rgba(14, 19, 28, .28);
  --font-display: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --font-body: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --r: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1218; --surface: #161b23; --surface-2: #1b212b; --ink: #e8ebf0; --ink-2: #c2c8d2; --muted: #8b94a3;
    --line: #262d38; --line-strong: #37404d;
    --brand: #6f93ff; --brand-ink: #0b1430; --brand-soft: #1a2442;
    --ok: #3cc073; --ok-soft: #12291c; --ok-ink: #8fe0b0;
    --warn: #f0b931; --warn-soft: #2f2610; --warn-ink: #f6d889;
    --bad: #f0645a; --bad-soft: #351816; --bad-ink: #f7aaa3;
    --plate-bg: #f4f5f7; --plate-ink: #111111; --plate-band: #2b54c4;
    --overlay: rgba(0, 0, 0, .62);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1218; --surface: #161b23; --surface-2: #1b212b; --ink: #e8ebf0; --ink-2: #c2c8d2; --muted: #8b94a3;
  --line: #262d38; --line-strong: #37404d;
  --brand: #6f93ff; --brand-ink: #0b1430; --brand-soft: #1a2442;
  --ok: #3cc073; --ok-soft: #12291c; --ok-ink: #8fe0b0;
  --warn: #f0b931; --warn-soft: #2f2610; --warn-ink: #f6d889;
  --bad: #f0645a; --bad-soft: #351816; --bad-ink: #f7aaa3;
  --plate-bg: #f4f5f7; --plate-ink: #111111; --plate-band: #2b54c4;
  --overlay: rgba(0, 0, 0, .62);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
:root { color-scheme: light; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
[hidden] { display: none !important; }
img { max-width: 100%; }
body {
  margin: 0;
  background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.wrap {
  max-width: 1280px; margin: 0 auto;
  padding-block: 28px 56px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex; flex-direction: column; gap: 20px;
}
h1, h2, h3 { font-family: var(--font-display); margin: 0; text-wrap: balance; }
.eyebrow { font-family: var(--font-mono); font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }

/* ---------- barra de comando ---------- */
.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px; padding-bottom: 4px; }
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.mark {
  width: 46px; height: 46px; border-radius: 11px; flex: none;
  background: var(--brand); color: var(--brand-ink); display: grid; place-items: center;
}
.mark svg { width: 26px; height: 26px; }
.brand h1 { font-size: 1.75rem; font-weight: 800; font-stretch: 85%; letter-spacing: -.01em; line-height: 1.05; }
.brand h1 .ver { font-family: var(--font-mono); font-size: .72rem; font-weight: 600; font-stretch: normal; letter-spacing: .04em; color: var(--brand); background: var(--brand-soft); border-radius: 6px; padding: 2px 7px; margin-left: 8px; vertical-align: middle; white-space: nowrap; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: .93rem; }
.top-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.today-chip { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.today-chip strong { font-family: var(--font-display); font-weight: 700; font-stretch: 90%; font-size: 1.02rem; }

button { font: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  padding: 8px 14px; font-weight: 600; font-size: .92rem; transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); padding: 11px 18px; font-size: .98rem; box-shadow: 0 6px 16px color-mix(in srgb, var(--brand) 30%, transparent); }
.btn-primary:hover { background: color-mix(in srgb, var(--brand) 88%, #000); border-color: transparent; }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--bad) 88%, #000); border-color: transparent; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--bad); padding-inline: 10px; }
.btn-ghost:hover { background: var(--bad-soft); border-color: transparent; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 8px; display: inline-grid; place-items: center;
  border: 1px solid transparent; background: transparent; color: var(--ink-2);
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
.icon-btn.del:hover { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.icon-btn svg { width: 17px; height: 17px; }

.notice { font-size: .9rem; color: var(--warn-ink); background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); border-radius: 8px; padding: 10px 14px; }

/* ---------- indicadores ---------- */
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 1.35fr); gap: 12px; }
.kpi {
  position: relative; text-align: left; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow);
  padding: 16px 18px 14px; display: flex; flex-direction: column; gap: 6px; min-width: 0;
  transition: border-color .15s, transform .15s;
}
button.kpi:hover { border-color: var(--line-strong); transform: translateY(-1px); }
button.kpi[aria-pressed="true"] { border-color: currentColor; }
.kpi[data-filter="bad"][aria-pressed="true"] { color: var(--bad); }
.kpi[data-filter="warn"][aria-pressed="true"] { color: var(--warn); }
.kpi[data-filter="ok"][aria-pressed="true"] { color: var(--ok); }
.kpi[aria-pressed="true"] .kpi-n, .kpi[aria-pressed="true"] .kpi-foot { color: var(--ink); }
.kpi-label { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .88rem; color: var(--ink-2); }
.sig { width: 10px; height: 10px; border-radius: 50%; flex: none; box-shadow: 0 0 0 3px var(--sig-ring); }
.sig.bad { background: var(--bad); --sig-ring: var(--bad-soft); }
.sig.warn { background: var(--warn); --sig-ring: var(--warn-soft); }
.sig.ok { background: var(--ok); --sig-ring: var(--ok-soft); }
.kpi-n { font-family: var(--font-display); font-weight: 800; font-stretch: 80%; font-size: 2.6rem; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi-foot { font-size: .8rem; color: var(--muted); }
.kpi.next { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.kpi.next .kpi-label, .kpi.next .kpi-foot { color: color-mix(in srgb, var(--bg) 70%, transparent); }
.next-body { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; min-width: 0; }
.next-date { font-family: var(--font-display); font-weight: 800; font-stretch: 80%; font-size: 2rem; line-height: 1; font-variant-numeric: tabular-nums; }
.next-desc { font-size: .88rem; color: color-mix(in srgb, var(--bg) 78%, transparent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.dist { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: var(--line); gap: 2px; }
.dist i { display: block; height: 100%; transition: flex-grow .4s ease; }
.dist .bad { background: var(--bad); } .dist .warn { background: var(--warn); } .dist .ok { background: var(--ok); }

/* ---------- painéis ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); min-width: 0; overflow: hidden; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 1.15rem; font-weight: 700; font-stretch: 95%; letter-spacing: -.005em; }
.panel-head .sub { color: var(--muted); font-size: .85rem; margin-top: 1px; }

.seg { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 9px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; color: var(--ink); padding: 7px 12px; font-weight: 600; font-size: .86rem; display: inline-grid; place-items: center; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button:hover { background: var(--surface-2); }
.seg svg { width: 16px; height: 16px; }
.range { font-family: var(--font-mono); font-size: .8rem; color: var(--muted); white-space: nowrap; }
.head-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---------- linha do tempo ---------- */
.timeline-scroll { overflow-x: auto; scrollbar-width: thin; }
.timeline { display: grid; grid-template-columns: repeat(12, minmax(124px, 1fr)); min-width: 1488px; padding: 0 8px; }
.month { position: relative; display: flex; flex-direction: column; }
.month + .month::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 58px; border-left: 1px dashed var(--line); }
.month.q-start + .month::before, .month.q-start::before { }
.stack { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; padding: 18px 7px 14px; min-height: 230px; position: relative; }
.month.now .stack { background: linear-gradient(to top, color-mix(in srgb, var(--brand) 9%, transparent), transparent 85%); }
.today-line { position: absolute; top: 6px; bottom: 0; width: 0; border-left: 2px solid var(--brand); z-index: 0; pointer-events: none; }
.today-line::before { content: ""; position: absolute; top: -4px; left: -6px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px var(--surface); }
.stack > .card { position: relative; z-index: 1; }
.empty-m { align-self: center; width: 18px; height: 2px; background: var(--line); border-radius: 2px; margin-bottom: 6px; }

.rail { position: relative; padding: 12px 6px 14px; text-align: center; border-top: 2px solid var(--ink); }
.rail::before { content: ""; position: absolute; left: 50%; top: -7px; width: 2px; height: 12px; background: var(--ink); transform: translateX(-50%); }
.rail .mname { display: block; font-family: var(--font-display); font-weight: 800; font-stretch: 85%; font-size: 1.05rem; text-transform: uppercase; letter-spacing: .06em; line-height: 1.1; }
.rail .myear { font-family: var(--font-mono); font-size: .7rem; color: var(--muted); }
.rail .mcount { position: absolute; right: 8px; top: 12px; font-family: var(--font-mono); font-size: .68rem; font-weight: 600; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; padding: 0 6px; line-height: 1.6; }
.month.now .rail { border-top-color: var(--brand); }
.month.now .rail::before { background: var(--brand); }
.month.now .mname { color: var(--brand); }
.month.now .myear::after { content: " · hoje"; color: var(--brand); font-weight: 600; }
.month.jan .rail .myear { color: var(--ink); font-weight: 600; }

.card {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 8px; row-gap: 4px; align-items: center;
  width: 100%; text-align: left; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 7px 8px 7px 8px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.card .day { justify-self: end; font-family: var(--font-mono); font-size: .7rem; font-weight: 600; padding: 1px 6px; border-radius: 5px; white-space: nowrap; }
.card .desc { grid-column: 1 / -1; font-size: .78rem; line-height: 1.25; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .tipo { grid-column: 1 / -1; font-family: var(--font-mono); font-size: .64rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
td .tipo-tag { display: inline-block; font-size: .8rem; font-weight: 600; color: var(--brand); background: var(--brand-soft); border-radius: 6px; padding: 2px 8px; white-space: nowrap; }
td .eng { display: flex; align-items: center; gap: 8px; white-space: nowrap; color: var(--ink-2); }
td .eng i { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; font-style: normal; font-size: .7rem; font-weight: 700; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); flex: none; }
.card.ok   { background: color-mix(in srgb, var(--ok-soft) 70%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.card.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 70%, var(--line)); }
.card.bad  { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 60%, var(--line)); }
.card.ok .day { background: var(--ok); color: #fff; }
.card.warn .day { background: var(--warn); color: #2a1e00; }
.card.bad .day { background: var(--bad); color: #fff; }

.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--surface-2); font-size: .84rem; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend .hint { margin-left: auto; color: var(--muted); }

/* ---------- placa Mercosul ---------- */
.plate {
  display: inline-flex; flex-direction: column; align-items: stretch; flex: none;
  background: var(--plate-bg); color: var(--plate-ink);
  border: 1.5px solid #1b1b1b; border-radius: 4px; overflow: hidden; line-height: 1;
}
.plate::before { content: ""; height: 4px; background: var(--plate-band); }
.plate b { font-family: var(--font-display); font-weight: 800; font-stretch: 72%; font-size: .98rem; letter-spacing: .1em; padding: 2px 6px 2px 7px; font-variant-numeric: tabular-nums; }
.plate.lg::before { height: 9px; }
.plate.lg b { font-size: 1.7rem; padding: 4px 14px 5px 16px; letter-spacing: .16em; }
.plate.lg { border-width: 2px; border-radius: 6px; }
.plate.lg .pl-country { font-family: var(--font-mono); font-size: .45rem; letter-spacing: .3em; color: #fff; text-align: center; margin-top: -8px; height: 8px; line-height: 8px; position: relative; }

/* ---------- tabela ---------- */
.search-box { position: relative; flex: 1 1 260px; max-width: 340px; min-width: 0; }
.search-box svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
input, select {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: 8px; padding: 10px 12px; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
input:hover, select:hover { border-color: var(--muted); }
input:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); outline: none; }
.search-box input { padding-left: 34px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 1080px; font-size: .93rem; }
th {
  text-align: left; font-family: var(--font-mono); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; padding: 11px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
td.num { font-family: var(--font-mono); font-size: .85rem; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink-2); }
td.venc { font-weight: 600; color: var(--ink); }
td.desc-cell { font-weight: 500; min-width: 220px; }
td.actions { white-space: nowrap; text-align: right; width: 1%; }
.count { font-size: .8rem; color: var(--muted); font-family: var(--font-mono); }
.countdown { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 3px 10px 3px 8px; border-radius: 999px; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-soft); color: var(--ok-ink); }
.pill.warn { background: var(--warn-soft); color: var(--warn-ink); }
.pill.bad { background: var(--bad-soft); color: var(--bad-ink); }
.empty { text-align: center; color: var(--muted); padding: 44px 16px; }
.empty strong { color: var(--ink); display: block; font-family: var(--font-display); font-size: 1.1rem; margin-bottom: 4px; }

/* ---------- modal ---------- */
.overlay {
  position: fixed; inset: 0; background: var(--overlay); display: grid; place-items: center; z-index: 50;
  padding: calc(16px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) calc(16px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  backdrop-filter: blur(3px);
}
.modal { background: var(--surface); color: var(--ink); border-radius: 16px; width: min(520px, 100%); max-height: 100%; overflow: auto; box-shadow: var(--shadow-lg); animation: pop .18s ease-out; }
@keyframes pop { from { transform: translateY(8px) scale(.985); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 0; }
.modal-head h2 { font-size: 1.35rem; font-weight: 800; font-stretch: 88%; }
.modal-body { padding: 18px 22px 22px; display: flex; flex-direction: column; gap: 16px; }
.modal form { display: contents; }
.plate-preview { display: flex; align-items: center; justify-content: center; padding: 18px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-weight: 600; font-size: .86rem; color: var(--ink-2); }
.field .err { font-size: .8rem; color: var(--bad); font-weight: 600; }
.field .hint { font-size: .72rem; color: var(--muted); margin-top: -2px; }
.pdf-box { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border: 1px dashed var(--line-strong); border-radius: 10px; background: var(--surface-2); }
.pdf-atual { display: inline-flex; align-items: center; gap: 8px; font-size: .88rem; font-weight: 600; flex: 1 1 180px; min-width: 0; overflow-wrap: anywhere; }
.pdf-atual.vazio { color: var(--muted); font-weight: 500; }
.pdf-atual.remover { color: var(--bad); text-decoration: line-through; }
.pdf-tag { font-family: var(--font-mono); font-size: .62rem; font-weight: 700; letter-spacing: .06em; color: #fff; background: var(--bad); border-radius: 4px; padding: 2px 5px; flex: none; }
.btn-sm { padding: 5px 10px; font-size: .82rem; }
#f-pdf { padding: 7px 10px; background: var(--surface); }
a.icon-btn { text-decoration: none; }
.icon-btn.pdf { color: var(--bad); }
.icon-btn.pdf:hover { background: var(--bad-soft); border-color: transparent; color: var(--bad); }
.sem-pdf { color: var(--line-strong); font-size: .85rem; padding-left: 10px; }.req { color: var(--bad); font-weight: 700; margin-left: 2px; }
.req-note { font-size: .75rem; color: var(--muted); margin: -6px 0 0; }
.field.invalid input, .field.invalid select { border-color: var(--bad); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
#f-frota { font-family: var(--font-mono); letter-spacing: .2em; font-size: 1.1rem; font-weight: 600; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.calc { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 12px; padding: 14px 16px; border-radius: 12px; background: var(--brand-soft); }
.calc .eyebrow { color: var(--brand); }
.calc .pv-date { font-family: var(--font-display); font-weight: 800; font-stretch: 85%; font-size: 1.6rem; line-height: 1.05; font-variant-numeric: tabular-nums; }
.calc #pv-status { grid-row: 1 / span 2; grid-column: 2; }
.modal-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 4px; }
.modal-actions .spacer { flex: 1; }
.del-body { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.del-body p { margin: 0; }
#ov-del .modal { width: min(440px, 100%); }
#ov-users .modal { width: min(620px, 100%); }
#ov-senha .modal { width: min(440px, 100%); }
.senha-regra { margin: 0; font-size: .82rem; color: var(--muted); }
.senha-aviso { margin: 0; font-size: .88rem; font-weight: 600; color: var(--warn-ink); background: var(--warn-soft); border-radius: 8px; padding: 9px 12px; }
.abas { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.abas button { border: 0; background: transparent; color: var(--muted); font-weight: 600; padding: 8px 12px; border-bottom: 2px solid transparent; border-radius: 0; }
.abas button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--brand); }
.ativ-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; max-height: 380px; overflow: auto; }
.ativ-lista li { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; padding: 9px 2px; border-bottom: 1px solid var(--line); font-size: .86rem; }
.ativ-lista time { font-family: var(--font-mono); font-size: .74rem; color: var(--muted); white-space: nowrap; grid-row: span 2; padding-top: 2px; }
.ativ-lista .quem { font-weight: 600; }
.ativ-lista .det { color: var(--ink-2); overflow-wrap: anywhere; }
.ativ-lista li.alerta .quem { color: var(--bad); }
.aviso-acao { margin: 0; color: var(--muted); font-size: .9rem; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  background: var(--ink); color: var(--bg); padding: 11px 18px 11px 14px; border-radius: 10px; font-weight: 600; z-index: 60;
  max-width: calc(100% - 32px); display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow-lg);
}
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.toast.err::before { background: var(--bad); }

/* ---------- usuário logado ---------- */
.userbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.user-chip { display: inline-flex; align-items: center; gap: 9px; padding: 4px 12px 4px 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); line-height: 1.15; }
.user-chip i { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-weight: 700; font-size: .78rem; background: var(--brand); color: var(--brand-ink); text-transform: uppercase; }
.user-chip strong { display: block; font-size: .88rem; }
.user-chip small { display: block; font-size: .72rem; color: var(--muted); }
body.ro #btn-new, body.ro .icon-btn[data-edit], body.ro .icon-btn.del { display: none; }
body.ro .card { cursor: default; }

/* ---------- login ---------- */
.login { position: fixed; inset: 0; z-index: 70; background: var(--bg); display: grid; place-items: center; overflow: auto;
  padding: calc(16px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) calc(16px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.login-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 28px 26px; display: flex; flex-direction: column; gap: 18px; }
.login-card .brand h1 { font-size: 1.5rem; }
.login-card form { display: flex; flex-direction: column; gap: 14px; }
.login-card .btn-primary { justify-content: center; width: 100%; }
.login-ok { font-size: .86rem; font-weight: 600; color: var(--ok-ink); background: var(--ok-soft); border-radius: 8px; padding: 9px 12px; margin: 0; }
.login-troca { margin: 0; text-align: center; font-size: .88rem; color: var(--muted); }
.link { border: 0; background: none; padding: 0; color: var(--brand); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.btn-bio { justify-content: center; width: 100%; border-color: var(--brand); color: var(--brand); }
.btn-bio:hover { background: var(--brand-soft); border-color: var(--brand); }
.btn-bio svg { width: 20px; height: 20px; }
.cad-titulo { font-size: 1.2rem; font-weight: 800; font-stretch: 88%; }
.login-card form[hidden] { display: none; }
#ov-bio .modal { width: min(460px, 100%); }
.bio-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.bio-lista:empty { display: none; }
.bio-lista li { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); font-size: .88rem; }
.bio-lista li span { flex: 1; min-width: 0; }
.bio-lista small { display: block; color: var(--muted); font-size: .76rem; }
.lvl.pendente { background: var(--warn-soft); color: var(--warn-ink); }
.btn-aprovar { height: 30px; padding: 0 10px; font-size: .8rem; background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-aprovar:hover { background: color-mix(in srgb, var(--ok) 85%, #000); border-color: transparent; }
.u-acoes { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.u-acoes .btn svg { width: 14px; height: 14px; }
.u-acoes .btn-aprovar { height: auto; }
.users-table td.actions { width: auto; }
.users-table small { display: block; font-weight: 400; color: var(--muted); font-size: .76rem; }
.login-err {font-size: .86rem; font-weight: 600; color: var(--bad-ink); background: var(--bad-soft); border-radius: 8px; padding: 9px 12px; margin: 0; }

/* ---------- usuários ---------- */
.users-table { width: 100%; border-collapse: collapse; min-width: 0; font-size: .9rem; }
.users-table td { padding: 9px 8px; }
.users-table td:first-child { font-weight: 600; }
.lvl { display: inline-block; font-size: .74rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; border-radius: 6px; padding: 2px 8px; }
.lvl.admin { background: var(--brand-soft); color: var(--brand); }
.lvl.leitura { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.user-form { border-top: 1px solid var(--line); padding-top: 16px; display: flex; flex-direction: column; gap: 14px; }
.user-form h3 { font-size: 1rem; font-weight: 700; }
.lvl-help { font-size: .78rem; color: var(--muted); margin: -4px 0 0; }
.icon-btn.confirm { width: auto; padding: 0 10px; background: var(--bad); color: #fff; font-weight: 700; font-size: .8rem; }

@media (max-width: 980px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi.next { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .brand h1 { font-size: 1.45rem; }
  .today-chip { display: none; }
  .top-right, .top-right .btn-primary { width: 100%; justify-content: center; }
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 12px; }
  .kpi-n { font-size: 2rem; }
  .kpi-foot { display: none; }
  .two { grid-template-columns: 1fr; }
  .legend .hint { margin-left: 0; }
  .panel-head { padding: 14px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before { transition: none !important; animation: none !important; }
}
