/* Marca Manuel Santiago: negro y blanco del logo, azul marino del uniforme como acento, naranja solo para avisos.
   Títulos en letra ancha (como el logo), números en condensada. Una columna, cómoda en móvil y en escritorio. */
:root {
  --bg: #F4F5F7; --surface: #FFFFFF; --ink: #0B0C0E; --muted: #5E6470; --line: #DDE0E6;
  --accent: #22315C; --accent-soft: #E4E8F2; --on-accent: #FFFFFF; --hero: #1C2950;
  --warm: #E2692A; --warm-soft: #FCEADF; --ok: #1E8A55; --ok-soft: #DDF2E6; --bad: #C23B3B; --bad-soft: #FBE4E4;
  --brand: "Michroma", "Eurostile", "Arial Black", system-ui, sans-serif;
  --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #09090A; --surface: #151619; --ink: #EDEEF0; --muted: #9A9FA9; --line: #2A2C31;
    --accent: #AFC0EC; --accent-soft: #1D2539; --on-accent: #09090A; --hero: #1C2950;
    --warm: #F08D4E; --warm-soft: #3A2618; --ok: #4CC88A; --ok-soft: #163327; --bad: #F07272; --bad-soft: #3A1C1C;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--body); -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2 { font-family: var(--brand); font-weight: 400; line-height: 1.15; margin: 0; letter-spacing: .02em; text-wrap: balance; }
h3 { font-family: var(--display); font-weight: 700; line-height: 1.05; margin: 0; }
p { margin: 0; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.app { max-width: 720px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 5; background: var(--bg);
  padding: calc(env(safe-area-inset-top, 0px) + 14px) max(18px, env(safe-area-inset-right, 0px)) 10px max(18px, env(safe-area-inset-left, 0px));
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
}
.topbar small { display: block; color: var(--muted); font-size: 13px; }
.topbar h1 { font-size: 21px; text-transform: uppercase; margin-top: 2px; }
.topbar .back { margin-bottom: 4px; }
main {
  flex: 1; display: flex; flex-direction: column; gap: 10px;
  padding: 4px max(14px, env(safe-area-inset-right, 0px)) calc(96px + env(safe-area-inset-bottom, 0px)) max(14px, env(safe-area-inset-left, 0px));
}
main:has(~ .fab) { padding-bottom: calc(160px + env(safe-area-inset-bottom, 0px)); }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--surface); border-top: 1px solid var(--line);
  display: flex; justify-content: center; padding: 6px max(6px, env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) max(6px, env(safe-area-inset-left, 0px));
}
.tabbar .inner { display: flex; width: 100%; max-width: 720px; }
.tabbar a {
  flex: 1; color: var(--muted); text-decoration: none; font: 600 11px var(--body); padding: 6px 2px;
  display: flex; flex-direction: column; align-items: center; gap: 3px; border-radius: 10px;
}
.tabbar a svg { width: 23px; height: 23px; }
.tabbar a[aria-current="page"] { color: var(--accent); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
a.card, button.card { display: block; width: 100%; text-align: left; color: inherit; text-decoration: none; cursor: pointer; }
a.card.row, button.card.row { display: flex; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.tiny { font-size: 13px; color: var(--muted); }
.strong { font-weight: 600; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.section-title { font: 600 12px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-top: 10px; }
.empty { color: var(--muted); font-size: 14px; text-align: center; padding: 22px 12px; }

.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.pill.warm { background: var(--warm-soft); color: var(--warm); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.muted { background: var(--line); color: var(--muted); }

.time { font-family: var(--mono); font-size: 14px; width: 50px; flex: none; }
.cname { font-weight: 600; font-size: 16px; }
.bar { height: 5px; border-radius: 5px; background: var(--line); overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; background: var(--accent); }
.bar i.full { background: var(--warm); }
.cancelada { opacity: .55; }
.cancelada .cname { text-decoration: line-through; }

.btn {
  font: 600 14px var(--body); border-radius: 11px; padding: 10px 14px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--on-accent); cursor: pointer; white-space: nowrap; text-align: center; text-decoration: none; display: inline-block;
}
.btn.ghost { background: transparent; color: var(--accent); }
.btn.warm { background: var(--warm); border-color: var(--warm); color: var(--on-accent); }
.btn.danger { background: transparent; border-color: var(--bad); color: var(--bad); }
.btn.small { padding: 6px 11px; font-size: 13px; }
.btn.block { display: block; width: 100%; }
.btn:disabled { opacity: .45; cursor: default; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; cursor: pointer; text-decoration: none; }

.days { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.days::-webkit-scrollbar { display: none; }
.days button {
  flex: 1 0 42px; max-width: 64px; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 6px 0;
  cursor: pointer; font: 500 11px var(--body); display: flex; flex-direction: column; align-items: center;
}
.days button b { font: 700 21px var(--display); }
.days button .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); margin-top: 2px; }
.days button .dot.none { background: transparent; }
.days button[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.weeknav { display: flex; align-items: center; justify-content: space-between; }

.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.kpis.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.kpi b { font: 700 28px var(--display); display: block; line-height: 1.05; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center;
  font: 700 15px var(--display); flex: none; border: 0; cursor: pointer;
}
.check {
  width: 34px; height: 34px; border-radius: 9px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer;
  display: grid; place-items: center; color: transparent; font-weight: 700; flex: none;
}
.check[aria-pressed="true"] { background: var(--ok); border-color: var(--ok); color: var(--surface); }

.bono { background: var(--ink); color: var(--surface); border-radius: 18px; padding: 18px; }
.bono .big { font: 700 60px var(--display); line-height: 1; }
.bono .tiny { color: inherit; opacity: .75; }
.dots { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 12px; }
.dots i { width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--surface); }
.dots i.on { background: var(--surface); }

.fab {
  position: fixed; right: max(18px, calc((100vw - 720px) / 2 + 18px)); bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 6;
  width: 56px; height: 56px; border-radius: 17px; border: 0; background: var(--accent); color: var(--on-accent); font-size: 30px; line-height: 1;
  cursor: pointer; box-shadow: 0 8px 22px -8px rgba(10, 14, 30, .6);
}

/* Formularios */
.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
.field input, .field select, .field textarea {
  font-size: 16px; padding: 11px 12px; border-radius: 11px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); width: 100%;
}
.field textarea { min-height: 80px; resize: vertical; }
.checkline { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--ink); }
.checkline input { width: 20px; height: 20px; accent-color: var(--accent); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.error { color: var(--bad); font-size: 14px; min-height: 1em; }
.segmented { display: flex; gap: 6px; flex-wrap: wrap; }
.segmented button { flex: 1; border: 1px solid var(--line); background: var(--surface); padding: 9px 10px; border-radius: 10px; cursor: pointer; font-weight: 600; }
.segmented button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

/* Hoja inferior */
.backdrop { position: fixed; inset: 0; background: rgba(8, 12, 18, .45); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  background: var(--surface); width: 100%; max-width: 720px; max-height: 88vh; overflow-y: auto; border-radius: 22px 22px 0 0;
  padding: 18px max(18px, env(safe-area-inset-right, 0px)) calc(18px + env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px));
  display: flex; flex-direction: column; gap: 12px;
}
.sheet h2 { font-size: 17px; text-transform: uppercase; }
.sheet .actions { display: flex; gap: 10px; }
.sheet .actions .btn { flex: 1; }
.option { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); cursor: pointer; width: 100%; text-align: left; }
.option:disabled { opacity: .5; cursor: default; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(92px + env(safe-area-inset-bottom, 0px)); z-index: 30;
  background: var(--ink); color: var(--surface); padding: 11px 16px; border-radius: 12px; font-size: 14px; width: min(92vw, 520px);
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, .5);
}
.toast.bad { background: var(--bad); color: #fff; }

/* Entrada */
.login { min-height: 100%; display: flex; flex-direction: column; align-items: center; }
.login .hero {
  width: 100%; background: radial-gradient(120% 90% at 50% 100%, #2B3B6B 0%, var(--hero) 55%, #0E1530 100%);
  display: flex; justify-content: center; align-items: flex-end; height: min(34vh, 300px);
  padding-top: env(safe-area-inset-top, 0px); overflow: hidden;
}
.login .hero img { height: 100%; width: auto; max-width: 100%; object-fit: contain; object-position: bottom; display: block; }
.login .box {
  width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 14px;
  padding: 24px max(18px, env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px));
}
.login h1 { font-size: 24px; text-transform: uppercase; }
.logo { width: 100%; max-width: 300px; height: auto; display: block; margin: 0 auto 4px; }
@media (prefers-color-scheme: dark) { .logo { filter: invert(1); } }
.copybox { display: flex; gap: 8px; }
.copybox input { flex: 1; min-width: 0; font: 13px var(--mono); padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.install { border-color: var(--accent); background: var(--accent-soft); }
.loading { display: grid; place-items: center; min-height: 40vh; color: var(--muted); }

@media (prefers-reduced-motion: no-preference) {
  .sheet { animation: subir .22s ease-out; }
  @keyframes subir { from { transform: translateY(40px); opacity: .4; } }
}
