/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg:        #f5f5f3;
  --surface:   #ffffff;
  --border:    #e5e5e3;
  --border2:   #d0d0ce;
  --text:      #1a1a1a;
  --muted:     #5f5e5a;
  --hint:      #9c9a92;
  --green:     #15803d;
  --green-bg:  #f0fdf4;
  --green-bd:  #bbf7d0;
  --amber:     #a16207;
  --amber-bg:  #fefce8;
  --amber-bd:  #fef08a;
  --red:       #b91c1c;
  --red-bg:    #fef2f2;
  --purple:    #7c3aed;
  --purple-bg: #ede9fe;
  --purple-bd: #c4b5fd;
  --radius:    8px;
  --radius-lg: 12px;
}
html { font-size: 14px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 13px; }

/* ── Topbar ───────────────────────────────────────────────────────────────── */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 52px;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-logo {
  font-size: 15px; font-weight: 600;
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap; overflow: hidden;
}
.topbar-logo span { font-size: 18px; flex-shrink: 0; }
.topbar-center { display: flex; justify-content: center; align-items: center; }
.topbar-right  { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }

/* ── Score widget ─────────────────────────────────────────────────────────── */
.score-widget {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 5px 12px; font-size: 12px;
}
.score-widget-full { width: 100%; justify-content: center; }
.score-team { display: flex; flex-direction: column; align-items: center; }
.score-team-name { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.score-num  { font-size: 20px; font-weight: 600; line-height: 1.1; }
.score-sep  { color: var(--hint); font-size: 14px; }
.score-q    { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-left: 4px; }
.q-badge    { font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 4px; background: var(--red-bg); color: var(--red); text-transform: uppercase; }
.q-badge.live { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.55} }
.q-time { font-size: 10px; color: var(--hint); }

/* Mobile score in side panel — hidden on desktop */
.mobile-score-wrap { display: none; }

/* ── Board tabs ───────────────────────────────────────────────────────────── */
.board-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  overscroll-behavior-x: contain;
}
.board-tab {
  padding: 10px 18px; font-size: 13px; border: none; background: none;
  color: var(--muted); border-bottom: 2px solid transparent;
  white-space: nowrap; transition: color .15s; position: relative;
}
.board-tab:hover { color: var(--text); }
.board-tab.active { color: var(--text); font-weight: 600; border-bottom-color: var(--text); }
.tab-dot {
  display: none; position: absolute; top: 8px; right: 8px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--green);
}
.board-tab.has-cart .tab-dot { display: block; }

/* ── Cart bar ─────────────────────────────────────────────────────────────── */
.cart-bar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 8px 16px; display: flex; align-items: center; gap: 10px;
}
.cart-chips { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; align-items: center; min-width: 0; }
.cart-chip  { display: flex; align-items: center; gap: 4px; background: var(--purple-bg); border: 1px solid var(--purple-bd); border-radius: 20px; padding: 3px 10px; font-size: 11px; color: var(--purple); white-space: nowrap; }
.chip-x     { cursor: pointer; font-size: 13px; line-height: 1; opacity: .6; }
.chip-x:hover { opacity: 1; }
.cart-empty { font-size: 12px; color: var(--hint); font-style: italic; min-width: 0; }
.cart-btn   { flex-shrink: 0; white-space: nowrap; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 14px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; border: 1px solid var(--border2);
  background: var(--surface); color: var(--text); transition: background .12s;
}
.btn:hover   { background: var(--bg); }
.btn:active  { transform: scale(.98); }
.btn-primary { background: var(--text); color: #fff; border-color: var(--text); }
.btn-primary:hover { background: #333; }
.btn-danger  { color: var(--red); border-color: #fca5a5; background: var(--red-bg); }
.btn-danger:hover { background: #fee2e2; }
.btn-sm   { padding: 5px 10px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }
.btn-xl   { padding: 11px 20px; font-size: 14px; }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }

/* ── Page layout ──────────────────────────────────────────────────────────── */
.page-wrap      { max-width: 1100px; margin: 0 auto; padding: 20px 16px; }
.page-wrap-wide { max-width: 1300px; margin: 0 auto; padding: 20px 16px; }

.board-layout { display: flex; gap: 16px; align-items: flex-start; }
.board-main   { flex: 1; min-width: 0; }
.board-side   {
  width: 220px; flex-shrink: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px;
  display: flex; flex-direction: column; gap: 14px;
}

/* ── Grid outer layout ────────────────────────────────────────────────────── */
.grid-outer {
  display: flex; align-items: stretch; gap: 0; margin-bottom: 6px;
}
.vertical-team-label {
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; width: 22px; margin-right: 4px;
}
.vertical-team-label span {
  writing-mode: vertical-rl; transform: rotate(180deg);
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); white-space: nowrap;
}
.grid-inner     { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.grid-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.grid-hint      { font-size: 11px; color: var(--hint); margin-top: 6px; }

/* ── Grid table ───────────────────────────────────────────────────────────── */
.grid-table { border-collapse: collapse; min-width: 480px; }
.team-header-top {
  text-align: center; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); padding: 4px 0 6px;
}
.grid-table th { font-size: 12px; font-weight: 700; color: var(--muted); padding: 4px 2px; text-align: center; width: 46px; }
.corner-cell   { width: 46px; }
.row-digit     { font-size: 12px; font-weight: 700; color: var(--muted); text-align: center; padding: 2px 4px; width: 46px; vertical-align: middle; }

/* ── Squares ──────────────────────────────────────────────────────────────── */
.sq {
  width: 46px; height: 46px; border: 1px solid var(--border);
  cursor: pointer; position: relative; vertical-align: middle; text-align: center;
  transition: background .1s;
}
.sq-inner {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; padding: 2px; font-size: 8px; line-height: 1.2;
}
.sq-name      { font-weight: 600; font-size: 8px; word-break: break-word; text-align: center; }
.sq-available { background: var(--surface); }
.sq-available:hover { background: #eff6ff; outline: 2px solid #93c5fd; outline-offset: -2px; }
.sq-reserved  { background: #fef9c3; cursor: default; }
.sq-confirmed { background: var(--green-bg); cursor: default; }
.sq-incart    { background: var(--purple-bg); outline: 2px solid var(--purple); outline-offset: -2px; }
.sq-winning   { background: #bbf7d0; outline: 2px solid var(--green); outline-offset: -2px; cursor: default; }
.sq-badge     { position: absolute; top: 1px; right: 1px; font-size: 7px; font-weight: 700; padding: 1px 3px; border-radius: 2px; line-height: 1.3; }
.badge-win    { background: var(--green); color: #fff; }
.badge-cart   { background: var(--purple); color: #fff; }

/* ── Legend ───────────────────────────────────────────────────────────────── */
.legend      { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.legend-item { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); }
.legend-dot  { width: 11px; height: 11px; border-radius: 2px; border: 1px solid var(--border); flex-shrink: 0; }

/* ── Side panel ───────────────────────────────────────────────────────────── */
.section-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--hint); margin-bottom: 6px; }
.stat-row      { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.stat-row:last-child { border-bottom: none; }
.stat-key { color: var(--muted); }
.stat-val { font-weight: 600; }
.progress-wrap { background: var(--bg); border-radius: 4px; height: 5px; margin-top: 5px; }
.progress-bar  { background: var(--text); border-radius: 4px; height: 5px; transition: width .3s; }
.payout-row   { display: flex; justify-content: space-between; padding: 4px 0; font-size: 11px; }
.payout-label { color: var(--muted); }
.payout-amt   { font-weight: 600; }

/* ── Alerts ───────────────────────────────────────────────────────────────── */
.alert       { border-radius: var(--radius); padding: 10px 12px; font-size: 12px; line-height: 1.5; margin-bottom: 8px; }
.alert-win   { background: var(--green-bg); border: 1px solid var(--green-bd); color: var(--green); }
.alert-warn  { background: var(--amber-bg); border: 1px solid var(--amber-bd); color: var(--amber); }
.alert-info  { background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8; }
.alert-title { font-weight: 600; margin-bottom: 2px; }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card       { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; }
.card + .card { margin-top: 12px; }
.card-title { font-size: 13px; font-weight: 600; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-group  { margin-bottom: 12px; }
.form-label  { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin-bottom: 4px; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border2);
  border-radius: var(--radius); font-size: 13px; color: var(--text);
  background: var(--surface); transition: border-color .12s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: #93c5fd; box-shadow: 0 0 0 3px rgba(147,197,253,.2);
}
.form-hint     { font-size: 11px; color: var(--hint); margin-top: 3px; }
.form-row      { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-textarea { resize: vertical; min-height: 64px; }

/* ── Payment methods ──────────────────────────────────────────────────────── */
.pay-methods { display: flex; gap: 6px; flex-wrap: wrap; }
.pay-btn     { flex: 1; min-width: 64px; padding: 8px 6px; border: 1px solid var(--border2); border-radius: var(--radius); background: var(--bg); font-size: 12px; font-weight: 500; color: var(--muted); text-align: center; transition: all .12s; }
.pay-btn:hover  { background: var(--surface); color: var(--text); }
.pay-btn.active { background: var(--surface); color: var(--text); border-color: var(--text); font-weight: 600; }
.pay-note { background: var(--bg); border-radius: var(--radius); padding: 10px 12px; font-size: 12px; color: var(--muted); line-height: 1.5; margin: 10px 0; }

/* ── Alert prefs in checkout ──────────────────────────────────────────────── */
.alert-prefs       { border-top: 1px solid var(--border); margin: 14px 0 10px; padding-top: 12px; }
.alert-prefs-title { font-size: 12px; font-weight: 600; margin-bottom: 10px; }

/* ── Toggles ──────────────────────────────────────────────────────────────── */
.toggle-row  { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); gap: 12px; }
.toggle-row:last-child { border-bottom: none; }
.toggle-info { flex: 1; }
.toggle-name { font-size: 12px; font-weight: 500; }
.toggle-desc { font-size: 11px; color: var(--hint); margin-top: 1px; }
.toggle      { position: relative; width: 34px; height: 20px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track { display: block; width: 34px; height: 20px; background: var(--border2); border-radius: 10px; cursor: pointer; transition: background .2s; }
.toggle input:checked + .toggle-track { background: var(--green); }
.toggle-thumb { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; background: #fff; border-radius: 50%; pointer-events: none; transition: transform .2s; }
.toggle input:checked ~ .toggle-thumb { transform: translateX(14px); }

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: flex-start; justify-content: center;
  z-index: 200; padding: 16px; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.modal {
  background: var(--surface); border-radius: var(--radius-lg);
  border: 1px solid var(--border); padding: 22px;
  width: 380px; max-width: 100%; margin: auto;
  max-height: 90vh; overflow-y: auto;
}
.modal-title { font-size: 16px; font-weight: 600; margin-bottom: 3px; }
.modal-sub   { font-size: 12px; color: var(--muted); margin-bottom: 16px; }

/* ── Order table ──────────────────────────────────────────────────────────── */
.order-table    { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
.order-table th { font-size: 11px; color: var(--muted); font-weight: 500; padding: 4px 0; border-bottom: 1px solid var(--border); text-align: left; }
.order-table td { font-size: 12px; padding: 5px 0; border-bottom: 1px solid var(--border); vertical-align: middle; }
.order-table tr:last-child td { border-bottom: none; }

/* ── Fee lines ────────────────────────────────────────────────────────────── */
.fee-lines { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 4px; }
.fee-line  { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.fee-line.total { font-size: 14px; font-weight: 600; color: var(--text); border-top: 1px solid var(--border); padding-top: 8px; margin-top: 4px; }

/* ── Stripe ───────────────────────────────────────────────────────────────── */
#stripe-element { border: 1px solid var(--border2); border-radius: var(--radius); padding: 10px; background: var(--surface); min-height: 44px; margin-bottom: 12px; }
.stripe-loading { text-align: center; padding: 20px; font-size: 13px; color: var(--hint); }

/* ── Success screen ───────────────────────────────────────────────────────── */
.success-screen { text-align: center; padding: 8px 0; }
.success-icon   { font-size: 40px; margin-bottom: 10px; }
.success-title  { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.success-body   { font-size: 13px; color: var(--muted); line-height: 1.6; }

/* ── My Squares ───────────────────────────────────────────────────────────── */
.my-sq-card    { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: 12px; overflow: hidden; }
.my-sq-header  { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.my-sq-row     { display: flex; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--border); gap: 12px; font-size: 13px; }
.my-sq-row:last-child { border-bottom: none; }
.sq-digit-badge { font-size: 16px; font-weight: 700; min-width: 60px; text-align: center; }
.sq-digit-label { font-size: 10px; color: var(--hint); text-align: center; }
.status-pill    { display: inline-flex; align-items: center; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 20px; white-space: nowrap; }
.pill-confirmed { background: var(--green-bg); color: var(--green); }
.pill-reserved  { background: var(--amber-bg); color: var(--amber); }

/* Referral row — wraps on mobile */
.referral-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.referral-row .form-input { min-width: 0; flex: 1; }

/* ── Admin ────────────────────────────────────────────────────────────────── */
.admin-wrap    { display: flex; min-height: calc(100vh - 52px); }
.admin-nav     { width: 190px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.admin-nav-logo { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 13px; font-weight: 600; }
.admin-nav-logo small { display: block; font-size: 11px; color: var(--hint); font-weight: 400; margin-top: 1px; }
.nav-link      { display: flex; align-items: center; justify-content: space-between; padding: 9px 16px; font-size: 13px; color: var(--muted); border-left: 2px solid transparent; cursor: pointer; border: none; background: none; width: 100%; text-align: left; font-family: inherit; transition: color .1s; }
.nav-link:hover  { color: var(--text); background: var(--bg); }
.nav-link.active { color: var(--text); font-weight: 600; border-left-color: var(--text); background: var(--bg); }
.nav-badge     { background: var(--red-bg); color: var(--red); font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 10px; }
.admin-content { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.admin-header  { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.admin-title   { font-size: 16px; font-weight: 600; }
.admin-sub     { font-size: 12px; color: var(--hint); margin-top: 1px; }
.admin-body    { padding: 20px; flex: 1; overflow-y: auto; }
.metrics       { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; margin-bottom: 18px; }
.metric        { background: var(--bg); border-radius: var(--radius); padding: 12px; }
.metric-label  { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.metric-val    { font-size: 24px; font-weight: 600; }
.metric-sub    { font-size: 11px; color: var(--hint); margin-top: 2px; }
.admin-table   { width: 100%; border-collapse: collapse; font-size: 12px; }
.admin-table th { font-size: 11px; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.admin-table td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--bg); }
.board-admin-row { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.board-admin-row:last-child { border-bottom: none; padding-bottom: 0; }
.board-drag      { color: var(--hint); font-size: 16px; cursor: grab; flex-shrink: 0; }
.board-info      { flex: 1; min-width: 0; }
.board-name-label { font-weight: 600; font-size: 13px; }
.board-meta-label { font-size: 11px; color: var(--muted); margin-top: 1px; }
.board-fill-bar  { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.fill-track      { flex: 1; background: var(--bg); border-radius: 3px; height: 4px; }
.fill-progress   { background: var(--text); border-radius: 3px; height: 4px; }
.fill-label      { font-size: 10px; color: var(--hint); white-space: nowrap; }
.pill        { display: inline-flex; align-items: center; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 10px; }
.pill-green  { background: var(--green-bg); color: var(--green); }
.pill-amber  { background: var(--amber-bg); color: var(--amber); }
.pill-gray   { background: var(--bg); color: var(--muted); border: 1px solid var(--border); }
.pill-red    { background: var(--red-bg); color: var(--red); }

/* Mobile admin nav toggle */
.admin-nav-toggle { display: none; }

/* ── Print ────────────────────────────────────────────────────────────────── */
@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .sq { width: 52px !important; height: 52px !important; }
  .sq-name { font-size: 7px !important; }
  .sq-confirmed { background: #d1fae5 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .sq-winning   { background: #6ee7b7 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.print-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.print-title  { font-size: 20px; font-weight: 700; }
.print-sub    { font-size: 13px; color: var(--muted); }
.print-score  { font-size: 24px; font-weight: 700; text-align: center; }
.print-rules  { font-size: 12px; color: var(--muted); margin-top: 16px; line-height: 1.6; }

/* ── Utility ──────────────────────────────────────────────────────────────── */
.text-muted    { color: var(--muted); }
.text-small    { font-size: 11px; }
.text-center   { text-align: center; }
.mt-1 { margin-top: 6px; }   .mb-1 { margin-bottom: 6px; }
.mt-2 { margin-top: 12px; }  .mb-2 { margin-bottom: 12px; }
.mt-3 { margin-top: 20px; }  .mb-3 { margin-bottom: 20px; }
.flex { display: flex; } .flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 6px; } .gap-2 { gap: 10px; }
.w-full { width: 100%; }
.hidden { display: none !important; }
[x-cloak] { display: none !important; }

/* ── Mobile ───────────────────────────────────────────────────────────────── */
@media (max-width: 540px) {

  /* Topbar */
  .topbar {
    grid-template-columns: 1fr auto;
    padding: 0 10px;
    height: 46px;
  }
  .topbar-center { display: none; }
  .topbar-logo   { font-size: 13px; }
  .topbar-logo span { font-size: 15px; }
  .topbar-right  { gap: 4px; }
  .topbar-right .btn { padding: 4px 8px; font-size: 11px; }

  /* Show score in side panel instead */
  .mobile-score-wrap { display: block; }

  /* Cart bar */
  .cart-bar  { padding: 6px 10px; gap: 6px; flex-wrap: nowrap; }
  .cart-empty { font-size: 11px; }
  .cart-chip  { font-size: 10px; padding: 2px 8px; }
  .cart-btn   { padding: 5px 10px; font-size: 12px; }

  /* Tabs */
  .board-tab { padding: 8px 12px; font-size: 12px; }

  /* Page wrap */
  .page-wrap-wide { padding: 10px 8px; }

  /* Vertical team label */
  .vertical-team-label       { width: 16px; margin-right: 2px; }
  .vertical-team-label span  { font-size: 9px; letter-spacing: .02em; }

  /* Team header */
  .team-header-top { font-size: 10px; }

  /* Shrink squares so 10 cols fit ~375px screen */
  .sq           { width: 31px; height: 36px; }
  .sq-name      { font-size: 6px; }
  .sq-badge     { font-size: 6px; padding: 1px 2px; }
  .grid-table th { width: 31px; font-size: 10px; padding: 3px 1px; }
  .corner-cell  { width: 26px; }
  .row-digit    { width: 26px; font-size: 10px; padding: 2px; }
  .grid-table   { min-width: unset; width: 100%; }

  /* Legend */
  .legend      { gap: 6px; }
  .legend-item { font-size: 10px; }
  .legend-dot  { width: 9px; height: 9px; }
  .grid-hint   { font-size: 10px; }

  /* Board layout — stack vertically */
  .board-layout { flex-direction: column; gap: 10px; }
  .board-side   { width: 100%; padding: 10px 12px; gap: 10px; }

  /* Modal — full width, scrollable */
  .modal-backdrop { padding: 8px; }
  .modal  { padding: 16px; max-height: 92vh; border-radius: var(--radius); }
  .modal-title { font-size: 14px; }

  /* Referral row */
  .referral-row { flex-direction: column; align-items: stretch; }

  /* Form rows single column */
  .form-row { grid-template-columns: 1fr; }

  /* Metrics 2 cols */
  .metrics { grid-template-columns: repeat(2, minmax(0,1fr)); }

  /* Admin — show toggle button, hide sidebar by default */
  .admin-nav { display: none; position: fixed; inset: 52px 0 0 0; z-index: 100; width: 220px; box-shadow: 2px 0 12px rgba(0,0,0,.15); }
  .admin-nav.open { display: flex; }
  .admin-nav-toggle {
    display: flex; align-items: center; gap: 6px;
    padding: 5px 10px; font-size: 12px;
    border: 1px solid var(--border2); border-radius: var(--radius);
    background: var(--surface); color: var(--text); cursor: pointer; font-family: inherit;
  }
  .admin-content { width: 100%; }
  .admin-body    { padding: 12px; }
  .admin-header  { padding: 10px 12px; }
}

@media (max-width: 380px) {
  /* iPhone SE and smaller */
  .sq       { width: 28px; height: 33px; }
  .sq-name  { font-size: 5.5px; }
  .corner-cell { width: 24px; }
  .row-digit   { width: 24px; font-size: 9px; }
  .grid-table th { width: 28px; font-size: 9px; }
}
