:root {
  /* Light theme. Teal is darkened from the Plotd accent so it clears
     contrast on white for both text and borders. */
  --paper: #fafaf9;
  --panel: #ffffff;
  --panel-2: #f3f4f6;
  --line: #e2e5ea;
  --line-soft: #eef0f3;
  --ink: #14161a;
  --steel: #6b7280;
  --teal: #0d8f8b;
  --teal-ink: #0a6f6c;
  --teal-dim: rgba(13, 143, 139, 0.09);
  --copper: #a35f1d;
  --amber: #a06a0c;
  --amber-dim: rgba(160, 106, 12, 0.1);
  --danger: #c22f3d;
  --danger-dim: rgba(194, 47, 61, 0.08);
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 22, 26, 0.05), 0 1px 12px rgba(20, 22, 26, 0.04);
  --font: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
h1 { font-size: 2.1rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }

a { color: var(--teal-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Kept as a hook for times and codes — same family, tabular figures. */
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.muted { color: var(--steel); }
.small { font-size: 0.82rem; }
.center { text-align: center; }
.row { display: flex; gap: 12px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grow { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.hidden { display: none !important; }

.label {
  font-family: var(--font);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--steel);
}

/* ---------------------------------------------------------------- layout */

.shell { max-width: 1180px; margin: 0 auto; padding: 24px 20px 80px; }
.narrow { max-width: 520px; margin: 0 auto; padding: 48px 20px 80px; }

.topbar {
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar .shell { padding: 14px 20px; display: flex; align-items: center; gap: 18px; }

.brand {
  font-family: var(--font);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.95rem;
  color: var(--ink);
}
.brand span { color: var(--teal); }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  color: var(--steel);
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  background: none;
}
.tab:hover { color: var(--ink); }
.tab.active { background: var(--teal-dim); border-color: rgba(13, 143, 139, 0.35); color: var(--teal-ink); }

/* ----------------------------------------------------------------- cards */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card + .card { margin-top: 16px; }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }

/* ---------------------------------------------------------------- inputs */

label.field { display: block; }
label.field > span {
  display: block;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--steel);
  margin-bottom: 6px;
}
.req { color: var(--copper); }

input, select, textarea {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.95rem;
}
input::placeholder, textarea::placeholder { color: #9ca3af; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-dim);
}
textarea { min-height: 78px; resize: vertical; }
input[type='checkbox'] { width: auto; accent-color: var(--teal); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--teal);
  color: #ffffff;
  border: 1px solid var(--teal);
  border-radius: 8px;
  padding: 10px 18px;
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn:hover { background: var(--teal-ink); border-color: var(--teal-ink); text-decoration: none; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.ghost { background: var(--panel); color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--teal); color: var(--teal-ink); background: var(--panel); }
.btn.danger { background: var(--panel); color: var(--danger); border-color: rgba(194, 47, 61, 0.35); }
.btn.danger:hover { background: var(--danger-dim); border-color: var(--danger); color: var(--danger); }
.btn.sm { padding: 6px 12px; font-size: 0.78rem; }
.btn.wide { width: 100%; }

/* ---------------------------------------------------------------- tables */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th {
  text-align: left;
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--steel);
  padding: 12px;
  background: var(--panel-2);
  white-space: nowrap;
}
td { padding: 11px 12px; border-top: 1px solid var(--line-soft); vertical-align: middle; }
tbody tr:hover { background: #fafbfc; }

.pill {
  display: inline-block;
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid;
}
.pill.present { color: var(--teal-ink); border-color: rgba(13, 143, 139, 0.35); background: var(--teal-dim); }
.pill.late { color: var(--amber); border-color: rgba(160, 106, 12, 0.35); background: var(--amber-dim); }

/* ----------------------------------------------------------------- photo */

.photo-2x2 {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  display: block;
}
.thumb { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; border: 1px solid var(--line); }
.photo-drop {
  border: 1px dashed #c8ccd4;
  border-radius: 8px;
  padding: 18px;
  text-align: center;
  cursor: pointer;
  background: var(--panel-2);
}
.photo-drop:hover { border-color: var(--teal); background: var(--teal-dim); }

.qr-card { text-align: center; }
.qr-card img {
  width: 100%;
  max-width: 230px;
  background: #fff;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--teal);
  box-shadow: 0 6px 24px rgba(20, 22, 26, 0.12);
  padding: 12px 18px;
  border-radius: 8px;
  z-index: 100;
  max-width: 90vw;
}
.toast.err { border-left-color: var(--danger); }

.banner {
  border-radius: 8px;
  padding: 12px 14px;
  border: 1px solid;
  font-size: 0.9rem;
}
.banner.err { color: var(--danger); border-color: rgba(194, 47, 61, 0.35); background: var(--danger-dim); }
.banner.ok { color: var(--teal-ink); border-color: rgba(13, 143, 139, 0.35); background: var(--teal-dim); }

#reader { width: 100%; max-width: 460px; margin: 0 auto; border-radius: var(--radius); overflow: hidden; }

@media print {
  body { background: #fff; }
  .card, .table-wrap { box-shadow: none; }
  .no-print { display: none !important; }
}

/* ----------------------------------------------------------- public board */

.quiet-link {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--steel);
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.quiet-link:hover {
  color: var(--teal-ink);
  border-color: var(--line);
  text-decoration: none;
}

.board-head { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-end; justify-content: space-between; }

.tally { display: flex; gap: 26px; flex-wrap: wrap; }
.tally div { line-height: 1.1; }
.tally b {
  font-size: 1.8rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  display: block;
}
.tally .on { color: var(--teal); }
.tally .off { color: var(--amber); }

td.rank { color: var(--steel); width: 56px; font-size: 0.8rem; font-variant-numeric: tabular-nums; }
td.who { font-size: 1rem; font-weight: 500; }
tr.fresh { animation: flash 2.4s ease-out; }
@keyframes flash {
  from { background: var(--teal-dim); }
  to { background: transparent; }
}

.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
  margin-right: 7px;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.25; } }
