/* ==========================================================================
   FPL Companion - design system
   One accent, generous space, big readable numbers. Light and dark.
   ========================================================================== */

:root {
  --bg:        #f4f6f8;
  --bg-soft:   #eaeef3;
  --surface:   #ffffff;
  --surface-2: #f7f9fb;
  --line:      #e0e6ed;
  --line-soft: #eef2f6;
  --text:      #10151c;
  --text-2:    #5b6875;
  --text-3:    #8b97a4;

  --accent:      #00a86b;
  --accent-soft: #e2f6ee;
  --accent-text: #007a4d;
  --on-accent:   #ffffff;

  --good:  #17a45c;
  --ok:    #7bb32e;
  --mid:   #d4a017;
  --bad:   #e0663a;
  --worst: #d13b3b;

  --up:    #17a45c;
  --down:  #d13b3b;
  --warn:  #d4a017;

  --shadow: 0 1px 2px rgba(16, 21, 28, .05), 0 4px 16px rgba(16, 21, 28, .06);
  --shadow-lift: 0 2px 6px rgba(16, 21, 28, .08), 0 12px 32px rgba(16, 21, 28, .12);

  --r-sm: 8px;
  --r:    14px;
  --r-lg: 20px;

  --pitch-1: #d8ecdd;
  --pitch-2: #c6e3cd;

  --tap: 44px;
}

html[data-theme='dark'] {
  --bg:        #0c1015;
  --bg-soft:   #11161d;
  --surface:   #151b23;
  --surface-2: #1b222c;
  --line:      #262f3b;
  --line-soft: #1e2631;
  --text:      #e8edf3;
  --text-2:    #9aa7b6;
  --text-3:    #6b7887;

  --accent:      #00d68f;
  --accent-soft: #0e2a22;
  --accent-text: #35e5a6;
  --on-accent:   #04160f;

  --good:  #2fcf7a;
  --ok:    #96d13c;
  --mid:   #e3b431;
  --bad:   #ef7a4a;
  --worst: #f05a5a;

  --up:    #2fcf7a;
  --down:  #f05a5a;
  --warn:  #e3b431;

  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
  --shadow-lift: 0 2px 6px rgba(0, 0, 0, .5), 0 12px 32px rgba(0, 0, 0, .45);

  --pitch-1: #16241d;
  --pitch-2: #112019;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Inter, 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
p { margin: 0 0 .6em; }
button { font: inherit; color: inherit; }
a { color: var(--accent-text); text-decoration: none; }

.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

/* ---------- App frame ---------------------------------------------------- */

#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--line-soft);
}

.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -.02em;
  margin-right: auto;
  min-width: 0;
}

@media (max-width: 460px) {
  .brand .brand-text { display: none; }
  .topbar-inner { gap: 8px; padding-left: 12px; padding-right: 12px; }
  .icon-btn { width: 36px; }
}

.brand-mark {
  width: 26px; height: 26px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent);
  display: grid; place-items: center;
  font-size: 13px; font-weight: 800;
  flex: none;
}

.icon-btn {
  width: var(--tap); height: 36px;
  min-width: 36px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 10px;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: scale(.96); }
.icon-btn svg { width: 17px; height: 17px; stroke: var(--text-2); fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* Deadline countdown */
.countdown {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}
.countdown .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.countdown.urgent { border-color: var(--warn); color: var(--warn); }
.countdown.urgent .dot { background: var(--warn); animation: pulse 1.6s infinite; }
.countdown.live { border-color: var(--down); color: var(--down); }
.countdown.live .dot { background: var(--down); animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .25 } }
.countdown .cd-label { color: var(--text-3); font-weight: 500; }
.countdown.urgent .cd-label, .countdown.live .cd-label { color: inherit; opacity: .8; }

/* ---------- Layout ------------------------------------------------------- */

.shell {
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  gap: 22px;
  padding: 0 16px;
}

.rail { display: none; }

.main {
  flex: 1;
  min-width: 0;
  padding: 16px 0 calc(78px + env(safe-area-inset-bottom));
}

/* Bottom tabs (phone) */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.6) blur(16px);
  -webkit-backdrop-filter: saturate(1.6) blur(16px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}

.tab {
  border: 0;
  background: none;
  padding: 8px 2px 9px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  color: var(--text-3);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .01em;
  transition: color .15s;
}
.tab svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab[aria-selected='true'] { color: var(--accent-text); }
.tab:active { transform: scale(.94); }

@media (min-width: 900px) {
  .tabbar { display: none; }
  .rail {
    display: block;
    width: 208px;
    flex: none;
    padding: 18px 0;
    position: sticky;
    top: 58px;
    align-self: flex-start;
  }
  .rail .tab {
    flex-direction: row;
    justify-content: flex-start;
    gap: 11px;
    width: 100%;
    padding: 10px 13px;
    border-radius: 11px;
    font-size: 14px;
    margin-bottom: 3px;
  }
  .rail .tab[aria-selected='true'] { background: var(--accent-soft); }
  .main { padding: 22px 0 60px; }
}

/* ---------- Building blocks ---------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card + .card, .stack > * + * { margin-top: 14px; }
.stack { display: block; }

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line-soft);
}
.card-head h2, .card-head h3 { font-size: 14.5px; }
.card-head .sub { font-size: 12px; color: var(--text-3); font-weight: 500; }
.card-head .spacer { margin-left: auto; }
.card-body { padding: 15px; }
.card-body.tight { padding: 10px 12px; }
.card-body.flush { padding: 0; }

.section-title {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-3);
  margin: 22px 2px 9px;
}
.section-title:first-child { margin-top: 4px; }

.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.tiny { font-size: 12px; }
.small { font-size: 13px; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
}
.pill.accent { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); }
.pill.warn   { background: color-mix(in srgb, var(--warn) 16%, transparent); border-color: transparent; color: var(--warn); }
.pill.danger { background: color-mix(in srgb, var(--down) 16%, transparent); border-color: transparent; color: var(--down); }
.pill.up     { background: color-mix(in srgb, var(--up) 16%, transparent); border-color: transparent; color: var(--up); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 15px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: none; border-color: transparent; color: var(--text-2); }
.btn.block { width: 100%; }
.btn.sm { min-height: 31px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--bg-soft);
  border-radius: 10px;
  border: 1px solid var(--line-soft);
}
.segmented button {
  border: 0;
  background: none;
  padding: 6px 13px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
}
.segmented button[aria-pressed='true'] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

input[type='text'], input[type='number'], input[type='search'], select {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  outline: none;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Big stat */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); gap: 2px; }
.stat { padding: 10px 6px; text-align: center; }
.stat .v { font-size: 22px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.stat .k { font-size: 10.5px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; margin-top: 2px; }
.stat .v.sm { font-size: 17px; }

/* ---------- Pitch -------------------------------------------------------- */

.pitch {
  background: linear-gradient(175deg, var(--pitch-1), var(--pitch-2));
  padding: 14px 8px 10px;
  position: relative;
}
.pitch::before {
  content: '';
  position: absolute; inset: 8px 10px;
  border: 1.5px solid color-mix(in srgb, var(--text) 9%, transparent);
  border-radius: 8px;
  pointer-events: none;
}
.pitch-row {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-bottom: 12px;
}
.pitch-row:last-child { margin-bottom: 4px; }

.bench-strip {
  background: var(--surface-2);
  border-top: 1px solid var(--line-soft);
  padding: 11px 8px 9px;
}
.bench-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-3);
  text-align: center; margin-bottom: 7px;
}

.plr {
  width: 70px;
  flex: none;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  position: relative;
}
.plr:active { transform: scale(.95); }
.plr-shirt {
  width: 38px; height: 38px;
  border-radius: 11px;
  display: grid; place-items: center;
  font-size: 10.5px; font-weight: 800; letter-spacing: -.02em;
  color: #fff;
  box-shadow: 0 2px 5px rgba(0,0,0,.18);
  position: relative;
}
.plr-name {
  font-size: 11px;
  font-weight: 650;
  max-width: 70px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: var(--surface);
  border-radius: 5px;
  padding: 1px 5px;
  line-height: 1.35;
}
.plr-sub {
  font-size: 10.5px;
  font-weight: 700;
  background: var(--text);
  color: var(--surface);
  border-radius: 5px;
  padding: 0 5px;
  line-height: 1.5;
  min-width: 22px;
  text-align: center;
}
.plr-sub.pts { background: var(--accent); color: var(--on-accent); }
.plr-badge {
  position: absolute;
  top: -4px; right: -4px;
  width: 17px; height: 17px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 9.5px; font-weight: 800;
  background: var(--text); color: var(--surface);
  border: 2px solid var(--surface);
}
.plr-badge.c { background: var(--accent); color: var(--on-accent); }
.plr-flag {
  position: absolute;
  top: -4px; left: -4px;
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid var(--surface);
}
.plr-flag.d { background: var(--worst); }
.plr-flag.w { background: var(--mid); }
.plr-flag.i { background: var(--bad); }
.plr.playing .plr-shirt { outline: 2px solid var(--down); outline-offset: 2px; }

@media (min-width: 560px) {
  .plr { width: 84px; }
  .plr-shirt { width: 44px; height: 44px; font-size: 12px; }
  .plr-name { font-size: 12px; max-width: 84px; }
  .pitch-row { gap: 8px; }
}

/* ---------- Verdict / advice --------------------------------------------- */

.verdict {
  border-left: 3px solid var(--accent);
}
.verdict .headline {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.3;
}
.verdict .why {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 6px;
}

details.why-box { border-top: 1px solid var(--line-soft); }
details.why-box > summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 15px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 6px;
}
details.why-box > summary::-webkit-details-marker { display: none; }
details.why-box > summary::after {
  content: '';
  width: 6px; height: 6px;
  border-right: 1.8px solid currentColor;
  border-bottom: 1.8px solid currentColor;
  transform: rotate(45deg);
  margin-left: auto;
  transition: transform .18s;
}
details.why-box[open] > summary::after { transform: rotate(-135deg); }
details.why-box .why-body { padding: 0 15px 14px; font-size: 13px; color: var(--text-2); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 12.5px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

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

.list { display: block; }
.list-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 15px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  background: none;
  border-left: 0; border-right: 0; border-top: 0;
  width: 100%;
  text-align: left;
  transition: background .12s;
}
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--surface-2); }
.list-row.static { cursor: default; }
.list-row.static:hover { background: none; }

.avatar {
  width: 34px; height: 34px;
  border-radius: 10px;
  flex: none;
  display: grid; place-items: center;
  font-size: 10px; font-weight: 800;
  letter-spacing: -.02em;
  /* Fallback so a badge is never invisible if no team colour is passed. */
  background: var(--surface-2);
  color: var(--text-2);
}
.rowtitle { font-size: 14px; font-weight: 600; }
.rowsub { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.rowend { text-align: right; flex: none; }
.rowend .big { font-size: 16px; font-weight: 700; }

/* ---------- Fixture ticker ----------------------------------------------- */

.ticker { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; }
.ticker th {
  position: sticky; top: 0;
  background: var(--surface);
  font-size: 10.5px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .05em;
  padding: 8px 4px;
  text-align: center;
  border-bottom: 1px solid var(--line);
  z-index: 2;
}
.ticker th.name-col, .ticker td.name-col {
  text-align: left;
  position: sticky; left: 0;
  background: var(--surface);
  z-index: 1;
  padding-left: 12px;
  min-width: 118px;
  border-right: 1px solid var(--line-soft);
}
.ticker th.name-col { z-index: 3; }
.ticker td {
  padding: 4px 3px;
  text-align: center;
  border-bottom: 1px solid var(--line-soft);
}
.fdr {
  display: block;
  border-radius: 6px;
  padding: 5px 2px;
  font-size: 11px;
  font-weight: 700;
  color: #0d1117;
  line-height: 1.2;
}
.fdr-1 { background: #37d18a; }
.fdr-2 { background: #79e0a8; }
.fdr-3 { background: #dfe4ea; }
.fdr-4 { background: #f5926a; }
.fdr-5 { background: #ea5a5a; color: #fff; }
.fdr-blank { background: var(--line-soft); color: var(--text-3); font-weight: 600; }
html[data-theme='dark'] .fdr-3 { background: #39424f; color: #dbe3ec; }
html[data-theme='dark'] .fdr-blank { background: #1c232d; }

.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------- Data table --------------------------------------------------- */

.dt { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.dt th {
  position: sticky; top: 0;
  background: var(--surface);
  padding: 9px 8px;
  font-size: 10.5px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .04em;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  user-select: none;
  z-index: 2;
}
.dt th:first-child, .dt td:first-child { text-align: left; padding-left: 12px; }
.dt th.sorted { color: var(--accent-text); }
.dt th .arrow { font-size: 9px; }
.dt td {
  padding: 8px;
  text-align: right;
  border-bottom: 1px solid var(--line-soft);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.dt tbody tr { cursor: pointer; }
.dt tbody tr:hover { background: var(--surface-2); }
.dt .proj-col { background: var(--accent-soft); }
.dt th.proj-col { color: var(--accent-text); }

.proj-note {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 9px 12px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--r-sm);
}

/* ---------- Live --------------------------------------------------------- */

.match {
  padding: 12px 15px;
  border-bottom: 1px solid var(--line-soft);
}
.match:last-child { border-bottom: 0; }
.match-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.match-team { display: flex; align-items: center; gap: 8px; min-width: 0; }
.match-team.away { flex-direction: row-reverse; text-align: right; }
.match-team .tname { font-weight: 650; font-size: 14px; }
.match-score { font-size: 19px; font-weight: 750; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.match-state {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-3); text-align: center; margin-top: 2px;
}
.match-state.live { color: var(--down); }
.match-events { margin-top: 9px; display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; font-size: 11.5px; color: var(--text-2); align-items: start; }
.match-events .ev-col { display: grid; gap: 3px; min-width: 0; }
.match-events .ev-col.away { text-align: right; }
.match-events .ev { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match-events .ev.mine { color: var(--accent-text); font-weight: 650; }

.bps-list { display: grid; gap: 4px; margin-top: 9px; }
.bps-item { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.bps-rank {
  width: 19px; height: 19px; border-radius: 6px; flex: none;
  display: grid; place-items: center; font-size: 10px; font-weight: 800;
  background: var(--accent-soft); color: var(--accent-text);
}
.bps-val { margin-left: auto; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ---------- Sandbox ------------------------------------------------------ */

.sb-slot {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}
.sb-slot.out { border-color: var(--down); background: color-mix(in srgb, var(--down) 7%, transparent); }
.sb-slot.in  { border-color: var(--up); background: color-mix(in srgb, var(--up) 7%, transparent); }
.sb-arrow { text-align: center; color: var(--text-3); font-size: 16px; padding: 2px 0; }

/* ---------- Sheet / modal ------------------------------------------------ */

.sheet-backdrop {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(6, 10, 15, .5);
  backdrop-filter: blur(2px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0 } }
.sheet {
  width: 100%;
  max-width: 620px;
  max-height: 90dvh;
  background: var(--surface);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: var(--shadow-lift);
  display: flex; flex-direction: column;
  animation: rise .24s cubic-bezier(.2,.8,.3,1);
  padding-bottom: env(safe-area-inset-bottom);
}
@keyframes rise { from { transform: translateY(24px); opacity: .6 } }
.sheet-grab { width: 36px; height: 4px; border-radius: 2px; background: var(--line); margin: 9px auto 4px; flex: none; }
.sheet-head { padding: 6px 16px 12px; border-bottom: 1px solid var(--line-soft); flex: none; }
.sheet-body { padding: 14px 16px 20px; overflow-y: auto; }
@media (min-width: 700px) {
  .sheet-backdrop { align-items: center; }
  .sheet { border-radius: var(--r-lg); max-height: 84dvh; }
}

/* ---------- Setup / empty ------------------------------------------------ */

.setup {
  max-width: 420px;
  margin: 8vh auto;
  padding: 0 18px;
  text-align: center;
}
.setup .brand-mark { width: 52px; height: 52px; border-radius: 16px; font-size: 22px; margin: 0 auto 18px; }
.setup h1 { font-size: 25px; letter-spacing: -.03em; margin-bottom: 8px; }
.setup p { color: var(--text-2); font-size: 14px; }
.setup .field { margin: 20px 0 12px; text-align: left; }
.setup label { font-size: 12.5px; font-weight: 650; display: block; margin-bottom: 6px; }
.setup .hint { font-size: 12px; color: var(--text-3); margin-top: 8px; line-height: 1.5; }
.setup .err { color: var(--down); font-size: 13px; margin-top: 10px; font-weight: 600; }

.empty { text-align: center; padding: 40px 20px; color: var(--text-3); font-size: 13.5px; }

/* Active-team chip in the header */
.teamchip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 190px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
  transition: background .15s;
}
.teamchip:hover { background: var(--surface-2); }
.teamchip .truncate { max-width: 140px; }
.teamchip .chev {
  width: 6px; height: 6px; flex: none;
  border-right: 1.8px solid var(--text-3);
  border-bottom: 1.8px solid var(--text-3);
  transform: rotate(45deg) translate(-2px, -2px);
}
@media (max-width: 620px) {
  .teamchip { max-width: 116px; }
  .teamchip .truncate { max-width: 76px; }
}

/* Numbered steps in onboarding */
.step { display: flex; gap: 11px; align-items: flex-start; }
.step-n {
  width: 22px; height: 22px; flex: none;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 800;
}
.step-t { font-size: 14px; font-weight: 650; }
.step-d { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }

/* The URL diagram: shows where the team ID hides */
.urlbox {
  margin: 12px 0 0;
  padding: 12px 10px 10px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  text-align: center;
  overflow-x: auto;
}
.urlbox-line {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  white-space: nowrap;
}
.urlbox-dim { color: var(--text-3); }
.urlbox-hit {
  background: var(--accent);
  color: var(--on-accent);
  padding: 2px 4px;
  border-radius: 4px;
  font-weight: 700;
}
@media (max-width: 420px) {
  .urlbox-line { font-size: 10.5px; }
}
.urlbox-arrow { color: var(--accent-text); font-size: 10px; margin-top: 3px; }
.urlbox-note { font-size: 11.5px; color: var(--accent-text); font-weight: 650; }

.card-body.center { text-align: center; }

.skeleton {
  background: linear-gradient(90deg, var(--line-soft) 25%, var(--bg-soft) 37%, var(--line-soft) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite;
  border-radius: var(--r-sm);
}
@keyframes shimmer { 0% { background-position: 100% 0 } 100% { background-position: 0 0 } }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 95;
  background: var(--text);
  color: var(--bg);
  padding: 9px 15px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lift);
  animation: rise .22s ease;
  max-width: calc(100vw - 32px);
  text-align: center;
}
@media (min-width: 900px) { .toast { bottom: 26px; } }

.offline-bar {
  background: var(--warn);
  color: #1a1200;
  font-size: 12.5px;
  font-weight: 650;
  text-align: center;
  padding: 6px 12px;
}

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