:root {
  --bg: #f6f7f9; --surface: #fff; --text: #1d2129; --muted: #69707d; --border: #e3e6eb;
  --brand: #ee4d2d; --ok: #1a7f4b; --warn: #a15c00; --bad: #c0262d; --info: #2457c5;
  --radius: 10px; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #14161a; --surface: #1d2026; --text: #e8eaee; --muted: #9aa1ad; --border: #30343c; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 15px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--bad); }
button { background: var(--brand); color: #fff; border: 0; border-radius: 8px; padding: 8px 14px; cursor: pointer; font: inherit; }
button.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
button.danger { background: var(--bad); }
button.ok { background: var(--ok); }
button.small { padding: 4px 8px; font-size: 13px; }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; padding: 7px 9px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); max-width: 100%; }
textarea { width: 100%; min-height: 260px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
label { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: min(360px, 100%); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.spacer { flex: 1; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--border); }
.badge.SIMULATION { background: #fff1c2; color: #6b4e00; }
.badge.TEST { background: #dbe7ff; color: #1b3f8f; }
.badge.PRODUCTION { background: #d4f5e2; color: #0d5a33; }
.banner { padding: 10px 16px; background: var(--bad); color: #fff; }
.banner.warn { background: #fff1c2; color: #6b4e00; }
.layout { display: grid; grid-template-columns: 230px 1fr; min-height: calc(100vh - 56px); }
nav { border-right: 1px solid var(--border); padding: 12px 8px; background: var(--surface); }
nav a { display: block; padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none; }
nav a.active, nav a:hover { background: var(--bg); color: var(--brand); }
main { padding: 16px; min-width: 0; }
h2 { margin: 0 0 12px; font-size: 20px; }
h3 { margin: 0 0 10px; font-size: 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.kpi .v { font-size: 24px; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--muted); font-size: 13px; }
.kpi.estimate .v { color: var(--warn); }
.kpi.confirmed .v { color: var(--ok); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; font-size: 14px; }
th { color: var(--muted); font-weight: 500; white-space: nowrap; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: end; }
.filters label { margin: 0; }
.status { font-size: 12px; padding: 2px 8px; border-radius: 99px; white-space: nowrap; background: var(--border); }
.status.published, .status.done, .status.approved { background: #d4f5e2; color: #0d5a33; }
.status.simulated, .status.test_validated { background: #fff1c2; color: #6b4e00; }
.status.failed, .status.rejected, .status.blocked { background: #fde0e0; color: #8c1b20; }
.status.pending, .status.processing, .status.export_ready { background: #dbe7ff; color: #1b3f8f; }
.bar { height: 8px; background: var(--border); border-radius: 99px; overflow: hidden; min-width: 80px; }
.bar > span { display: block; height: 100%; background: var(--brand); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; padding: 2px 8px; border: 1px solid var(--border); border-radius: 99px; }
pre { white-space: pre-wrap; word-break: break-word; background: var(--bg); padding: 10px; border-radius: 8px; font-size: 13px; }
.day { margin-bottom: 14px; }
.day h4 { margin: 0 0 6px; }
.toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px; z-index: 10; max-width: calc(100% - 32px); }
svg.chart { width: 100%; height: 180px; }
svg.chart text { fill: var(--muted); font-size: 11px; }
video { width: 100%; max-width: 280px; border-radius: 8px; background: #000; }
@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
  nav { display: none; position: fixed; inset: 56px 0 0 0; z-index: 4; overflow-y: auto; }
  nav.open { display: block; }
  .top strong { display: none; }
}
@media (min-width: 801px) { #menu-toggle { display: none; } }
