:root {
  --navy: #103068;
  --navy-deep: #0b2248;
  --green: #0b8a58;
  --mint: #d8f3e4;
  --lime: var(--green);
  --lime-deep: #005a36;
  --ink: #0b1c30;
  --ink-soft: #24344a;
  --muted: #3a4250;
  --paper: #f4faf7;
  --cream: #eef3ee;
  --card: #ffffff;
  --line: #d5e6dc;
  --ok: #1b6b3a;
  --ok-bg: #e7f6ec;
  --warn: #8a5a00;
  --warn-bg: #fff4d6;
  --bad: #9b2c2c;
  --bad-bg: #fdecec;
  --shadow: 0 10px 30px rgba(0, 37, 92, 0.08);
  --font: "Avenir Next", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  padding-bottom: env(safe-area-inset-bottom);
}
@media (hover: none) {
  body { -webkit-tap-highlight-color: rgba(16, 52, 110, 0.12); }
}
a { color: inherit; }
button, input, select, textarea { font: inherit; }
:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }
.wrap { width: min(46rem, calc(100% - 32px)); margin: 0 auto; padding: 20px 0 56px; }
.wrap.wide { width: min(72rem, calc(100% - 32px)); }
.brand { display: flex; gap: 10px; align-items: center; font-weight: 750; letter-spacing: -0.04em; margin-bottom: 18px; }
.logo-lockup {
  height: 64px;
  width: auto;
  aspect-ratio: 2.47;
  object-fit: fill;
  object-view-box: inset(34% 10% 35% 13%);
  display: block;
  flex: none;
}
.mark { width: 36px; height: 46px; object-fit: contain; display: block; flex: none; }
h1 { font-size: 1.7rem; letter-spacing: -0.04em; margin: 0 0 8px; color: var(--navy); }
.product-list {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: var(--paper);
}
.product-list li {
  padding: 10px 14px;
  font-weight: 700;
  color: var(--navy);
  border-bottom: 1px solid var(--line);
}
.product-list li:last-child { border-bottom: 0; }
.offer-line {
  margin: 0 0 14px;
  padding: 10px 14px 2px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
}
.offer-line legend {
  font-weight: 800;
  color: var(--navy);
  padding: 0 6px;
}
.pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
h2 { font-size: 1.15rem; letter-spacing: -0.03em; margin: 28px 0 12px; color: var(--navy); }
.lede, .muted { color: var(--ink-soft); }
.card, .panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
  box-shadow: var(--shadow);
}
label { display: block; font-weight: 650; font-size: 0.92rem; margin-bottom: 12px; }
label > input, label > textarea, label > select { margin-top: 6px; }
input, textarea, select {
  width: 100%;
  height: 48px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
}
textarea { height: auto; min-height: 76px; padding: 10px 12px; }
input[type="checkbox"] { width: 1.15rem; height: 1.15rem; }
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  height: 48px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--green);
  color: #fff;
  font-weight: 750;
  cursor: pointer;
  text-decoration: none;
  touch-action: manipulation;
}
button.secondary, .btn.secondary { background: #fff; color: var(--navy); border: 1.5px solid var(--line); }
button.lime, .btn-lime { background: var(--green); color: #fff; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.err, .banner.bad { color: var(--bad); background: var(--bad-bg); border-radius: 12px; padding: 12px 14px; }
.ok, .banner { color: var(--ok); background: var(--ok-bg); border-radius: 12px; padding: 12px 14px; }
.pin-banner { background: var(--warn-bg); color: var(--ink); border-radius: 16px; padding: 16px; margin: 12px 0 18px; }
.pin-banner strong { font-size: 1.6rem; letter-spacing: 0.08em; }
.list { display: grid; gap: 8px; }
.row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
}
.row small { color: var(--muted); }
.badge {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--paper);
  font-size: 0.78rem;
  font-weight: 750;
}
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
nav.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
nav.tabs a {
  text-decoration: none;
  font-weight: 700;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
}
.kicker {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.receipt-photo {
  display: block;
  width: 100%;
  max-height: min(70vh, 640px);
  object-fit: contain;
  border-radius: 12px;
  background: #0b1c30;
  margin: 8px 0 16px;
}
.clock { font-variant-numeric: tabular-nums; font-weight: 750; font-size: 1.4rem; }
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 16px; font-size: 0.82rem; font-weight: 700; }
.steps span { text-align: center; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 8px 6px; color: var(--muted); white-space: nowrap; }
.steps .on { color: #fff; background: var(--navy); border-color: var(--navy); }
.form-card { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; margin-bottom: 8px; }
.form-card label { margin-bottom: 8px; }
/* minmax(0, 1fr): sin él, el ancho intrínseco de los chips de días infla la
   columna del grid y TODOS los inputs del formulario sangran fuera de la
   tarjeta. En teléfonos angostos eso corta el formulario contra el borde. */
.days { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.days label { justify-content: center; margin: 0; min-height: 44px; }
.gps { font-variant-numeric: tabular-nums; color: var(--muted); margin: 0 0 14px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0 0 8px; }
.topbar form { margin: 0; }
.topbar strong { font-size: 1.05rem; }
.req { color: var(--bad); }
fieldset.hours { border: 1px solid var(--line); border-radius: 14px; margin: 0 0 12px; padding: 12px; }
fieldset.hours legend { font-weight: 700; padding: 0 6px; }
.days label { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 650; }
.days input { width: auto; height: auto; }
.hours-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.slot-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 0 0 8px; }
.slot-head strong { font-size: 0.85rem; color: var(--muted); }
.slot-head button { height: 34px; min-height: 34px; padding: 0 12px; font-size: 0.8rem; }
.hours-slot { border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 10px; }
.hours-slot .days { margin-bottom: 8px; }
#add-hours { width: 100%; }
.hours-hint { color: var(--muted); font-size: 0.85rem; margin: 6px 0 10px; }
.field-note { min-height: 1.2em; margin: -6px 0 12px; font-size: 0.85rem; color: var(--muted); }
.field-note.bad { color: var(--bad); }
.live { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.85rem; }
details summary { cursor: pointer; font-weight: 700; }
@media (max-width: 720px) {
  .row { align-items: flex-start; flex-direction: column; }
}

.console {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 232px 1fr;
  background: var(--paper);
}
.side {
  background: var(--navy);
  color: #f7f8f4;
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.side .brand { color: #fff; margin: 0 8px 18px; flex-direction: row; align-items: center; gap: 10px; flex-wrap: wrap; }
.side .brand .side-name { font-size: 1.25rem; letter-spacing: -0.04em; }
.side .brand .side-kicker { color: #b7ebc9; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; margin: 0; width: 100%; }
.side button.tab,
.side .logout button {
  width: 100%;
  height: 42px;
  justify-content: flex-start;
  border-radius: 10px;
  background: transparent;
  color: #d7e0da;
  font-weight: 650;
  padding: 0 12px;
}
.side button.tab.on { background: var(--green); color: #fff; }
.side .logout { margin-top: auto; }
.side .logout button {
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
}
.stage { padding: 28px 32px 48px; min-width: 0; }
.stage-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; margin-bottom: 18px; }
.stage-head h1 { font-size: 1.8rem; }
.stage-head p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.panel { display: none; }
.panel.on { display: block; }
.console .panel {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}
.console .panel > * + * { margin-top: 16px; }
.data {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.data th, .data td { text-align: left; padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data th { font-size: 0.72rem; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); font-weight: 700; background: #f4faf6; }
.data thead th:first-child { border-top-left-radius: 19px; }
.data thead th:last-child { border-top-right-radius: 19px; }
.data tr:last-child td:first-child { border-bottom-left-radius: 19px; }
.data tr:last-child td:last-child { border-bottom-right-radius: 19px; }
.data tr:last-child td { border-bottom: 0; }
.data .actions { justify-content: flex-end; }
.data form { margin: 0; }
.data button, .data .btn { height: 34px; padding: 0 12px; font-size: 0.82rem; }
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--paper);
}
.login-panel {
  width: min(100%, 420px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.login-panel .brand { margin-bottom: 22px; }
.login-panel h1 { font-size: 2rem; margin-bottom: 8px; }
.login-panel p { color: #314039; margin: 0 0 18px; }
.login-panel button { width: 100%; }
@media (max-width: 860px) {
  .console, .login-screen { grid-template-columns: 1fr; }
  .side {
    position: sticky;
    top: 0;
    z-index: 4;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    overflow: visible;
    padding: 10px 12px;
    padding-top: max(10px, env(safe-area-inset-top));
    -webkit-overflow-scrolling: touch;
  }
  .side .brand { display: flex; margin: 0 4px 0 0; flex: none; }
  .side .brand .side-kicker, .side .brand .side-name { display: none; }
  .side .logout { display: flex; margin: 0 0 0 auto; flex: none; }
  .side .logout button { width: auto; min-height: 44px; height: 44px; padding: 0 14px; }
  .side button.tab { width: auto; flex: 1 1 auto; min-height: 44px; height: 44px; }
  .stage { padding: 16px 14px calc(28px + env(safe-area-inset-bottom)); }
  .data { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
@media (max-width: 720px) {
  .wrap { width: min(46rem, calc(100% - 24px)); padding: 16px 0 calc(28px + env(safe-area-inset-bottom)); }
  h1 { font-size: 1.45rem; }
  input, textarea, select { height: 52px; font-size: 1rem; }
  textarea { height: auto; min-height: 76px; }
  #gps, #save, .login-panel button { width: 100%; height: 52px; margin-top: 8px; }
  .sticky-actions {
    position: sticky;
    bottom: 0;
    z-index: 3;
    background: linear-gradient(transparent, var(--paper) 18px);
    margin: 8px -18px -18px;
    padding: 18px 18px calc(12px + env(safe-area-inset-bottom));
    gap: 10px;
  }
  .sticky-actions button { flex: 1; height: 52px; min-width: 0; }
  .days label { min-height: 44px; padding: 8px 10px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
  .pin-banner strong { font-size: 2rem; }
  .clock { font-size: 1.7rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
