/* ══════════════════════════════════════════════════════════════════════
   BlissClock — Bliss Birth Center staff time clock
   ──────────────────────────────────────────────────────────────────────
   Brand palette sourced from the Bliss Birth Center web platform
   (bliss-mobile POC). If the brand refreshes, swap ONLY the variables
   in this :root block — everything downstream derives from them.
   ══════════════════════════════════════════════════════════════════════ */
:root {
  --bliss-primary: #2f6f7e;        /* calm teal — headers, clock-in */
  --bliss-primary-dark: #24545f;
  --bliss-secondary: #f6c6a7;      /* warm peach — accents */
  --bliss-accent: #88b3a4;         /* sage green — success states */
  --bliss-bg: #fff7f1;             /* soft cream — page background */
  --bliss-ink: #2b3a40;            /* body text */
  --bliss-ink-soft: #5c6f76;
  --bliss-card: #ffffff;
  --bliss-line: #f0e2d6;
  --bliss-out: #c96f4a;            /* terracotta — clock-out, warnings */
  --bliss-danger: #b3423a;
  --bliss-shadow: 0 10px 30px rgba(47, 111, 126, 0.12);
  --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius: 18px;
  --tap: 64px;                     /* minimum tap target */
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.5;
  color: var(--bliss-ink);
  background: var(--bliss-bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; color: var(--bliss-primary-dark); margin: 0; }

.shell { max-width: 480px; margin: 0 auto; padding: 16px 16px 48px; }
.shell.wide { max-width: 1100px; }

/* ── Header ─────────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 4px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, var(--bliss-secondary), var(--bliss-primary));
  display: grid; place-items: center; color: #fff;
  font-family: var(--font-display); font-size: 22px; flex-shrink: 0;
}
.brand-name { font-family: var(--font-display); font-size: 22px; color: var(--bliss-primary-dark); line-height: 1.1; }
.brand-sub { font-size: 12px; color: var(--bliss-ink-soft); letter-spacing: 0.08em; text-transform: uppercase; }

/* ── Cards & layout ─────────────────────────────────────────────────── */
.card {
  background: var(--bliss-card); border-radius: var(--radius);
  box-shadow: var(--bliss-shadow); padding: 20px; margin-top: 16px;
  border: 1px solid var(--bliss-line);
}
.center { text-align: center; }
.muted { color: var(--bliss-ink-soft); font-size: 14px; }
.spacer { flex: 1; }

/* ── Buttons ────────────────────────────────────────────────────────── */
button { font-family: var(--font-body); cursor: pointer; }

.btn {
  min-height: var(--tap); padding: 14px 22px; border-radius: 14px;
  border: none; font-size: 18px; font-weight: 600;
  background: var(--bliss-primary); color: #fff;
  transition: transform 0.06s ease, opacity 0.15s ease;
  touch-action: manipulation;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.secondary { background: #fff; color: var(--bliss-primary-dark); border: 2px solid var(--bliss-primary); }
.btn.ghost { background: transparent; color: var(--bliss-ink-soft); border: none; min-height: 48px; font-weight: 500; }
.btn.danger { background: var(--bliss-danger); }
.btn.block { display: block; width: 100%; }

/* ── PIN keypad ─────────────────────────────────────────────────────── */
.pin-dots { display: flex; justify-content: center; gap: 14px; min-height: 22px; margin: 18px 0 8px; }
.pin-dot {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--bliss-primary); background: transparent;
}
.pin-dot.filled { background: var(--bliss-primary); }

.keypad {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  max-width: 320px; margin: 18px auto 0;
}
.key {
  min-height: 72px; font-size: 28px; font-weight: 500;
  border-radius: 16px; border: 1px solid var(--bliss-line);
  background: #fff; color: var(--bliss-ink);
  box-shadow: 0 2px 6px rgba(47, 111, 126, 0.08);
  touch-action: manipulation;
}
.key:active { background: var(--bliss-bg); transform: scale(0.97); }
.key.action { font-size: 20px; color: var(--bliss-ink-soft); box-shadow: none; background: transparent; border: none; }
.key.go { background: var(--bliss-primary); color: #fff; border: none; font-size: 22px; }

/* ── Punch screen ───────────────────────────────────────────────────── */
.status-banner { border-radius: 14px; padding: 14px 18px; margin-top: 16px; font-weight: 600; text-align: center; }
.status-banner.in { background: rgba(136, 179, 164, 0.22); color: #2c5647; }
.status-banner.out { background: rgba(246, 198, 167, 0.35); color: #7c4a2d; }

.punch-btn {
  width: 230px; height: 230px; border-radius: 50%; border: none;
  margin: 26px auto 10px; display: grid; place-items: center;
  font-size: 30px; font-weight: 700; color: #fff; line-height: 1.2;
  font-family: var(--font-display);
  box-shadow: 0 16px 40px rgba(47, 111, 126, 0.35);
  touch-action: manipulation;
  transition: transform 0.08s ease;
}
.punch-btn:active { transform: scale(0.96); }
.punch-btn:disabled { opacity: 0.6; }
.punch-btn.in { background: radial-gradient(circle at 32% 28%, #43899a, var(--bliss-primary-dark)); }
.punch-btn.out { background: radial-gradient(circle at 32% 28%, #db8a63, var(--bliss-out)); box-shadow: 0 16px 40px rgba(201, 111, 74, 0.35); }
.punch-sub { font-family: var(--font-body); font-size: 14px; font-weight: 400; opacity: 0.9; }

/* ── Punch history ──────────────────────────────────────────────────── */
.period-chip {
  display: inline-block; background: rgba(47, 111, 126, 0.1);
  color: var(--bliss-primary-dark); border-radius: 999px;
  padding: 6px 14px; font-size: 13px; font-weight: 600;
}
.punch-list { list-style: none; margin: 12px 0 0; padding: 0; }
.punch-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 10px; border-bottom: 1px solid var(--bliss-line);
  border-radius: 10px;
}
.punch-row.current { background: rgba(246, 198, 167, 0.16); }
.punch-type {
  width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff;
}
.punch-type.in { background: var(--bliss-accent); }
.punch-type.out { background: var(--bliss-out); }
.punch-when { font-weight: 600; }
.punch-where { font-size: 13px; color: var(--bliss-ink-soft); overflow-wrap: anywhere; }
.flag {
  display: inline-block; font-size: 11px; font-weight: 700;
  background: rgba(179, 66, 58, 0.12); color: var(--bliss-danger);
  border-radius: 6px; padding: 2px 7px; margin-left: 6px; vertical-align: middle;
}
.flag.soft { background: rgba(92, 111, 118, 0.12); color: var(--bliss-ink-soft); }

/* ── Toast ──────────────────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--bliss-ink); color: #fff; padding: 14px 22px;
  border-radius: 12px; font-size: 15px; max-width: 90vw; text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25); z-index: 60;
  opacity: 0; pointer-events: none; transition: opacity 0.25s ease;
}
.toast.show { opacity: 1; }
.toast.error { background: var(--bliss-danger); }

/* ── Forms ──────────────────────────────────────────────────────────── */
label { display: block; font-size: 14px; font-weight: 600; color: var(--bliss-ink-soft); margin: 12px 0 4px; }
input, select, textarea {
  width: 100%; min-height: 52px; padding: 10px 14px; font-size: 16px;
  font-family: var(--font-body); color: var(--bliss-ink);
  border: 1.5px solid var(--bliss-line); border-radius: 12px; background: #fff;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible {
  outline: 3px solid rgba(47, 111, 126, 0.4); outline-offset: 1px;
}

/* ── Admin ──────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 8px; margin-top: 16px; }
.tab {
  min-height: 52px; padding: 10px 20px; border-radius: 999px;
  border: 1.5px solid var(--bliss-line); background: #fff;
  font-size: 16px; font-weight: 600; color: var(--bliss-ink-soft);
}
.tab.active { background: var(--bliss-primary); border-color: var(--bliss-primary); color: #fff; }

.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filters > div { flex: 1 1 150px; }
.filters label { margin-top: 0; }

.table-wrap { overflow-x: auto; margin-top: 14px; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--bliss-ink-soft); padding: 10px 12px; border-bottom: 2px solid var(--bliss-line);
  white-space: nowrap;
}
td { padding: 12px; border-bottom: 1px solid var(--bliss-line); vertical-align: top; }
tr.voided td { opacity: 0.45; text-decoration: line-through; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: rgba(47, 111, 126, 0.05); }

.pill { display: inline-block; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; }
.pill.in { background: rgba(136, 179, 164, 0.25); color: #2c5647; }
.pill.out { background: rgba(201, 111, 74, 0.18); color: #7c4a2d; }
.pill.admin { background: rgba(47, 111, 126, 0.14); color: var(--bliss-primary-dark); }
.pill.inactive { background: rgba(92, 111, 118, 0.14); color: var(--bliss-ink-soft); }

/* ── Modal ──────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(43, 58, 64, 0.5);
  display: none; align-items: flex-end; justify-content: center; z-index: 50;
  padding: 0;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff; border-radius: 20px 20px 0 0; width: 100%; max-width: 560px;
  max-height: 88vh; overflow-y: auto; padding: 22px 20px 30px;
}
.modal h3 { margin-bottom: 4px; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.modal-actions .btn { flex: 1 1 140px; }

.audit-list { list-style: none; margin: 10px 0 0; padding: 0; font-size: 14px; }
.audit-list li { padding: 10px 0; border-bottom: 1px solid var(--bliss-line); }

@media (min-width: 700px) {
  .modal-backdrop { align-items: center; padding: 24px; }
  .modal { border-radius: 20px; }
}

/* Larger phones / desktop refinements */
@media (min-width: 480px) {
  .shell { padding-top: 24px; }
}
