/* MyTurnPick — calm, simple, easy to the eyes. Navy + teal (brand). */

:root {
  --navy: #16283f;
  --navy-dark: #0f1d30;
  --teal: #1f9e87;
  --teal-dark: #177965;
  --ink: #22302c;
  --muted: #6b7a75;
  --line: #e2e8e5;
  --bg: #f7f9f8;
  --card: #ffffff;
  --red-bg: #fdecea;
  --red-ink: #9c2b21;
  --gold-bg: #fff6da;
  --gold-ink: #7a5c00;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
h2 { font-size: 22px; margin: 10px 0 14px; }
h3 { font-size: 16px; margin: 0 0 10px; }
.stack { margin-top: 22px; }
.note { font-size: 14px; color: var(--muted); margin: 6px 0 12px; }


.error { font-size: 14px; color: var(--red-ink); margin: 0 0 12px; }

/* ---------- auth ---------- */

.auth-wrap { min-height: 100vh; display: flex; align-items: flex-start; justify-content: center; padding: 32px 16px; }
.auth-card { max-width: 420px; width: 100%; text-align: center; }
.auth-logo { width: 96px; height: 96px; border-radius: 22px; }
.auth-card h1 { color: var(--navy); font-size: 30px; margin: 12px 0 4px; }
.tagline { color: var(--muted); font-size: 15px; line-height: 1.5; margin: 0 0 20px; }
.auth-card form { text-align: left; }

/* ---------- header ---------- */

.app-header {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 640px; margin: 0 auto; padding: 14px 16px 4px;
}
.brand {
  display: flex; align-items: center; gap: 10px; background: none; border: none;
  font: inherit; font-size: 19px; font-weight: 700; color: var(--navy); cursor: pointer; padding: 0;
}
.brand-icon { width: 34px; height: 34px; border-radius: 8px; }
.header-actions { display: flex; gap: 4px; align-items: center; }

main { max-width: 640px; margin: 0 auto; padding: 8px 16px 60px; }

/* ---------- cards, lists, rows ---------- */

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-bottom: 12px;
}
.list { display: flex; flex-direction: column; gap: 10px; }
.row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; min-height: 60px; font: inherit; color: inherit;
}
button.row { cursor: pointer; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-name { font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 13px; color: var(--muted); }
.row.mine { border-color: var(--teal); background: #eefaf7; }
.empty { color: var(--muted); font-size: 15px; padding: 12px 4px; }

.pill {
  flex: none; font-size: 12px; font-weight: 700; border-radius: 999px;
  padding: 3px 9px; background: #e6efec; color: var(--teal-dark); white-space: nowrap;
}
.pill.gold { background: var(--gold-bg); color: var(--gold-ink); }
.pill.navy { background: var(--navy); color: #fff; }

/* ---------- forms & buttons ---------- */

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field input[type="text"], .field input[type="email"], .field input[type="password"],
.field input[type="date"], .field select, .field textarea,
.inline-form input, .inline-form select {
  width: 100%; font: inherit; font-size: 16px; padding: 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card);
  color: var(--ink); min-height: 48px;
}
.field textarea { resize: vertical; }
.checkline { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; margin: 4px 0 16px; }
.checkline input { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.inline-form { display: flex; gap: 8px; margin-top: 10px; }
.inline-form input, .inline-form select { flex: 1; min-height: 48px; }

.btn {
  font: inherit; font-size: 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); padding: 13px 18px; min-height: 50px;
  cursor: pointer; width: 100%; margin-bottom: 10px;
}
.btn-primary { background: var(--teal); border-color: var(--teal); color: #fff; font-weight: 600; }
.btn-secondary { background: #eef4f2; }
.btn-quiet { background: transparent; border-color: transparent; color: var(--teal-dark); }
.btn-danger { background: transparent; border-color: #f3c6c0; color: var(--red-ink); }
.btn-navy { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 600; }
.btn-small { width: auto; min-height: 44px; padding: 9px 14px; margin-bottom: 0; white-space: nowrap; }
.btn.back { width: auto; padding-left: 0; margin-bottom: 4px; }
.btn:disabled { opacity: 0.45; cursor: default; }

.chips { display: flex; gap: 8px; margin: 6px 0 16px; justify-content: center; }
.chip {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 999px; padding: 9px 16px; font-size: 15px; min-height: 40px; cursor: pointer;
}
.chip.active { background: var(--navy); border-color: var(--navy); color: #fff; }

/* ---------- group view ---------- */

.group-head h2 { margin-bottom: 2px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 10px 0 16px; overflow-x: auto; }
.tab {
  flex: 1; font: inherit; font-size: 15px; font-weight: 600; background: none; border: none;
  color: var(--muted); min-height: 46px; cursor: pointer; white-space: nowrap; padding: 0 8px;
}
.tab.active { color: var(--navy); box-shadow: inset 0 -3px 0 var(--teal); }

.turnbar {
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px;
  background: var(--navy); color: #fff; font-size: 16px;
}
.turnbar.mine { background: var(--teal-dark); }
.turnbar .sub { font-size: 13px; opacity: 0.85; margin-top: 2px; }
.turnbar .actions { display: flex; gap: 8px; margin-top: 10px; }
.turnbar .actions .btn { margin-bottom: 0; }

.order-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.order-list .pill.done { background: #dfe7e3; color: var(--muted); text-decoration: line-through; }
.order-list .pill.now { background: var(--teal); color: #fff; }

#wheelBox { text-align: center; }
#wheelCanvas { max-width: 100%; height: auto; }

/* ---------- dates calendar ---------- */

.cal-month { margin-bottom: 16px; }
.cal-month h4 { margin: 0 0 8px; font-size: 15px; color: var(--navy); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-grid .dow { font-size: 11px; color: var(--muted); text-align: center; padding: 2px 0; }
.cal-day {
  font: inherit; font-size: 14px; min-height: 40px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; padding: 0;
}
.cal-day.picked { background: var(--teal); border-color: var(--teal); color: #fff; font-weight: 700; }
.cal-day.past { opacity: 0.35; cursor: default; }
.cal-day.blank { border: none; background: transparent; cursor: default; }

/* ---------- squares ---------- */

.sq-wrap { overflow-x: auto; padding-bottom: 8px; }
.sq-grid { display: grid; grid-template-columns: 34px repeat(10, minmax(46px, 1fr)); gap: 3px; min-width: 560px; }
.sq-head {
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
  color: var(--navy); min-height: 34px;
}
.sq-cell {
  min-height: 46px; border: 1px solid var(--line); border-radius: 8px; background: var(--card);
  font-size: 11px; line-height: 1.25; padding: 3px; overflow: hidden; text-align: center;
  display: flex; align-items: center; justify-content: center; word-break: break-word;
}
button.sq-cell { cursor: pointer; font-family: inherit; color: var(--ink); }
.sq-cell.claimed { background: #eef4f2; font-weight: 600; }
.sq-cell.winner { background: var(--gold-bg); border-color: #ecd98f; }
.sq-legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); margin: 8px 0; flex-wrap: wrap; }

/* ---------- record ---------- */

.record-event { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.record-event time { color: var(--muted); white-space: nowrap; font-size: 13px; }
.trophy { font-size: 15px; padding: 8px 0; border-bottom: 1px solid var(--line); }

@media print {
  .no-print, .tabs, .btn, .app-header, form { display: none !important; }
  body.print-no-events #eventsSection { display: none !important; }
  body { background: #fff; }
  main { max-width: none; }
  .tabpane.hidden { display: none !important; }
}

/* Password eyes (ported from OnCallPick): addPasswordEyes() wraps
   every password input in .pwwrap and parks the eye button at the
   field's right end. The input gains room on the right so text
   never slides under the eye; the eye itself is quiet — no border,
   no fill — until tapped. Placed last so its padding wins. */
.pwwrap { position: relative; display: block; }
.field .pwwrap > input { padding-right: 52px; }
.pweye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: 0; border-radius: 8px; padding: 8px;
  color: var(--muted); cursor: pointer; line-height: 0; margin: 0; min-height: 0;
}
.pweye:hover { color: var(--ink); }
.pweye svg { display: block; }
