:root {
  --bg: #f4f5f4;
  --card: #ffffff;
  --ink: #1a1a19;
  --muted: #6b6b66;
  --line: #e3e3df;
  --teal: #1d9e75;
  --teal-ink: #0f6e56;
  --teal-bg: #e1f5ee;
  --red: #d03b3b;
  --red-ink: #a32d2d;
  --red-bg: #fcebeb;
  --accent: #185fa5;
  --accent-bg: #e6f1fb;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  padding-bottom: 32px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) 18px 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { margin: 0; font-size: 20px; font-weight: 600; }
.topbar p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }

.icon-btn {
  width: 40px; height: 40px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 12px;
  font-size: 20px; color: var(--ink);
  display: flex; align-items: center; justify-content: center;
}
.icon-btn:active { transform: scale(0.94); }

.summary {
  display: flex;
  gap: 8px;
  padding: 14px 18px 4px;
  flex-wrap: wrap;
}
.chip {
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
}
.chip.ok { color: var(--teal-ink); background: var(--teal-bg); border-color: transparent; }
.chip.no { color: var(--red-ink); background: var(--red-bg); border-color: transparent; }
.chip.pend { color: var(--muted); }

.list { padding: 8px 14px; display: flex; flex-direction: column; gap: 10px; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}
.card.done { opacity: 0.62; }
.card.now { border: 2px solid var(--accent); }

.row { display: flex; align-items: center; gap: 12px; }
.hora { min-width: 52px; text-align: center; }
.hora b { display: block; font-size: 16px; font-weight: 600; }
.hora small { font-size: 11px; color: var(--accent); }
.who { flex: 1; min-width: 0; }
.who b { display: block; font-size: 16px; font-weight: 500; }
.who span { font-size: 13px; color: var(--muted); }

.pill {
  font-size: 13px; font-weight: 500;
  padding: 6px 12px; border-radius: 999px; white-space: nowrap;
}
.pill.ok { color: var(--teal-ink); background: var(--teal-bg); }
.pill.no { color: var(--red-ink); background: var(--red-bg); }

.actions { display: flex; gap: 8px; margin-top: 12px; }
.btn {
  flex: 1; height: 46px;
  border: none; border-radius: 12px;
  font-size: 15px; font-weight: 600;
}
.btn:active { transform: scale(0.97); }
.btn.llego { flex: 2; background: var(--teal); color: #fff; }
.btn.no { background: transparent; color: var(--red-ink); border: 1px solid var(--red); }

.undo {
  margin-top: 10px; width: 100%;
  background: none; border: none; color: var(--muted);
  font-size: 13px; text-decoration: underline; padding: 4px;
}

.gate {
  position: fixed; inset: 0; z-index: 50;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
/* `.gate { display:flex }` le gana al atributo `hidden`; esta regla lo corrige. */
.gate[hidden] { display: none; }
.gate-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 24px; width: 100%; max-width: 320px;
  text-align: center;
}
.gate-card h1 { margin: 0 0 6px; font-size: 20px; }
.gate-card p { margin: 0 0 16px; color: var(--muted); font-size: 14px; }
.gate-card input {
  width: 100%; height: 48px; text-align: center; font-size: 20px;
  border: 1px solid var(--line); border-radius: 12px; margin-bottom: 12px;
}
.gate-card button {
  width: 100%; height: 48px; border: none; border-radius: 12px;
  background: var(--teal); color: #fff; font-size: 16px; font-weight: 600;
}
.pin-error { color: var(--red-ink) !important; margin: 12px 0 0 !important; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 18px;
  border-radius: 999px; font-size: 14px; z-index: 40;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
}
