:root {
  --bg: #f4f6f9; --card: #ffffff; --ink: #12202f; --muted: #5c6b7a;
  --line: #e2e8f0; --brand: #0b5cab; --brand-ink: #ffffff;
  --up: #12915a; --up-bg: #e6f6ee; --busy: #b5651d; --busy-bg: #fbeee0;
  --danger: #b3261e; --pill: #eef2f7;
  --shadow: 0 1px 3px rgba(16,32,48,.08), 0 4px 16px rgba(16,32,48,.05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1622; --card: #12202f; --ink: #e7eef5; --muted: #93a4b5;
    --line: #21354a; --brand: #2e8be0; --brand-ink: #05121f;
    --up: #35d68a; --up-bg: #12352a; --busy: #e6a15c; --busy-bg: #34281a;
    --danger: #ff6b61; --pill: #1b2c3e;
    --shadow: 0 1px 3px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink);
  -webkit-text-size-adjust: 100%;
}
h1, h2 { margin: 0 0 .5rem; line-height: 1.2; }
h2 { font-size: 1.05rem; display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.err { color: var(--danger); font-size: .9rem; margin: .4rem 0 0; }

.screen { max-width: 720px; margin: 0 auto; padding: 1rem; }
.screen.wide { max-width: 1100px; }
.center { min-height: 100dvh; display: grid; place-items: center; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 1rem; margin: 0 0 1rem; box-shadow: var(--shadow);
}

/* login */
.login { width: min(92vw, 380px); display: grid; gap: .85rem; }
.brand { font-size: 1.5rem; letter-spacing: -.02em; }
.brand span { display: block; font-size: .8rem; font-weight: 600; color: var(--muted); letter-spacing: .12em; text-transform: uppercase; }
label { display: grid; gap: .35rem; font-weight: 600; font-size: .9rem; }
input, select, button { font: inherit; }
input, select {
  padding: .7rem .8rem; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--ink); width: 100%;
}
button { cursor: pointer; border: 0; border-radius: 10px; padding: .7rem 1rem; font-weight: 700; }
button.primary { background: var(--brand); color: var(--brand-ink); }
button.primary:hover { filter: brightness(1.06); }
button.ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); font-weight: 600; }
button.ghost.sm, .ghost.sm { padding: .3rem .6rem; font-size: .8rem; }
button.wide { width: 100%; }
button:disabled { opacity: .5; cursor: default; }

/* topbar */
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  gap: .75rem; padding: .7rem 1rem; background: var(--card); border-bottom: 1px solid var(--line);
}
.topbar-actions { display: flex; gap: .5rem; align-items: center; }
.topbar a.ghost { text-decoration: none; display: inline-flex; align-items: center; }
.pill { font-size: .72rem; font-weight: 700; padding: .15rem .5rem; border-radius: 999px; background: var(--pill); color: var(--muted); margin-left: .5rem; text-transform: uppercase; letter-spacing: .04em; }
.pill.on { background: var(--up-bg); color: var(--up); }
.pill.mgr { background: var(--pill); color: var(--brand); }

/* status banner */
.status.up-now { border-color: var(--up); background: var(--up-bg); }
.status .big { font-size: 1.25rem; font-weight: 800; }

/* the up list */
.line { list-style: none; margin: 0; padding: 0; }
.line li {
  display: flex; align-items: center; gap: .6rem; padding: .6rem .3rem;
  border-bottom: 1px solid var(--line);
}
.line li:last-child { border-bottom: 0; }
.line .pos { width: 1.6rem; text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; }
.line .nm { font-weight: 600; flex: 1; }
.tag { font-size: .72rem; font-weight: 700; padding: .12rem .5rem; border-radius: 999px; }
.tag.up { background: var(--up-bg); color: var(--up); }
.tag.busy { background: var(--busy-bg); color: var(--busy); }

/* my up card + funnel */
.myup .who { font-weight: 700; font-size: 1.1rem; }
.funnel { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .8rem; }
.funnel button { flex: 1 1 auto; min-width: 5.5rem; }
.stage-chip { display: inline-block; font-size: .78rem; font-weight: 700; color: var(--brand); }
.row { display: flex; gap: .5rem; }
.row > * { flex: 1; }
.logup { display: grid; gap: .6rem; }

/* manager grid + table */
.grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 780px) { .grid { grid-template-columns: 1fr 1fr; } }
.openup { border: 1px solid var(--line); border-radius: 10px; padding: .6rem; margin-bottom: .6rem; }
.openup .hd { display: flex; justify-content: space-between; gap: .5rem; font-weight: 600; }
.openup .ctl { display: flex; gap: .4rem; margin-top: .5rem; flex-wrap: wrap; }
.tablewrap { overflow-x: auto; }
table.sb { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.sb th, table.sb td { text-align: right; padding: .45rem .5rem; border-bottom: 1px solid var(--line); }
table.sb th:first-child, table.sb td:first-child, table.sb th:nth-child(2), table.sb td:nth-child(2) { text-align: left; }
table.sb tbody tr:hover { background: var(--bg); }

/* still-here nudge */
.card.nudge { border-color: var(--busy); background: var(--busy-bg); }
.card.nudge strong { display: block; margin-bottom: .2rem; }
.card.nudge button { margin-top: .6rem; }

/* team management */
.team-names { display: grid; gap: .5rem; margin-bottom: .8rem; }
label.inline { display: grid; grid-template-columns: 4rem 1fr; align-items: center; gap: .5rem; font-weight: 600; }
label.inline input { width: 100%; }
.assign-list { display: grid; gap: .4rem; max-height: 340px; overflow-y: auto; }
.assign-row { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .3rem 0; border-bottom: 1px solid var(--line); }
.assign-row select { max-width: 10rem; }

/* wall board */
.wall { min-height: 100dvh; background: var(--bg); padding: 2.5vmin 3vmin; }
.wall-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.wall-head h1 { font-size: 5vmin; letter-spacing: -.02em; }
.wall-stats { font-size: 2.4vmin; color: var(--muted); font-weight: 700; }
.wall-stats b { color: var(--ink); }
.wall-line { list-style: none; margin: 3vmin 0 0; padding: 0; display: grid; gap: 1.4vmin; }
.wall-line li {
  display: flex; align-items: center; gap: 2vmin; background: var(--card);
  border: 1px solid var(--line); border-radius: 2vmin; padding: 2vmin 2.5vmin; box-shadow: var(--shadow);
}
.wall-line li.upnext { border-color: var(--up); background: var(--up-bg); }
.wall-line .pos { font-size: 4vmin; font-weight: 800; color: var(--muted); width: 2.4ch; }
.wall-line .nm { font-size: 4.4vmin; font-weight: 800; flex: 1; }
.wall-line .tag { font-size: 2.4vmin; padding: .4vmin 1.6vmin; }
.wall-foot { margin-top: 3vmin; color: var(--muted); font-size: 1.8vmin; }
