:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #efeee9;
  --text: #1c1d20;
  --muted: #6b6c70;
  --line: #e2e0da;
  --accent: #2f5bd3;
  --accent-soft: #e6ecfb;
  --ok: #1f7a4d;
  --warn: #a86400;
  --warn-soft: #fbf0dd;
  --bad: #b3261e;
  --bad-soft: #fbe5e3;
  --radius: 12px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 2px 8px rgb(0 0 0 / 0.04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16171a; --surface: #1e2024; --surface-2: #262930; --text: #ecedef; --muted: #9a9ca3; --line: #30333a;
    --accent: #7c9cff; --accent-soft: #232c45; --ok: #5fc48f; --warn: #e6a94a; --warn-soft: #3a2f1c; --bad: #ff8a80; --bad-soft: #3d2322;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }

.shell { display: grid; grid-template-columns: 210px 1fr; min-height: 100vh; }
.nav { position: sticky; top: 0; height: 100vh; padding: 20px 12px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.brand { font-weight: 700; font-size: 17px; padding: 4px 12px 16px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: var(--text); text-decoration: none; }
.nav a:hover { background: var(--surface-2); }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.ico { width: 18px; text-align: center; opacity: .8; }
.badge { margin-left: auto; background: var(--warn); color: #fff; border-radius: 999px; font-size: 12px; padding: 0 7px; }
main { padding: 24px clamp(16px, 3vw, 36px) 96px; max-width: 1200px; width: 100%; outline: none; }

h1 { font-size: 24px; margin: 0 0 2px; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 0 0 10px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.sub { color: var(--muted); margin: 0 0 20px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.capture { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.capture input[type=text] { flex: 1 1 260px; min-width: 0; }
input, select { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 9px 14px; cursor: pointer; }
button:hover { background: var(--surface-2); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.primary:hover { filter: brightness(1.05); }
button.ghost { border-color: transparent; background: transparent; padding: 6px 8px; }
button.ghost:hover { background: var(--surface-2); }
button:disabled { opacity: .5; cursor: default; }

.ahora { background: var(--accent-soft); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; }
.ahora-k { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.ahora-v { font-size: 18px; font-weight: 650; margin-top: 2px; }
.ahora-s { margin-top: 4px; font-size: 14px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 20px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); text-decoration: none; color: inherit; }
.tile .v { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile .l { color: var(--muted); font-size: 13px; }
.tile.warn { background: var(--warn-soft); border-color: transparent; }
.tile.bad { background: var(--bad-soft); border-color: transparent; }

.grid2 { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card > h2 { display: flex; align-items: center; gap: 8px; }
.card > h2 .right { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 500; }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; padding-top: 2px; }
.list .body { flex: 1; min-width: 0; }
.list .title { font-weight: 550; overflow-wrap: anywhere; }
.list .meta { color: var(--muted); font-size: 13px; }
.list .actions { display: flex; gap: 2px; flex-shrink: 0; }
.num { width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }

.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text); white-space: nowrap; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--muted)); }
.chip.ok { color: var(--ok); } .chip.warn { color: var(--warn); background: var(--warn-soft); } .chip.bad { color: var(--bad); background: var(--bad-soft); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.timeline > li { align-items: stretch; }
.time { width: 92px; flex-shrink: 0; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; padding-top: 1px; }
.bar { width: 3px; border-radius: 2px; background: var(--c, var(--accent)); flex-shrink: 0; }
.past { opacity: .5; }
.now-line { border-top: 2px solid var(--bad) !important; }

.alert { background: var(--warn-soft); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; font-size: 14px; }
.alert.bad { background: var(--bad-soft); }
.empty { color: var(--muted); padding: 8px 0; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; }
.seg button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.day { margin-bottom: 18px; }
.day h3 { font-size: 14px; margin: 0 0 6px; }
.clients { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.meter { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin: 6px 0; }
.meter > i { display: block; height: 100%; background: var(--accent); }
.meter.warn > i { background: var(--warn); } .meter.bad > i { background: var(--bad); }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 7px 8px; border-top: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; border-top: 0; }

.login { max-width: 360px; margin: 12vh auto; }
.login form { display: flex; flex-direction: column; gap: 10px; }

#toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; max-width: min(560px, calc(100vw - 32px)); box-shadow: 0 6px 24px rgb(0 0 0 / .2); z-index: 10; }

@media (max-width: 860px) {
  .grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .shell { grid-template-columns: 1fr; }
  .nav { position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; flex-direction: row; justify-content: space-around; padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)); border-right: 0; border-top: 1px solid var(--line); background: var(--bg); z-index: 5; }
  .brand { display: none; }
  .nav a { flex-direction: column; gap: 0; font-size: 11px; padding: 6px 4px; flex: 1; text-align: center; }
  .nav a .ico { font-size: 17px; }
  .badge { position: absolute; margin: 0 0 0 18px; font-size: 10px; }
  main { padding-top: calc(16px + env(safe-area-inset-top, 0px)); }
  .time { width: 74px; }
}
