/* ---------- Fonts (self-hosted, SIL Open Font License) ---------- */

@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url(fonts/bricolage-grotesque-latin-ext-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url(fonts/bricolage-grotesque-latin-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Figtree';
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url(fonts/figtree-latin-ext-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Figtree';
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url(fonts/figtree-latin-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Tokens ---------- */

:root {
  /* Palette from sportback.football: emerald, football yellow, charcoal, light grey */
  --paper: #f4f4f4;
  --surface: #ffffff;
  --ink: #384043;
  --ink-soft: #5d666a;
  --ink-faint: #899195;
  --line: #e3e5e5;
  --line-strong: #c8cdce;

  --turf: #006548;
  --turf-hover: #00543c;
  --turf-tint: #e0efe9;
  --on-turf: #ffffff;

  --gold: #ffc844;
  --gold-hover: #ffbb1f;
  --on-gold: #006548;

  --danger: #b33a27;
  --danger-tint: #fbe9e5;
  --warn: #8a5300;
  --warn-tint: #fff0d4;
  --toast-action: #ffc844;

  --pitch-a: #007351;
  --pitch-b: #006548;
  --chalk: rgba(255, 255, 255, 0.82);

  --gk-bg: #fff0d4;   --gk-fg: #8a5300;
  --def-bg: #dfe9ff;  --def-fg: #244a9e;
  --mid-bg: #ece4ff;  --mid-fg: #5a35a0;
  --wing-bg: #d6f2ee; --wing-fg: #0d6a62;
  --fwd-bg: #ffe2dc;  --fwd-fg: #a9372a;
  --other-bg: #e7ede9; --other-fg: #3e4c44;

  --font-display: 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Figtree', 'Segoe UI', system-ui, sans-serif;

  --radius-card: 18px;
  --radius-ctl: 10px;
  --topbar-h: 77px;
  /* Room taken by the phone's status bar (top) and navigation bar (bottom) when FollowUp runs full screen */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #141819;
    --surface: #1c2123;
    --ink: #e9ecec;
    --ink-soft: #a9b1b4;
    --ink-faint: #798286;
    --line: #2a3033;
    --line-strong: #3a4246;

    --turf: #3dbb8c;
    --turf-hover: #55c99c;
    --turf-tint: #12352a;
    --on-turf: #04140e;

    --gold: #ffc844;
    --gold-hover: #ffd36b;
    --on-gold: #00412e;

    --danger: #f07a66;
    --danger-tint: #3a1e19;
    --warn: #f2b656;
    --warn-tint: #3a2c10;
    --toast-action: #00543c;

    --pitch-a: #00573e;
    --pitch-b: #004d37;
    --chalk: rgba(255, 255, 255, 0.7);

    --gk-bg: #3a2c10;   --gk-fg: #f2c46b;
    --def-bg: #1b2a4a;  --def-fg: #9db8f5;
    --mid-bg: #2b2145;  --mid-fg: #c2a9f2;
    --wing-bg: #10332f; --wing-fg: #7fd8cc;
    --fwd-bg: #3e1f1a;  --fwd-fg: #f5a495;
    --other-bg: #232d27; --other-fg: #b5c2ba;

    color-scheme: dark;
  }
}

/* ---------- Base ---------- */

* { box-sizing: border-box; }

/* No double-tap zoom on phones (iPhones ignore the viewport tag's user-scalable=no) */
html { touch-action: manipulation; background: var(--paper); } /* also behind the phone's status and navigation bars */
/* Never scroll sideways: a few pixels too wide somewhere must not shift the whole app (clip keeps the sticky top bar working) */
body { overflow-x: clip; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--turf); outline-offset: 2px; }
[tabindex="-1"]:focus { outline: none; }

.muted { color: var(--ink-faint); font-weight: 400; }

.icon { display: inline-grid; place-items: center; }
.icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Position colours, used by avatars, badges and chips */
.pos-gk   { --pos-bg: var(--gk-bg);   --pos-fg: var(--gk-fg); }
.pos-def  { --pos-bg: var(--def-bg);  --pos-fg: var(--def-fg); }
.pos-mid  { --pos-bg: var(--mid-bg);  --pos-fg: var(--mid-fg); }
.pos-wing { --pos-bg: var(--wing-bg); --pos-fg: var(--wing-fg); }
.pos-fwd  { --pos-bg: var(--fwd-bg);  --pos-fg: var(--fwd-fg); }
.pos-other { --pos-bg: var(--other-bg); --pos-fg: var(--other-fg); }

/* ---------- Controls ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-ctl);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.btn:hover { border-color: var(--ink-faint); }
.btn:disabled { opacity: 0.6; cursor: wait; }
.btn-primary { background: var(--gold); border-color: var(--gold); color: var(--on-gold); font-weight: 700; }
.btn-primary:hover { background: var(--gold-hover); border-color: var(--gold-hover); }
.btn-quiet-danger { background: transparent; border-color: transparent; color: var(--danger); }
.btn-quiet-danger:hover { background: var(--danger-tint); border-color: transparent; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: var(--radius-ctl);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  flex: none;
}
.icon-btn:hover { background: var(--paper); color: var(--ink); }

input, textarea, select {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-ctl);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  min-width: 0;
}
textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--ink-faint); }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--turf);
  box-shadow: 0 0 0 3px var(--turf-tint);
}

select {
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2385918a' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 18px;
  cursor: pointer;
}

/* ---------- Top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  height: var(--topbar-h);
  padding: 0 32px;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
}
.brand-mark { width: 34px; height: 34px; }
.brand-mark rect { fill: var(--turf); }
.brand-mark circle, .brand-mark path { fill: none; stroke: #ffffff; stroke-width: 2.4; }
.brand-mark circle { stroke: var(--gold); }

.search { position: relative; justify-self: center; width: 100%; max-width: 620px; }
.search svg {
  position: absolute; left: 16px; top: 50%; translate: 0 -50%;
  width: 20px; height: 20px; fill: none; stroke: var(--ink-faint); stroke-width: 2.2; stroke-linecap: round;
  pointer-events: none;
}
.search input { height: 48px; padding-left: 46px; border-radius: 999px; border-color: var(--line); font-size: 1rem; }

.topbar-actions { display: flex; align-items: center; gap: 12px; }

/* Admin mode: just a shield (its name shows on hover and is read out by screen readers) */
.admin-badge { display: grid; place-items: center; width: 32px; height: 42px; }
.admin-badge svg { width: 24px; height: 24px; fill: var(--gold); stroke: var(--turf); stroke-width: 1.8; stroke-linejoin: round; }

.account { position: relative; }
.account-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: var(--turf);
  color: var(--on-turf);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
}
.account-button:hover { background: var(--turf-hover); }
.account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  min-width: 240px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 16px 40px -16px rgba(0, 0, 0, 0.3);
}
.account-who { display: flex; flex-direction: column; margin: 0 0 6px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.account-who span { color: var(--ink-soft); font-size: 0.88rem; overflow-wrap: anywhere; }
.account-menu button {
  height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  font-weight: 500;
  cursor: pointer;
}
.account-menu button:hover { background: var(--paper); }

/* ---------- Notification bell ---------- */

.bell { position: relative; }
.bell-button { position: relative; width: 42px; height: 42px; border-radius: 50%; color: var(--ink); }
.bell-button .icon svg { width: 22px; height: 22px; }
.bell-count {
  position: absolute;
  top: 2px;
  right: 0;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}
.bell-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  width: 380px;
  max-height: min(70vh, 560px);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 16px 40px -16px rgba(0, 0, 0, 0.3);
}
.bell-head { margin: 0; padding: 14px 16px 10px; font-family: var(--font-display); font-weight: 650; font-size: 1.05rem; border-bottom: 1px solid var(--line); }
.bell-list { list-style: none; margin: 0; padding: 6px; }
.bell-list li > * {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  font-size: 0.9rem;
  line-height: 1.35;
}
.bell-list button { cursor: pointer; }
.bell-list button:hover { background: var(--paper); }
.bell-list li.unread > * { background: var(--turf-tint); }
.bell-text { overflow-wrap: anywhere; }
.bell-text .status { font-size: inherit; }
.bell-time { color: var(--ink-soft); font-size: 0.8rem; }
.bell-empty { padding: 18px 12px; color: var(--ink-soft); font-size: 0.9rem; }

/* Install on your phone */
.install-guide > p { margin: 0; }
.install-guide .btn-primary { align-self: flex-start; }
.install-steps h3 { margin: 6px 0 8px; font-family: var(--font-display); font-weight: 650; font-size: 1.1rem; }
.install-steps ol { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; line-height: 1.45; }

/* ---------- Login ---------- */

.login { display: grid; place-items: center; min-height: 100vh; padding: calc(24px + var(--safe-top)) 16px calc(24px + var(--safe-bottom)); }
.login-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: min(400px, 100%);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: 0 24px 48px -32px rgba(0, 0, 0, 0.35);
}
.login-card h1 { margin: 8px 0 0; font-family: var(--font-display); font-weight: 700; font-size: 1.6rem; letter-spacing: -0.02em; }
.login-card .btn { width: 100%; }

/* ---------- Board ---------- */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}
.layout.has-panel { grid-template-columns: minmax(0, 1fr) 460px; }

.board { padding: 28px 32px 64px; min-width: 0; }

.toolbar {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.toolbar .chips { flex: 1; min-width: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 8px 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
}
.chip[class*='status-']::before {
  content: '';
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--st);
}
.chip:hover { border-color: var(--line-strong); color: var(--ink); }
.chip-count {
  min-width: 24px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink-faint);
  font-size: 0.8rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.chip[aria-pressed='true'] { background: var(--turf); border-color: var(--turf); color: var(--on-turf); }
.chip[aria-pressed='true'] .chip-count { background: color-mix(in srgb, var(--on-turf) 20%, transparent); color: inherit; }

.toolbar-tools { display: flex; gap: 8px; flex: none; }
.tool { position: relative; }
.tool-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
}
.tool-button:hover { border-color: var(--line-strong); color: var(--ink); }
.tool-button.active { border-color: var(--turf); color: var(--turf); background: var(--turf-tint); }
.tool-count {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--turf);
  color: var(--on-turf);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}
.tool-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 32; /* above the phone's + button */
  width: 300px;
  max-height: min(70vh, 520px);
  overflow-y: auto;
  padding: 6px 6px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 16px 40px -16px rgba(0, 0, 0, 0.3);
}
.tool-menu-small { width: 220px; }
.tool-menu-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px 4px; font-family: var(--font-display); font-weight: 650; }
.tool-clear { border: 0; background: none; color: var(--turf); font-weight: 600; cursor: pointer; padding: 4px; }
.tool-menu fieldset { margin: 0; padding: 0; border: 0; }
.tool-menu legend { padding: 10px 10px 4px; color: var(--ink-soft); font-size: 0.8rem; font-weight: 600; }
.tool-menu .muted { margin: 0; padding: 4px 10px; font-size: 0.88rem; }
.tool-option, .tool-choice {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  font-size: 0.92rem;
  cursor: pointer;
}
.tool-option:hover, .tool-choice:hover { background: var(--paper); }
.tool-option input { width: 18px; height: 18px; flex: none; accent-color: var(--turf); }
.tool-option span:first-of-type { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.tool-option-count { color: var(--ink-faint); font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.tool-choice[aria-checked='true'] { color: var(--turf); font-weight: 700; }
.tool-choice[aria-checked='true']::after { content: '✓'; margin-left: auto; }

.count { margin: 22px 0 12px; color: var(--ink-soft); font-size: 0.92rem; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
}

.card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 18px 18px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s;
  min-width: 0;
}
.card:hover { border-color: var(--line-strong); }
.card { position: relative; }
.card .status { position: absolute; top: 18px; right: 18px; }
.card.selected { border-color: var(--turf); box-shadow: 0 0 0 1px var(--turf); }

.avatar {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 17px;
  background: var(--pos-bg);
  color: var(--pos-fg);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: 0.01em;
  flex: none;
}
.card .avatar { margin-bottom: 8px; }
.avatar-lg {
  width: 92px;
  height: 92px;
  border-radius: 28px;
  font-size: 2.1rem;
  border: 5px solid var(--surface);
}

.card-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--pos-bg);
  color: var(--pos-fg);
  font-weight: 600;
  font-size: 0.8rem;
}

.card-meta {
  display: flex;
  flex-direction: column;
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 0.9rem;
  max-width: 100%;
}
.card-team { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.empty {
  grid-column: 1 / -1;
  padding: 64px 24px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-card);
  text-align: center;
}
.empty h2 { margin: 0 0 6px; font-family: var(--font-display); font-weight: 650; font-size: 1.45rem; }
.empty p { max-width: 44ch; margin: 0 auto 20px; color: var(--ink-soft); }

/* Phone-only controls, shown in the 720px block below */
.fab { display: none; }
.icon-back { display: none; }

/* ---------- Side panel ---------- */

.panel {
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--line);
  animation: panel-in 0.22s ease-out;
  scroll-padding-bottom: 96px; /* keep focused fields above the sticky Save bar */
}
.panel[hidden] { display: none; }

@keyframes panel-in {
  from { opacity: 0; transform: translateX(24px); }
}
@keyframes sheet-in {
  from { opacity: 0; transform: translateY(40px); }
}

.panel-loading { padding: 28px; color: var(--ink-soft); }
.panel > .panel-close { align-self: flex-end; margin: 12px; }

.pitch-head { position: relative; flex: none; }
.pitch svg { display: block; width: 100%; height: auto; aspect-ratio: 300 / 120; }
.pitch .stripe-a { fill: var(--pitch-a); }
.pitch .stripe-b { fill: var(--pitch-b); }
.pitch .lines * { fill: none; stroke: var(--chalk); stroke-width: 1.4; }
.pitch .mark { fill: var(--chalk); }
.pitch .spot { fill: var(--gold); stroke: #ffffff; stroke-width: 2; }
.pitch .spot-ring {
  fill: color-mix(in srgb, var(--gold) 45%, transparent);
  transform-box: fill-box;
  transform-origin: center;
  animation: spot-pulse 1.6s ease-out 2;
}
@keyframes spot-pulse {
  0% { transform: scale(0.6); opacity: 1; }
  100% { transform: scale(1.6); opacity: 0; }
}
.pitch-head .panel-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  color: var(--ink);
}

.profile { padding: 0 28px 24px; }
.profile-id {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-top: -46px;
  position: relative;
}
.profile-id h2 {
  margin: 6px 0 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.85rem;
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.profile-status { display: flex; flex-direction: column; gap: 8px; margin-top: 22px; }

/* ---------- Follow-up status ---------- */

.status-watch     { --st: var(--ink-soft); --st-bg: var(--other-bg); }
.status-contacted { --st: var(--def-fg);   --st-bg: var(--def-bg); }
.status-talks     { --st: var(--warn);     --st-bg: var(--warn-tint); }
.status-signed    { --st: var(--turf);     --st-bg: var(--turf-tint); }
.status-dropped   { --st: var(--danger);   --st-bg: var(--danger-tint); }
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--st);
  font-weight: 600;
  font-size: 0.8rem;
  white-space: nowrap;
}
.status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--st); }
.choice[class*='status-'] { --pos-fg: var(--st); --pos-bg: var(--st-bg); }

/* Reminders on a profile */
.reminders { margin-top: 28px; }
.reminders h3 { margin: 0 0 8px; font-family: var(--font-display); font-weight: 650; font-size: 1.15rem; }
.reminders > p { margin: 0 0 8px; }
.reminder-list { list-style: none; margin: 0 0 12px; padding: 0; }
.reminder {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}
.reminder-when { font-size: 0.84rem; font-weight: 600; color: var(--ink-soft); }
.reminder.due .reminder-when { color: var(--warn); }
.reminder-text { grid-column: 1; font-weight: 500; overflow-wrap: anywhere; }
.reminder-who { grid-column: 1; color: var(--ink-soft); font-size: 0.82rem; }
.reminder-actions { grid-column: 2; grid-row: 1 / span 3; align-self: center; display: flex; gap: 6px; }
.reminder-add summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--turf);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.reminder-add summary::-webkit-details-marker { display: none; }
.reminder-form { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; padding: 14px; border-radius: 12px; background: var(--paper); }
.reminder-form .btn { align-self: flex-start; }
.check { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--turf); }

.facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 24px 0 28px;
}
.facts > div { padding: 12px 14px; border-radius: 12px; background: var(--paper); }
.facts dt { font-size: 0.8rem; font-weight: 600; color: var(--ink-soft); }
.facts dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.facts small { display: block; margin-top: 2px; color: var(--ink-faint); font-size: 0.8rem; font-weight: 400; }

.more h3, .form-extra h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 1.15rem;
}
.more > p { margin: 0; }

.extras { display: grid; grid-template-columns: minmax(110px, max-content) 1fr; margin: 0; }
.extras dt, .extras dd { padding: 11px 0; border-top: 1px solid var(--line); }
.extras dt { padding-right: 20px; color: var(--ink-soft); }
.extras dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  font-size: 0.9rem;
  font-weight: 500;
}
.hint {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--turf-tint);
  color: var(--turf);
  font-size: 0.8rem;
  font-weight: 600;
}
.hint.warn { background: var(--warn-tint); color: var(--warn); }
.longtext { white-space: pre-wrap; font-weight: 400; }

.panel-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 10px;
  margin-top: auto;
  padding: 16px 28px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}

/* ---------- Form ---------- */

.player-form { display: flex; flex-direction: column; min-height: 100%; }
.form-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 24px 20px 4px 28px;
}
.form-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}
.form-body { display: flex; flex-direction: column; gap: 18px; padding: 12px 28px 24px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-weight: 600; font-size: 0.92rem; }
.field-hint { color: var(--ink-soft); font-size: 0.84rem; margin: 0; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.choice-group { display: flex; flex-wrap: wrap; gap: 8px; }
/* :where() keeps this default weaker than the .pos-* colours above */
:where(.choice) { --pos-bg: var(--turf-tint); --pos-fg: var(--turf); }
.choice {
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}
.choice:hover { border-color: var(--ink-faint); color: var(--ink); }
.choice[aria-pressed='true'] { background: var(--pos-bg); border-color: var(--pos-fg); color: var(--pos-fg); }
.choice-group.small .choice { height: 34px; padding: 0 12px; }

.position-lines { display: flex; flex-direction: column; gap: 10px; }
.position-line { display: grid; grid-template-columns: 72px 1fr; align-items: start; gap: 8px; }
.position-line-label { padding-top: 10px; color: var(--ink-faint); font-size: 0.84rem; font-weight: 600; }

.form-extra { display: flex; flex-direction: column; gap: 4px; padding-top: 8px; border-top: 1px solid var(--line); margin-top: 4px; }
.form-extra h3 { margin-top: 18px; margin-bottom: 0; }

.extra-rows { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.extra-rows:empty { display: none; }
.extra-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 10px;
  padding: 10px 6px 10px 14px;
  border-radius: 12px;
  background: var(--paper);
}
.extra-label { font-weight: 600; font-size: 0.92rem; overflow-wrap: anywhere; }
.extra-row input, .extra-row textarea { background: var(--surface); }
.extra-row .extra-label-input { height: 40px; }

.with-unit { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); }
.with-unit input { max-width: 120px; }

.tag-input {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 5px 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-ctl);
  background: var(--surface);
  cursor: text;
}
.tag-input:focus-within { border-color: var(--turf); box-shadow: 0 0 0 3px var(--turf-tint); }
.tag-input input { flex: 1; min-width: 110px; height: 32px; padding: 0 4px; border: 0; box-shadow: none; background: transparent; }
.tag-input input:focus { box-shadow: none; }
.tag-input .tag { padding-right: 4px; }
.tag-remove {
  border: 0;
  background: none;
  padding: 0 4px;
  margin-left: 2px;
  color: var(--ink-faint);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
}
.tag-remove:hover { color: var(--danger); }

.suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.suggest {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 34px;
  padding: 0 12px 0 8px;
  border: 1px dashed var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--turf);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
}
.suggest .icon svg { width: 16px; height: 16px; }
.suggest:hover { border-style: solid; border-color: var(--turf); background: var(--turf-tint); }
.suggest-other { color: var(--ink-soft); }

.form-error { margin: 0; min-height: 1.4em; color: var(--danger); font-weight: 600; }
.form-error:empty { min-height: 0; }

/* ---------- Team ---------- */

.btn-small { height: 34px; padding: 0 12px; font-size: 0.88rem; }

.people { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.person {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 12px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.person .avatar { width: 40px; height: 40px; font-size: 0.9rem; }
.person-who { display: flex; flex-direction: column; min-width: 0; }
.person-who span { color: var(--ink-soft); font-size: 0.88rem; overflow-wrap: anywhere; }
.person-tags { display: flex; gap: 6px; }
.person-tags .tag { font-size: 0.8rem; }
.tag-admin { border-color: var(--turf); color: var(--turf); font-weight: 700; }
.person-actions { grid-column: 2 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.person-actions:empty { display: none; }
.person-reset { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
.person-reset input { flex-basis: 100%; height: 38px; }
.person-reset .form-error { flex-basis: 100%; }

.with-generate { display: flex; gap: 8px; }
.add-person { gap: 14px; }
.add-person h3 { margin-bottom: 0; }

/* ---------- Toasts ---------- */

.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(24px + var(--safe-bottom));
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  translate: -50% 0;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 11px 12px 11px 18px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--surface);
  font-weight: 500;
  box-shadow: 0 12px 32px -12px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
  animation: toast-in 0.2s ease-out;
  transition: opacity 0.2s;
}
.toast.leaving { opacity: 0; }
.toast-action {
  padding: 4px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--toast-action);
  font-weight: 700;
  cursor: pointer;
}
.toast-action:hover { background: color-mix(in srgb, var(--surface) 12%, transparent); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Smaller screens ---------- */

@media (max-width: 1100px) {
  .layout.has-panel { grid-template-columns: minmax(0, 1fr); }
  .panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    width: min(460px, 100%);
    height: 100%;
    box-shadow: -24px 0 48px -24px rgba(0, 0, 0, 0.35);
  }
}

@media (max-width: 720px) {
  :root { --topbar-h: auto; }
  .topbar {
    grid-template-columns: 1fr auto;
    gap: 12px;
    padding: calc(12px + var(--safe-top)) 16px 12px; /* below the phone's clock and battery */
  }
  .search { grid-column: 1 / -1; grid-row: 2; max-width: none; }
  .topbar-actions { gap: 8px; }
  #add-player { display: none; } /* replaced by the round + button at the bottom */
  /* The bell list spans the screen under the top bar (the sticky top bar holds it), instead of hanging off the bell. */
  .bell { position: static; }
  .bell-menu { top: calc(64px + var(--safe-top)); left: 12px; right: 12px; width: auto; }
  .board { padding: 16px 16px calc(112px + var(--safe-bottom)); } /* room under the last cards for the + button */
  .toolbar { position: relative; gap: 8px; } /* holds the filter and sort menus */
  /* Status pills on one line that scrolls sideways, from the screen's left edge to the two icons */
  .toolbar .chips {
    flex-wrap: nowrap; overflow-x: auto; margin-left: -16px; padding: 0 16px 2px 16px; scrollbar-width: none;
    mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); /* fades out: the row goes on sideways */
  }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; }
  .tool { position: static; }
  .tool-menu, .tool-menu-small { left: 0; right: 0; width: auto; }
  .count { margin-top: 14px; }
    .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .card .status { position: static; margin-bottom: 2px; } /* narrow cards: own line, not over the avatar */
  .profile, .form-body { padding-left: 20px; padding-right: 20px; }
  .panel-actions { padding: 14px 20px calc(14px + var(--safe-bottom)); } /* above the navigation bar */
  .form-head { padding-left: 20px; }
  .facts { grid-template-columns: 1fr 1fr; }
  .field-pair { grid-template-columns: 1fr; }
  .extra-row { grid-template-columns: minmax(0, 1fr) 36px; }
  .extra-row > :nth-child(2) { grid-column: 1; grid-row: 2; }
  .extra-row > .icon-btn { grid-column: 2; grid-row: 1; }
  /* The + button, at thumb reach */
  .fab {
    position: fixed;
    right: 18px;
    bottom: calc(22px + var(--safe-bottom));
    z-index: 30;
    display: grid;
    place-items: center;
    width: 60px;
    height: 60px;
    border: 0;
    border-radius: 20px;
    background: var(--gold);
    color: var(--on-gold);
    box-shadow: 0 10px 24px -8px rgba(0, 0, 0, 0.45);
    cursor: pointer;
  }
  .fab svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
  .fab:active { transform: scale(0.96); }
  /* Player, forms and menus open as a full sheet sliding up, with a back arrow at the top left */
  .panel { width: 100%; box-shadow: none; animation: sheet-in 0.24s ease-out; }
  .icon-close { display: none; }
  .icon-back { display: inline-grid; }
  .pitch-head .panel-close { top: calc(12px + var(--safe-top)); left: 12px; right: auto; }
  .form-head { justify-content: flex-start; padding-left: 12px; padding-top: calc(24px + var(--safe-top)); }
  .form-head .panel-close { order: -1; }
  .panel > .panel-close { align-self: flex-start; margin-top: calc(12px + var(--safe-top)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
