@import url("/vendor/phosphor/style.css");

@font-face { font-family: "Como"; src: url("/fonts/Como-Bold.otf") format("opentype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("/fonts/Montserrat-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("/fonts/Montserrat-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("/fonts/Montserrat-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  --navy: #33367e;
  --navy-hover: #3b3f97;
  --navy-active: #2e316e;
  --turquoise: #88c7cd;
  --azure: #e3f5f5;
  --gold: #e8b100;
  --gold-soft: #fdf3d1;
  --green: #3ac28d;
  --green-soft: #bde8d4;
  --red: #d94848;
  --black: #202020;
  --grey-text: #6b7281;
  --grey: #ededed;
  --canvas: #f5f5f5;
  --white: #fff;

  --font-display: "Como", "Montserrat", system-ui, sans-serif;
  --font-body: "Montserrat", system-ui, -apple-system, sans-serif;
  --shadow-card: 0 6px 20px rgba(0, 0, 0, .15);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, .06);
  --r-md: 8px;
  --r-lg: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--black);
  font: 400 16px/1.5 var(--font-body);
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; color: var(--navy); margin: 0; letter-spacing: -.01em; }
h1 { font-size: clamp(28px, 5vw, 40px); line-height: 1.1; }
h2 { font-size: 24px; line-height: 1.15; }
h3 { font-size: 18px; line-height: 1.2; }
p { margin: 0; }
a { color: var(--navy); }
.muted { color: var(--grey-text); }
.small { font-size: 14px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 16px;
  border: 1px solid var(--navy); border-radius: var(--r-md);
  background: var(--white); color: var(--navy);
  font: 600 14px/1.2 var(--font-body); text-decoration: none; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--azure); }
.btn-primary { background: var(--navy); color: var(--white); }
.btn-primary:hover { background: var(--navy-hover); border-color: var(--navy-hover); }
.btn-primary:active { background: var(--navy-active); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-danger { border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: #fbeaea; }
.btn-block { width: 100%; min-height: 48px; font-size: 16px; }
.btn:disabled { opacity: .6; cursor: default; }
:focus-visible { outline: 2px solid var(--turquoise); outline-offset: 2px; }

/* ---------- Inputs ---------- */
input[type="email"], input[type="text"], textarea {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--grey); border-radius: var(--r-md);
  background: var(--white); color: var(--black);
  font: 400 16px/1.4 var(--font-body);
}
input:focus, textarea:focus { outline: none; border-color: var(--turquoise); box-shadow: 0 0 0 3px var(--azure); }
textarea { min-height: 120px; resize: vertical; }
label.field { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }

/* ---------- Auth pages ---------- */
.auth-page {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: linear-gradient(180deg, var(--azure), var(--canvas) 70%);
}
.auth-card {
  width: 100%; max-width: 420px; display: grid; gap: 16px;
  padding: 32px; background: var(--white); border-radius: var(--r-lg); box-shadow: var(--shadow-card);
}
.auth-logo { height: auto; margin-bottom: 8px; }
.auth-card form { display: grid; gap: 16px; }
.notice { padding: 12px 14px; border-radius: var(--r-md); font-size: 14px; }
.notice-ok { background: var(--azure); color: var(--navy); }
.notice-error { background: #fbeaea; color: var(--red); }

/* ---------- App shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px;
  padding: 12px max(16px, calc((100% - 1120px) / 2));
  background: var(--white); box-shadow: var(--shadow-sm);
}
.topbar img { display: block; height: 44px; width: auto; }
.topbar .spacer { flex: 1; }
.topbar .who { font-size: 14px; color: var(--grey-text); }
.topbar form { margin: 0; }
main.page { max-width: 1120px; margin: 0 auto; padding: 32px 16px 64px; display: grid; gap: 32px; }

.card { background: var(--white); border-radius: var(--r-lg); box-shadow: var(--shadow-card); padding: 24px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }

/* ---------- Intro + progress ---------- */
.intro { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; align-items: stretch; }
.intro .welcome { display: grid; gap: 12px; align-content: center; }
.intro .welcome img { width: 72px; height: auto; }
.stats { display: grid; gap: 16px; align-content: center; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { display: grid; gap: 2px; }
.stat b { font: 700 28px/1 var(--font-display); color: var(--navy); }
.stat span { font-size: 12px; color: var(--grey-text); font-weight: 600; }
.bar { height: 10px; border-radius: 999px; background: var(--grey); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--turquoise), var(--navy)); transition: width .3s ease; }

/* ---------- Bingo card ---------- */
.bingo { display: grid; grid-template-columns: repeat(var(--cols, 5), minmax(0, 1fr)); gap: 12px; }
.tile {
  position: relative; display: grid; align-content: center; justify-items: center; gap: 8px;
  aspect-ratio: 1 / .82; padding: 12px 8px;
  border: 1px solid var(--grey); border-radius: var(--r-lg);
  background: var(--white); color: var(--navy); text-align: center; cursor: pointer;
  font: inherit; box-shadow: var(--shadow-sm);
  transition: background-color .15s, border-color .15s, transform .15s;
}
.tile:hover { border-color: var(--turquoise); background: var(--azure); }
.tile i.ph { font-size: 32px; }
.tile .t-title { font: 700 15px/1.15 var(--font-display); }
.tile .t-person { font-size: 12px; font-weight: 600; color: var(--grey-text); }
.tile .t-count {
  position: absolute; top: 8px; right: 8px;
  padding: 2px 8px; border-radius: 999px; background: var(--azure); color: var(--navy);
  font-size: 11px; font-weight: 700;
}
.tile.done { background: var(--navy); border-color: var(--navy); color: var(--white); }
.tile.done .t-person { color: var(--turquoise); }
.tile.done:hover { background: var(--navy-hover); }
.tile i.ph.t-check { position: absolute; top: 8px; right: 8px; font-size: 20px; color: var(--turquoise); display: none; }
.tile.done i.ph.t-check { display: block; }
.tile.done .t-count { display: none; }
.tile.in-line { box-shadow: 0 0 0 3px var(--gold); }
.tile.readonly { cursor: default; }

.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--grey-text); margin-top: 16px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i.sw { width: 14px; height: 14px; border-radius: 4px; display: inline-block; border: 1px solid var(--grey); }
.legend i.sw.done { background: var(--navy); border-color: var(--navy); }

/* ---------- Lists (dialog tasks) and question squares ---------- */
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.check {
  display: flex; gap: 12px; align-items: flex-start; padding: 8px 12px; font-size: 15px;
  border: 1px solid var(--grey); border-radius: var(--r-md); cursor: pointer; background: var(--white);
}
.check:hover { border-color: var(--turquoise); }
.check input { margin: 2px 0 0; width: 18px; height: 18px; accent-color: var(--navy); flex: none; cursor: pointer; }
.check.is-done { background: var(--azure); border-color: var(--azure); }
.check.is-done .check-text { color: var(--grey-text); text-decoration: line-through; }
.check.is-disabled { opacity: .5; cursor: default; }
.check.is-disabled input { cursor: default; }
.question-text { font: 700 18px/1.3 var(--font-display); color: var(--navy); }
/* Photo grid: greyed out while unknown, the answer on top of the photo. */
.photo-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.photo-tile {
  display: grid; justify-items: center; gap: 10px; padding: 10px 4px 8px;
  border: 0; border-radius: var(--r-md); background: none; color: var(--black); font: inherit; cursor: pointer;
}
.photo-tile:hover { background: var(--azure); }
.photo-tile .photo-wrap { position: relative; }
.photo-tile .photo { display: block; width: 72px; height: 72px; border-radius: 50%; object-fit: cover; transition: filter .2s, opacity .2s; }
.photo-tile.is-unknown .photo { filter: grayscale(1); opacity: .4; }
.photo-tile.is-found .photo { box-shadow: 0 0 0 3px var(--gold); }
.photo-tile .name { font-size: 13px; font-weight: 600; line-height: 1.2; }
.photo-tile .value {
  position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%);
  padding: 2px 8px; border-radius: 999px; white-space: nowrap;
  font-size: 12px; font-weight: 700; box-shadow: var(--shadow-sm);
}
.value-yes, .value-amount { background: var(--navy); color: var(--white); }
.value-no { background: var(--white); color: var(--grey-text); border: 1px solid var(--grey); }
.initials { display: grid; place-items: center; background: var(--azure); color: var(--navy); font-weight: 700; }

/* Answer popup for one colleague. */
dialog.answer { width: min(360px, calc(100% - 32px)); }
.answer-body { position: relative; justify-items: center; text-align: center; }
.answer-body .x { position: absolute; top: 12px; right: 12px; }
.answer-body .x i.ph { font-size: 24px; }
.answer-photo { width: 112px; height: 112px; border-radius: 50%; object-fit: cover; font-size: 32px; }
.answer-buttons { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; width: 100%; }
.answer-form { display: grid; justify-items: center; gap: 12px; width: 100%; }
.answer-form .amount-input input { width: 140px; padding: 10px 12px; font: 400 18px/1.4 var(--font-body); text-align: center; border: 1px solid var(--grey); border-radius: var(--r-md); }
.error-text { color: var(--red); min-height: 0; }
.error-text:empty { display: none; }

.amount-input { display: inline-flex; align-items: center; gap: 8px; }
.amount-input input:invalid { border-color: var(--red); }
.amount-input .unit { font-size: 14px; font-weight: 600; color: var(--grey-text); }
.save-state { font-size: 12px; color: var(--grey-text); min-height: 18px; }

/* ---------- Dialog ---------- */
dialog {
  width: min(560px, calc(100% - 32px)); max-height: calc(100% - 32px);
  padding: 0; border: 0; border-radius: var(--r-lg); box-shadow: var(--shadow-card);
}
dialog::backdrop { background: rgba(32, 32, 32, .45); }
.dlg { display: grid; gap: 16px; padding: 24px; }
.dlg-head { display: flex; gap: 16px; align-items: flex-start; }
.dlg-head i.ph { font-size: 36px; color: var(--navy); }
.dlg-head .x { margin-left: auto; }
.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--azure); color: var(--navy); font-size: 12px; font-weight: 600; }

/* ---------- Team photos on hover ---------- */
[data-photo] { text-decoration: underline dotted var(--turquoise); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.photo-pop {
  position: fixed; z-index: 60; width: 96px; height: 96px; object-fit: cover;
  border: 3px solid var(--white); border-radius: 50%; background: var(--azure);
  box-shadow: var(--shadow-card); pointer-events: none;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 50; transform: translate(-50%, 20px);
  display: flex; gap: 12px; align-items: center; max-width: calc(100% - 32px);
  padding: 14px 20px; border-radius: var(--r-md); background: var(--navy); color: var(--white);
  box-shadow: var(--shadow-card); font-weight: 600; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast i.ph { color: var(--gold); font-size: 24px; }
.toast.error { background: var(--red); }
.toast.error i.ph { color: var(--white); }

/* ---------- Admin ---------- */
.table-wrap { overflow-x: auto; }
table.people { width: 100%; border-collapse: collapse; font-size: 14px; }
.people th { text-align: left; font-size: 12px; color: var(--grey-text); font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--grey); white-space: nowrap; }
.people td { padding: 12px; border-bottom: 1px solid var(--grey); vertical-align: middle; }
.people tbody tr { cursor: pointer; }
.people tbody tr:hover { background: var(--azure); }
.people tbody tr.selected { background: var(--azure); }
.people .mini-bar { width: 120px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-gold { background: var(--gold-soft); color: #8a6a00; }
.badge-green { background: var(--green-soft); color: #1d7a56; }
.detail { display: grid; gap: 24px; }
.detail .bingo { gap: 6px; }
.detail .tile { aspect-ratio: auto; min-height: 76px; padding: 8px 4px; gap: 4px; }
.detail .tile i.ph { font-size: 20px; }
.detail .tile .t-title { font-size: 12px; }
.detail .tile .t-person, .detail .tile .t-count { display: none; }
.detail .tile i.ph.t-check { font-size: 14px; top: 4px; right: 4px; }
.people.checks th, .people.checks td { text-align: center; }
.people.checks th:first-child, .people.checks td:first-child { text-align: left; white-space: nowrap; }
.people.checks tbody tr { cursor: default; }
.kv { display: grid; gap: 12px; }
.kv dt { font-weight: 600; font-size: 14px; color: var(--navy); }
.kv dd { margin: 2px 0 0; white-space: pre-wrap; }
.empty { padding: 32px; text-align: center; color: var(--grey-text); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .intro { grid-template-columns: 1fr; }
}
/* Six columns get too narrow on tablets; fall back to three. */
@media (max-width: 1000px) {
  .bingo:not(.mini) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tile { aspect-ratio: auto; min-height: 130px; }
}
@media (max-width: 480px) {
  .photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .bingo:not(.mini) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile { aspect-ratio: auto; min-height: 120px; }
  .topbar .who { display: none; }
}
#people-intro { margin-bottom: 16px; }
