/* ============================================================================
   THE BOARD - visionOS-style spatial glass UI
   ========================================================================== */

:root {
  --bg-0: #04050a;
  --bg-1: #0a0d18;

  --glass: rgba(255, 255, 255, 0.055);
  --glass-2: rgba(255, 255, 255, 0.085);
  --glass-3: rgba(255, 255, 255, 0.13);
  --hair: rgba(255, 255, 255, 0.14);
  --hair-bright: rgba(255, 255, 255, 0.34);

  --text: rgba(255, 255, 255, 0.94);
  --text-2: rgba(255, 255, 255, 0.62);
  --text-3: rgba(255, 255, 255, 0.40);

  --blue: #5ea0ff;
  --cyan: #59e3ff;
  --amber: #ffc24d;
  --amber-deep: #ff9d2e;
  --green: #38e8b0;
  --green-deep: #15c98c;
  --red: #ff6a6a;
  --violet: #9a7bff;

  --r-card: 26px;
  --r-slot: 15px;
  --r-pill: 999px;

  --shadow-float: 0 24px 70px -28px rgba(0, 0, 0, 0.85), 0 2px 10px -2px rgba(0, 0, 0, 0.5);
  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  --font: "Geist", -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg-0);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: -0.01em;
}

/* ---- Atmosphere: layered aurora orbs + fine grain (depth, no flat banding) -- */
.atmos { position: fixed; inset: 0; z-index: -2; overflow: hidden; background:
    radial-gradient(120% 90% at 50% -10%, #121a33 0%, var(--bg-1) 42%, var(--bg-0) 100%); }
.atmos::before, .atmos::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.55;
  animation: drift 26s var(--ease-out) infinite alternate;
}
.atmos::before {
  width: 60vw; height: 60vw; left: -14vw; top: -18vw;
  background: radial-gradient(circle, rgba(94, 160, 255, 0.55), transparent 62%);
}
.atmos::after {
  width: 52vw; height: 52vw; right: -12vw; bottom: -20vw;
  background: radial-gradient(circle, rgba(154, 123, 255, 0.42), transparent 62%);
  animation-delay: -8s;
}
.atmos .orb3 {
  position: absolute; width: 40vw; height: 40vw; left: 40vw; bottom: -22vw;
  border-radius: 50%; filter: blur(100px); opacity: 0.4;
  background: radial-gradient(circle, rgba(56, 232, 176, 0.4), transparent 62%);
  animation: drift 30s var(--ease-out) -14s infinite alternate;
}
.grain { position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }

@keyframes drift {
  0% { transform: translate3d(0,0,0) scale(1); }
  100% { transform: translate3d(4vw, 5vh, 0) scale(1.12); }
}

/* ---- Generic glass surface ---- */
.glass {
  background: linear-gradient(160deg, var(--glass-2), var(--glass));
  border: 1px solid var(--hair);
  backdrop-filter: blur(32px) saturate(170%);
  -webkit-backdrop-filter: blur(32px) saturate(170%);
  box-shadow: var(--shadow-float), inset 0 1px 0 0 rgba(255,255,255,0.22), inset 0 -1px 0 0 rgba(0,0,0,0.25);
}

/* ============================ APP SHELL ============================ */
.app { min-height: 100vh; padding: 22px clamp(14px, 3vw, 40px) 60px; }

/* ---- Top ornament bar ---- */
.topbar {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 14px 16px 14px 22px; border-radius: var(--r-pill);
  position: sticky; top: 14px; z-index: 40; margin-bottom: 26px;
  animation: rise 0.7s var(--ease-spring) both;
}
.brand { display: flex; align-items: center; gap: 13px; padding-right: 8px; }
.brand .mark {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(150deg, var(--blue), var(--violet));
  box-shadow: 0 6px 18px -4px rgba(94,160,255,0.6), inset 0 1px 0 rgba(255,255,255,0.5);
}
.brand .mark svg { width: 21px; height: 21px; }
.brand .title { font-weight: 800; font-size: 17px; letter-spacing: 0.14em; }
.brand .sub { font-size: 11.5px; color: var(--text-2); font-weight: 500; letter-spacing: 0.02em; }

.stat-row { display: flex; gap: 10px; flex: 1; flex-wrap: wrap; justify-content: center; }
.stat {
  display: flex; align-items: center; gap: 10px; padding: 8px 15px 8px 12px;
  border-radius: var(--r-pill); background: var(--glass); border: 1px solid var(--hair);
  min-width: 112px; transition: transform 0.3s var(--ease-spring), background 0.3s;
}
.stat:hover { transform: translateY(-2px); background: var(--glass-2); }
.stat .dot { width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 12px currentColor; }
.stat .meta { display: flex; flex-direction: column; line-height: 1.05; }
.stat .num { font-family: var(--mono); font-weight: 700; font-size: 19px; font-variant-numeric: tabular-nums; }
.stat .lab { font-size: 10px; color: var(--text-2); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.stat.written { color: var(--blue); }
.stat.confirmed { color: var(--green); }
.stat.pending { color: var(--amber); }
.stat.blew { color: var(--red); }
.stat.left { color: var(--text-2); }
.stat .num, .stat .lab { color: var(--text); }
.stat.confirmed .num { color: var(--green); }

.topbar .right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.me-pill {
  display: flex; align-items: center; gap: 9px; padding: 7px 14px 7px 7px; border-radius: var(--r-pill);
  background: var(--glass-2); border: 1px solid var(--hair); cursor: pointer;
  transition: transform 0.25s var(--ease-spring), background 0.25s;
}
.me-pill:hover { transform: translateY(-2px); background: var(--glass-3); }
.me-pill .who { font-size: 10px; color: var(--text-2); font-weight: 600; letter-spacing: 0.05em; }
.me-pill .nm { font-size: 13.5px; font-weight: 700; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 800; color: #06121f;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.55), 0 4px 12px -3px rgba(0,0,0,0.6);
}
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--glass-2); border: 1px solid var(--hair); color: var(--text); cursor: pointer;
  transition: transform 0.25s var(--ease-spring), background 0.25s, rotate 0.5s var(--ease-spring);
}
.icon-btn:hover { transform: translateY(-2px); background: var(--glass-3); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn.gear:hover { rotate: 40deg; }

/* ============================ BOARD ============================ */
.layout { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: start; }
@media (max-width: 1100px) { .layout { grid-template-columns: 1fr; } }

.board {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(225px, 1fr));
}

.rep {
  border-radius: var(--r-card); padding: 16px 16px 14px; position: relative; overflow: hidden;
  animation: rise 0.7s var(--ease-spring) both;
}
.rep::after { /* top specular sheen */
  content: ""; position: absolute; inset: 0 0 auto 0; height: 42%;
  background: linear-gradient(180deg, rgba(255,255,255,0.10), transparent);
  pointer-events: none; opacity: 0.7;
}
.rep-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 13px; position: relative; z-index: 1; }
.rep-name { font-size: 16.5px; font-weight: 700; letter-spacing: -0.02em; display: flex; align-items: center; gap: 9px; }
.rep-name .rdot { width: 7px; height: 7px; border-radius: 50%; background: linear-gradient(var(--blue), var(--violet)); box-shadow: 0 0 10px var(--blue); }
.rep-prog { display: flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: 11px; color: var(--text-2); font-weight: 600; }
.rep-prog .conf { color: var(--green); }
.ring { --p: 0; width: 26px; height: 26px; border-radius: 50%;
  background: conic-gradient(var(--green) calc(var(--p) * 1%), rgba(255,255,255,0.10) 0);
  display: grid; place-items: center; transition: --p 0.6s var(--ease-out); }
.ring::after { content: ""; width: 19px; height: 19px; border-radius: 50%; background: rgba(10,14,24,0.85); }

.slots { display: flex; flex-direction: column; gap: 8px; position: relative; z-index: 1; }

/* ---- a single appointment line ---- */
.slot {
  --accent: var(--text-3);
  display: flex; align-items: center; gap: 11px; min-height: 46px;
  padding: 8px 12px; border-radius: var(--r-slot); cursor: pointer;
  border: 1px solid var(--hair); background: rgba(255,255,255,0.03);
  transition: transform 0.32s var(--ease-spring), background 0.3s, border-color 0.3s, box-shadow 0.4s;
  position: relative; overflow: hidden;
}
.slot:hover { transform: translateY(-2px); background: rgba(255,255,255,0.07); border-color: var(--hair-bright); }
.slot:active { transform: scale(0.975); }
.slot .lineno {
  width: 22px; height: 22px; border-radius: 7px; flex: 0 0 auto; display: grid; place-items: center;
  font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--text-3);
  background: rgba(255,255,255,0.05); border: 1px solid var(--hair);
}

/* empty state */
.slot.empty { border-style: dashed; border-color: rgba(255,255,255,0.16); }
.slot.empty .body { color: var(--text-3); font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 7px; }
.slot.empty .body .plus { width: 17px; height: 17px; opacity: 0.8; }
.slot.empty:hover { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(94,160,255,0.12); }
.slot.empty::before { /* invitation shimmer */
  content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(94,160,255,0.10) 50%, transparent 70%);
  transform: translateX(-100%); transition: transform 0.7s var(--ease-out);
}
.slot.empty:hover::before { transform: translateX(100%); }

/* filled */
.slot.filled { background: linear-gradient(150deg, rgba(255,255,255,0.10), rgba(255,255,255,0.04)); }
.slot .time { font-family: var(--mono); font-size: 15.5px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.slot .ampm { font-size: 10.5px; color: var(--text-2); font-weight: 700; margin-left: 1px; }
.slot .body { display: flex; flex-direction: column; line-height: 1.15; flex: 1; min-width: 0; }
.slot .byline { font-size: 10.5px; color: var(--text-2); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot .wchip { display: inline-flex; align-items: center; gap: 5px; }
.slot .wdot { width: 14px; height: 14px; border-radius: 50%; font-size: 8px; display: grid; place-items: center; font-weight: 800; color: #06121f; }

/* pending confirm = amber */
.slot.pending { --accent: var(--amber); border-color: rgba(255,194,77,0.40); box-shadow: 0 0 22px -10px rgba(255,194,77,0.7); }
.slot.pending .time { color: #ffd98a; }
.slot.pending .badge { color: var(--amber); }

/* confirmed = green glass + check (color carries the meaning, no drawn box) */
.slot.confirmed { --accent: var(--green); border-color: rgba(56,232,176,0.55);
  background: linear-gradient(150deg, rgba(56,232,176,0.16), rgba(56,232,176,0.05));
  box-shadow: 0 0 26px -8px rgba(56,232,176,0.65), inset 0 0 0 1px rgba(56,232,176,0.30); }
.slot.confirmed .time { color: #9bffe0; }
/* handed in for confirm = blue glass (between pending amber and confirmed green) */
.slot.handed { --accent: var(--blue); border-color: rgba(94,160,255,0.55);
  background: linear-gradient(150deg, rgba(94,160,255,0.16), rgba(94,160,255,0.05));
  box-shadow: 0 0 26px -8px rgba(94,160,255,0.6), inset 0 0 0 1px rgba(94,160,255,0.28); }
.slot.handed .time { color: #bcd6ff; }
.slot.handed .badge { color: var(--blue); opacity: 1; animation: pop 0.45s var(--ease-spring) both; }
.slot .badge { margin-left: auto; width: 22px; height: 22px; flex: 0 0 auto; display: grid; place-items: center; opacity: 0; }
.slot.confirmed .badge { color: var(--green); opacity: 1; animation: pop 0.45s var(--ease-spring) both; }

/* transient animations */
.slot.justwrote { animation: slotglow 0.8s var(--ease-out); }
.slot.blowup { animation: shatter 0.55s var(--ease-out) forwards; }

@keyframes slotglow { 0% { box-shadow: 0 0 0 0 rgba(94,160,255,0.55), 0 0 20px -6px rgba(94,160,255,0.85); } 100% { box-shadow: 0 0 0 16px rgba(94,160,255,0); } }
@keyframes pop { 0% { transform: scale(0); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }
@keyframes shatter { 0% { transform: scale(1); filter: blur(0); } 30% { transform: scale(1.06) rotate(-1deg); }
  100% { transform: scale(0.6) translateY(8px); opacity: 0; filter: blur(6px); } }

/* spark burst on write */
.spark { position: absolute; width: 6px; height: 6px; border-radius: 50%; pointer-events: none; z-index: 60; }

/* ============================ LEADERBOARD ============================ */
.rail { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 84px; }
.panel { border-radius: var(--r-card); padding: 18px; animation: rise 0.7s var(--ease-spring) both; }
.panel h3 { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-2); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.panel h3 .live { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); animation: pulse 1.8s ease-in-out infinite; }

.lb { display: flex; flex-direction: column; gap: 7px; }
.lb-row {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 14px;
  background: rgba(255,255,255,0.035); border: 1px solid transparent;
  transition: transform 0.5s var(--ease-spring), background 0.35s, border-color 0.35s;
}
.lb-row:hover { background: rgba(255,255,255,0.07); }
.lb-row .rank { font-family: var(--mono); font-size: 12px; font-weight: 700; width: 20px; color: var(--text-3); text-align: center; }
.lb-row .nm { font-size: 13.5px; font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-row .cnt { font-family: var(--mono); font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.lb-row .bar { position: absolute; }
.lb-row { position: relative; overflow: hidden; }
.lb-row .fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; z-index: 0;
  background: linear-gradient(90deg, rgba(94,160,255,0.22), rgba(94,160,255,0.02));
  transition: width 0.7s var(--ease-out); }
.lb-row > * { position: relative; z-index: 1; }
.lb-row.gold { border-color: rgba(255,210,90,0.45); box-shadow: 0 0 22px -10px rgba(255,210,90,0.7); }
.lb-row.gold .fill { background: linear-gradient(90deg, rgba(255,210,90,0.30), rgba(255,210,90,0.03)); }
.lb-row.gold .rank, .lb-row.gold .cnt { color: #ffe08a; }
.lb-row.silver .rank, .lb-row.silver .cnt { color: #dfe7ff; }
.lb-row.bronze .rank, .lb-row.bronze .cnt { color: #ffc59b; }
.lb-row .medal { font-size: 14px; }
.lb-empty { color: var(--text-3); font-size: 12.5px; text-align: center; padding: 16px 0; }
.lb-me { outline: 1.5px solid rgba(94,160,255,0.5); }

/* mini distribution bars in second panel */
.dist { display: flex; flex-direction: column; gap: 10px; }
.dist-row { display: flex; flex-direction: column; gap: 5px; }
.dist-row .top { display: flex; justify-content: space-between; font-size: 12px; }
.dist-row .top .v { font-family: var(--mono); color: var(--text-2); font-weight: 600; }
.track { height: 7px; border-radius: 99px; background: rgba(255,255,255,0.07); overflow: hidden; display: flex; }
.track .seg { height: 100%; transition: width 0.7s var(--ease-out); }
.track .seg.c { background: linear-gradient(90deg, var(--green-deep), var(--green)); }
.track .seg.p { background: linear-gradient(90deg, var(--amber-deep), var(--amber)); }

/* ============================ OVERLAYS ============================ */
.scrim {
  position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center;
  padding: 20px; background: rgba(4,5,10,0.55); backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px); opacity: 0; transition: opacity 0.3s;
}
.scrim.show { display: flex; opacity: 1; }
.sheet {
  width: min(640px, 96vw); max-height: 88vh; overflow: auto; border-radius: 30px; padding: 26px;
  transform: translateY(18px) scale(0.97); opacity: 0; transition: transform 0.45s var(--ease-spring), opacity 0.35s;
}
.scrim.show .sheet { transform: translateY(0) scale(1); opacity: 1; }
.sheet h2 { font-size: 21px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 4px; }
.sheet .lead { color: var(--text-2); font-size: 13.5px; margin-bottom: 20px; }
.sheet .close { position: absolute; }

/* name picker grid */
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 9px; }
.chip {
  display: flex; align-items: center; gap: 9px; padding: 10px 12px; border-radius: 14px; cursor: pointer;
  background: var(--glass); border: 1px solid var(--hair); font-weight: 600; font-size: 13.5px;
  transition: transform 0.25s var(--ease-spring), background 0.25s, border-color 0.25s;
  animation: rise 0.5s var(--ease-spring) both;
}
.chip:hover { transform: translateY(-3px); background: var(--glass-3); border-color: var(--hair-bright); }
.chip:active { transform: scale(0.95); }
.chip.sel { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(94,160,255,0.4); }

/* time picker */
.time-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 9px; margin-bottom: 16px; }
.tchip {
  padding: 13px 8px; border-radius: 14px; cursor: pointer; text-align: center; font-family: var(--mono);
  font-weight: 700; font-size: 15px; background: var(--glass); border: 1px solid var(--hair);
  transition: transform 0.22s var(--ease-spring), background 0.22s, border-color 0.22s, box-shadow 0.3s;
  animation: rise 0.45s var(--ease-spring) both;
}
.tchip small { display: block; font-family: var(--font); font-size: 9.5px; color: var(--text-2); font-weight: 700; }
.tchip:hover { transform: translateY(-3px) scale(1.03); border-color: var(--blue); box-shadow: 0 0 0 3px rgba(94,160,255,0.14); background: var(--glass-3); }
.tchip:active { transform: scale(0.94); }
.custom-row { display: flex; gap: 10px; align-items: center; }
.custom-row input[type="time"] {
  flex: 1; padding: 12px 14px; border-radius: 13px; background: var(--glass); border: 1px solid var(--hair);
  color: var(--text); font-family: var(--mono); font-size: 15px; color-scheme: dark;
}

/* slot action menu */
.menu { display: flex; flex-direction: column; gap: 8px; }
.menu .ctx { display: flex; align-items: center; gap: 13px; padding: 13px 15px; border-radius: 15px;
  background: var(--glass); border: 1px solid var(--hair); cursor: pointer; font-weight: 600; font-size: 14.5px;
  transition: transform 0.2s var(--ease-spring), background 0.2s; }
.menu .ctx:hover { transform: translateX(3px); background: var(--glass-3); }
.menu .ctx .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: 0 0 auto; }
.menu .ctx.confirm .ic { background: rgba(56,232,176,0.18); color: var(--green); }
.menu .ctx.unconfirm .ic { background: rgba(255,194,77,0.16); color: var(--amber); }
.menu .ctx.edit .ic { background: rgba(94,160,255,0.16); color: var(--blue); }
.menu .ctx.blow .ic { background: rgba(255,106,106,0.16); color: var(--red); }
.menu .ctx.del .ic { background: rgba(255,255,255,0.08); color: var(--text-2); }
.menu .ctx.handin .ic { background: rgba(94,160,255,0.18); color: var(--blue); }
.menu .ctx.unhand .ic { background: rgba(255,194,77,0.12); color: var(--amber); }
.menu .ctx small { display: block; font-size: 11px; color: var(--text-2); font-weight: 500; }
.slot-summary { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 16px;
  background: var(--glass); border: 1px solid var(--hair); margin-bottom: 18px; }
.slot-summary .big { font-family: var(--mono); font-size: 26px; font-weight: 800; }

/* roster editor */
.tabs { display: flex; gap: 8px; margin-bottom: 18px; background: rgba(255,255,255,0.04); padding: 5px; border-radius: 14px; }
.tab { flex: 1; padding: 9px; border-radius: 10px; text-align: center; font-weight: 700; font-size: 13px; cursor: pointer; color: var(--text-2); transition: all 0.25s; }
.tab.on { background: var(--glass-3); color: var(--text); box-shadow: var(--shadow-float); }
.editlist { display: flex; flex-direction: column; gap: 8px; max-height: 44vh; overflow: auto; padding-right: 4px; }
.editrow { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; border-radius: 13px; background: var(--glass); border: 1px solid var(--hair); animation: rise 0.4s var(--ease-spring) both; }
.editrow input { flex: 1; background: transparent; border: none; color: var(--text); font-size: 14px; font-weight: 600; font-family: var(--font); }
.editrow input:focus { outline: none; }
.editrow .del { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; cursor: pointer; color: var(--red); background: rgba(255,106,106,0.10); border: 1px solid transparent; transition: all 0.2s; }
.editrow .del:hover { background: rgba(255,106,106,0.22); }
.addrow { display: flex; gap: 9px; margin-top: 12px; }
.addrow input { flex: 1; padding: 12px 14px; border-radius: 13px; background: var(--glass); border: 1px solid var(--hair); color: var(--text); font-size: 14px; font-family: var(--font); }
.addrow input:focus { outline: none; border-color: var(--blue); }

.btn { padding: 12px 20px; border-radius: 13px; border: 1px solid var(--hair); background: var(--glass-2); color: var(--text); font-weight: 700; font-size: 14px; cursor: pointer; font-family: var(--font); transition: transform 0.22s var(--ease-spring), background 0.22s; }
.btn:hover { transform: translateY(-2px); background: var(--glass-3); }
.btn:active { transform: scale(0.96); }
.btn.primary { background: linear-gradient(150deg, var(--blue), var(--violet)); border-color: transparent; box-shadow: 0 8px 22px -8px rgba(94,160,255,0.7); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); border-color: rgba(255,106,106,0.3); }
.row-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.row-actions .spacer { flex: 1; }

/* toast */
.toast-wrap { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: var(--r-pill); font-weight: 600; font-size: 13.5px;
  animation: toastin 0.4s var(--ease-spring) both; }
.toast .tic { width: 20px; height: 20px; }
@keyframes toastin { 0% { transform: translateY(20px) scale(0.9); opacity: 0; } 100% { transform: translateY(0) scale(1); opacity: 1; } }

/* shared keyframes */
@keyframes rise { 0% { transform: translateY(16px); opacity: 0; } 100% { transform: translateY(0); opacity: 1; } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

/* sync badge */
.syncbadge { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--text-2); font-weight: 600; }
.syncbadge .d { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.syncbadge.live .d { background: var(--green); box-shadow: 0 0 8px var(--green); }

/* ---- Room / TV mode: bigger everything, hide chrome ---- */
body.room .topbar .right { display: none; }
body.room .stat { min-width: 150px; padding: 12px 22px 12px 16px; }
body.room .stat .num { font-size: 27px; }
body.room .board { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
body.room .rep-name { font-size: 19px; }

/* responsive */
@media (max-width: 640px) {
  .app { padding: 14px 12px 50px; }
  .topbar { border-radius: 24px; gap: 12px; }
  .stat-row { order: 3; width: 100%; justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .stat { min-width: 104px; }
  .board { grid-template-columns: 1fr; }
}

/* ---- rep header meta: progress + per-rep line stepper ---- */
.rep-meta { display: flex; align-items: center; gap: 8px; }
.stepper { display: inline-flex; align-items: center; gap: 2px; background: rgba(255,255,255,0.05); border: 1px solid var(--hair); border-radius: 999px; padding: 2px; }
.stepper .stp { width: 20px; height: 20px; border-radius: 50%; border: none; background: transparent; color: var(--text-2); font-size: 15px; font-weight: 700; cursor: pointer; line-height: 1; display: grid; place-items: center; transition: background 0.2s, color 0.2s; }
.stepper .stp:hover { background: var(--glass-3); color: var(--text); }
.stepper .stp:active { transform: scale(0.9); }
.stepper .tgt { font-family: var(--mono); font-size: 12px; font-weight: 700; min-width: 15px; text-align: center; color: var(--text); }
body.readonly .stepper .stp { display: none; }
body.readonly .stepper { background: transparent; border-color: transparent; }
body.readonly .slot, body.readonly .slot.empty:hover, body.readonly .slot:hover { cursor: default; transform: none; box-shadow: none; }
body.readonly .slot.empty:hover { border-color: rgba(255,255,255,0.16); }

/* ---- per-rep progress bars: route (filled/target) + confirm (% confirmed) ---- */
.rep-bars { display: flex; flex-direction: column; gap: 6px; margin-bottom: 13px; position: relative; z-index: 1; }
.barrow { display: grid; grid-template-columns: 38px 1fr 42px; align-items: center; gap: 8px; }
.barrow .bk { font-size: 9px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-3); }
.barrow .bar { position: relative; height: 8px; border-radius: 99px; background: rgba(255,255,255,0.08); overflow: hidden; }
.barrow .bar .fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 99px; transition: width 0.7s var(--ease-out); }
.barrow .bar.route .fill { background: linear-gradient(90deg, var(--blue), var(--cyan)); box-shadow: 0 0 10px -2px rgba(94,160,255,0.8); }
.barrow .bar.conf .fill { background: linear-gradient(90deg, var(--green-deep), var(--green)); box-shadow: 0 0 10px -2px rgba(56,232,176,0.8); }
.barrow .bv { font-family: var(--mono); font-size: 11px; font-weight: 700; text-align: right; }
.barrow.route .bv { color: #9fd0ff; }
.barrow.conf .bv { color: #7fe9c4; }
body.room .barrow .bar { height: 11px; }
body.room .barrow .bk { font-size: 11px; }
body.room .barrow .bv { font-size: 13px; }

/* ---- date navigation ---- */
.datenav { display: inline-flex; align-items: center; gap: 2px; background: var(--glass-2); border: 1px solid var(--hair); border-radius: var(--r-pill); padding: 3px; }
.datenav .dnav { width: 30px; height: 30px; border-radius: 50%; border: none; background: transparent; color: var(--text); cursor: pointer; display: grid; place-items: center; transition: background 0.2s; }
.datenav .dnav:hover:not(:disabled) { background: var(--glass-3); }
.datenav .dnav:disabled { opacity: 0.3; cursor: default; }
.datenav .dnav svg { width: 16px; height: 16px; }
.datenav .dlabel { border: none; background: transparent; color: var(--text); font-weight: 700; font-size: 12.5px; cursor: pointer; padding: 0 8px; min-width: 58px; }
.datenav .dlabel:hover { color: var(--blue); }

/* ---- read-only banner (viewing a past day) ---- */
.robanner { display: none; align-items: center; justify-content: center; gap: 12px; border-radius: var(--r-pill); padding: 9px 16px; margin-bottom: 18px; color: var(--amber); font-weight: 600; font-size: 13px; border-color: rgba(255,194,77,0.35); }
body.readonly .robanner { display: flex; }

/* ---- stats sheet ---- */
.rngrow { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 14px; }
.rngbtn { padding: 8px 14px; border-radius: var(--r-pill); border: 1px solid var(--hair); background: var(--glass); color: var(--text-2); font-weight: 600; font-size: 13px; cursor: pointer; transition: all 0.2s; }
.rngbtn:hover { background: var(--glass-3); color: var(--text); }
.rngbtn.on { background: linear-gradient(150deg, var(--blue), var(--violet)); color: #fff; border-color: transparent; }
.custom-range { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.custom-range input[type="date"] { padding: 9px 11px; border-radius: 11px; background: var(--glass); border: 1px solid var(--hair); color: var(--text); font-family: var(--mono); font-size: 13px; color-scheme: dark; }
.statsbody { display: flex; flex-direction: column; gap: 16px; }
.floorsum { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.fs { background: var(--glass); border: 1px solid var(--hair); border-radius: 16px; padding: 14px 8px; text-align: center; }
.fs-num { font-family: var(--mono); font-size: 23px; font-weight: 800; font-variant-numeric: tabular-nums; }
.fs-lab { font-size: 10px; color: var(--text-2); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; margin-top: 3px; }
.bctable { display: flex; flex-direction: column; gap: 4px; }
.bcrow { display: grid; grid-template-columns: 1fr 48px 48px 48px 58px; align-items: center; gap: 6px; padding: 9px 12px; border-radius: 12px; background: rgba(255,255,255,0.03); }
.bcrow.head { background: transparent; color: var(--text-2); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 4px 12px; }
.bcrow.head span:not(.bc-n) { text-align: right; }
.bcrow .bc-n { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bcrow .mono { font-family: var(--mono); font-size: 13.5px; text-align: right; font-variant-numeric: tabular-nums; }
.bcrow.gold { background: rgba(255,210,90,0.10); border: 1px solid rgba(255,210,90,0.3); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; transition-duration: 0.08s !important; }
  .atmos::before, .atmos::after, .atmos .orb3 { animation: none; }
}
