/* ===========================================================================
   Schlepfield Wednesday — design system
   Shared by every page. Mobile first; desktop layers on at 780px and 1024px.
   =========================================================================== */

:root {
  /* Brand */
  --navy-900: #08132a;
  --navy-800: #0d1d3d;
  --navy-700: #14294f;
  --navy-600: #1d3a68;
  --accent:   #3d6ff5;
  --accent-soft: #eaf0ff;

  /* Surfaces */
  --canvas:  #f2f5fa;
  --surface: #ffffff;
  --raised:  #fbfcfe;
  --line:    #e5eaf2;
  --line-strong: #d3dbe8;

  /* Text */
  --ink:    #0b1526;
  --ink-2:  #3d4a5f;
  --muted:  #6b7789;
  --faint:  #9aa5b6;

  /* Semantic */
  --good:      #0e7c56;
  --good-bg:   #e7f7f0;
  --warn:      #a25a06;
  --warn-bg:   #fdf3e4;
  --bad:       #bb2d38;
  --bad-bg:    #fdecee;
  --info:      #1d4ed8;
  --info-bg:   #e9efff;
  --violet:    #6b3fd4;
  --violet-bg: #f1ecfd;

  --radius:    14px;
  --radius-sm: 10px;
  --radius-xs: 8px;

  --shadow-sm: 0 1px 2px rgba(11, 21, 38, .05);
  --shadow-md: 0 4px 16px -4px rgba(11, 21, 38, .12);
  --shadow-lg: 0 24px 60px -12px rgba(8, 19, 42, .35);

  --bar-h: 60px;
  --tabbar-h: calc(58px + env(safe-area-inset-bottom, 0px));
}

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

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--canvas);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
/* Only the app shell should refuse the rubber-band; the signed-out pages scroll. */
body:not(.auth) { overscroll-behavior-y: none; }

/* Money and counts should never jitter as they change */
.stat-value, .charge-amount, .amount-paid, .amount-owed,
.group-total, .unbacked-fig .n, td { font-variant-numeric: tabular-nums; }

h1, h2, h3 { letter-spacing: -0.02em; line-height: 1.25; }

a { color: var(--accent); }

::selection { background: var(--accent-soft); }

/* --- App bar ------------------------------------------------------------ */

.nav {
  position: sticky; top: 0; z-index: 40;
  height: var(--bar-h);
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 0 1rem;
  background: var(--navy-900);
  color: #fff;
  padding-top: env(safe-area-inset-top, 0px);
  height: calc(var(--bar-h) + env(safe-area-inset-top, 0px));
  box-sizing: content-box;
}
.nav-brand {
  display: flex; align-items: center; gap: .6rem;
  font-weight: 700; font-size: .95rem; letter-spacing: -0.01em;
  min-width: 0;
}
.nav-brand img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.nav-brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-brand .brand-long { display: none; }
.nav-badge { flex-shrink: 0; }
.nav-right { display: flex; align-items: center; gap: .6rem; flex-shrink: 0; }
.nav-name { font-size: .8rem; color: rgba(255,255,255,.62); display: none; }
.nav-badge {
  font-size: .6rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  background: rgba(255,255,255,.14); color: #fff;
  padding: .2rem .45rem; border-radius: 5px;
}
.logout-btn {
  background: rgba(255,255,255,.1); color: #fff; border: none;
  padding: .45rem .8rem; border-radius: 8px;
  font-family: inherit; font-size: .8rem; font-weight: 600; cursor: pointer;
  transition: background .15s;
}
.logout-btn:hover { background: rgba(255,255,255,.2); }
.logout-btn:active { transform: scale(.97); }

/* --- Page ---------------------------------------------------------------- */

.main {
  max-width: 1120px; margin: 0 auto;
  padding: 1rem 1rem calc(var(--tabbar-h) + 1.5rem);
}

.section-title {
  font-size: .68rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--faint);
  margin: 1.5rem 0 .6rem;
}
.section-title:first-child { margin-top: 0; }

/* --- Stats --------------------------------------------------------------- */

.stats-grid, .stats-row {
  display: grid; gap: .6rem; margin-bottom: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.stat-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .85rem .95rem;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, transform .12s;
}
.stat-card:active { transform: scale(.99); }
.stat-label {
  font-size: .64rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--faint);
  min-height: 3em; /* two lines, so a wrapping label doesn't push its value out of line */
}
.stat-value {
  font-size: 1.6rem; font-weight: 800; letter-spacing: -0.03em;
  margin-top: .2rem; color: var(--ink);
}
.stat-value.green { color: var(--navy-800); }
.stat-value.amber { color: var(--warn); }
.stat-value.blue  { color: var(--accent); }
.stat-sub { font-size: .7rem; color: var(--faint); margin-top: .2rem; font-weight: 500; line-height: 1.35; }

/* --- Tabs: bottom bar on mobile, inline on desktop ----------------------- */

.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: stretch;
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs { scroll-snap-type: x proximity; }
.tab {
  flex: 1 0 auto; min-width: 3.9rem; scroll-snap-align: center;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .15rem; padding: .5rem .15rem;
  font-size: .58rem; font-weight: 650; letter-spacing: -0.02em;
  color: var(--faint); cursor: pointer;
  transition: color .15s;
  -webkit-tap-highlight-color: transparent;
}
.tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab svg { width: 19px; height: 19px; stroke-width: 1.9; flex-shrink: 0; }
.tab.active { color: var(--accent); }
.tab:active { opacity: .6; }

.tab-content { display: none; }
/* Scoped to the visible one: applied to all of them, the fill mode leaves hidden
   panels holding the opening frame. */
.tab-content.active { display: block; animation: rise .22s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* --- Cards --------------------------------------------------------------- */

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1rem;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem; flex-wrap: wrap;
  padding-bottom: .85rem; margin-bottom: .25rem;
  border-bottom: 1px solid var(--line);
}
.card-title { font-size: .95rem; font-weight: 700; letter-spacing: -0.01em; }
.card-header + p, .card-header ~ p:first-of-type { font-size: .8rem; color: var(--muted); }

/* --- Tables: real tables on desktop, stacked cards on mobile ------------- */

table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; font-size: .62rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--faint);
  padding: .7rem .5rem; border-bottom: 1px solid var(--line); white-space: nowrap;
}
tbody td { padding: .8rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: .85rem; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s; }

@media (max-width: 779px) {
  table, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }
  tbody tr {
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    padding: .75rem .85rem; margin-bottom: .55rem; background: var(--raised);
  }
  tbody tr:last-child { margin-bottom: 0; }
  tbody td { border: none; padding: .18rem 0; font-size: .85rem; }
  tbody td:first-child { font-size: .95rem; font-weight: 700; letter-spacing: -0.01em; padding-bottom: .3rem; }
  tbody td:empty { display: none; }
}

/* --- Buttons ------------------------------------------------------------- */

.btn-primary, .btn-sm, .btn-danger, .btn-cancel, .add-btn, .promo-btn, .btn {
  font-family: inherit; font-weight: 600; cursor: pointer;
  border-radius: var(--radius-xs); border: 1px solid transparent;
  transition: background .15s, border-color .15s, transform .1s, opacity .15s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary:active, .btn-sm:active, .btn-danger:active,
.btn-cancel:active, .add-btn:active, .btn:active { transform: scale(.97); }

.btn-primary, .btn, .add-btn, .promo-btn {
  background: var(--navy-800); color: #fff;
  padding: .6rem 1rem; font-size: .85rem;
}
.btn-primary:hover, .btn:hover, .add-btn:hover, .promo-btn:hover { background: var(--navy-600); }

.btn-sm {
  background: var(--surface); color: var(--ink-2);
  border-color: var(--line-strong);
  padding: .4rem .7rem; font-size: .78rem;
}
.btn-sm:hover { background: var(--canvas); border-color: var(--muted); }

.btn-danger {
  background: var(--bad-bg); color: var(--bad); border-color: transparent;
  padding: .4rem .7rem; font-size: .78rem;
}
.btn-danger:hover { background: #fbdde1; }

.btn-cancel {
  background: var(--surface); color: var(--ink-2); border-color: var(--line-strong);
  padding: .6rem 1rem; font-size: .85rem;
}
.btn-cancel:hover { background: var(--canvas); }

button:disabled { opacity: .55; cursor: not-allowed; transform: none !important; }

/* --- Forms --------------------------------------------------------------- */

label {
  display: block; font-size: .8rem; font-weight: 600;
  color: var(--ink-2); margin-bottom: .35rem;
}
input[type=text], input[type=email], input[type=password], input[type=tel],
input[type=number], input[type=date], input[type=datetime-local], input[type=time],
input[type=search], textarea, select {
  width: 100%; padding: .7rem .8rem;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-xs);
  font-size: 16px; /* keeps iOS from zooming on focus */
  font-family: inherit; color: var(--ink); background: var(--surface);
  outline: none; transition: border-color .15s, box-shadow .15s;
  margin-bottom: .85rem;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
input.invalid { border-color: var(--bad) !important; background: var(--bad-bg); }
textarea { resize: vertical; min-height: 72px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7789' d='M1.4 0 6 4.6 10.6 0 12 1.4 6 7.4 0 1.4z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .8rem center; padding-right: 2.2rem; }
input[type=checkbox] { width: auto; margin: 0; accent-color: var(--accent); }

/* --- Badges -------------------------------------------------------------- */

.charge-status, .pm-badge, .nav-badge {
  display: inline-block; font-size: .68rem; font-weight: 700;
  padding: .2rem .5rem; border-radius: 999px; white-space: nowrap;
  letter-spacing: -0.01em;
}
.status-paid      { background: var(--good-bg);   color: var(--good); }
.status-pending   { background: var(--warn-bg);   color: var(--warn); }
.status-failed    { background: var(--bad-bg);    color: var(--bad); }
.status-scheduled { background: var(--info-bg);   color: var(--info); }
.status-overdue   { background: var(--bad-bg);    color: var(--bad); }
.status-credit    { background: var(--good-bg);   color: var(--good); }
.status-refunded  { background: var(--violet-bg); color: var(--violet); }
.pm-badge { background: var(--good-bg); color: var(--good); }
.pm-tag { font-size: .68rem; font-weight: 700; padding: .2rem .5rem; border-radius: 999px; }
.pm-tag.yes { background: var(--good-bg); color: var(--good); }
.pm-tag.no  { background: var(--warn-bg); color: var(--warn); }

/* --- Modals -------------------------------------------------------------- */

.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(8, 19, 42, .55);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0; animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.modal {
  background: var(--surface); width: 100%;
  border-radius: 20px 20px 0 0; padding: 1.25rem 1.1rem;
  padding-bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
  max-height: 92vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slide-up .26s cubic-bezier(.22,.9,.3,1) both;
}
@keyframes slide-up { from { transform: translateY(4%); opacity: .6 } to { transform: none; opacity: 1 } }
.modal h2 { font-size: 1.1rem; font-weight: 800; margin-bottom: .9rem; }
.modal-actions {
  display: flex; gap: .6rem; justify-content: flex-end;
  margin-top: 1.25rem; flex-wrap: wrap;
}
.modal-actions button { flex: 1 1 auto; }
.modal-error, .modal-success {
  font-size: .82rem; padding: .65rem .85rem; border-radius: var(--radius-xs);
  margin-bottom: .9rem; line-height: 1.45;
}
.modal-error   { background: var(--bad-bg);  color: var(--bad);  border: 1px solid #f6ccd2; }
.modal-success { background: var(--good-bg); color: var(--good); border: 1px solid #c2ead9; }

/* --- Lists and rows ------------------------------------------------------ */

.empty { text-align: center; padding: 2.5rem 1rem; color: var(--faint); font-size: .88rem; }
.empty .icon { font-size: 2rem; margin-bottom: .6rem; opacity: .5; }

.activity-item, .charge-item, .charge-row, .player-select-item, .select-all-row {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: .8rem 0; border-bottom: 1px solid var(--line);
}
.player-select-item, .select-all-row { align-items: center; }
.charge-dot { margin-top: .42rem; }
.charge-right { display: flex; flex-direction: column; align-items: flex-end; gap: .3rem; }
.activity-item:last-child, .charge-item:last-child, .charge-row:last-child { border-bottom: none; }
.activity-info, .charge-info { flex: 1; min-width: 0; }
.activity-name, .charge-title, .player-name {
  font-weight: 650; font-size: .9rem; letter-spacing: -0.01em;
  overflow: hidden; text-overflow: ellipsis;
}
.activity-detail, .charge-date, .charge-desc, .player-email {
  font-size: .76rem; color: var(--muted); margin-top: .1rem;
}
.charge-date { color: var(--faint); }
.activity-amount, .charge-right { text-align: right; flex-shrink: 0; }
.charge-amount, .activity-amount { font-weight: 700; font-size: .92rem; }
.amount-paid { color: var(--good); font-weight: 700; }
.amount-owed { color: var(--warn); font-weight: 700; }

.charge-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--faint); }
.charge-dot.paid { background: var(--good); }
.charge-dot.pending { background: var(--warn); }
.charge-dot.failed { background: var(--bad); }

.group-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: .85rem 0 .6rem; border-bottom: 2px solid var(--line); margin-bottom: .2rem;
}
.charge-item + .group-head { margin-top: .9rem; }
.group-head:first-child { padding-top: 0; }
.group-name { font-size: .66rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--faint); }
.group-total { font-size: .95rem; font-weight: 800; color: var(--navy-800); }

/* --- Player selector ----------------------------------------------------- */

.player-select-list {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  max-height: 260px; overflow-y: auto; background: var(--raised);
}
.player-select-item, .select-all-row {
  padding: .65rem .8rem; cursor: pointer; gap: .65rem;
  -webkit-tap-highlight-color: transparent;
}
.player-select-item:hover, .select-all-row:hover { background: var(--surface); }
.select-all-row { font-weight: 700; font-size: .8rem; color: var(--muted); background: var(--surface); }

/* --- Progress ------------------------------------------------------------ */

.progress-bar { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--good); border-radius: 99px; transition: width .4s cubic-bezier(.22,.9,.3,1); }

/* --- Payment method (player) --------------------------------------------- */

.payment-method, .pm-missing { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.payment-method .add-btn, .pm-missing .add-btn { margin-left: auto; }
.pm-icon {
  width: 40px; height: 40px; border-radius: 10px; background: var(--canvas);
  display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0;
}
.pm-info, .pm-missing-text { flex: 1; min-width: 140px; }
.pm-info strong, .pm-missing-text strong { font-size: .9rem; display: block; font-weight: 650; }
.pm-info span, .pm-missing-text p { font-size: .76rem; color: var(--faint); }

/* --- Analysis panels ----------------------------------------------------- */

.recon { font-size: .8rem; padding: .75rem .9rem; border-radius: var(--radius-sm); margin-bottom: .8rem; line-height: 1.5; }
.recon.ok   { background: var(--good-bg); color: var(--good); }
.recon.warn { background: var(--warn-bg); color: var(--warn); border: 1px solid #f4dcb8; }
.sync-line { font-size: .7rem; color: var(--faint); margin: -.4rem 0 .9rem; }

.row-note { font-size: .72rem; margin-top: .2rem; line-height: 1.4; }
.row-note.warn { color: var(--warn); }
.row-note.bad  { color: var(--bad); }
.row-note.ok   { color: var(--faint); }

.unbacked-head { display: flex; flex-wrap: wrap; gap: 1rem 1.75rem; padding: .25rem 0 1rem; }
.unbacked-fig { min-width: 5.5rem; }
.unbacked-fig .n { font-size: 1.35rem; font-weight: 800; line-height: 1.1; letter-spacing: -0.03em; }
.unbacked-fig .l { font-size: .64rem; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); font-weight: 700; margin-top: .15rem; }
.unbacked-note {
  font-size: .76rem; color: var(--muted); padding-top: .7rem;
  border-top: 1px solid var(--line); margin-top: .5rem; line-height: 1.5;
}
.unbacked-note code { background: var(--canvas); padding: .1rem .3rem; border-radius: 4px; font-size: .95em; }

/* --- Category controls --------------------------------------------------- */

.cat-toggle {
  display: flex; gap: .25rem; background: var(--canvas);
  padding: .25rem; border-radius: var(--radius-sm); margin-bottom: .9rem;
}
.cat-btn {
  flex: 1; padding: .45rem .6rem; border: none; background: transparent;
  border-radius: var(--radius-xs); cursor: pointer; font-family: inherit;
  font-size: .78rem; font-weight: 650; color: var(--muted); transition: all .15s;
}
.cat-btn.active { background: var(--surface); color: var(--navy-800); box-shadow: var(--shadow-sm); }
.cat-select {
  font-family: inherit; font-size: .7rem; font-weight: 650; color: var(--muted);
  background: var(--canvas); border: 1px solid var(--line);
  border-radius: 6px; padding: .2rem 1.5rem .2rem .4rem; cursor: pointer;
  width: auto; margin: 0; background-position: right .35rem center;
}
.cat-manual { font-size: .62rem; color: var(--faint); margin-left: .3rem; font-style: italic; }

/* --- Notices ------------------------------------------------------------- */

.notice {
  display: flex; gap: .75rem; align-items: flex-start;
  padding: .85rem .95rem; border-radius: var(--radius-sm);
  font-size: .82rem; line-height: 1.5; margin-bottom: 1rem;
}
.notice-icon { font-size: 1.05rem; line-height: 1.3; flex-shrink: 0; }
.notice strong { display: block; font-weight: 700; margin-bottom: .15rem; }
.notice.info { background: var(--info-bg); color: #1b3a8f; }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.good { background: var(--good-bg); color: var(--good); }

/* --- Desktop ------------------------------------------------------------- */

@media (min-width: 780px) {
  body { font-size: 15px; }
  :root { --tabbar-h: 0px; }

  .nav { padding: 0 1.5rem; }
  .nav-name { display: inline; }
  .nav-brand { font-size: 1.02rem; }
  .nav-brand .brand-long { display: inline; }
  .nav-brand .brand-short { display: none; }
  .stat-label { min-height: 0; }
  .nav-brand img { width: 34px; height: 34px; }

  .main { padding: 1.5rem 1.5rem 3rem; }

  .stats-grid, .stats-row { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .85rem; }
  .stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-card { padding: 1.1rem 1.15rem; }
  .stat-value { font-size: 1.85rem; }

  .tabs {
    position: static; display: flex; gap: .2rem;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: 12px; padding: .3rem; margin-bottom: 1.25rem;
    backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  .tab {
    flex: 0 1 auto; flex-direction: row; gap: .45rem;
    padding: .5rem .9rem; font-size: .84rem; border-radius: var(--radius-xs);
  }
  .tab svg { width: 16px; height: 16px; }
  .tab:hover { color: var(--ink-2); background: var(--canvas); }
  .tab.active { background: var(--navy-800); color: #fff; }
  .tab.active:hover { background: var(--navy-800); }

  .card { padding: 1.35rem 1.5rem; }

  .modal-overlay { align-items: center; padding: 1.5rem; }
  .modal { border-radius: 18px; max-width: 560px; padding: 1.6rem; max-height: 86vh; }
  .modal-actions button { flex: 0 0 auto; }
}

@media (min-width: 1024px) {
  .main { padding: 2rem 2rem 3rem; }
}

/* --- Motion preferences -------------------------------------------------- */

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

/* --- Signed-out pages (login, reset, card setup, guest payment) ----------- */

body.auth {
  min-height: 100vh;   /* fallback for iOS before 15.4, where dvh is ignored */
  min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center;
  /* "safe" keeps the top reachable when the content is taller than the screen — plain
     centring clips it off the top with no way to scroll back, which is what a long
     signup form or an open keyboard does on a phone. */
  justify-content: center;
  justify-content: safe center;
  padding: 1.25rem;
  padding-top: max(1.25rem, env(safe-area-inset-top, 0px));
  padding-bottom: max(1.25rem, env(safe-area-inset-bottom, 0px));
  background:
    radial-gradient(1200px 600px at 50% -10%, #16305e 0%, transparent 60%),
    var(--navy-900);
}
/* Direct children stack and share one column width. Without the column direction above
   they sit side by side and each gets squeezed, which is what broke the login page on a
   phone when a second child was present. */
body.auth > * { width: 100%; max-width: 460px; }
body.auth .card {
  padding: 1.75rem 1.5rem;
  border: none; border-radius: 20px;
  box-shadow: var(--shadow-lg);
  margin-bottom: 0;
}
body.auth .logo { text-align: center; margin-bottom: 1.5rem; }
body.auth .logo-icon {
  width: 58px; height: 58px; border-radius: 50%; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: .65rem; background: var(--navy-800);
}
body.auth .logo-icon img { width: 100%; height: 100%; object-fit: cover; }
body.auth .logo h1 { font-size: 1.3rem; font-weight: 800; }
body.auth .logo p { color: var(--muted); font-size: .84rem; margin-top: .15rem; }

body.auth .tabs {
  position: static; display: flex; gap: .25rem;
  background: var(--canvas); border: none; border-radius: var(--radius-sm);
  padding: .25rem; margin-bottom: 1.25rem;
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
body.auth .tab {
  flex: 1; flex-direction: row; justify-content: center;
  padding: .55rem; font-size: .85rem; border-radius: var(--radius-xs);
  color: var(--muted);
}
body.auth .tab.active { background: var(--surface); color: var(--navy-800); box-shadow: var(--shadow-sm); }

body.auth .btn { width: 100%; padding: .8rem; font-size: .95rem; }
body.auth .error, body.auth .success {
  font-size: .82rem; padding: .7rem .85rem; border-radius: var(--radius-xs);
  margin-bottom: 1rem; line-height: 1.45; display: none;
}
body.auth .error   { background: var(--bad-bg);  color: var(--bad); }
body.auth .success { background: var(--good-bg); color: var(--good); }

@media (min-width: 780px) {
  body.auth .card { padding: 2rem 2.25rem; }
}

/* --- Toolbars: filter rows inside a card -------------------------------- */

.toolbar {
  display: flex; flex-wrap: wrap; gap: .5rem; align-items: center;
  padding: .85rem 0; border-bottom: 1px solid var(--line); margin-bottom: .25rem;
}
.toolbar select, .toolbar input, .toolbar button { margin-bottom: 0; }
.toolbar select, .toolbar input[type=text] {
  width: auto; flex: 1 1 8rem; min-width: 0;
  padding: .45rem .7rem; font-size: .85rem;
}
.toolbar select { padding-right: 1.9rem; }
.toolbar .count { font-size: .72rem; color: var(--faint); white-space: nowrap; margin-left: auto; }

/* Cards whose content is edge-to-edge lists */
.card > .toolbar:first-of-type { margin-top: -.25rem; }

@media (max-width: 779px) {
  .card-header { flex-direction: column; align-items: stretch; gap: .6rem; }
  .card-header > .btn-primary, .card-header > button { width: 100%; }
  .card-header > div:last-child { display: flex; gap: .5rem; }
  .card-header > div:last-child > button { flex: 1; }
}

/* --- Labelled cells: on mobile a table cell becomes a label/value row ----- */

@media (max-width: 779px) {
  tbody td[data-label] {
    display: flex; align-items: center; justify-content: space-between;
    gap: .75rem; padding: .28rem 0;
  }
  tbody td[data-label]::before {
    content: attr(data-label);
    font-size: .66rem; font-weight: 700; letter-spacing: .06em;
    text-transform: uppercase; color: var(--faint);
    flex-shrink: 0;
  }
  tbody td[data-label] > * { text-align: right; }
  tbody td[data-actions] {
    display: flex; flex-wrap: wrap; gap: .4rem;
    padding-top: .6rem; margin-top: .35rem; border-top: 1px solid var(--line);
  }
  tbody td[data-actions] > button { flex: 1 1 auto; }
}
@media (min-width: 780px) {
  tbody td[data-actions] { display: flex; gap: .4rem; flex-wrap: wrap; }
}

/* --- Squad numbers ------------------------------------------------------- */

.squad-badge, .num-chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.5rem; height: 1.5rem; padding: 0 .3rem;
  background: var(--navy-800); color: #fff;
  border-radius: 6px; font-size: .7rem; font-weight: 800;
  font-variant-numeric: tabular-nums; flex-shrink: 0;
}
.num-chip { background: var(--canvas); color: var(--muted); min-width: 1.9rem; height: 1.9rem; font-size: .78rem; }
select.squad-num {
  width: auto; min-width: 4.4rem; margin: 0;
  padding: .35rem 1.6rem .35rem .5rem;
  font-size: .85rem; font-weight: 700; font-variant-numeric: tabular-nums;
  background-position: right .45rem center;
}
select.squad-num.saved {
  border-color: var(--good); background-color: var(--good-bg); color: var(--good);
}

.amount-failed { color: var(--bad); font-weight: 700; }


.btn-sm.chosen-in  { background: var(--good-bg); color: var(--good); border-color: var(--good); }
.btn-sm.chosen-out { background: var(--bad-bg);  color: var(--bad);  border-color: var(--bad); }

/* --- Forms that deserve more than one stacked column ---------------------- */

.card.narrow { max-width: 620px; margin-left: auto; margin-right: auto; }

.field-note {
  font-size: .78rem; color: var(--faint);
  margin: -.55rem 0 1rem; line-height: 1.45;
}

@media (min-width: 780px) {
  .form-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 1.1rem; }
  .form-grid > .full { grid-column: 1 / -1; }
}

/* --- Game time: one track per player ------------------------------------- */

.gt-row {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center;
  gap: .85rem; padding: .85rem 0; border-bottom: 1px solid var(--line);
}
.gt-row:last-child { border-bottom: none; }
.gt-who { min-width: 0; }
.gt-name { font-weight: 650; font-size: .92rem; letter-spacing: -.01em; display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.gt-sub { font-size: .72rem; color: var(--faint); margin-top: .15rem; }

/* Solid = picked, amber = put their name in and was passed over, grey = unavailable. */
.gt-bar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: var(--line); margin-top: .4rem; }
.gt-bar span { display: block; height: 100%; }
.gt-picked     { background: var(--navy-800); }
.gt-overlooked { background: #e0a13c; }
.gt-away       { background: var(--line); }

.gt-rate { text-align: right; min-width: 3.5rem; }
.gt-rate b { display: block; font-size: 1.15rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.gt-rate span { font-size: .66rem; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }

.gt-key { display: flex; flex-wrap: wrap; gap: .9rem; font-size: .72rem; color: var(--muted); padding: .25rem 0 1rem; }
.gt-key i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: .35rem; vertical-align: -1px; }

.flag { font-size: .64rem; font-weight: 700; padding: .12rem .4rem; border-radius: 5px; white-space: nowrap; }
.flag.cold { background: var(--warn-bg); color: var(--warn); }
.flag.free { background: var(--info-bg); color: var(--info); }

/* Squad picker */
.sq-count { font-size: .8rem; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.sq-list { display: grid; gap: .4rem; margin: .75rem 0 1rem; }
.sq-item {
  display: flex; align-items: center; gap: .7rem; padding: .6rem .75rem;
  border: 1.5px solid var(--line); border-radius: 11px; cursor: pointer; background: var(--surface);
  transition: border-color .12s, background .12s;
}
.sq-item.on { border-color: var(--navy-800); background: var(--accent-soft); }
.sq-item.disabled { opacity: .4; pointer-events: none; }
.sq-item .who { flex: 1; min-width: 0; }
.sq-item .who b { display: block; font-weight: 650; font-size: .9rem; }
.sq-item .who span { font-size: .7rem; color: var(--faint); }
.sq-tick { width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--line-strong); flex-shrink: 0; }
.sq-item.on .sq-tick { background: var(--navy-800); border-color: var(--navy-800); box-shadow: inset 0 0 0 3px #fff; }
