/* ==========================================================================
   Studio OS dark redesign: CORE (tokens, shell, Home, Leaderboard, Account, toasts)
   Loaded after style.css and the inline <style> in index.html so it wins.
   redesign-flows.css (post/review) and login-v2.css load after this file and
   only USE the tokens defined here.
   ========================================================================== */

/* ---- 1. Tokens (also on :root so pre-login screens are dark) ------------- */
:root, html.theme-dark {
  --bg: #0E0E10;
  --bg2: #161618;
  --bg3: #1E1E21;
  --bg4: #2A2A2E;
  --cream: #F4EEE4;
  --cream-ink: #1C1C1E;
  --cream-ink2: #4A5568;          /* secondary text on cream (>=6:1) */
  --accent: #FF3B30;
  --accent-rgb: 255,59,48;
  --accent-dark: #D92B22;
  --accent-btn: #DB2D24;          /* filled red controls carrying white text (>=4.5:1) */
  --accent-dim: rgba(255,59,48,.14);
  --ok: #34C759;
  --ok-dim: rgba(52,199,89,.14);
  --amber: #FFB020;
  --amber-dim: rgba(255,176,32,.14);
  --blue: #4C8DFF;
  --blue-dim: rgba(76,141,255,.14);
  --text: #FFFFFF;
  --text2: #B8B8BE;
  --text3: #A3A3AA;
  --border: rgba(255,255,255,.09);
  --border2: rgba(255,255,255,.16);
  --radius-card: 20px;
  --radius-ctl: 14px;
  --radius: 14px;
  --radius-sm: 12px;
  --shadow-card: 0 8px 28px rgba(0,0,0,.28);
  --shadow-pop: 0 18px 48px rgba(0,0,0,.5);
  --font-display: 'Manrope', 'Inter', system-ui, sans-serif;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  /* legacy token names still referenced by older markup and JS-generated HTML */
  --red: #FF3B30;
  --red-dim: rgba(255,59,48,.14);
  --green: #34C759;
  --green-dim: rgba(52,199,89,.14);
  --green-dark: #1E8A3C;
  --amber-dim: rgba(255,176,32,.14);
  --blue-dim: rgba(76,141,255,.14);
  --gold: #FFB020;
  --silver: #B8B8BE;
  --bronze: #FF8A65;
  --text1: #FFFFFF;
  --card-glow: var(--shadow-card);
  --card-glow-active: var(--shadow-card);
  --skeleton-shimmer: rgba(255,255,255,.06);
  --rail-w: 248px;
  --nav-h: 68px;
  --gutter: 20px;
  color-scheme: dark;
}

/* ---- 2. Base ------------------------------------------------------------- */
html, body { background: var(--bg); color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; }
body::after { display: none; }
h1, h2, h3, .page-title, .topbar-title, .sheet-title, .confirm-title { font-family: var(--font-display); }
/* QA fix: the watermark logos have opaque white backgrounds, so brightness(0) invert(1) painted a visible light square/box behind content. Hidden in the dark theme. */
#cp-watermark, #cp-watermark.visible { display: none !important; }
#dash-watermark { display: none !important; }
::selection { background: rgba(255,59,48,.4); }

:focus-visible { outline: 2px solid #fff !important; outline-offset: 2px; box-shadow: 0 0 0 5px rgba(255,59,48,.55); border-radius: inherit; }
button:focus-visible, a:focus-visible, [role="button"]:focus-visible, [tabindex]:focus-visible { outline: 2px solid #fff !important; outline-offset: 2px; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: none !important; }

/* ---- 3. Generic components in the dark language -------------------------- */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 20px;
}
.card:hover, .card:active { box-shadow: var(--shadow-card); transform: none; }
.card-label { font-family: var(--font-display); font-size: 12px; font-weight: 700; letter-spacing: .12em; color: var(--text3); }

.btn { border-radius: var(--radius-ctl); font-family: var(--font); font-weight: 700; min-height: 48px; }
/* QA fix: a plain .btn (Board Post/Reply, Requests submit, Documents upload, launch retry) had no dark-theme background and rendered as grey browser default. Low specificity so .btn-green/.btn-dim and inline styles still win. */
:where(html.theme-dark) .btn { background: var(--accent-btn); color: #fff; }
/* QA fix: .btn is width:100%, which squeezed the Board reply input to ~26px next to its Send button. */
html.theme-dark #board-list .btn { width: auto; flex: 0 0 auto; min-width: 84px; }
html.theme-dark #board-list input[id^="board-reply-"] { min-width: 0; flex: 1 1 auto; }
.btn-green, .post-btn {
  background: var(--accent-btn); color: #fff; border: 0;
  box-shadow: 0 10px 24px rgba(219,45,36,.28);
}
.btn-green:hover, .post-btn:hover { background: var(--accent-dark); }
.btn-dim { background: var(--bg3); color: var(--text); border: 1px solid var(--border2); box-shadow: none; }
.btn:disabled { opacity: .45; }
.post-btn { border-radius: var(--radius-ctl); font-family: var(--font-display); font-weight: 800; letter-spacing: 0; }

.form-label { color: var(--text2); letter-spacing: .06em; }
.form-input {
  background: var(--bg3); border: 1px solid var(--border2); color: var(--text);
  border-radius: var(--radius-ctl); min-height: 48px; font-family: var(--font);
}
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,59,48,.22); }
.form-input::placeholder { color: var(--text3); }

.fpill { background: var(--bg3); border: 1px solid var(--border); color: var(--text2); opacity: 1; min-height: 40px; }
.fpill.active { background: var(--accent-btn); border-color: var(--accent-btn); color: #fff; box-shadow: none; }
.sfpill { color: var(--text2); opacity: 1; }
.sfpill.active { background: var(--accent-dim); color: #FF8A83; border-color: rgba(255,59,48,.4); }

.sheet, .confirm-sheet { background: var(--bg2); border: 1px solid var(--border); border-bottom: 0; border-radius: 24px 24px 0 0; box-shadow: var(--shadow-pop); }
.sheet-option { color: var(--text); border-radius: var(--radius-ctl); min-height: 48px; }
.sheet-option:hover { background: var(--bg3); }
.sheet-option.active { background: var(--accent-dim); color: #fff; }
.sheet-option-check { color: var(--accent); }
.sheet-overlay, .confirm-overlay { background: rgba(5,8,14,.72); }

.studio-pill { background: var(--bg2); border: 1px solid var(--border2); color: var(--text); border-radius: 999px; font-weight: 600; min-height: 44px; }
.studio-pill:active { background: var(--bg3); }

.announce { background: var(--bg2); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius-ctl); }
.announce-text { color: var(--text2); opacity: 1; }

.progress-track { background: var(--bg4); height: 6px; }
.progress-fill { background: linear-gradient(90deg, var(--accent-dark), var(--accent)); }
.nudge { color: #FF8A83; background: var(--accent-dim); border: 1px solid rgba(255,59,48,.25); }
.streak-row { color: var(--text2); }

.stat-box { background: var(--bg3); border: 1px solid var(--border); border-radius: 16px; box-shadow: none; }
.stat-val { font-family: var(--font-display); font-weight: 800; }
.stat-val.green { color: var(--accent); }
.stat-lbl { color: var(--text3); opacity: 1; }
.tier-badge { font-family: var(--font-display); }

.today-plan.cp {
  background: var(--bg3); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: 16px; box-shadow: none;
}
.today-plan.cp .today-plan-hero.cp { color: var(--text); font-family: var(--font-display); font-weight: 700; border-bottom-color: var(--border); }
.today-plan.cp .today-plan-subheader { color: var(--text3); }
.today-plan.cp .today-plan-list li { color: var(--text2); }
.today-plan.cp .today-plan-close { color: var(--text3); }

.status-pill { opacity: 1; }
.empty-note { color: var(--text3); font-size: 13px; text-align: center; padding: 18px 0; line-height: 1.5; }

/* ---- 4. Shell: topbar ----------------------------------------------------- */
.topbar {
  background: var(--bg);
  border-bottom: 0;
  padding: 14px var(--gutter) 10px;
  padding-top: calc(14px + var(--safe-top));
  gap: 10px;
}
.topbar-title { font-size: 18px; font-weight: 800; color: var(--text); letter-spacing: -.01em; }
.topbar-badge { background: var(--accent-dim); color: #FF8A83; animation: none; }
.back-btn {
  background: var(--bg2); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-ctl); margin: 0; min-width: 44px; min-height: 44px; font-size: 20px;
}
.back-btn:hover { background: var(--bg3); }

.topbar-brand { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.wordmark, .rail-wordmark, .loading-logo { font-family: var(--font-display); font-weight: 800; letter-spacing: -.04em; color: var(--text); }
.wordmark { font-size: 26px; line-height: 1; }
.wordmark span, .rail-wordmark span, .loading-logo span { color: var(--accent); }
.wordmark-tag { display: none; }

.icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; flex-shrink: 0; border-radius: var(--radius-ctl);
  background: var(--bg2); border: 1px solid var(--border); color: var(--text); cursor: pointer;
  transition: background .15s ease, transform .1s ease;
}
.icon-btn svg { width: 21px; height: 21px; }
.icon-btn:hover { background: var(--bg3); }
.icon-btn:active { transform: scale(.95); }
.bell-badge {
  position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px;
  background: var(--accent-btn); color: #fff; font-size: 10px; font-weight: 800; align-items: center; justify-content: center;
  border: 2px solid var(--bg);
}
.avatar-btn {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%; border: 2px solid var(--border2);
  background: #C9D3E3; color: var(--cream-ink); font-family: var(--font-display); font-weight: 800; font-size: 14px;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; text-transform: uppercase;
}
.avatar-btn:empty { background: var(--bg3); }

/* Page-style topbar (Leaderboard) */
.page-topbar { align-items: flex-start; }
.page-head { flex: 1; min-width: 0; }
.page-h1 { font-family: var(--font-display); font-size: 28px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; color: var(--text); }
.page-h1-sub { font-size: 13px; color: var(--text3); margin-top: 4px; }

/* ---- 5. Shell: navigation (bottom bar on mobile, left rail on desktop) --- */
.app-nav { display: none; }
body.nav-main .app-nav { display: flex; }

.app-nav {
  position: fixed; z-index: 995; left: 0; right: 0; bottom: 0; max-width: 480px; margin: 0 auto;
  align-items: flex-end; justify-content: space-around;
  height: calc(var(--nav-h) + var(--safe-bottom)); padding: 0 6px var(--safe-bottom);
  background: rgba(14,14,16,.94); backdrop-filter: blur(18px) saturate(1.3); -webkit-backdrop-filter: blur(18px) saturate(1.3);
  border-top: 1px solid var(--border);
}
.app-nav .rail-brand, .app-nav .nav-item.nav-ideas { display: none; }
.app-nav .nav-item {
  position: relative; flex: 1 1 0; min-width: 0; min-height: 56px; height: 56px; margin-bottom: 6px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: none; border: 0; border-radius: var(--radius-ctl); cursor: pointer; padding: 4px 0;
  color: var(--text3); opacity: 1; filter: none; font-family: var(--font);
  transition: color .15s ease, transform .1s ease;
}
.app-nav .nav-item:active { transform: scale(.94); }
.app-nav .nav-item svg { width: 22px; height: 22px; }
.app-nav .nav-label { font-size: 10.5px; font-weight: 600; letter-spacing: .01em; text-transform: none; white-space: nowrap; }
.app-nav .nav-item.active { color: var(--accent); filter: none; }
.app-nav .nav-home { order: 1; }
.app-nav .nav-review { order: 2; }
.app-nav .nav-post { order: 3; }
.app-nav .nav-lb { order: 4; }
.app-nav .nav-account { order: 5; }
/* centre raised Post button */
.app-nav .nav-post { overflow: visible; color: var(--text2); }
.app-nav .nav-post-ic {
  display: flex; align-items: center; justify-content: center; width: 56px; height: 56px; margin-top: -30px; border-radius: 50%;
  background: var(--accent-btn); color: #fff; border: 4px solid var(--bg);
  box-shadow: 0 8px 22px rgba(219,45,36,.5);
}
.app-nav .nav-post-ic svg { width: 26px; height: 26px; }
.app-nav .nav-post.active { color: var(--accent); }
.app-nav .nav-badge {
  position: absolute; top: 2px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px;
  background: var(--accent-btn); color: #fff; font-size: 10px; font-weight: 800; align-items: center; justify-content: center;
  border: 2px solid var(--bg);
}

/* content clears the bar on mobile */
body.nav-main .scroll-content { padding-bottom: calc(var(--nav-h) + 36px + var(--safe-bottom)); }
body.nav-main .toast { bottom: calc(var(--nav-h) + 20px + var(--safe-bottom)); }

/* GAPS: rail now appears from 900px (was 1024px) */
@media (min-width: 900px) {
  :root, html.theme-dark { --gutter: max(32px, calc((100vw - var(--rail-w) - 1080px) / 2)); }
  body.nav-any .app-nav, body.nav-main .app-nav {
    display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 6px;
    top: 0; right: auto; bottom: 0; left: 0; width: var(--rail-w); max-width: none; height: auto; margin: 0;
    padding: 28px 16px 24px; background: var(--bg2); backdrop-filter: none; -webkit-backdrop-filter: none;
    border-top: 0; border-right: 1px solid var(--border);
  }
  body.nav-any #app { max-width: none; padding-left: var(--rail-w); }
  /* QA fix: legacy index.html rule `.screen{padding-left:80px}` (old 80px rail) double-padded every screen: content sat 80px off-centre and the login card/background showed a dark strip on the left. */
  html body .screen { padding-left: 0; }
  .app-nav .rail-brand { display: block; padding: 4px 12px 22px; }
  .rail-wordmark { font-size: 30px; line-height: 1; }
  .rail-tag { margin-top: 8px; font-size: 10px; font-weight: 600; letter-spacing: .28em; text-transform: uppercase; color: var(--text3); }
  .app-nav .nav-item.nav-ideas { display: flex; }
  .app-nav .nav-item {
    flex: 0 0 auto; width: 100%; height: 48px; min-height: 48px; margin: 0; padding: 0 14px;
    flex-direction: row; justify-content: flex-start; gap: 14px; color: var(--text2);
  }
  .app-nav .nav-item:hover { background: var(--bg3); color: var(--text); }
  .app-nav .nav-label { font-size: 15px; font-weight: 600; }
  .app-nav .nav-item.active, .app-nav .nav-post.active { background: var(--accent-btn); color: #fff; }
  .app-nav .nav-item.active:hover { background: var(--accent-btn); }
  .app-nav .nav-home { order: 1; }
  .app-nav .nav-post { order: 2; }
  .app-nav .nav-ideas { order: 3; }
  .app-nav .nav-review { order: 4; }
  .app-nav .nav-lb { order: 5; }
  .app-nav .nav-account { order: 6; }
  .app-nav .nav-post-ic { width: 22px; height: 22px; margin: 0; border: 0; background: none; box-shadow: none; color: inherit; }
  .app-nav .nav-post-ic svg { width: 22px; height: 22px; }
  .app-nav .nav-post { color: var(--text2); }
  .app-nav .nav-badge { position: static; margin-left: auto; border-color: transparent; }

  body.nav-any .scroll-content, body.nav-main .scroll-content { padding-bottom: 48px; }
  body.nav-any .toast, body.nav-main .toast { bottom: 28px; margin-left: calc(var(--rail-w) / 2); }
  .topbar-brand { display: none; }
}

/* shared horizontal gutter so every screen lines up with the content column */
.topbar, .scroll-content, .dash-tabs { padding-left: var(--gutter); padding-right: var(--gutter); }
html body .dash-tabs { padding-left: var(--gutter) !important; padding-right: var(--gutter) !important; }

/* ---- 6. Home -------------------------------------------------------------- */
.home-greet { margin: 4px 0 16px; }
.home-greet-title { font-family: var(--font-display); font-size: 26px; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; color: var(--text); }
.home-greet-title .wave { font-size: .9em; }
.home-greet-sub { margin-top: 4px; font-size: 13px; color: var(--text3); }
#dash-month:not(:empty)::before { content: ' \00B7 '; }
#dash-greet-studio:empty + #dash-month::before { content: ''; }

.home-grid { display: block; }
@media (min-width: 1100px) {
  .home-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 28px; align-items: start; }
}
.home-side > .card, .home-side > .section-head, .home-side > #streak-wrap { margin-bottom: 14px; }
.home-side .post-btn { margin-top: 4px; margin-bottom: 8px; min-height: 52px; }

.section-head { display: flex; align-items: center; justify-content: space-between; margin: 22px 0 12px; }
.section-head > span { font-family: var(--font-display); font-size: 17px; font-weight: 800; letter-spacing: -.01em; color: var(--text); }
.home-main > .section-head:first-child, .home-side > .section-head:first-child { margin-top: 0; }
.link-btn { background: none; border: 0; color: var(--accent); font-family: var(--font); font-size: 13px; font-weight: 600; cursor: pointer; min-height: 44px; padding: 0 4px; margin: -8px -4px; }
.link-btn:hover { text-decoration: underline; }

/* hero banner */
#dash-hero { margin-bottom: 14px; }
.dash-hero-card {
  position: relative; height: 196px; border-radius: 22px; overflow: hidden; cursor: pointer;
  background: var(--bg2); border: 1px solid var(--border); box-shadow: var(--shadow-card);
}
.dash-hero-card:hover { box-shadow: var(--shadow-card); }
.dash-hero-card img { width: 100%; height: 100%; object-fit: cover; object-position: var(--hero-pos, center center); }
.dash-hero-card .hero-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
  text-align: left; padding: 20px 22px;
  background: linear-gradient(90deg, rgba(14,14,16,.94) 0%, rgba(14,14,16,.72) 46%, rgba(14,14,16,.12) 100%);
}
.dash-hero-card .hero-tagline {
  font-family: var(--font-display); font-weight: 800; letter-spacing: -.035em; line-height: 1.02; color: #fff;
  font-size: clamp(28px, 7vw, 40px); max-width: 62%; text-shadow: none; animation: none;
}
.dash-hero-card .hero-studio { margin-top: 12px; font-size: 11px; font-weight: 700; letter-spacing: .2em; color: var(--text2); text-transform: uppercase; text-shadow: none; }
.hero-chev {
  position: absolute; right: 14px; bottom: 14px; width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 24px; line-height: 1; color: #fff;
  background: rgba(255,255,255,.16); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
@media (min-width: 1024px) { .dash-hero-card { height: 224px; } .dash-hero-card .hero-tagline { font-size: 46px; } }

/* quick-stat tiles */
.home-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 4px; }
.home-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 2px;
  min-height: 112px; padding: 14px 4px 12px; background: var(--bg2); border: 1px solid var(--border); border-radius: 18px;
  color: var(--text); cursor: pointer; font-family: var(--font); text-align: center;
  transition: transform .1s ease, background .15s ease, border-color .15s ease;
}
.home-tile:hover { background: var(--bg3); border-color: var(--border2); }
.home-tile:active { transform: scale(.97); }
.tile-ic { display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 12px; background: var(--accent-dim); color: var(--accent); margin-bottom: 6px; }
.tile-ic svg { width: 21px; height: 21px; }
.tile-amber .tile-ic { background: var(--amber-dim); color: var(--amber); }
.tile-ok .tile-ic { background: var(--ok-dim); color: var(--ok); }
.tile-blue .tile-ic { background: var(--blue-dim); color: var(--blue); }
.tile-num { font-family: var(--font-display); font-size: 24px; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; color: var(--text); font-variant-numeric: tabular-nums; }
.tile-num-plus { color: var(--text3); }
.tile-lbl { font-size: 11.5px; font-weight: 600; color: var(--text2); }
@media (min-width: 1024px) { .home-tile { min-height: 124px; } .tile-num { font-size: 28px; } .tile-lbl { font-size: 13px; } }

/* recent activity: cream paper cards */
#activity-feed .activity-item {
  background: var(--cream); border: 0; border-radius: 18px; box-shadow: 0 6px 18px rgba(0,0,0,.22);
  padding: 12px 14px; gap: 12px; margin-bottom: 10px; color: var(--cream-ink);
}
#activity-feed .activity-icon { width: 40px; height: 40px; background: rgba(28,28,30,.08); font-size: 18px; }
#activity-feed .activity-text { color: var(--cream-ink2); font-size: 13.5px; }
#activity-feed .activity-text strong { color: var(--cream-ink); font-weight: 700; }
#activity-feed .activity-time { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; color: var(--cream-ink2); font-size: 11.5px; }
#activity-feed .activity-thumb { width: 52px; height: 52px; border-radius: 12px; }
.act-chip { font-size: 9.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; padding: 3px 8px; border-radius: 99px; }
.act-chip.ok { background: rgba(52,199,89,.2); color: #17702F; }
#activity-feed.act-collapsed .activity-item:nth-child(n+7) { display: none; }
.act-more { display: block; margin: 6px auto 0; }

/* leaderboard rows (Home card + Leaderboard screen) */
.lb-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; position: relative;
  border: 1px solid transparent; margin-bottom: 6px;
}
.lb-row:last-child { margin-bottom: 0; }
.lb-row.lb-egg { cursor: pointer; }
.lb-rank {
  width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 800; font-size: 13px; color: var(--text2); background: var(--bg3);
}
.lb-row:nth-child(2) .lb-rank, .lb-row:nth-child(3) .lb-rank { background: var(--bg4); color: var(--text); }
.lb-av {
  width: 40px; height: 40px; flex-shrink: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--bg4); color: var(--text); font-weight: 700; font-size: 13px; border: 2px solid var(--border2);
}
.lb-info { flex: 1; min-width: 0; }
.lb-name { font-size: 15px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-you { font-size: 12px; font-weight: 500; color: var(--text3); }
.lb-studio { font-size: 12px; color: var(--text3); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-count { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-display); font-weight: 800; font-size: 17px; color: #FF8A4C; font-variant-numeric: tabular-nums; }
.lb-flame { width: 18px; height: 18px; color: #FF6B2C; }
.lb-first {
  background: linear-gradient(135deg, rgba(255,176,32,.22), rgba(255,59,48,.10)); border-color: rgba(255,176,32,.5);
  padding: 14px 12px;
}
.lb-first .lb-rank { background: var(--amber); color: #3A2600; }
.lb-first .lb-av { border-color: var(--amber); }
.lb-first .lb-name { font-size: 16px; }
.lb-mine:not(.lb-first) { background: rgba(255,255,255,.06); border-color: var(--border2); }
.lb-mine::before { content: ''; position: absolute; left: -1px; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--accent); }
.lb-gap { text-align: center; color: var(--text3); letter-spacing: .3em; font-size: 14px; line-height: 1; padding: 2px 0 8px; }

/* Leaderboard screen */
#lb-periods { display: flex; margin-bottom: 14px; }
#lb-periods .seg-tab { flex: 0 0 auto; width: auto; }
.lb-me-card {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px; margin-bottom: 14px;
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-card);
}
.lb-me-rank { font-family: var(--font-display); font-size: 30px; font-weight: 800; letter-spacing: -.03em; color: var(--accent); min-width: 56px; }
.lb-me-body { flex: 1; min-width: 0; }
.lb-me-title { font-size: 15px; font-weight: 700; color: var(--text); }
.lb-me-sub { font-size: 13px; color: var(--text2); margin-top: 3px; }
.lb-list { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 10px; }
.lb-list .skeleton-leader-row { padding: 12px 8px; }

/* segmented tabs (shared with flows: .seg-tabs/.seg-tab) */
.seg-tabs { display: flex; gap: 8px; overflow-x: auto; }
.seg-tab {
  flex: 0 0 auto; min-height: 40px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg3); color: var(--text2); font-family: var(--font); font-size: 14px; font-weight: 700; cursor: pointer;
}
.seg-tab.active { background: var(--accent-btn); border-color: var(--accent-btn); color: #fff; }

/* Feed / Scorecard / Admin tabs */
html body .dash-tabs { background: var(--bg) !important; padding-top: 4px !important; padding-bottom: 12px !important; }
.dash-tabs-inner { background: var(--bg2); border: 1px solid var(--border); border-radius: 16px; padding: 4px; }
html body .dash-tab { font-family: var(--font-display); color: var(--text2) !important; border-radius: 12px !important; min-height: 40px; }
html body .dash-tab.active { color: #fff !important; text-shadow: none; }
.dash-tab-slider { background: var(--accent-btn); box-shadow: 0 6px 16px rgba(219,45,36,.35); border-radius: 12px; top: 4px; bottom: 4px; }

/* hub cards (Content wall / Requests / Board / Activity) */
.dash-hub-card, #activity-entry, #admin-tab-activity {
  background: var(--bg2) !important; border: 1px solid var(--border) !important; border-radius: var(--radius-card) !important;
  box-shadow: none !important; text-align: left !important; display: flex; flex-direction: column; justify-content: flex-start;
}
#activity-entry, #admin-tab-activity { /* JS toggles display: keep flex only when shown */ }
.dash-hub-card:hover, #activity-entry:hover, #admin-tab-activity:hover { background: var(--bg3) !important; border-color: var(--border2) !important; }
.dash-hub-card > div:nth-child(2), #activity-entry > div:nth-child(2), #admin-tab-activity > div:nth-child(2) { color: var(--text) !important; font-family: var(--font-display); }
.dash-hub-card svg:not([fill="none"][width="28"]) { stroke: var(--accent) !important; }
#activity-entry svg, #admin-tab-activity svg { stroke: var(--blue) !important; }
.dash-hub-card > div:first-child, #activity-entry > div:first-child, #admin-tab-activity > div:first-child { justify-content: flex-start !important; }

/* Scorecard tweaks that rely on hardcoded colours */
.sc-good { color: var(--ok); }
.sc-bad { color: #FF6A60; }
.sc-warn { color: var(--amber); }
.sc-trend-up { color: var(--ok); }
.sc-trend-down { color: #FF6A60; }
.sc-badge { background: var(--accent-btn); font-family: var(--font-display); }
.sc-section { background: var(--bg2); border-radius: var(--radius-card); }
.sc-section-title { color: var(--accent); font-family: var(--font-display); }

/* ---- 7. Account (full panel on mobile, centred card on desktop) --------- */
.acct-overlay { position: fixed; inset: 0; z-index: 994; }
body.nav-main .acct-overlay { bottom: calc(var(--nav-h) + var(--safe-bottom)); }
.acct-backdrop { position: absolute; inset: 0; background: rgba(5,8,14,.72); }
.acct-panel {
  position: absolute; top: 0; bottom: 0; left: 0; right: 0; margin: 0 auto; max-width: 480px; overflow-y: auto;
  background: var(--bg); padding: calc(10px + var(--safe-top)) var(--gutter) 28px; animation: fadeUp .22s ease;
}
.acct-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 18px; }
.acct-head h2 { font-family: var(--font-display); font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.acct-head-spacer { width: 44px; }
.acct-profile { display: flex; align-items: center; gap: 14px; padding: 18px; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-card); margin-bottom: 20px; }
.acct-avatar {
  width: 64px; height: 64px; flex-shrink: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: #C9D3E3; color: var(--cream-ink); font-family: var(--font-display); font-weight: 800; font-size: 22px; text-transform: uppercase;
}
.acct-who { flex: 1; min-width: 0; }
.acct-name-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.acct-name { font-family: var(--font-display); font-size: 18px; font-weight: 800; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.acct-role { padding: 3px 9px; border-radius: 99px; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; background: var(--accent-btn); color: #fff; }
.acct-email { margin-top: 4px; font-size: 13px; color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-edit { background: none; border: 1px solid var(--border2); color: var(--text); border-radius: 99px; font-family: var(--font); font-size: 13px; font-weight: 600; padding: 0 14px; min-height: 44px; cursor: pointer; flex-shrink: 0; }
.acct-edit:hover { background: var(--bg3); }
#edit-name-row { margin: -8px 0 20px; }
#edit-name-row[style*="block"] { display: flex !important; gap: 8px; }
#edit-name-row .form-input { flex: 1; min-width: 0; }
#edit-name-row .btn { width: auto; padding: 0 20px; margin: 0; }
.acct-group-label { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--text3); margin: 0 4px 8px; }
.acct-group { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; margin-bottom: 20px; }
.acct-row {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 58px; padding: 0 18px; text-align: left;
  background: none; border: 0; color: var(--text); font-family: var(--font); font-size: 15px; font-weight: 600; cursor: pointer;
}
.acct-group > .acct-row + .acct-row, .acct-group > div + .acct-row, .acct-group > .acct-row + div, .acct-group > div + div { border-top: 1px solid var(--border); }
.acct-row:hover { background: var(--bg3); }
.acct-row > svg:first-child { width: 22px; height: 22px; flex-shrink: 0; color: var(--text2); }
.acct-row-label { flex: 1; min-width: 0; }
.acct-chev { width: 18px; height: 18px; color: var(--text3); transition: transform .15s ease; flex-shrink: 0; }
.acct-row.open .acct-chev { transform: rotate(90deg); }
.acct-row:disabled { opacity: .55; cursor: not-allowed; }
#push-toggle-btn { border: 0 !important; color: var(--text) !important; background: none !important; }
.sw { position: relative; width: 48px; height: 28px; border-radius: 99px; background: var(--bg4); border: 1px solid var(--border2); flex-shrink: 0; transition: background .18s ease; }
.sw::after { content: ''; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .18s ease; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
[aria-checked="true"] > .sw { background: var(--accent-btn); border-color: var(--accent-btn); }
[aria-checked="true"] > .sw::after { transform: translateX(20px); }
.acct-pw { padding: 6px 18px 18px; border-top: 1px solid var(--border); }
.acct-pw .form-label { margin: 12px 0 6px; font-size: 12px; }
.acct-pw .btn { margin-top: 16px; }
.acct-signout {
  width: 100%; min-height: 54px; border-radius: var(--radius-card); cursor: pointer; font-family: var(--font-display); font-size: 16px; font-weight: 800;
  background: rgba(255,59,48,.1); border: 1px solid rgba(255,59,48,.4); color: #FF7A70;
}
.acct-signout:hover { background: rgba(255,59,48,.18); }
@media (min-width: 900px) {
  body.nav-any .acct-overlay { left: var(--rail-w); bottom: 0; }
  .acct-panel { top: 5vh; bottom: 5vh; max-width: 560px; border-radius: 28px; border: 1px solid var(--border); box-shadow: var(--shadow-pop); padding: 22px 28px 28px; }
}

/* Other modal sheets pick up the dark panels from the generic rules above. Their JS-built inline styles reference tokens. */
#feedback-modal textarea.form-input, #reject-modal textarea.form-input { background: var(--bg3) !important; border-color: var(--border2) !important; }
#studio-picker-modal > div, #push-prompt > div { background: var(--bg2) !important; border: 1px solid var(--border2); border-radius: 24px !important; }
#push-prompt button:last-child { background: var(--accent-btn) !important; color: #fff !important; }

/* ---- 8. Toasts, offline banner, loading, skeletons, error states -------- */
.toast {
  background: rgba(30,30,33,.96); color: var(--text); border: 1px solid var(--border2); border-radius: 16px;
  font-size: 14px; font-weight: 600; padding: 12px 20px; box-shadow: var(--shadow-pop);
}
.toast.toast-success { background: #10281A; color: #6EE08F; border-color: rgba(52,199,89,.45); box-shadow: var(--shadow-pop); font-size: 14px; font-weight: 700; padding: 12px 20px; }
.toast.toast-error { background: #2C1416; color: #FF9A92; border-color: rgba(255,59,48,.5); }
.offline-banner { background: #2C1416 !important; color: #fff !important; border-bottom: 1px solid rgba(255,59,48,.6) !important; box-shadow: 0 6px 20px rgba(0,0,0,.4) !important; }
.offline-banner .offline-dot { background: var(--accent); box-shadow: 0 0 8px var(--accent); }

.loading-logo { font-size: 34px; }
.loading-bar { background: var(--bg3); }
.loading-bar-fill { background: var(--accent); }

.skeleton { background: var(--bg3); }
.skeleton::after { background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.07) 50%, transparent 100%); }
.skeleton-activity-item { background: var(--bg2); border-color: var(--border); border-radius: 18px; }
.skeleton-stat-box { background: var(--bg3); border-radius: 16px; }
.skeleton-admin-card { background: var(--bg2); border-color: var(--border); }
.skeleton-leader-row + .skeleton-leader-row { border-top-color: var(--border); }
.inline-error { color: var(--text2) !important; }
.inline-error button { background: var(--bg3) !important; border: 1px solid var(--border2) !important; color: var(--text) !important; min-height: 44px !important; padding: 0 20px !important; border-radius: 99px !important; }

/* ---- 9. Responsive tweaks ------------------------------------------------ */
@media (max-width: 380px) {
  :root, html.theme-dark { --gutter: 16px; }
  .home-tile { padding-left: 2px; padding-right: 2px; min-height: 104px; }
  .tile-lbl { font-size: 11px; }
  .dash-hero-card .hero-tagline { font-size: 26px; }
  .home-greet-title { font-size: 23px; }
  .studio-pill { padding: 8px 10px; }
}
@media (max-width: 479px) {
  .topbar { gap: 6px; }
}

/* ---- 9b. QA fixes: legacy inline-red buttons carried white text on #FF3B30 (3.55:1); use the AA filled-red token ---- */
html.theme-dark #invite-send-btn, html.theme-dark #bulk-send-btn, html.theme-dark #screen-documents [onclick*="doc-modal"][style*="background:var(--accent)"] { background: var(--accent-btn) !important; }

/* ---- 9c. QA fix: touch-target floor (44px). Pills/tabs/legacy small controls were 22-40px tall. ---- */
html body .dash-tab, html.theme-dark .fpill, html.theme-dark #screen-admin .fpill, html.theme-dark .sfpill, html.theme-dark #screen-admin .sfpill { min-height: 44px !important; }
html.theme-dark .reaction-btn, html.theme-dark .reaction-add { height: 44px !important; }
html.theme-dark .rq-card .bulk-check::before { content: ""; position: absolute; top: -7px; left: -7px; width: 44px; height: 44px; }
html.theme-dark #board-list button[onclick*="toggleBoardPin"], html.theme-dark #board-list button[onclick*="deleteBoard"] { min-height: 44px; min-width: 44px; padding: 0 12px !important; }
html.theme-dark #board-list input[id^="board-reply-"] { min-height: 44px; }
html.theme-dark .doc-action-btn { width: 44px; height: 44px; }
html.theme-dark #screen-inventory :is(input, select), html.theme-dark #invite-password, html.theme-dark #invite-tab-single, html.theme-dark #invite-tab-bulk, html.theme-dark #screen-activity select { min-height: 44px; }
html.theme-dark .note-textarea { min-height: 44px; }
html.theme-dark .sfpill { min-width: 44px; }
html.theme-dark .act-badge.act-badge-red { color: #FF6B63; } /* QA: #FF3B30 on the tinted badge was 4.40:1 */
html.theme-dark #screen-documents [onclick*="doc-modal"][style*="background"] { min-height: 44px; display: flex; align-items: center; justify-content: center; }
/* QA fix: Requests tabs have no slider element, so the active tab had no visible state; Invite "Generate" button (.btn-dim, width:100%) squeezed the password input to ~34px. */
html.theme-dark #req-tabs { background: var(--bg2); border: 1px solid var(--border); border-radius: 16px; padding: 4px; gap: 4px; }
html.theme-dark #req-tabs .dash-tab { flex: 1; border-radius: 12px !important; }
html.theme-dark #req-tabs .dash-tab.active { background: var(--accent-btn) !important; color: #fff !important; }
html.theme-dark #invite-single-wrap .btn-dim { width: auto; flex: 0 0 auto; }
html.theme-dark #invite-password { min-width: 0; }
html.theme-dark #feedback-modal button[onclick*="closeFeedbackModal"] { min-width: 44px; min-height: 44px; }

/* ---- 10. Reduced motion --------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  /* QA fix: style.css has `.dash-tab{transition:color .25s,text-shadow .25s !important}` which out-ranked the universal rule above. Higher specificity (:not(#x)) wins over any class-level !important. */
  html body *:not(#qa-x), html body *:not(#qa-x)::before, html body *:not(#qa-x)::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ==== GAPS (shell/layout + account only): tablet column, account avatar card + cream Security card ==== */
/* Tablet 600-899px: a ~720px centred column with the bottom bar (the rail takes over from 900px, see section 5). */
@media (min-width: 600px) and (max-width: 899px) {
  :root, html.theme-dark { --gutter: 28px; }
  #app { max-width: 720px; }
  .app-nav { max-width: 720px; }
  body.nav-main .toast { max-width: 520px; }
}
/* Account panel is a centred card from 600px up (full-height phone panel below) */
@media (min-width: 600px) {
  .acct-panel { top: 3vh; bottom: 3vh; max-width: 560px; border-radius: 28px; border: 1px solid var(--border); box-shadow: var(--shadow-pop); padding: 22px 28px 28px; }
}
/* big centred avatar card */
.acct-profile { flex-direction: column; text-align: center; gap: 10px; padding: 26px 18px 20px; background: linear-gradient(180deg, var(--bg3) 0%, var(--bg2) 100%); }
.acct-avatar { width: 96px; height: 96px; font-size: 34px; letter-spacing: .02em; box-shadow: 0 0 0 4px var(--bg2), 0 0 0 6px var(--border2); margin-bottom: 6px; }
.acct-who { flex: none; width: 100%; display: flex; flex-direction: column; align-items: center; }
.acct-name-row { justify-content: center; }
.acct-name { font-size: 22px; letter-spacing: -.02em; }
.acct-role { order: 2; margin-top: 8px; padding: 4px 12px; font-size: 11px; }
.acct-who { gap: 0; }
.acct-name-row { order: 1; }
.acct-email { order: 3; max-width: 100%; margin-top: 8px; }
.acct-studio { order: 4; margin-top: 4px; font-size: 13px; font-weight: 600; color: var(--text2); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-studio:empty { display: none; }
.acct-profile .acct-edit { margin-top: 6px; padding: 0 22px; }
#edit-name-row { margin: -8px 0 20px; }
/* cream Security card */
.acct-group.acct-cream { background: var(--cream); border-color: transparent; color: var(--cream-ink); box-shadow: var(--shadow-card); }
.acct-cream .acct-sec-note { display: flex; gap: 14px; align-items: flex-start; padding: 18px; }
.acct-cream .acct-sec-note svg { width: 24px; height: 24px; flex-shrink: 0; color: var(--accent-btn); margin-top: 2px; }
.acct-cream .acct-sec-note p { font-size: 14px; line-height: 1.5; color: var(--cream-ink2); margin: 0; }
.acct-cream .acct-sec-note strong { color: var(--cream-ink); font-size: 15px; font-weight: 700; }
.acct-cream .acct-row { color: var(--cream-ink); }
.acct-cream .acct-row:hover { background: rgba(28,28,30,.06); }
.acct-cream .acct-row > svg:first-child { color: var(--cream-ink2); }
.acct-cream .acct-chev { color: #566073; }
.acct-group.acct-cream > .acct-row, .acct-group.acct-cream > .acct-pw, .acct-group.acct-cream > div + .acct-row { border-top: 1px solid rgba(28,28,30,.12); }
.acct-cream .acct-pw .form-label { color: var(--cream-ink2); }
.acct-cream .acct-pw .form-input { background: #fff; color: var(--cream-ink); border: 1px solid rgba(28,28,30,.28); }
.acct-cream .acct-pw .form-input::placeholder { color: #5E6778; }
.acct-cream .acct-pw .form-input:focus { border-color: var(--accent-btn); box-shadow: 0 0 0 3px rgba(219,45,36,.18); outline: none; }
.acct-cream .acct-row:focus-visible { outline: 2px solid var(--accent-btn); outline-offset: -3px; }

/* ---- 7. Home social feed, extra tabs, leaderboard restyle (gaps pass, Nov 2026) ----------------- */
/* tab bar: 6 tabs scroll horizontally on phones instead of squeezing */
#dash-tabs .dash-tabs-inner { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
#dash-tabs .dash-tabs-inner::-webkit-scrollbar { display: none; }
html body #dash-tabs .dash-tab { flex: 1 0 auto; padding-left: 16px !important; padding-right: 16px !important; white-space: nowrap; }

/* photo-first post cards (cream body so the existing cream reaction chips keep their contrast) */
.pf-list { display: flex; flex-direction: column; gap: 16px; }
.pf-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 768px) { .pf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .pf-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.pf-card { background: var(--cream); color: var(--cream-ink); border-radius: var(--radius-card); overflow: hidden; box-shadow: var(--shadow-card); display: flex; flex-direction: column; min-width: 0; }
.pf-media { position: relative; display: block; width: 100%; padding: 0; border: 0; margin: 0; background: #060607; cursor: pointer; aspect-ratio: 4 / 3; overflow: hidden; }
.pf-media img, .pf-media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.pf-media:focus-visible { outline: 3px solid var(--accent-btn); outline-offset: -3px; }
.pf-badge { position: absolute; bottom: 10px; right: 10px; padding: 4px 10px; border-radius: 999px; background: rgba(14,14,16,.82); color: #fff; font-size: 12px; font-weight: 700; }
.pf-badge.pf-play { right: auto; left: 10px; }
.pf-body { padding: 14px 16px 10px; }
.pf-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.pf-av { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; background: var(--cream-ink) !important; color: #fff !important; }
.pf-who { min-width: 0; }
.pf-name { font-family: var(--font-display); font-weight: 800; font-size: 15px; color: var(--cream-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-meta { font-size: 12.5px; color: var(--cream-ink2); }
.pf-cap { margin: 0 0 10px; font-size: 14.5px; line-height: 1.5; color: var(--cream-ink); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.pf-card .reaction-bar { margin-bottom: 4px; }
.pf-empty { color: var(--text2); font-size: 14px; text-align: center; padding: 28px 16px; line-height: 1.5; background: var(--bg2); border: 1px dashed var(--border2); border-radius: var(--radius-card); }
.pf-loadmore { margin-top: 6px; grid-column: 1 / -1; }
.pf-grid .pf-media { aspect-ratio: 1 / 1; }
@media (min-width: 1100px) { #home-photo-feed .pf-media { aspect-ratio: 16 / 10; } }
.dash-extra { padding-bottom: 32px; }

/* Updates tab */
.upd-card { background: var(--cream); color: var(--cream-ink); border-radius: var(--radius-card); padding: 16px 18px; margin-bottom: 12px; box-shadow: var(--shadow-card); }
.upd-ann { background: linear-gradient(135deg, #FFE9B0, #F8CF6B); }
.upd-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.upd-kind { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #5B2DB4; margin-bottom: 0; }
.upd-ann .upd-kind { color: #5A2A00; margin-bottom: 8px; }
.upd-kind.upd-q { color: #8A4B00; }
.upd-pin { font-size: 11px; font-weight: 800; color: var(--cream-ink2); }
.upd-chip { margin-left: auto; font-size: 11.5px; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: rgba(28,28,30,.09); color: var(--cream-ink); }
.upd-body { font-size: 15px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; color: var(--cream-ink); }
.upd-meta { margin-top: 8px; font-size: 12.5px; color: var(--cream-ink2); }
.upd-ann .upd-meta { color: #4A3A12; }

/* Recognition tab */
.rg-head:first-child { margin-top: 0; }
.rg-list { margin-bottom: 8px; }
.lb-tier { display: inline-block; margin-top: 3px; font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; padding: 1px 8px; border-radius: 999px; background: rgba(28,28,30,.1); color: var(--cream-ink); }
.lb-first .lb-tier { background: rgba(90,42,0,.14); color: #3F1E00; }

/* Leaderboard: cream rows, gold #1, rank numbers, initials avatars, post counts (>=4.5:1 on cream) */
.lb-row { background: var(--cream); color: var(--cream-ink); border: 1px solid transparent; box-shadow: 0 4px 14px rgba(0,0,0,.18); margin-bottom: 8px; }
.lb-rank { background: rgba(28,28,30,.09); color: var(--cream-ink); width: 30px; height: 30px; font-size: 14px; }
.lb-row:nth-child(2) .lb-rank, .lb-row:nth-child(3) .lb-rank { background: rgba(28,28,30,.16); color: var(--cream-ink); }
.lb-av { background: var(--cream-ink); color: #fff; border: 2px solid rgba(28,28,30,.18); }
.lb-name { color: var(--cream-ink); }
.lb-you { color: var(--cream-ink2); }
.lb-studio { color: var(--cream-ink2); }
.lb-count { color: #A8310A; align-items: baseline; }
.lb-count .lb-flame { color: #C2410C; align-self: center; }
.lb-unit { font-family: var(--font); font-size: 11.5px; font-weight: 700; color: var(--cream-ink2); margin-left: 1px; }
.lb-first { background: linear-gradient(135deg, #FFE08A 0%, #F5B431 100%); border-color: #C98A0B; box-shadow: 0 8px 24px rgba(245,180,49,.28); }
.lb-first .lb-rank { background: var(--cream-ink); color: #FFD36B; }
.lb-first .lb-av { border-color: #8A5A00; }
.lb-first .lb-studio, .lb-first .lb-you { color: #3F2A00; }
.lb-first .lb-count { color: #5A2A00; }
.lb-first .lb-count .lb-flame { color: #8A3A00; }
.lb-first .lb-unit { color: #3F2A00; }
.lb-mine:not(.lb-first) { background: #FFF7EA; border-color: var(--accent-dark); }
.lb-mine::before { background: var(--accent-btn); }
.lb-list { padding: 12px; }
.lb-egg:focus-visible, .lb-row:focus-visible { outline: 3px solid var(--accent-btn); outline-offset: 2px; }
.lb-me-count .lb-unit { color: var(--text2); }
.lb-me-count { color: #FF9A62; }
#lb-periods { background: var(--bg2); border: 1px solid var(--border); border-radius: 999px; padding: 4px; gap: 4px; }
#lb-periods .seg-tab { flex: 1 1 0; min-height: 44px; background: transparent; border-color: transparent; }
#lb-periods .seg-tab.active { background: var(--accent-btn); border-color: var(--accent-btn); }
@media (prefers-reduced-motion: reduce) { .pf-card, .pf-media, .lb-row { transition: none !important; animation: none !important; } }

/* ===== 8. Page background photos (real studio photos, faint, one fixed layer) =====
   One fixed pseudo-element behind everything; image swaps by body[data-screen].
   No blur/filter (performance). Legibility: low opacity + top/bottom scrim. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-color: var(--bg); background-repeat: no-repeat; background-position: center; background-size: cover;
  opacity: 1;
}
body[data-screen]::before {
  background-image:
    linear-gradient(180deg, rgba(14,14,16,.80) 0%, rgba(14,14,16,.70) 38%, rgba(14,14,16,.80) 100%),
    var(--page-bg, none);
}
body[data-screen="dashboard"]   { --page-bg: url(images/bg/home.jpg); }
body[data-screen="myposts"], body[data-screen="admin"] { --page-bg: url(images/bg/review.jpg); }
body[data-screen="post1"], body[data-screen="post2"], body[data-screen="post3"], body[data-screen="post4"], body[data-screen="success"] { --page-bg: url(images/bg/post.jpg); }
body[data-screen="leaderboard"] { --page-bg: url(images/bg/studio.jpg); }
body[data-screen="postdetail"]  { --page-bg: url(images/bg/detail.jpg); }
body[data-screen="gallery"], body[data-screen="board"], body[data-screen="activity"], body[data-screen="documents"], body[data-screen="vault"] { --page-bg: url(images/bg/calm.jpg); }
body[data-screen="suggestions"], body[data-screen="inventory"], body[data-screen="requests"], body[data-screen="invite"], body[data-screen="easter-egg"] { --page-bg: url(images/bg/calm.jpg); }
body[data-screen="login"], body[data-screen="loading"] { --page-bg: none; }
/* account lives in a sheet over the current screen: leave the page photo as is */
/* let the photo show through the sticky top bar */
.topbar { background: rgba(14,14,16,.62); }
@media (prefers-reduced-data: reduce) { body[data-screen]::before { background-image: none; } }
/* body must be transparent so the fixed photo layer (z-index:-1) shows; html supplies the base navy */
html { background: var(--bg); }
html body { background: transparent; }
html body .dash-tabs { background: rgba(14,14,16,.55) !important; }

/* ===== 9. Refinement pass (Nov 2026): structured cards, subtle outlines, tighter type =====
   Direction: C layout (clear separated cards), A borders (1px white ~24%), D typography.
   Pure override layer; same content and structure. ============================================ */
:root, html.theme-dark {
  --line: rgba(255,255,255,.22);          /* outline on cards / panels / groups */
  --line-soft: rgba(255,255,255,.14);     /* nested items, dividers */
  --radius-card: 16px;
  --radius-ctl: 14px;
  --shadow-card: 0 10px 30px rgba(0,0,0,.34), inset 0 1px 0 rgba(255,255,255,.04);
}

/* quieter photo behind everything so foreground reads first */
body[data-screen]::before {
  background-image: linear-gradient(180deg, rgba(14,14,16,.88) 0%, rgba(14,14,16,.80) 40%, rgba(14,14,16,.88) 100%), var(--page-bg, none);
}

/* outlined containers */
html body .card, html body .home-tile, html body .stat-box, html body .lb-me-card, html body .lb-list,
html body .announce, html body .dash-hero-card, html body .sheet, html body .confirm-sheet,
html body .studio-pill, html body .icon-btn, html body .back-btn, html body .fpill, html body .btn-dim,
html body .dash-tabs-inner, html body .seg-tabs, html body .seg-tab {
  border-color: var(--line);
}
html body .card, html body .home-tile, html body .lb-me-card, html body .lb-list, html body .dash-hero-card, html body .stat-box {
  border-radius: var(--radius-card);
  background: var(--bg2);
}
html body .card { padding-block: 18px; }
html body .dash-tabs-inner { border-radius: var(--radius-card); background: rgba(22,22,24,.86); }
html body .dash-tab { font-weight: 600; letter-spacing: .005em; }
html body .dash-tab.active { font-weight: 700; }

/* type hierarchy */
.home-greet-title { font-size: 30px; font-weight: 800; letter-spacing: -.035em; }
.home-greet-sub { font-size: 13.5px; color: var(--text2); letter-spacing: .01em; }
.section-head { margin: 28px 0 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line-soft); }
.section-head > span { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.home-main > .section-head:first-child, .home-side > .section-head:first-child { margin-top: 0; }
.link-btn { font-size: 13px; font-weight: 700; letter-spacing: .01em; }
.card-label { font-size: 11.5px; letter-spacing: .14em; color: var(--text2); margin-bottom: 8px; }
.tile-num { font-size: 28px; font-weight: 800; }
.tile-lbl { font-size: 12.5px; font-weight: 600; letter-spacing: .01em; }
.lb-name { font-weight: 700; letter-spacing: -.005em; }

/* stat tiles: identical size, centered, easy to compare */
.home-tiles { gap: 12px; }
.home-tile { min-height: 124px; padding: 16px 6px 14px; border-radius: var(--radius-card); justify-content: center; box-shadow: var(--shadow-card); }
.home-tile:hover { border-color: rgba(255,255,255,.34); }

/* hero: same card, cleaner edge + padding */
.dash-hero-card { border-radius: var(--radius-card); border: 1px solid var(--line); }
.dash-hero-card .hero-overlay { padding: 24px 26px; }
.dash-hero-card .hero-studio { font-size: 11px; letter-spacing: .22em; }

/* Latest from the team: header + contained feed */
#home-photo-feed { border: 1px solid var(--line-soft); border-radius: var(--radius-card); padding: 12px; background: rgba(22,22,24,.55); }
.pf-card { border: 1px solid rgba(255,255,255,.28); border-radius: 14px; }

/* cards and recent-activity rows */
#activity-feed .activity-item { border-radius: 14px; border: 1px solid rgba(255,255,255,.28); }
.lb-row { border-radius: 14px; }

/* buttons: primary stays red; every other button gets the outline */
.post-btn, .btn-green { border-radius: var(--radius-ctl); border: 1px solid rgba(255,255,255,.18); letter-spacing: .01em; }
.btn-dim, .studio-pill { border: 1px solid var(--line); }

/* sidebar (desktop): outlined rail, each item roomier, quiet outline on hover, red only when active */
@media (min-width: 900px) {
  body.nav-any .app-nav, body.nav-main .app-nav {
    top: 12px; bottom: 12px; left: 12px; width: calc(var(--rail-w) - 24px);
    border: 1px solid var(--line); border-radius: 20px; background: rgba(22,22,24,.92); gap: 8px; padding: 24px 14px 20px;
  }
  body.nav-any #app { padding-left: var(--rail-w); }
  .app-nav .nav-item { border: 1px solid transparent; padding-block: 11px; }
  .app-nav .nav-item:hover { background: var(--bg3); border-color: var(--line-soft); }
  .app-nav .nav-item.active, .app-nav .nav-post.active { border-color: rgba(255,255,255,.18); box-shadow: 0 8px 22px rgba(219,45,36,.32); }
  .app-nav .nav-label { font-size: 15px; font-weight: 600; letter-spacing: .005em; }
}

/* right rail: each panel clearly its own premium card */
.home-side > .card, .home-side .announce { margin-bottom: 18px; box-shadow: var(--shadow-card); }
.home-side .section-head { border-bottom: 0; padding-bottom: 0; margin: 0 0 12px; }
@media (min-width: 1100px) { .home-grid { gap: 32px; } }
@media (max-width: 1099px) { .home-side { margin-top: 8px; } }

/* inputs: same outline language */
html body input[type=text], html body input[type=email], html body input[type=password], html body textarea, html body select { border-color: var(--line); }

/* ---- 10. iPhone fixes (Nov 2026): studio sheet above the bottom nav, title never clipped ---- */
/* Overlay sheets sat at z-index 100 under the bottom nav (995), hiding the last option(s). */
.sheet-overlay, .confirm-overlay { z-index: 1001; }
.sheet-overlay .sheet { max-height: calc(100dvh - 24px); overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
#sheet-studio-list { padding-bottom: 4px; }
@media (max-width: 899px) {
  .topbar-brand { flex: 0 0 auto; }
  .wordmark { flex-shrink: 0; white-space: nowrap; }
  .studio-pill { flex: 0 1 auto; min-width: 0; max-width: 100%; }
  #studio-pill-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #studio-pill svg { flex: 0 0 auto; }
}
@media (max-width: 479px) {
  .wordmark { font-size: 22px; }
  .topbar > div[style*="flex:1"] { flex: 0 0 0 !important; }
  .topbar .studio-pill { margin-left: auto; padding: 8px 12px; gap: 6px; }
  .topbar #studio-pill-logo { display: none !important; }
}

/* ---- 11. iPhone fixes round 2 (Nov 2026): tiny screens, keyboard, tap targets ---- */
/* Keyboard inset (set by app.js from visualViewport; 0 when no keyboard). */
:root { --kb: 0px; }
/* 320px: keep the studio name readable in the pill instead of "CP ..." */
@media (max-width: 359px) {
  .topbar { gap: 6px; }
  .wordmark { font-size: 18px; }
  .topbar .studio-pill { padding: 8px 10px; gap: 5px; }
  .topbar .icon-btn, .topbar .avatar-btn { width: 40px; min-width: 40px; height: 40px; }
  .topbar .studio-pill { min-height: 40px; }
}
/* Feedback / Ideas sheet: scrollable, lifts above the keyboard, no resizable textarea */
#feedback-modal .fb-sheet { max-height: calc(100dvh - var(--kb) - 12px); overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; bottom: var(--kb) !important; }
#feedback-modal #fb-message { resize: none; }
#feedback-modal .fb-close { min-width: 44px; min-height: 44px; margin: -14px -12px -14px 0 !important; }
/* Bottom sheets / modals follow the keyboard and can scroll in short landscape */
.sheet-overlay.open { padding-bottom: var(--kb); }
.sheet-overlay .sheet { max-height: calc(100dvh - var(--kb) - 24px); }
#doc-modal, #inv-add-modal { padding-bottom: var(--kb); }
#doc-modal > div, #inv-add-modal > .modal-sheet { max-height: calc(100dvh - var(--kb) - 12px); overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
#doc-modal .modal-x { min-width: 44px; min-height: 44px; }
/* tap targets */
#groupme-admin-wrap button[onclick^="loadGroupMe"] { min-height: 44px; min-width: 44px; padding: 0 8px; }

/* 11. Call Coach tile (replaces Ideas tile on Home) */
a.home-tile { text-decoration: none; color: inherit; }
.tile-ic-img { background: transparent; }
.tile-ic-img img { width: 38px; height: 38px; border-radius: 50%; display: block; }
.tile-cc { justify-content: center; }
.tile-cc .tile-ic-img { width: 72px; height: 72px; margin-bottom: 6px; }
.tile-cc .tile-ic-img img { width: 72px; height: 72px; }
@media (max-width: 599px) { .tile-cc .tile-ic-img, .tile-cc .tile-ic-img img { width: 52px; height: 52px; } }
