/* JBO Construction — pensado primero para el teléfono y la tablet: botones grandes, letra legible, modo claro y oscuro.
   Colores de la marca: rojo de la J, rojo oscuro del techo y el arco, gris de la C. Contrastes revisados (WCAG AA):
   texto ≥ 4.5:1, bordes de campos ≥ 3:1. */

:root {
  --brand-red: #d40000;
  --brand-dark: #801b12;
  --brand-gray: #4d585d;
  --bg: #f2f3f5;
  --surface: #ffffff;
  --surface-2: #eceef1;
  --text: #16191b;
  --muted: #545b61;
  --line: #dde1e5;
  --line-strong: #7b848a;
  --primary: #d40000;
  --primary-press: #a30000;
  --primary-soft: #fdecec;
  --primary-ink: #b00000;
  --on-primary: #ffffff;
  --link: #b00000;
  --focus: #1d4ed8;
  --danger: #b42318;
  --on-danger: #ffffff;
  --ok: #15803d;
  --warn: #a16207;
  --header-bg: #1e2428;
  --header-fg: #ffffff;
  --header-muted: #c3cbd0;
  --badge-ok-bg: #dcfce7; --badge-ok-fg: #14532d;
  --badge-warn-bg: #ffedd5; --badge-warn-fg: #7c2d12;
  --badge-bad-bg: #fee2e2; --badge-bad-fg: #7f1d1d;
  --badge-info-bg: #e0e9f5; --badge-info-fg: #1e3a5f;
  --badge-muted-bg: #e7eaed; --badge-muted-fg: #3d454b;
  --error-bg: #fef2f2;
  --toast-bg: #1e2428; --toast-fg: #ffffff;
  --shadow: 0 1px 2px rgb(22 25 27 / 6%), 0 4px 14px rgb(22 25 27 / 6%);
  --shadow-lift: 0 2px 4px rgb(22 25 27 / 8%), 0 10px 28px rgb(22 25 27 / 10%);
  --radius: 16px;
  --radius-sm: 11px;
  --tabbar-h: 66px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* Títulos con la letra angosta del logo (la trae el iPhone/iPad; en otros equipos, la normal). */
  --font-display: "Avenir Next Condensed", "Roboto Condensed", "Arial Narrow", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1214;
    --surface: #181c1f;
    --surface-2: #22272b;
    --text: #f2f4f5;
    --muted: #a9b1b7;
    --line: #2c3237;
    --line-strong: #7c868d;
    --primary: #e0201a;
    --primary-press: #b91515;
    --primary-soft: #3a1413;
    --primary-ink: #ff7a70;
    --on-primary: #ffffff;
    --link: #ff7a70;
    --focus: #93c5fd;
    --danger: #ff8a80;
    --on-danger: #1c1917;
    --ok: #86efac;
    --warn: #fcd34d;
    --header-bg: #161b1e;
    --header-fg: #ffffff;
    --header-muted: #aeb7bd;
    --badge-ok-bg: #052e16; --badge-ok-fg: #bbf7d0;
    --badge-warn-bg: #431407; --badge-warn-fg: #fed7aa;
    --badge-bad-bg: #450a0a; --badge-bad-fg: #fecaca;
    --badge-info-bg: #16263a; --badge-info-fg: #c7dcf5;
    --badge-muted-bg: #2a3035; --badge-muted-fg: #d3d9dd;
    --error-bg: #2a1212;
    --toast-bg: #f2f4f5; --toast-fg: #16191b;
    --shadow: none;
    --shadow-lift: 0 8px 28px rgb(0 0 0 / 45%);
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 400 1.0625rem/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.25rem; font-weight: 700; }
h2 { font-size: 1.125rem; font-weight: 700; }
h3 { font-size: 1.0625rem; font-weight: 650; }
p { margin: 0 0 .75rem; }
p:last-child { margin-bottom: 0; }
a { color: var(--link); text-underline-offset: 3px; }
img { max-width: 100%; height: auto; }
strong { font-weight: 700; }
ul, ol { padding-left: 1.25rem; margin: 0 0 .75rem; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
[tabindex="-1"]:focus { outline: none; }

.muted { color: var(--muted); }
.center { text-align: center; }
.lead { font-size: 1.25rem; font-weight: 650; margin: 0; }
.hint { color: var(--muted); font-size: .9375rem; margin: .375rem 0 0; }
.brand { color: var(--primary); font-weight: 800; letter-spacing: .02em; font-size: 1.125rem; margin-bottom: 1rem; }
.code { font-family: var(--mono); font-size: 1.25rem; font-weight: 700; letter-spacing: .08em; }
.secret { word-break: break-all; user-select: all; -webkit-user-select: all; text-align: center; background: var(--surface-2); padding: .75rem; border-radius: var(--radius-sm); }

/* ---------- Pantalla ---------- */
.screen { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: .625rem;
  min-height: calc(60px + var(--safe-top));
  padding: var(--safe-top) max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
  background: var(--header-bg);
  color: var(--header-fg);
  border-bottom: 3px solid var(--brand-red);
}
.topbar h1 {
  margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--font-display); font-size: 1.3125rem; font-weight: 700; letter-spacing: .01em;
}
.brand-mark {
  flex: none; width: 40px; height: 40px; padding: 4px;
  background: #ffffff; border-radius: 10px;
  box-shadow: 0 1px 3px rgb(0 0 0 / 30%);
}
.brand-mark img { display: block; width: 100%; height: 100%; object-fit: contain; }
.topbar .back {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; margin-left: -12px;
  font-size: 2rem; line-height: 1; text-decoration: none; color: var(--header-fg);
  border-radius: 50%;
}
.topbar .back:active { background: rgb(255 255 255 / 12%); }
.topbar .btn-ghost { color: var(--header-fg); }
.topbar-actions { display: flex; gap: .5rem; margin-left: auto; }
.content {
  flex: 1;
  width: 100%; max-width: 40rem; margin: 0 auto;
  padding: 16px max(16px, env(safe-area-inset-right, 0px)) calc(32px + var(--safe-bottom)) max(16px, env(safe-area-inset-left, 0px));
}
.screen:has(> .tabbar) .content { padding-bottom: calc(var(--tabbar-h) + 32px + var(--safe-bottom)); }

.section { margin-top: 1.5rem; }
.section:first-child { margin-top: 0; }
.section > h2 {
  display: flex; align-items: center; gap: .5rem;
  font-size: .8125rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: .75rem;
}
.section > h2::before { content: ""; width: 4px; height: 1em; border-radius: 2px; background: var(--brand-red); flex: none; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.card { overflow-wrap: anywhere; }
.card > h2, .card > h3 { margin-bottom: .375rem; }
.card > .btn { margin-top: .5rem; width: 100%; }
.notice { border-left: 4px solid var(--primary); }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }
.empty .btn { margin-top: 1rem; }
.hello { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.divider { display: flex; align-items: center; gap: .75rem; color: var(--muted); margin: 1.5rem 0 1rem; font-size: .9375rem; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 48px; padding: .625rem 1.25rem;
  border: 1.5px solid transparent; border-radius: 12px;
  font: inherit; font-weight: 650; line-height: 1.2; text-align: center; text-decoration: none;
  cursor: pointer; user-select: none; -webkit-user-select: none;
  transition: background-color .15s, transform .05s;
  touch-action: manipulation;
}
.btn:active { transform: scale(.98); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; }
.btn[aria-busy="true"] { cursor: progress; }
.btn[aria-busy="true"]::before {
  content: ""; width: 1em; height: 1em; border-radius: 50%;
  border: 2.5px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
.btn-primary { background: var(--primary); color: var(--on-primary); box-shadow: 0 1px 2px rgb(128 27 18 / 25%); }
.btn-primary:active { background: var(--primary-press); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
.btn-secondary:active { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--link); }
.btn-ghost:active { background: var(--surface-2); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: var(--danger); }
.btn-danger:active { background: var(--error-bg); }
.btn-block { display: flex; width: 100%; }
.btn-big { min-height: 64px; font-size: 1.25rem; border-radius: 16px; width: 100%; }
.btn-small { min-height: 40px; padding: .375rem .875rem; font-size: .9375rem; }
.section > .btn, .content > .btn, .content > a.btn { width: 100%; margin-top: .5rem; }
.section > .btn:not(:last-child) { margin-bottom: 12px; }
.content > .btn + p, .section > .btn + p { margin-top: 1rem; }

/* ---------- Formularios ---------- */
.form { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1rem; }
.field { display: flex; flex-direction: column; }
.field > label { font-weight: 650; margin-bottom: .375rem; }
.optional { font-weight: 400; color: var(--muted); }
.field input:not([type="checkbox"]):not([type="radio"]), .field select, .field textarea, .dialog textarea {
  width: 100%; min-height: 48px;
  padding: .625rem .875rem;
  font: inherit; font-size: max(1rem, 16px); /* 16px o más: el iPhone no hace zoom al tocar el campo */
  color: var(--text); background: var(--surface);
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm);
  appearance: none; -webkit-appearance: none;
}
.field textarea, .dialog textarea { min-height: 96px; resize: vertical; }
.field select {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px; background-repeat: no-repeat;
  padding-right: 2.5rem;
}
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible, .dialog textarea:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--focus);
}
.field input[type="file"] { padding: .5rem; }
.field-password { display: grid; grid-template-columns: 1fr auto; column-gap: .5rem; align-items: center; }
.field-password > label, .field-password > .hint { grid-column: 1 / -1; }
.field-password .reveal { min-height: 48px; }
.field-check { flex-direction: row; flex-wrap: wrap; align-items: center; gap: .75rem; }
.field-check input { width: 24px; height: 24px; margin: 0; accent-color: var(--primary); }
.field-check > label { margin: 0; font-weight: 500; flex: 1; }
.field-check > .hint { flex-basis: 100%; margin-left: calc(24px + .75rem); }
.form-error {
  margin: 0; padding: .75rem 1rem;
  color: var(--danger); background: var(--error-bg);
  border: 1px solid currentColor; border-radius: var(--radius-sm);
  font-weight: 600;
}

/* ---------- Datos ---------- */
.badge {
  display: inline-block; padding: .125rem .625rem; border-radius: 999px;
  font-size: .8125rem; font-weight: 700; line-height: 1.6; white-space: nowrap; max-width: 100%;
}
.badge-ok { background: var(--badge-ok-bg); color: var(--badge-ok-fg); }
.badge-warn { background: var(--badge-warn-bg); color: var(--badge-warn-fg); }
.badge-bad { background: var(--badge-bad-bg); color: var(--badge-bad-fg); }
.badge-info { background: var(--badge-info-bg); color: var(--badge-info-fg); }
.badge-muted { background: var(--badge-muted-bg); color: var(--badge-muted-fg); }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 10px; margin-bottom: 12px; }
.stat {
  display: flex; flex-direction: column; gap: .125rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 14px 12px; box-shadow: var(--shadow);
  border-top: 3px solid var(--brand-gray);
}
.stat-label { color: var(--muted); font-size: .875rem; }
.stat-value { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-hint { color: var(--muted); font-size: .8125rem; }
.stat { min-width: 0; overflow-wrap: anywhere; }
.stat-value-long { font-family: var(--font); font-size: 1.0625rem; line-height: 1.3; }
.stat-value-mid { font-size: 1.2rem; letter-spacing: -.01em; }

.todo, .menu { list-style: none; padding: 0; margin: 0 0 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.todo li + li, .menu li + li { border-top: 1px solid var(--line); }
.todo a, .menu a, .menu .btn {
  display: flex; align-items: center; gap: .5rem; width: 100%;
  min-height: 52px; padding: .75rem 1rem;
  color: var(--text); text-decoration: none; text-align: left; justify-content: flex-start;
  border-radius: 0; font-weight: 500;
}
.todo a::after, .menu a::after { content: "›"; margin-left: auto; color: var(--muted); font-size: 1.5rem; line-height: 1; }
.todo a:active, .menu a:active, .menu .btn:active { background: var(--surface-2); transform: none; }
.todo strong { color: var(--primary); font-size: 1.125rem; min-width: 1.5rem; }

.steps { padding-left: 1.5rem; }
.steps > li { margin-bottom: 1rem; padding-left: .25rem; }
.steps > li::marker { font-weight: 800; color: var(--primary); }
.enroll { display: flex; flex-direction: column; align-items: stretch; gap: .75rem; margin-top: .75rem; }
.enroll .qr { align-self: center; background: #ffffff; padding: 10px; border-radius: var(--radius-sm); border: 1px solid var(--line); }

/* ---------- Barra de abajo ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  min-height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding: 0 env(safe-area-inset-right, 0px) var(--safe-bottom) env(safe-area-inset-left, 0px);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-top: 1px solid var(--line);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: var(--tabbar-h);
  color: var(--muted); text-decoration: none; font-size: .8125rem; font-weight: 650;
}
.tab .icon { display: block; width: 52px; height: 30px; padding: 3px 13px; border-radius: 999px; transition: background-color .15s; }
.tab.active { color: var(--primary-ink); }
.tab.active .icon { stroke-width: 2.4; background: var(--primary-soft); }

/* ---------- Avisos, diálogos y carga ---------- */
.toasts {
  position: fixed; left: 0; right: 0; z-index: 50;
  bottom: calc(var(--tabbar-h) + 12px + var(--safe-bottom));
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 0 16px; pointer-events: none;
}
.toast {
  max-width: 34rem; width: fit-content;
  padding: .75rem 1rem; border-radius: 12px;
  background: var(--toast-bg); color: var(--toast-fg);
  font-weight: 600; box-shadow: 0 6px 24px rgb(0 0 0 / 25%);
  animation: rise .2s ease-out;
  pointer-events: auto;
}
.toast-error { background: var(--danger); color: var(--on-danger); }

.dialog {
  width: min(92vw, 28rem); padding: 20px;
  border: 1px solid var(--line); border-radius: 18px;
  background: var(--surface); color: var(--text);
  box-shadow: 0 12px 40px rgb(0 0 0 / 30%);
}
.dialog::backdrop { background: rgb(0 0 0 / 45%); }
.dialog > p { font-size: 1.0625rem; }
.dialog textarea { margin: .5rem 0 0; }
.dialog-actions { display: flex; gap: .75rem; justify-content: flex-end; margin-top: 1.25rem; }
.dialog-actions .btn { flex: 1; }

.loading { display: flex; align-items: center; justify-content: center; gap: .75rem; min-height: 50dvh; color: var(--muted); }
.spin {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--primary);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}

/* Pantallas anchas (tablet o computadora): la barra de abajo no ocupa todo el ancho. */
@media (min-width: 48rem) {
  .tabbar { left: 50%; right: auto; width: 40rem; transform: translateX(-50%); border: 1px solid var(--line); border-bottom: 0; border-radius: 18px 18px 0 0; }
}

/* ---------- Listas, fichas y filtros ---------- */
.row { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.row > h3, .row > p { margin: 0; }
.card-link { display: block; color: inherit; text-decoration: none; position: relative; }
.card-link:active { background: var(--surface-2); }
.card-link > p { margin: .25rem 0 0; }
.facts { display: grid; gap: .5rem; margin: .5rem 0 0; }
.facts > div { display: grid; grid-template-columns: 7.5rem 1fr; gap: .75rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.list { list-style: none; padding: 0; margin: 0 0 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.list > .item { display: flex; align-items: center; justify-content: space-between; gap: .75rem; min-height: 56px; padding: .625rem 1rem; }
.list > .item + .item { border-top: 1px solid var(--line); }
.list > .item > div { display: flex; flex-direction: column; min-width: 0; }
.list > .item > div > * { overflow-wrap: anywhere; }
.list > .item .btn { flex: none; min-height: 44px; }
.details { margin: 0 0 12px; }
.details > summary {
  display: flex; align-items: center; min-height: 48px; padding: .5rem 0;
  cursor: pointer; font-weight: 650; color: var(--link); list-style: none;
}
.details > summary::-webkit-details-marker { display: none; }
.details > summary::before { content: "▸"; display: inline-block; width: 1.25rem; transition: transform .15s; }
.details[open] > summary::before { transform: rotate(90deg); }
.segmented { display: flex; gap: 4px; padding: 4px; margin-bottom: 1rem; background: var(--surface-2); border-radius: 12px; }
.segmented a {
  flex: 1; display: flex; align-items: center; justify-content: center; min-height: 44px; padding: .25rem .5rem;
  border-radius: 9px; color: var(--muted); font-weight: 650; text-decoration: none; text-align: center; font-size: .9375rem;
}
.segmented a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.code-big { font-size: 1.75rem; text-align: center; margin: .75rem 0; user-select: all; -webkit-user-select: all; }
.stack { display: flex; flex-direction: column; gap: .625rem; margin: 1rem 0; }
.stack .btn { width: 100%; }
.nodata { font-weight: 700; color: var(--warn); }
.nodata .muted { font-weight: 400; }
.bad { color: var(--danger); }
.content > .segmented + .btn, .content > .segmented + a.btn { margin: 0 0 1rem; }
.facts a { display: inline-flex; align-items: center; min-height: 44px; margin: -12px 0; }

/* ---------- Reloj ---------- */
.clock { display: flex; flex-direction: column; gap: .75rem; }
.clock > p { margin: 0; }
.clock-state { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; font-weight: 650; }
.clock-big { font-size: 2.25rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; margin: .25rem 0; }
.clock .btn-ghost { align-self: center; }
.notice-line { background: var(--badge-info-bg); color: var(--badge-info-fg); padding: .625rem .875rem; border-radius: var(--radius-sm); font-weight: 600; }
.notice-bad { border-left-color: var(--danger); }
.notice-bad ul { margin: .25rem 0 .5rem; }
.item-end { display: flex; flex-direction: column; align-items: flex-end; gap: .25rem; flex: none; }
.weeknav { display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; gap: .5rem; margin-bottom: 1rem; text-align: center; font-weight: 700; }
.weeknav .btn { min-height: 48px; font-size: 1.75rem; padding: 0; }
.weeknav-spacer { width: 48px; }
.dialog-title { font-weight: 700; font-size: 1.125rem; }
.dialog-choices { display: flex; flex-direction: column; gap: .625rem; margin-top: 1rem; }

/* ---------- Recibos ---------- */
.receipt-preview { max-height: 240px; width: auto; align-self: flex-start; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.receipt-link { display: block; }
.receipt-img { display: block; width: 100%; max-height: 70vh; object-fit: contain; background: var(--surface-2); border-radius: var(--radius); border: 1px solid var(--line); }
.field input[type="file"] { min-height: 56px; background: var(--surface-2); }

/* ---------- Aprobar ---------- */
.item-check { align-items: flex-start; }
.item-check > input[type="checkbox"] { width: 24px; height: 24px; margin: .125rem 0 0; flex: none; accent-color: var(--primary); }
.item-check > label { display: flex; flex-direction: column; flex: 1; min-width: 0; gap: .125rem; cursor: pointer; }
.flags { display: flex; flex-wrap: wrap; gap: .375rem; margin-top: .25rem; }
.actions { display: flex; flex-wrap: wrap; gap: .625rem; margin-top: .75rem; }
.actions .btn { flex: 1 1 10rem; }
.dialog-wide { width: min(96vw, 40rem); }

.warn-line { background: var(--badge-warn-bg); color: var(--badge-warn-fg); padding: .5rem .75rem; border-radius: var(--radius-sm); font-weight: 650; font-size: .9375rem; }
.late-hours { margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--line); display: grid; gap: .5rem; }

/* ---------- Versión nueva ---------- */
.update-banner {
  position: fixed; left: 12px; right: 12px; z-index: 60;
  top: calc(8px + var(--safe-top));
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .625rem .75rem .625rem 1rem; border-radius: 14px;
  background: var(--toast-bg); color: var(--toast-fg); font-weight: 600;
  box-shadow: 0 6px 24px rgb(0 0 0 / 25%);
}

/* ---------- Fin del día: fotos y materiales ---------- */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.field:has(> .visually-hidden) { position: relative; }
label.btn { font-weight: 650; margin: 0; }
.field > label.btn { margin-bottom: 0; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr)); gap: 8px; margin: .75rem 0 0; }
.photo-thumb {
  position: relative; display: block; margin: 0; padding: 0; aspect-ratio: 1 / 1; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2);
}
button.photo-thumb { cursor: zoom-in; width: 100%; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-missing { display: flex; align-items: center; justify-content: center; font-size: .8125rem; color: var(--muted); text-align: center; padding: .5rem; }
.photo-remove {
  position: absolute; top: 4px; right: 4px; width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: rgb(0 0 0 / 60%); color: #ffffff; font-size: 1.5rem; line-height: 1; cursor: pointer;
}
.photo-day { margin-bottom: 1rem; }
.photo-day > h3 { font-size: .9375rem; color: var(--muted); margin: .5rem 0 0; }
.material-rows { display: flex; flex-direction: column; gap: .75rem; margin-bottom: .5rem; }
.material-row { display: flex; flex-direction: column; gap: .5rem; padding: .75rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.material-row-qty { display: grid; grid-template-columns: minmax(0, 6rem) minmax(0, 1fr) auto; gap: .5rem; align-items: center; }
.material-row input {
  width: 100%; min-width: 0; min-height: 48px; padding: .625rem .75rem;
  font: inherit; font-size: max(1rem, 16px); color: var(--text); background: var(--surface);
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm); appearance: none; -webkit-appearance: none;
}
.material-row input:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--focus); }
.steps-compact > li { margin-bottom: .375rem; }
.list > .item.item-stack { align-items: flex-start; }
.list > .item .flags .badge { white-space: normal; }
.list > .item.item-check > .btn { align-self: center; }
.item-check > .item-body { display: flex; flex-direction: column; align-items: flex-start; flex: 1; min-width: 0; gap: .125rem; }
.item-check > .item-body > label { display: flex; flex-direction: column; gap: .125rem; width: 100%; cursor: pointer; }
.list > .item .btn-inline { min-height: 40px; padding: .25rem 0; margin-top: .125rem; }
.list > .item > div > .btn-inline { align-self: flex-start; }

/* Geocerca: botones de una marca (aprobar con motivo, anular) debajo de su texto */
.list > .item.item-check { flex-wrap: wrap; }
.list > .item > .item-actions { flex: 1 0 100%; flex-direction: row; flex-wrap: wrap; gap: .5rem; padding-left: calc(24px + .75rem); }
.list > .item.item-wrap { flex-wrap: wrap; }
.list > .item > .item-actions.item-actions-flush { padding-left: 0; }
.site-status { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.checkin-state { margin: 0 0 .5rem; }
.abonos { margin-top: .5rem; }
.money-line { display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin: .25rem 0 .5rem; }

/* ---------- Marca: entrar, inicio y accesos rápidos ---------- */
.hero { display: flex; flex-direction: column; align-items: center; gap: .5rem; margin: .5rem 0 1.5rem; text-align: center; }
.hero-logo { display: block; width: min(72vw, 300px); height: auto; }
.hero-logo img { display: block; width: 100%; height: auto; }
.hero-tag { margin: 0; color: var(--muted); font-size: .9375rem; }
.screen-auth .content { max-width: 28rem; }
.screen-auth .form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }

.welcome {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  margin-bottom: 1.25rem; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
/* El arco del logo, de adorno. */
.welcome::after {
  content: ""; position: absolute; left: -10%; right: -10%; bottom: -46px; height: 60px;
  border-radius: 50% 50% 0 0 / 100% 100% 0 0; border-top: 6px solid var(--brand-dark); opacity: .18; pointer-events: none;
}
.welcome .lead { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; }
.welcome-date { margin: .125rem 0 0; color: var(--muted); font-size: .9375rem; }

.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.75rem, 1fr)); gap: 10px; margin-bottom: 12px; }
.tile {
  position: relative;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: .75rem;
  min-height: 96px; padding: 14px;
  color: var(--text); text-decoration: none; font-weight: 700; line-height: 1.25;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform .06s, box-shadow .15s;
}
.tile:active { transform: scale(.98); background: var(--surface-2); }
.tile .icon { width: 40px; height: 40px; padding: 8px; border-radius: 12px; background: var(--primary-soft); color: var(--primary-ink); }
.tile-main { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.tile-main .icon { background: rgb(255 255 255 / 18%); color: var(--on-primary); }
.tile-count {
  position: absolute; top: 10px; right: 10px;
  min-width: 28px; height: 28px; padding: 0 8px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary); color: var(--on-primary); font-size: .875rem; font-weight: 800;
}
.tile-main .tile-count { background: #ffffff; color: var(--primary-press); }

.todo strong {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 30px; padding: 0 8px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary-ink); font-size: .9375rem;
}
.menu a .icon, .menu .btn .icon { flex: none; width: 34px; height: 34px; padding: 6px; border-radius: 10px; background: var(--surface-2); color: var(--brand-gray); }
@media (prefers-color-scheme: dark) {
  .menu a .icon, .menu .btn .icon { color: var(--muted); }
}
.role-chip { background: var(--primary-soft); color: var(--primary-ink); }

/* Registro de horas y ganancias: filtros en dos columnas cuando caben */
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: .5rem .75rem; }
.filters > * { margin: 0; }

/* Avisos del día en la tarjeta de horas (lunch, limpieza y fotos) */
.reminders { display: flex; flex-direction: column; gap: .5rem; margin: .25rem 0 .5rem; }
.reminders:empty { display: none; }
.reminder { padding: .625rem .75rem; border-radius: var(--radius-sm); border: 1.5px solid var(--line-strong); background: var(--surface); line-height: 1.35; }
.reminder-warn { border-color: #d9a400; background: color-mix(in srgb, #ffd54f 22%, var(--surface)); }
.reminder-bad { border-color: var(--brand-red); background: color-mix(in srgb, #ff6b6b 18%, var(--surface)); }
.reminder-info { border-color: #2a7bd1; background: color-mix(in srgb, #7fb7ff 20%, var(--surface)); }

.bars { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 12px; }
.bar-head { display: flex; justify-content: space-between; gap: .75rem; font-variant-numeric: tabular-nums; }
.bar-track { -webkit-appearance: none; appearance: none; width: 100%; height: 10px; border: 0; border-radius: 999px; overflow: hidden; margin-top: 4px; background: var(--line); display: block; }
.bar-track::-webkit-progress-bar { background: var(--line); border-radius: 999px; }
.bar-track::-webkit-progress-value { background: var(--brand-gray); border-radius: 999px; }
.bar-track::-moz-progress-bar { background: var(--brand-gray); border-radius: 999px; }
.bar-hint { font-size: .8125rem; }

/* Panel de dinero: ganancia futura bien visible */
.item-total { border-top: 2px solid var(--line-strong); }
.future {
  display: flex; flex-direction: column; gap: .25rem; margin-top: 14px; padding: 16px;
  background: var(--surface-2); border: 2px solid var(--ok); border-radius: var(--radius);
}
.future-bad { border-color: var(--danger); }
.future-label { font-weight: 700; }
.future-value { font-family: var(--font-display); font-size: 2.25rem; font-variant-numeric: tabular-nums; line-height: 1.1; color: var(--ok); }
.future-bad .future-value { color: var(--danger); }
.future-math, .future-note { color: var(--muted); font-size: .875rem; }

/* Cumplimiento: fila con botones debajo */
.list > .item.item-col { flex-wrap: wrap; }
.item-col > div:first-child { flex: 1 1 100%; }
.item-col > .btn, .item-col > .row-actions { flex: 1 0 100%; }
.row-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.row-actions .btn { flex: 1 1 10rem; }

/* Botones de una marca: en una columna para que no se salgan de la pantalla */
.item-end .row-actions { flex-direction: column; align-items: stretch; width: 100%; }
.item-end .row-actions .btn { flex: none; }
/* Enlaces de aviso (p. ej. "Aprobar horas") con tamaño táctil */
.warn-line a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 .5rem; font-weight: 700; }

/* Elegir fotos para descargar */
.photo-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.photo-controls .hint { flex-basis: 100%; margin: 0; }
.photo-thumb.photo-selected { outline: 4px solid var(--accent, #c00); outline-offset: -4px; }
.photo-thumb.photo-selected::after { content: '✓'; position: absolute; top: 6px; right: 6px; background: var(--accent, #c00); color: #fff; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; }
.photo-thumb { position: relative; }

.photo-big { touch-action: pan-y; max-height: 65vh; object-fit: contain; }
.photo-nav { display: flex; gap: 8px; justify-content: space-between; margin: 8px 0; }
.photo-nav .btn { flex: 1; }

/* Panel del negocio: siempre oscuro, para verlo mejor. */
.screen.dash {
  --bg: #0b1220; --surface: #111a2c; --surface-2: #17233a; --text: #f1f5f9; --muted: #a8b3c4; --line: #26334d; --line-strong: #8794ab;
  --link: #8ab4ff; --ok: #86efac; --warn: #fcd34d; --danger: #ff8a80;
  background: var(--bg); color: var(--text); color-scheme: dark;
}
.dash .kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
@media (min-width: 720px) { .dash .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kpi-label { color: var(--muted); font-size: .8125rem; }
.kpi-value { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi-value-mid { font-size: 1.25rem; }
.kpi-sub { color: var(--muted); font-size: .8125rem; }
.kpi-good { color: #86efac; }
.kpi-bad { color: #ff8a80; }
.bar-row { margin: 8px 0; }
.bar-head { display: flex; justify-content: space-between; gap: 8px; font-size: .875rem; color: var(--muted); }
.bar-head strong { color: var(--text); font-variant-numeric: tabular-nums; }
.bar { height: 10px; border-radius: 5px; background: #1e2b45; overflow: hidden; margin-top: 4px; }
.bar-fill { display: block; height: 100%; border-radius: 5px; }
.bar-coll { background: #60a5fa; }
.bar-spent { background: #fbbf24; }
.bar-over { background: #ff8a80; }
.proj-rest { font-weight: 700; margin: 8px 0 0; font-variant-numeric: tabular-nums; }
.dash .cards { display: grid; gap: 10px; }
.w-0 { width: 0%; }
.w-5 { width: 5%; }
.w-10 { width: 10%; }
.w-15 { width: 15%; }
.w-20 { width: 20%; }
.w-25 { width: 25%; }
.w-30 { width: 30%; }
.w-35 { width: 35%; }
.w-40 { width: 40%; }
.w-45 { width: 45%; }
.w-50 { width: 50%; }
.w-55 { width: 55%; }
.w-60 { width: 60%; }
.w-65 { width: 65%; }
.w-70 { width: 70%; }
.w-75 { width: 75%; }
.w-80 { width: 80%; }
.w-85 { width: 85%; }
.w-90 { width: 90%; }
.w-95 { width: 95%; }
.w-100 { width: 100%; }

.photo-thumb.photo-shared::before { content: 'Cliente'; position: absolute; left: 6px; bottom: 6px; background: #1a7f37; color: #fff; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 700; z-index: 1; }

.tap-row { cursor: pointer; flex: 1; min-width: 0; }
.tap-row:focus-visible { outline: 3px solid var(--accent, #c00); outline-offset: 2px; border-radius: 6px; }
.pair { display: flex; gap: 8px; } .pair > .btn { flex: 1; min-width: 0; }

/* Videos del trabajo (opcionales) */
.photo-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.photo-play { position: absolute; left: 6px; top: 6px; background: rgba(0,0,0,.7); color: #fff; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 700; z-index: 1; pointer-events: none; }
.photo-stage { display: grid; justify-items: center; }
.photo-stage video { max-width: 100%; }
.check-line{display:flex;gap:8px;align-items:center;min-height:44px}
