/* =========================================================================================
   Studio Panel design system
   Loaded after app.css. Re-maps the old tokens onto a calm, neutral palette and restyles the
   shared building blocks: the app shell, page headers, buttons, inputs, cards, tables, chips,
   tabs and modals. Brand colour, corner radius and default mode come from studio.config.json
   at runtime (--brand, --brand-dark, --radius-lg).
   ========================================================================================= */

:root {
  --brand: #5B5FEF;
  --brand-dark: #8C8FFF;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 8px;

  --font-display: 'Inter Tight', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --sidebar-w: 252px;

  --bg: #F6F6F7;
  --surface: #FFFFFF;
  --surface-2: #FAFAFB;
  --surface-3: #F2F2F4;
  --row-alt: #FAFAFB;
  --input-bg: #FFFFFF;
  --sidebar-bg: #FBFBFC;
  --ink: #111216;
  --ink-soft: #50535C;
  --muted: #8A8D96;
  --line: #E7E7EA;
  --line-strong: #D7D8DD;

  --accent: var(--brand);
  --accent-ink: #FFFFFF;
  --accent-soft: color-mix(in srgb, var(--brand) 8%, #FFFFFF);
  --accent-soft-strong: color-mix(in srgb, var(--brand) 14%, #FFFFFF);
  --accent-hover: color-mix(in srgb, var(--brand) 88%, #000000);
  --ring: color-mix(in srgb, var(--brand) 28%, transparent);

  --btn-primary-bg: var(--brand);
  --btn-primary-bg-hover: var(--accent-hover);
  --btn-primary-text: #FFFFFF;

  --warn-bg: #FEF7E8;
  --warn-line: #F3E0B3;
  --warn-text: #8A5A00;
  --ok-bg: #EBF8F1;
  --ok-line: #C5E8D4;
  --ok-text: #137A47;
  --ok-text-hover: #0D5F37;
  --err-bg: #FDF0EE;
  --err-line: #F4CCC5;
  --err-text: #B0301B;

  --radius: var(--radius-lg);
  --shadow-xs: 0 1px 2px rgba(17, 18, 22, .05);
  --shadow-sm: 0 1px 2px rgba(17, 18, 22, .04), 0 1px 3px rgba(17, 18, 22, .03);
  --shadow-md: 0 2px 6px rgba(17, 18, 22, .05), 0 12px 32px -8px rgba(17, 18, 22, .12);
  --shadow-lg: 0 20px 50px -12px rgba(17, 18, 22, .25);
}

:root[data-theme="dark"] {
  --accent: var(--brand-dark);
  --accent-ink: #0C0D10;
  --bg: #0C0D10;
  --surface: #141519;
  --surface-2: #17181D;
  --surface-3: #1C1D23;
  --row-alt: #16171C;
  --input-bg: #101115;
  --sidebar-bg: #0F1013;
  --ink: #EDEDF0;
  --ink-soft: #A2A4AD;
  --muted: #6D7079;
  --line: #24252B;
  --line-strong: #30323A;
  --accent-soft: color-mix(in srgb, var(--brand-dark) 12%, #141519);
  --accent-soft-strong: color-mix(in srgb, var(--brand-dark) 20%, #141519);
  --accent-hover: color-mix(in srgb, var(--brand-dark) 88%, #FFFFFF);
  --ring: color-mix(in srgb, var(--brand-dark) 34%, transparent);
  --btn-primary-bg: var(--brand);
  --btn-primary-bg-hover: color-mix(in srgb, var(--brand) 86%, #FFFFFF);
  --warn-bg: #261F10;
  --warn-line: #42361A;
  --warn-text: #E3B25A;
  --ok-bg: #0F2018;
  --ok-line: #1B3A2A;
  --ok-text: #55C98F;
  --ok-text-hover: #79DBA9;
  --err-bg: #291614;
  --err-line: #47231E;
  --err-text: #EE8B7F;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, .35), 0 16px 40px -10px rgba(0, 0, 0, .55);
  --shadow-lg: 0 24px 60px -16px rgba(0, 0, 0, .7);
}

/* ---------- Base ---------------------------------------------------------------------- */
body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--ink);
  font-feature-settings: 'cv11', 'ss01';
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  letter-spacing: -.018em;
  color: var(--ink);
}
h1 { font-weight: 700; }
h2, h3, h4 { font-weight: 650; }

::selection { background: var(--accent-soft-strong); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: var(--accent); }

.boot-screen { min-height: 100vh; display: grid; place-items: center; }
.boot-mark {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2.5px solid var(--line);
  border-top-color: var(--accent);
  animation: sp-spin .75s linear infinite;
}
@keyframes sp-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .boot-mark { animation-duration: 2.4s; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* =========================================================================================
   App shell
   ========================================================================================= */
.topbar { display: none !important; }

#app:has(> .app-sidebar) { padding-left: var(--sidebar-w); }

.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  z-index: 40;
  display: flex;
  flex-direction: column;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--line);
}

.shell-top { padding: 18px 14px 10px; display: grid; gap: 14px; }

.shell-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 2px 6px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 15px;
  letter-spacing: -.01em;
}
.shell-brand img,
.shell-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  flex-shrink: 0;
  object-fit: cover;
}
.shell-mark {
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--surface);
  font-size: 11px;
  font-weight: 700;
}
.shell-brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.shell-search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 34px;
  padding: 0 8px 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: border-color .15s, color .15s;
}
.shell-search:hover { border-color: var(--line-strong); color: var(--ink-soft); }
.shell-search span { flex: 1; text-align: left; }
.shell-search kbd {
  font: 500 11px var(--font-body);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
  background: var(--surface-2);
}

.shell-nav {
  flex: 1;
  overflow-y: auto;
  padding: 6px 10px 12px;
  scrollbar-width: thin;
}
.shell-group { padding: 6px 0; }
.shell-group + .shell-group { margin-top: 2px; }
.shell-group-label {
  padding: 8px 10px 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .01em;
}
.shell-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 34px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 500;
  font-size: 13.5px;
  transition: background .12s, color .12s;
}
.shell-link svg { color: var(--muted); flex-shrink: 0; transition: color .12s; }
.shell-link:hover { background: var(--surface-3); color: var(--ink); }
.shell-link:hover svg { color: var(--ink-soft); }
.shell-link.active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 0 0 1px var(--line), var(--shadow-xs);
}
.shell-link.active svg { color: var(--accent); }
:root[data-theme="dark"] .shell-link.active { background: var(--surface-3); box-shadow: none; }

.shell-foot { padding: 10px; border-top: 1px solid var(--line); }
.shell-account { position: relative; }
.shell-account summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .12s;
}
.shell-account summary::-webkit-details-marker { display: none; }
.shell-account summary:hover,
.shell-account[open] summary { background: var(--surface-3); }
.shell-account summary > svg { color: var(--muted); margin-left: auto; transform: rotate(180deg); }
.shell-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--surface-3);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 700;
}
.shell-avatar img { width: 100%; height: 100%; object-fit: cover; }
.shell-who { display: grid; min-width: 0; line-height: 1.25; }
.shell-who strong { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shell-who small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shell-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 6px);
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  display: grid;
  animation: sp-pop .14s ease-out;
}
.shell-menu a,
.shell-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 9px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.shell-menu a:hover,
.shell-menu button:hover { background: var(--surface-3); }
.shell-menu svg { width: 16px; height: 16px; color: var(--ink-soft); }
.shell-menu-pad { width: 16px; flex-shrink: 0; }
.shell-menu .danger { color: var(--err-text); }
.shell-menu-sep { height: 1px; background: var(--line); margin: 4px 2px; }
@keyframes sp-pop { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.mobile-header, .shell-scrim { display: none; }

.icon-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.icon-btn:hover { background: var(--surface-3); border-color: var(--line-strong); }

/* Signed-out header (recruitment and other public pages) */
.pub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.pub-header-right { display: flex; align-items: center; gap: 10px; }
.pub-link { color: var(--ink-soft); text-decoration: none; font-size: 13.5px; margin-right: 6px; }
.pub-link:hover { color: var(--ink); }

.sec-strip { border-radius: 0; }

@media (max-width: 960px) {
  #app:has(> .app-sidebar) { padding-left: 0; }
  .app-sidebar {
    transform: translateX(-100%);
    transition: transform .22s cubic-bezier(.2, .7, .2, 1);
    box-shadow: var(--shadow-lg);
    width: min(84vw, 300px);
  }
  .app-sidebar.open { transform: none; }
  .mobile-header {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
  }
  .shell-scrim {
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(10, 11, 14, .4);
  }
  .shell-scrim.open { display: block; }
  .pub-header { padding: 12px 16px; }
  .pub-link { display: none; }
}

/* =========================================================================================
   Page layout
   ========================================================================================= */
.shell {
  max-width: 1180px;
  padding: 36px 40px 96px;
}
@media (max-width: 720px) { .shell { padding: 24px 16px 72px; } }

.heading-block { margin-bottom: 24px; }
.heading-block h1,
.shell > h1,
.home-head h1 {
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: -.022em;
  margin: 0 0 6px;
}
.sub { color: var(--ink-soft); font-size: 14px; }
.sec-title { font-size: 16px; letter-spacing: -.01em; }
.hint { color: var(--muted); }
.eyebrow { color: var(--muted); letter-spacing: .06em; font-weight: 600; }

/* ---------- Buttons ------------------------------------------------------------------ */
.btn {
  border-radius: var(--radius-sm);
  font-weight: 550;
  font-size: 13.5px;
  padding: 10px 16px;
  letter-spacing: -.003em;
  transition: background .12s, box-shadow .12s, color .12s, border-color .12s, opacity .12s;
}
.btn:active:not(:disabled) { transform: translateY(.5px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 7px; }

.btn-primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  box-shadow: 0 1px 2px rgba(17, 18, 22, .12), inset 0 1px 0 rgba(255, 255, 255, .12);
}
.btn-primary:hover:not(:disabled) { background: var(--btn-primary-bg-hover); }

.btn-ghost {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 0 0 1px var(--line-strong) inset, var(--shadow-xs);
}
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); }

.btn-ok { box-shadow: 0 1px 2px rgba(17, 18, 22, .12); }

/* ---------- Surfaces --------------------------------------------------------------- */
.panel {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  padding: 24px;
}
.gate-card,
.lock-card,
.staff-card,
.team-card,
.bd-card,
.home-card,
.home-stat,
.stat-card,
.owed-hero {
  border-radius: var(--radius-lg);
  border-color: var(--line);
}
.home-card,
.home-stat,
.team-card,
.staff-card { box-shadow: var(--shadow-sm); }
.stat-card { background: var(--surface); }

.home-stat .home-stat-value,
.stat-card .stat-value,
.owed-hero strong {
  font-family: var(--font-display);
  letter-spacing: -.02em;
}

/* ---------- Forms ------------------------------------------------------------------ */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="search"],
input[type="url"],
input[type="date"],
input[type="datetime-local"],
input[type="month"],
input[type="tel"],
input[type="password"],
select,
textarea {
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background-color: var(--input-bg);
  color: var(--ink);
  box-shadow: var(--shadow-xs);
  transition: border-color .12s, box-shadow .12s;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--ring) !important;
}
.field label { color: var(--ink); font-weight: 550; font-size: 13px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }

/* ---------- Tables ----------------------------------------------------------------- */
table.req-table thead th,
.an-table thead th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--line);
}
table.req-table tbody tr:hover td,
.an-table tbody tr:hover td { background: var(--surface-2); }

/* ---------- Chips, tabs, segmented controls ----------------------------------------- */
.status-chip {
  border-radius: 999px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 550;
  font-size: 12px;
  padding: 3px 9px 3px 8px;
}
.status-chip::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: .85;
}
.chip-filter { font-weight: 550; transition: background .12s, color .12s, border-color .12s; }
.chip-filter:hover { border-color: var(--line-strong); color: var(--ink); }
.chip-filter.active,
.chip-filter.on,
.chip-filter[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface);
}

.tabs {
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 3px;
  gap: 2px;
}
.tab-btn { border-radius: 6px; color: var(--ink-soft); font-weight: 550; }
.tab-btn:hover { color: var(--ink); }
.tab-btn.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 0 0 1px var(--line), var(--shadow-xs);
}
.seg { background: var(--surface-3); border-radius: 9px; }

/* ---------- Feedback --------------------------------------------------------------- */
.error-box, .warn-box, .confirm-box { border-radius: var(--radius-md); }
.toast { border-radius: var(--radius-md) !important; box-shadow: var(--shadow-md) !important; }
.empty-note, .home-empty { color: var(--muted); }

/* ---------- Modals ----------------------------------------------------------------- */
.modal-scrim {
  background: rgba(10, 11, 14, .45) !important;
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.modal-card {
  border-radius: calc(var(--radius-lg) + 2px) !important;
  box-shadow: var(--shadow-lg) !important;
  border: 1px solid var(--line) !important;
}

/* ---------- Gate cards (recruitment, invites, loading states) ----------------------- */
.gate-shell { padding-top: clamp(32px, 9vh, 96px); }
.gate-card { padding: 32px 30px; box-shadow: var(--shadow-md); }
.gate-card .gate-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--ink);
}
.gate-card .gate-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gate-card:has(.gate-icon img) .gate-icon { background: transparent; }

/* =========================================================================================
   Settings
   ========================================================================================= */
.manage-layout { gap: 40px; }
.manage-side {
  width: 220px;
  top: 28px;
  gap: 1px;
}
.manage-side .ms-group {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  padding: 14px 12px 6px;
}
.manage-side .ms-group:first-child { padding-top: 2px; }
.manage-side button[data-manage-tab] {
  display: grid !important;
  gap: 1px;
  padding: 8px 12px !important;
  border-radius: var(--radius-sm) !important;
  font-size: 13.5px !important;
  color: var(--ink-soft) !important;
  background: transparent !important;
  font-weight: 500 !important;
}
.manage-side button[data-manage-tab]:hover { background: var(--surface-3) !important; color: var(--ink) !important; }
.manage-side button[data-manage-tab].on {
  background: var(--surface) !important;
  color: var(--ink) !important;
  font-weight: 600 !important;
  box-shadow: 0 0 0 1px var(--line), var(--shadow-xs);
}
.manage-side button[data-manage-tab] small { font-size: 12px; color: var(--muted); font-weight: 400; }
.manage-section-head { margin: 0 0 18px; }
.manage-section-head h2 { font-size: 20px; margin: 0 0 4px; }
.manage-section-head p { color: var(--ink-soft); margin: 0; max-width: 68ch; }
details.advanced {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  margin: 0 0 16px;
  box-shadow: var(--shadow-sm);
}
details.advanced > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  font-weight: 600;
}
details.advanced > summary::-webkit-details-marker { display: none; }
details.advanced > summary::after {
  content: '';
  margin-left: auto;
  width: 8px;
  height: 8px;
  border-right: 1.75px solid var(--muted);
  border-bottom: 1.75px solid var(--muted);
  transform: rotate(45deg) translateY(-2px);
  transition: transform .15s;
}
details.advanced[open] > summary::after { transform: rotate(225deg) translateY(-2px); }
details.advanced > summary small { color: var(--muted); font-weight: 400; }
details.advanced > .advanced-body { padding: 18px 20px 20px; border-top: 1px solid var(--line); }
@media (max-width: 900px) {
  .manage-layout { flex-direction: column; gap: 18px; }
  .manage-layout { min-width: 0; max-width: 100%; }
  .manage-layout > * { min-width: 0; max-width: 100%; }
  .manage-side { position: static; width: 100%; max-width: 100%; min-width: 0; flex-direction: row !important; overflow-x: auto; }
  .manage-side .ms-group { display: none; }
  .manage-side button[data-manage-tab] small { display: none; }
  .manage-side button[data-manage-tab] { white-space: nowrap; }
}

/* =========================================================================================
   Sign-in experience
   Desktop: exactly one screen tall, never scrolls. The form column scrolls on its own only if
   the window is extremely short. Phones: a single column that scrolls normally.
   ========================================================================================= */
.auth {
  --hero-image: none;
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-columns: minmax(420px, 44%) 1fr;
  background: var(--surface);
  color: var(--ink);
  overflow: hidden;
}

.auth-side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  padding: clamp(20px, 3.2vh, 36px) clamp(28px, 4.5vw, 64px);
  scrollbar-width: thin;
}
.auth-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-shrink: 0; }
.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 16px;
  letter-spacing: -.01em;
}
.auth-brand img, .auth-brand .auth-brand-mark { width: 32px; height: 32px; border-radius: 9px; object-fit: cover; flex-shrink: 0; }
.auth-brand .auth-brand-mark { display: grid; place-items: center; background: var(--ink); color: var(--surface); font-size: 12px; }
.auth-brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.auth-icon-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.auth-icon-btn:hover { background: var(--surface-3); color: var(--ink); border-color: var(--line-strong); }

.auth-main {
  width: 100%;
  max-width: 380px;
  margin: auto;
  padding: clamp(24px, 6vh, 64px) 0;
  animation: auth-in .4s cubic-bezier(.2, .7, .2, 1) both;
}
.auth-main h1 {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 650;
  letter-spacing: -.028em;
  line-height: 1.12;
  margin: 0 0 8px;
}
.auth-sub { font-size: 15px; line-height: 1.55; color: var(--ink-soft); margin: 0 0 28px; }
.auth-main .error-box { margin-bottom: 16px; }

.auth-providers { display: grid; gap: 10px; }
.btn-roblox, .btn-provider {
  width: 100%;
  min-height: 46px;
  font-size: 14.5px;
  font-weight: 600;
  border-radius: 11px;
  gap: 10px;
}
.btn.btn-roblox { background: var(--ink); color: var(--surface); border-color: var(--ink); box-shadow: 0 1px 2px rgba(17, 18, 22, .18); }
.btn.btn-roblox:hover:not(:disabled) { background: color-mix(in srgb, var(--ink) 86%, var(--surface)); }
.btn-roblox svg { width: 18px; height: 18px; }
.btn-provider {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 0 0 1px var(--line-strong) inset;
}
.btn-provider:hover:not(:disabled) { background: var(--surface-3); }
.btn-roblox svg, .btn-provider svg { flex-shrink: 0; }
[data-auth][aria-busy="true"] { cursor: progress; opacity: .8 !important; }
.auth-or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; margin: 2px 0; }
.auth-or::before, .auth-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.auth-test { border: 1px solid var(--warn-line); border-radius: 12px; padding: 12px; background: var(--warn-bg); }
.auth-test-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--warn-text); font-size: 12.5px; margin-bottom: 10px; line-height: 1.4; }
.auth-test-badge {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--warn-text);
  border: 1px solid currentColor;
  border-radius: 5px;
  padding: 1px 6px;
}
.auth-test-roles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.auth-test-roles .btn-provider { min-height: 36px; font-size: 13px; gap: 7px; border-radius: 9px; }
.auth-test-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.auth-test-dot[data-role="Owner"] { background: var(--brand); }
.auth-test-dot[data-role="Manager"] { background: #D9932B; }
.auth-test-dot[data-role="Staff"] { background: #2E9E66; }

.auth-legal { margin: 18px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.auth-legal a { color: var(--ink-soft); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.auth-legal a:hover { color: var(--ink); text-decoration-color: currentColor; }

.auth-bottom { flex-shrink: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; font-size: 12.5px; color: var(--muted); }
.auth-note { flex-basis: 100%; margin: 0 0 6px; color: var(--ink-soft); font-size: 13px; line-height: 1.5; }
.auth-links { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.auth-links a { color: var(--muted); text-decoration: none; }
.auth-links a:hover { color: var(--ink); }
.auth-copy { margin-left: auto; }

/* Right-hand studio panel. Always dark, tinted with the brand colour. */
.auth-art {
  position: relative;
  margin: 12px 12px 12px 0;
  border-radius: 20px;
  overflow: hidden;
  isolation: isolate;
  color: #fff;
  background: color-mix(in srgb, var(--brand) 16%, #0D0E12);
  display: flex;
  flex-direction: column;
  padding: clamp(32px, 6vh, 64px) clamp(32px, 4.5vw, 72px) 0;
  min-height: 0;
}
.auth-art::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(rgba(255, 255, 255, .07) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
  mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
}
.auth-art::after {
  content: '';
  position: absolute;
  z-index: -1;
  width: 70%;
  aspect-ratio: 1;
  right: -20%;
  bottom: -35%;
  border-radius: 50%;
  background: color-mix(in srgb, var(--brand) 55%, transparent);
  filter: blur(90px);
  opacity: .55;
}
.auth-art.has-image { background: #0D0E12 var(--hero-image) center / cover no-repeat; }
.auth-art.has-image::before { background-image: linear-gradient(180deg, rgba(8, 9, 12, .72), rgba(8, 9, 12, .35) 60%, rgba(8, 9, 12, .6)); -webkit-mask-image: none; mask-image: none; background-size: auto; }
.auth-art.has-image::after { display: none; }

.auth-art-copy { max-width: 520px; flex-shrink: 0; }
.auth-eyebrow { display: inline-block; font-size: 12.5px; font-weight: 600; letter-spacing: .02em; color: rgba(255, 255, 255, .62); margin-bottom: 14px; }
.auth-art h2 {
  font-family: var(--font-display);
  font-size: clamp(32px, 3.4vw, 50px);
  line-height: 1.04;
  font-weight: 650;
  letter-spacing: -.035em;
  margin: 0;
  color: #fff;
  text-wrap: balance;
}
.auth-art p { margin: 16px 0 0; max-width: 42ch; font-size: clamp(15px, 1.1vw, 17px); line-height: 1.55; color: rgba(255, 255, 255, .68); }

.auth-preview {
  margin-top: auto;
  transform: translateY(18px);
  align-self: stretch;
  max-width: 640px;
  border-radius: 16px 16px 0 0;
  background: rgba(20, 21, 26, .86);
  border: 1px solid rgba(255, 255, 255, .09);
  border-bottom: 0;
  box-shadow: 0 -20px 60px -20px rgba(0, 0, 0, .5);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  padding: 22px 22px 34px;
  animation: auth-up .55s .1s cubic-bezier(.2, .7, .2, 1) both;
}
.ap-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid rgba(255, 255, 255, .07); }
.ap-k { display: block; font-size: 12px; color: rgba(255, 255, 255, .5); margin-bottom: 4px; }
.ap-v { font-family: var(--font-display); font-size: 24px; font-weight: 650; letter-spacing: -.02em; color: #fff; }
.ap-v em { font-style: normal; font-size: 15px; font-weight: 500; color: rgba(255, 255, 255, .55); margin-left: 4px; }
.ap-pill { font-size: 12px; color: rgba(255, 255, 255, .72); border: 1px solid rgba(255, 255, 255, .12); border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
.ap-table { display: grid; }
.ap-row { display: grid; grid-template-columns: 32px 1fr auto 84px; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid rgba(255, 255, 255, .05); font-size: 13.5px; }
.ap-row:last-child { border-bottom: 0; }
.ap-av { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font-size: 11px; font-weight: 600; color: rgba(255, 255, 255, .8); background: rgba(255, 255, 255, .07); }
.ap-task { min-width: 0; display: grid; }
.ap-task b { font-weight: 550; color: rgba(255, 255, 255, .92); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-task small { font-size: 12px; color: rgba(255, 255, 255, .45); }
.ap-amt { font-variant-numeric: tabular-nums; color: rgba(255, 255, 255, .85); }
.ap-st { justify-self: end; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; }
.ap-st.approved { background: color-mix(in srgb, var(--brand-dark) 22%, transparent); color: color-mix(in srgb, var(--brand-dark) 70%, #fff); }
.ap-st.review { background: rgba(214, 160, 40, .16); color: #F0C468; }
.ap-st.paid { background: rgba(60, 190, 120, .14); color: #6BD9A0; }

@keyframes auth-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes auth-up { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: translateY(18px); } }

.auth-status { display: flex; align-items: center; gap: 12px; color: var(--ink-soft); font-size: 15px; }
.auth-status .boot-mark { width: 20px; height: 20px; flex-shrink: 0; }
.auth-invite { display: grid; gap: 8px; margin: 0 0 22px; }
.auth-invite > div { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 11px 14px; background: var(--surface-2); }
.auth-invite small { display: block; color: var(--muted); font-size: 12px; font-weight: 600; margin-bottom: 2px; }
.auth-invite strong { font-size: 15px; }

/* Short desktop windows: tighten the panel so the preview still fits. */
@media (max-height: 760px) and (min-width: 961px) {
  .auth-art h2 { font-size: clamp(28px, 2.8vw, 40px); }
  .ap-row:nth-child(n+4) { display: none; }
}
@media (max-height: 620px) and (min-width: 961px) {
  .auth-preview { display: none; }
}
@media (max-width: 1180px) {
  .ap-row { grid-template-columns: 32px 1fr auto; }
  .ap-st { display: none; }
}
@media (max-width: 960px) {
  .auth { display: block; height: auto; min-height: 100vh; min-height: 100dvh; overflow: visible; }
  .auth-side { min-height: 100vh; min-height: 100dvh; overflow: visible; padding: 18px 20px 22px; }
  .auth-art { display: none; }
  .auth-main { padding: 40px 0; }
}
@media (max-width: 520px) {
  .auth-main h1 { font-size: 26px; }
  .auth-test-roles { grid-template-columns: 1fr; }
  .auth-copy { margin-left: 0; flex-basis: 100%; }
}

/* =========================================================================================
   Legal pages (public and signed in)
   ========================================================================================= */
.legal-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 0 0 28px; overflow-x: auto; scrollbar-width: none; }
.legal-tabs a { padding: 10px 2px; margin-right: 18px; color: var(--ink-soft); text-decoration: none; font-weight: 550; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.legal-tabs a:hover { color: var(--ink); }
.legal-tabs a.on { color: var(--ink); border-bottom-color: var(--ink); }
.legal-doc { max-width: 68ch; color: var(--ink-soft); font-size: 15px; line-height: 1.7; }
.legal-doc h2 { font-size: 16.5px; font-weight: 650; color: var(--ink); margin: 30px 0 8px; letter-spacing: -.01em; }
.legal-doc h2:first-child { margin-top: 0; }
.legal-doc p { margin: 0 0 12px; }
.legal-doc ul { margin: 0 0 12px; padding-left: 20px; }
.legal-doc li { margin: 4px 0; }
.legal-updated { font-size: 13px !important; color: var(--muted); margin-bottom: 22px !important; }
.legal-skeleton { display: grid; gap: 12px; max-width: 68ch; }
.legal-skeleton i { display: block; height: 12px; border-radius: 6px; background: var(--surface-3); animation: legal-pulse 1.2s ease-in-out infinite alternate; }
.legal-skeleton i:nth-child(2) { width: 92%; } .legal-skeleton i:nth-child(3) { width: 80%; } .legal-skeleton i:nth-child(4) { width: 95%; } .legal-skeleton i:nth-child(5) { width: 60%; }
@keyframes legal-pulse { to { opacity: .45; } }
.legal-shell .legal-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: clamp(22px, 3vw, 40px); }

.legal-public { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--surface); }
.legal-public-head { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px clamp(18px, 4vw, 40px); background: color-mix(in srgb, var(--surface) 88%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.legal-public-actions { display: flex; align-items: center; gap: 10px; }
.legal-public-actions .btn { width: auto; }
.legal-public-main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: clamp(32px, 6vh, 64px) clamp(18px, 4vw, 32px) 64px; }
.legal-public-main h1 { font-family: var(--font-display); font-size: clamp(28px, 4vw, 38px); font-weight: 650; letter-spacing: -.03em; margin: 0 0 20px; }
.legal-public-foot { padding: 20px clamp(18px, 4vw, 40px); border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; text-align: center; }
.legal-public-foot a { color: var(--ink-soft); }
.ob-policy.legal-doc { max-width: none; font-size: 14px; }
.ob-policy.legal-doc h2 { font-size: 14.5px; margin-top: 20px; }

/* =========================================================================================
   Page components: toolbars, stat strips, tables
   ========================================================================================= */
.dash-head { align-items: flex-end; margin-bottom: 20px; }
.dash-head h1 { font-size: 26px; letter-spacing: -.022em; }
.dash-toolbar { gap: 8px; }
.dash-toolbar .btn-primary,
.heading-block .btn-primary,
.home-head .btn-primary { width: auto; }
/* Secondary exports shouldn't shout: keep them neutral next to the primary action. */
.dash-toolbar .btn-ok {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 0 0 1px var(--line-strong) inset, var(--shadow-xs);
}
.dash-toolbar .btn-ok:hover { background: var(--surface-3); }

.stat-strip {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}
.strip-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 16px 18px;
}
.strip-label {
  text-transform: none !important;
  letter-spacing: 0 !important;
  font-size: 12.5px !important;
  font-weight: 500 !important;
  color: var(--muted) !important;
}
.strip-value {
  font-family: var(--font-display);
  font-size: 24px !important;
  font-weight: 650 !important;
  letter-spacing: -.02em;
  margin-top: 4px;
}

table.req-table td { vertical-align: top; }
table.req-table .btn-sm { padding: 5px 10px; font-size: 12.5px; }
table.req-table td:last-child > div,
table.req-table .row-actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* Settings nav buttons: neutralise the old bordered style. */
.manage-side button[data-manage-tab] {
  border: 0 !important;
  width: 100%;
  text-align: left !important;
  justify-items: start;
  min-height: 0;
  cursor: pointer;
  font-family: inherit;
}
.btn-xs { padding: 4px 10px; font-size: 12px; border-radius: 6px; font-weight: 550; }
.btn.btn-sm.btn-xs { padding: 4px 10px; }
@media (max-width: 600px) {
  .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .strip-value { font-size: 20px !important; }
}

/* In Settings, "Add ..." actions are secondary: dark neutral instead of status green. */
.manage-layout .btn-ok {
  background: var(--ink);
  color: var(--surface);
  box-shadow: var(--shadow-xs);
}
.manage-layout .btn-ok:hover:not(:disabled) { background: color-mix(in srgb, var(--ink) 85%, var(--surface)); }
.manage-layout .panel .btn-primary { width: auto; min-width: 140px; }

/* =========================================================================================
   Settings > Branding
   ========================================================================================= */
.bk-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; padding-bottom: 80px; }
.bk-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; min-width: 0; }
.bk-section { margin: 0 !important; }
.bk-section h3 { font-size: 15px; font-weight: 650; margin: 0 0 16px; letter-spacing: -.01em; }
.bk-section .field:last-child { margin-bottom: 0; }
.bk-aside { position: sticky; top: 24px; }
.bk-image-row { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.bk-thumb { width: 64px; height: 64px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2) repeating-conic-gradient(var(--surface-3) 0 25%, transparent 0 50%) 0 0 / 14px 14px; display: grid; place-items: center; overflow: hidden; flex-shrink: 0; }
.bk-thumb.wide { width: 112px; }
.bk-thumb img { width: 100%; height: 100%; object-fit: cover; }
.bk-thumb span { font-size: 11.5px; color: var(--muted); }
.bk-image-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.bk-upload { cursor: pointer; }
.bk-color { display: flex; gap: 8px; align-items: center; }
.bk-color input[type="color"] { width: 44px; height: 40px; padding: 3px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--input-bg); cursor: pointer; flex-shrink: 0; }
.bk-color input[type="text"] { font-family: 'JetBrains Mono', ui-monospace, monospace; text-transform: uppercase; }
.bk-toggles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.bk-toggle { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-md); cursor: pointer; transition: border-color .12s, background .12s; }
.bk-toggle:hover { border-color: var(--line-strong); }
.bk-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.bk-toggle b { display: block; font-size: 13.5px; font-weight: 600; color: var(--ink); }
.bk-toggle small { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }
.bk-switch { position: relative; flex-shrink: 0; width: 32px; height: 19px; border-radius: 999px; background: var(--line-strong); transition: background .15s; margin-top: 1px; }
.bk-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .15s; }
.bk-toggle input:checked + .bk-switch { background: var(--accent); }
.bk-toggle input:checked + .bk-switch::after { transform: translateX(13px); }
.bk-toggle input:focus-visible + .bk-switch { outline: 2px solid var(--accent); outline-offset: 2px; }
.bk-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.bk-chip { display: inline-flex !important; align-items: center; gap: 7px; padding: 7px 11px; border: 1px solid var(--line-strong); border-radius: 999px; font-size: 13px !important; font-weight: 500 !important; color: var(--ink) !important; cursor: pointer; margin: 0 !important; }
.bk-chip:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.bk-legal-tabs { margin-bottom: 12px; }
.bk-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); vertical-align: middle; margin-left: 3px; }
.bk-legal { width: 100%; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12.5px; line-height: 1.6; min-height: 240px; resize: vertical; }
.bk-legal-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.bk-legal-actions .btn { width: auto; }
.bk-reset { text-align: left; }
.bk-reset .pp-linkbtn { color: var(--err-text); }

.bk-savebar {
  position: fixed;
  z-index: 40;
  left: calc(var(--sidebar-w) + 24px);
  right: 24px;
  bottom: 18px;
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 10px 10px 18px;
  border-radius: 14px;
  background: var(--ink);
  color: var(--surface);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  font-weight: 550;
  transform: translateY(140%);
  opacity: 0;
  pointer-events: none;
  transition: transform .2s cubic-bezier(.2, .7, .2, 1), opacity .2s;
}
.bk-savebar.show { transform: none; opacity: 1; pointer-events: auto; }
.bk-savebar > div { display: flex; gap: 8px; }
.bk-savebar .btn { width: auto; }
.bk-savebar .btn-ghost { background: transparent; color: var(--surface); border-color: color-mix(in srgb, var(--surface) 30%, transparent); }
.bk-savebar .btn-ghost:hover:not(:disabled) { background: color-mix(in srgb, var(--surface) 12%, transparent); }

/* Live preview */
.bp-card { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); padding: 14px; display: grid; gap: 12px; }
.bp-label { font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.bp-app { display: grid; grid-template-columns: 104px 1fr; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; font-size: 10.5px; min-height: 150px; }
.bp-side { background: var(--sidebar-bg); border-right: 1px solid var(--line); padding: 8px; display: grid; align-content: start; gap: 3px; }
.bp-brand { display: flex; align-items: center; gap: 5px; margin-bottom: 6px; min-width: 0; }
.bp-brand b { font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bp-mark { width: 18px; height: 18px; border-radius: 5px; overflow: hidden; display: grid; place-items: center; background: var(--ink); color: var(--surface); font-size: 7.5px; font-weight: 700; flex-shrink: 0; }
.bp-mark img { width: 100%; height: 100%; object-fit: cover; }
.bp-nav { padding: 4px 6px; border-radius: 5px; color: var(--ink-soft); }
.bp-nav.on { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
.bp-main { padding: 10px; display: grid; align-content: start; gap: 8px; background: var(--bg); }
.bp-title { font-weight: 650; font-size: 12px; }
.bp-tile { background: var(--surface); border: 1px solid var(--line); border-radius: calc(var(--bp-radius) * .55); padding: 7px 8px; }
.bp-tile small { display: block; color: var(--muted); font-size: 9.5px; }
.bp-tile strong { font-size: 13px; }
.bp-btn { justify-self: start; background: var(--bp-accent); color: #fff; border-radius: calc(var(--bp-radius) * .5); padding: 5px 9px; font-weight: 600; font-size: 10px; }
.bp-btn.dark { background: var(--ink); color: var(--surface); justify-self: stretch; text-align: center; }
.bp-signin { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; min-height: 92px; font-size: 10px; }
.bp-form { padding: 10px; display: grid; align-content: center; gap: 8px; order: -1; }
.bp-form b { font-size: 12px; }
.bp-art { background: color-mix(in srgb, var(--bp-accent) 16%, #0D0E12) center / cover; color: #fff; padding: 10px; display: flex; align-items: flex-end; }
.bp-art b { font-size: 11px; line-height: 1.2; }

@media (max-width: 1180px) {
  .bk-layout { grid-template-columns: minmax(0, 1fr); }
  .bk-aside { position: static; order: -1; max-width: 420px; }
}
@media (max-width: 900px) {
  .bk-savebar { left: 12px; right: 12px; bottom: 12px; }
}
@media (max-width: 640px) {
  .bk-toggles { grid-template-columns: 1fr; }
  .bk-section .row2, .bk-section .row3 { grid-template-columns: minmax(0, 1fr); display: grid; }
  .bk-aside { display: none; }
  .bk-savebar > span { display: none; }
  .bk-savebar > div { flex: 1; justify-content: flex-end; }
}

/* =========================================================================================
   Consistency pass: one page-header pattern, filter rows that don't wrap one item per line.
   ========================================================================================= */
.dash-head, .home-head { align-items: flex-start; margin-bottom: 22px; }
.dash-head h1, .home-head h1, .heading-block h1 { margin: 0 0 6px; }
.dash-head .sub, .home-head .sub, .heading-block .sub, .heading-block p.sub { margin: 0; }
.dash-head > div:first-child, .home-head > div:first-child { min-width: 0; flex: 1 1 320px; }
.dash-toolbar { padding-top: 2px; }
.dash-toolbar .btn, .home-head .btn { width: auto; }
.heading-block .sec-title { margin: 0 0 6px; }

.filter-select-group { align-items: center; }
.filter-select { width: auto; flex: 0 0 auto; min-width: 0; }
.filter-select[type="number"] { width: 96px; }

@media (max-width: 720px) {
  .dash-head, .home-head { flex-direction: column; align-items: stretch; }
  .dash-head > div:first-child, .home-head > div:first-child { flex: none; }
  .dash-toolbar { padding-top: 0; }
  .filter-select { flex: 1 1 140px; max-width: none; }
}

/* ---------- Confirm dialog (replaces window.confirm) ---------------------------------- */
.ask-scrim { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 16px; background: rgba(10, 11, 14, .42); animation: ask-fade .12s ease-out; }
.ask-scrim.closing { opacity: 0; transition: opacity .12s; }
.ask-box { width: 100%; max-width: 420px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 22px 22px 18px; animation: ask-pop .16s cubic-bezier(.2, .7, .2, 1); }
.ask-box h2 { font-size: 16.5px; font-weight: 650; line-height: 1.35; margin: 0; letter-spacing: -.01em; }
.ask-box p { margin: 8px 0 0; color: var(--ink-soft); font-size: 14px; line-height: 1.55; white-space: pre-line; }
.ask-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.ask-actions .btn { width: auto; min-width: 88px; }
.btn.btn-danger-solid { background: var(--err-text); border-color: var(--err-text); color: #fff; }
.btn.btn-danger-solid:hover:not(:disabled) { background: color-mix(in srgb, var(--err-text) 88%, #000); }
:root[data-theme="dark"] .btn.btn-danger-solid { background: #C8402C; border-color: #C8402C; }
@keyframes ask-fade { from { opacity: 0; } }
@keyframes ask-pop { from { opacity: 0; transform: translateY(6px) scale(.98); } }
@media (max-width: 480px) { .ask-actions { flex-direction: column-reverse; } .ask-actions .btn { width: 100%; } }

/* Section headings inside a page, and quieter destructive buttons in table rows. */
.heading-block.section-head { margin: 36px 0 12px; }
.heading-block.section-head .sec-title { font-size: 17px; font-weight: 650; }
.btn.btn-danger-ghost { background: transparent; color: var(--err-text); box-shadow: none; border-color: transparent; }
.btn.btn-danger-ghost:hover:not(:disabled) { background: var(--err-bg); }

/* Grid tracks that can shrink below their content, so nothing pushes the page wider than a phone. */
.manage-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.manage-grid > * { min-width: 0; }
@media (max-width: 820px) { .manage-grid { grid-template-columns: minmax(0, 1fr); } }

/* =========================================================================================
   Notifications bell
   ========================================================================================= */
.shell-tools { display: flex; gap: 6px; align-items: center; }
.shell-tools .shell-search { flex: 1; min-width: 0; }
.shell-tools .notif-bell { width: 34px; height: 34px; flex-shrink: 0; border-radius: var(--radius-sm); }
.mobile-header-tools { display: flex; gap: 6px; }
.notif-bell { position: relative; }
.notif-badge { position: absolute; top: -4px; right: -4px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--err-text); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center; box-shadow: 0 0 0 2px var(--sidebar-bg); }
.notif-badge[hidden] { display: none; }
.notif-root { position: fixed; z-index: 900; width: 360px; max-width: calc(100vw - 16px); }
.notif-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden; animation: ask-pop .14s cubic-bezier(.2, .7, .2, 1); }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
.notif-list { max-height: min(440px, 60vh); overflow-y: auto; }
.notif-empty { padding: 28px 18px; text-align: center; color: var(--muted); font-size: 13px; display: grid; gap: 4px; }
.notif-empty b { color: var(--ink); font-size: 14px; }
.notif-item { display: flex; gap: 10px; width: 100%; text-align: left; padding: 11px 14px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); cursor: pointer; font: inherit; }
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { background: var(--accent-soft); }
.notif-item.unread:hover { background: var(--accent-soft-strong); }
.notif-ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-soft); flex-shrink: 0; }
.notif-item.unread .notif-ic { background: var(--surface); color: var(--accent); }
.notif-txt { display: grid; gap: 2px; min-width: 0; font-size: 13px; }
.notif-txt b { font-weight: 600; }
.notif-txt span { color: var(--ink-soft); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notif-txt small { color: var(--muted); font-size: 11.5px; }
.notif-foot { padding: 9px 14px; border-top: 1px solid var(--line); font-size: 12.5px; background: var(--surface-2); }
.notif-foot a { color: var(--ink-soft); text-decoration: none; }
.notif-foot a:hover { color: var(--ink); }

.np-panel { margin-top: 24px; }
.inline-form { display: flex; gap: 8px; max-width: 460px; }
.inline-form input { flex: 1; min-width: 0; }
.inline-form .btn { width: auto; flex-shrink: 0; }
.np-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.np-toggle { border: 0; padding: 0; align-items: center; }

.field label.bk-toggle { display: flex; margin: 0; font-size: inherit; font-weight: 400; color: inherit; letter-spacing: 0; }
.field label.bk-chip { margin: 0; }
.panel .btn-sm.btn-primary, .panel .btn-sm.btn-ghost { width: auto; }

/* Settings > Plan */
.plan-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.plan-tier { display: inline-block; font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.plan-meta { color: var(--ink-soft); font-size: 13.5px; margin-top: 4px; }
.plan-addons { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.plan-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.plan-list li { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.plan-list li:last-child { border-bottom: 0; }
.plan-list small { color: var(--muted); font-size: 12px; }
.plan-mark { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; }
.plan-list li.yes .plan-mark { background: var(--ok-bg); color: var(--ok-text); }
.plan-list li.no { color: var(--muted); }
.plan-list li.no .plan-mark { background: var(--surface-3); }

/* =========================================================================================
   Revenue share, contracts, exports, tax
   ========================================================================================= */
.panel-title { font-size: 15px; font-weight: 650; margin: 0 0 14px; }
.amount-input { display: flex; gap: 6px; }
.amount-input input { flex: 1; min-width: 0; }
.amount-input select { width: auto; flex: 0 0 auto; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.mini-table td { padding: 7px 0; border-bottom: 1px solid var(--line); }
.mini-table tr:last-child td { border-bottom: 0; }
.mini-table td.num { text-align: right; font-variant-numeric: tabular-nums; padding-left: 16px; white-space: nowrap; }
.mini-table tr.muted td { color: var(--muted); }
.rs-record { margin-bottom: 22px; }
.rs-preview { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 6px 14px; margin: 0 0 16px; background: var(--surface-2); }
.rs-preview .hint { display: block; padding: 8px 0; }
.rs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.rs-game { margin: 0 !important; display: flex; flex-direction: column; }
.rs-game-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.rs-game-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.rs-game-name img { width: 28px; height: 28px; border-radius: 7px; object-fit: cover; }
.rs-game-name strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rs-game-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.rs-bar { height: 6px; border-radius: 999px; background: var(--surface-3); margin: 12px 0 4px; overflow: hidden; }
.rs-bar span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.rs-shares { list-style: none; margin: 8px 0 0; padding: 0; }
.rs-shares li { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.rs-shares li:last-child { border-bottom: 0; }
.rs-shares b { font-variant-numeric: tabular-nums; }
.rs-add { display: grid; grid-template-columns: 1fr 74px auto; gap: 6px; margin-top: auto; padding-top: 14px; }
.rs-add .btn { width: auto; }

/* Contracts */
.tone-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; background: var(--surface-3); color: var(--ink-soft); }
.tone-chip.ok { background: var(--ok-bg); color: var(--ok-text); }
.tone-chip.warn { background: var(--warn-bg); color: var(--warn-text); }
.tone-chip.info { background: var(--accent-soft); color: var(--accent); }
.tone-chip.muted { color: var(--muted); }
.back-link { display: inline-block; margin-bottom: 14px; color: var(--ink-soft); text-decoration: none; font-size: 13.5px; }
.back-link:hover { color: var(--ink); }
.ct-editor { margin-bottom: 22px; }
.ct-ms-edit { display: grid; gap: 8px; }
.ct-ms-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) 130px 150px 36px; gap: 8px; align-items: center; }
.ct-ms-row .icon-btn { width: 36px; height: 36px; font-size: 18px; }
.ct-ms-num { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 650; background: var(--surface-3); color: var(--ink-soft); flex-shrink: 0; }
.ct-ms-num.done { background: var(--ok-bg); color: var(--ok-text); }
.ct-ms-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; font-size: 13.5px; color: var(--ink-soft); }
.ct-tabs { display: inline-flex; margin-bottom: 14px; }
.ct-list { display: grid; gap: 8px; }
.ct-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px 130px auto; gap: 18px; align-items: center; padding: 14px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); text-decoration: none; color: var(--ink); transition: border-color .12s, box-shadow .12s; }
.ct-row:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.ct-row-main { display: grid; gap: 2px; min-width: 0; }
.ct-row-main strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ct-row-main span { color: var(--muted); font-size: 13px; }
.ct-attn { color: var(--warn-text); font-weight: 600; }
.ct-row-progress { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.ct-row-progress span { display: block; height: 100%; background: var(--ok-text); }
.ct-row-amt { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.ct-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.ct-stats > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px 16px; }
.ct-stats small { display: block; color: var(--muted); font-size: 12.5px; }
.ct-stats strong { font-family: var(--font-display); font-size: 20px; letter-spacing: -.02em; }
.ct-sign { margin-bottom: 18px; border-color: var(--accent) !important; }
.ct-page .warn-box { margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.ct-page .warn-box .btn { width: auto; }
.ct-ms-list { display: grid; gap: 10px; }
.ct-ms { display: flex; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 18px; }
.ct-ms-body { flex: 1; min-width: 0; }
.ct-ms-top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.ct-ms-amt { font-variant-numeric: tabular-nums; font-weight: 650; white-space: nowrap; }
.ct-ms-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin-top: 6px; color: var(--muted); font-size: 12.5px; }
.ct-ms-text { margin: 8px 0 0; color: var(--ink-soft); font-size: 13.5px; white-space: pre-wrap; }
.ct-ms-note { margin: 10px 0 0; padding: 9px 12px; border-radius: var(--radius-md); background: var(--surface-2); font-size: 13.5px; color: var(--ink-soft); white-space: pre-wrap; }
.ct-ms-note.warn { background: var(--warn-bg); color: var(--warn-text); }
.ct-ms-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.ct-ms-actions .btn { width: auto; }
.ct-terms { max-width: none; font-size: 14px; }
.ct-signature { display: grid; gap: 2px; margin-top: 20px; padding-top: 16px; border-top: 1px dashed var(--line-strong); }
.ct-signature span { font-size: 12px; color: var(--muted); }
.ct-signature strong { font-family: 'Brush Script MT', 'Segoe Script', cursive; font-size: 24px; font-weight: 400; }
.ct-signature small { color: var(--muted); font-size: 12px; }
.ct-danger { margin-top: 24px; }
.ct-danger .btn { width: auto; }
@media (max-width: 760px) {
  .ct-row { grid-template-columns: minmax(0, 1fr) auto; }
  .ct-row-progress { display: none; }
  .ct-row-amt { text-align: left; }
  .ct-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ct-ms-row { grid-template-columns: 26px minmax(0, 1fr) 36px; }
  .ct-ms-row input[type="number"], .ct-ms-row input[type="date"] { grid-column: 2; }
}

/* My payments extras, tax, receipts */
.my-extra-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: start; margin-top: 24px; }
.my-extra-grid > .np-panel { margin: 0; }
.my-extra-grid > [hidden] { display: none; }
@media (max-width: 820px) { .my-extra-grid { grid-template-columns: minmax(0, 1fr); } }
.receipt-link { display: block; margin-top: 4px; font-size: 12px; }
.kv { display: grid; gap: 8px; margin: 0; }
.kv > div { display: grid; grid-template-columns: 110px 1fr; gap: 10px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--ink); }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; }
.field .seg label { display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 8px 14px; font-weight: 500; font-size: 13.5px; color: var(--ink-soft); cursor: pointer; letter-spacing: 0; }
.seg label + label { border-left: 1px solid var(--line-strong); }
.seg label.on { background: var(--accent-soft); color: var(--ink); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.inline-select { width: auto !important; padding: 2px 6px !important; font-size: 12.5px !important; min-height: 0 !important; display: inline-block; margin-right: 4px; }
.toolbar-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar-row .btn { width: auto; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-tag.neutral { background: var(--surface-3); color: var(--ink-soft); font-weight: 500; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.receipt-shell { max-width: 820px; }
.receipt-actions { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.receipt-actions .btn { width: auto; }
.receipt-actions .back-link { margin: 0; }
.receipt { background: #fff; color: #111216; border: 1px solid var(--line); border-radius: 14px; padding: clamp(24px, 5vw, 48px); }
.receipt-head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; padding-bottom: 24px; border-bottom: 1px solid #e7e7ea; }
.receipt-brand { display: flex; gap: 12px; align-items: flex-start; }
.receipt-brand img, .receipt-brand .auth-brand-mark { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; display: grid; place-items: center; background: #111216; color: #fff; font-weight: 700; font-size: 13px; }
.receipt-brand div { display: grid; gap: 2px; font-size: 13px; color: #50535c; }
.receipt-brand strong { color: #111216; font-size: 15px; }
.receipt-title { text-align: right; }
.receipt-title h1 { font-size: 22px; margin: 0 0 4px; color: #111216; }
.receipt-title span { font-size: 12px; color: #8a8d96; }
.receipt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding: 24px 0; }
.receipt-grid > div { display: grid; gap: 2px; align-content: start; font-size: 13.5px; color: #50535c; }
.receipt-grid small { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: #8a8d96; }
.receipt-grid strong { color: #111216; font-size: 15px; }
.receipt-lines { width: 100%; border-collapse: collapse; font-size: 14px; color: #111216; }
.receipt-lines th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: #8a8d96; font-weight: 600; padding: 10px 0; border-bottom: 1px solid #e7e7ea; }
.receipt-lines td { padding: 14px 0; border-bottom: 1px solid #e7e7ea; vertical-align: top; }
.receipt-lines td div { color: #50535c; font-size: 13px; margin-top: 2px; }
.receipt-detail { white-space: pre-wrap; }
.receipt-lines tfoot td { font-weight: 700; font-size: 16px; border-bottom: 0; }
.receipt-lines .num { text-align: right; white-space: nowrap; padding-left: 20px; }
.receipt-foot { margin-top: 28px; font-size: 12px; color: #8a8d96; }
@media print {
  .app-sidebar, .mobile-header, .shell-scrim, .no-print, #toastRoot, .notif-root { display: none !important; }
  body, .shell { background: #fff !important; }
  #app:has(> .app-sidebar) { padding-left: 0 !important; }
  .shell { padding: 0 !important; margin: 0 !important; max-width: none !important; }
  .receipt { border: 0; padding: 0; }
}

/* Exports & budgets */
.ex-range { margin-bottom: 18px; }
.ex-range .chip-row { padding-top: 4px; }
.ex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.ex-card { margin: 0 !important; display: flex; flex-direction: column; }
.ex-card h3 { margin: 0 0 6px; font-size: 15px; }
.ex-card p { margin: 0 0 14px; color: var(--ink-soft); font-size: 13.5px; line-height: 1.5; flex: 1; }
.ex-card .btn { width: auto; align-self: flex-start; }
.bud-list { display: grid; gap: 8px; }
.bud-row { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(220px, 2fr) auto; gap: 18px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px 18px; }
.bud-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.bud-name img { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; }
.bud-name div { display: grid; min-width: 0; }
.bud-name strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bud-name span { color: var(--muted); font-size: 12.5px; }
.bud-meter { display: grid; gap: 6px; font-size: 13px; color: var(--ink-soft); }
.bud-meter .rs-bar { margin: 0; }
.rs-bar.near span { background: var(--warn-text); }
.rs-bar.over span { background: var(--err-text); }
.bud-edit { display: flex; gap: 6px; }
.bud-edit input { width: 120px; }
.bud-edit .btn { width: auto; }
@media (max-width: 760px) { .bud-row { grid-template-columns: minmax(0, 1fr); } }

/* Two-factor sign-in, account page */
.mfa-form { display: grid; gap: 10px; }
.mfa-code { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 26px !important; letter-spacing: .35em; text-align: center; padding: 12px !important; }
.mfa-code.rc { font-size: 18px !important; letter-spacing: .12em; }
.mfa-links { display: flex; justify-content: space-between; margin-top: 16px; }
.acct-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.acct-grid > .panel { margin: 0; }
@media (max-width: 900px) { .acct-grid { grid-template-columns: minmax(0, 1fr); } }
.acct-links { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 22px; font-size: 13.5px; }
.acct-links a { color: var(--ink-soft); }
.mfa-steps { margin: 0 0 12px; padding-left: 20px; display: grid; gap: 18px; }
.mfa-steps li > strong { display: block; }
.mfa-steps li > span { display: block; color: var(--muted); font-size: 13px; }
.mfa-qr { width: 180px; height: 180px; margin: 12px 0 6px; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: 12px; display: grid; place-items: center; }
.mfa-qr svg { width: 100%; height: 100%; }
.mfa-manual summary { cursor: pointer; font-size: 13px; color: var(--ink-soft); }
.mfa-secret { display: inline-block; font-size: 14px; padding: 8px 10px; border-radius: 8px; background: var(--surface-3); word-break: break-all; }
.mfa-on { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13.5px; color: var(--ink-soft); }
.rc-box { margin-top: 14px; padding: 14px; border: 1px dashed var(--line-strong); border-radius: var(--radius-md); background: var(--surface-2); }
.rc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.rc-grid code { font-size: 14px; padding: 6px 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; text-align: center; }
.rc-box .btn, .acct-grid .btn { width: auto; }
.sess-list { list-style: none; margin: 0; padding: 0; }
.sess-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.sess-list li:last-child { border-bottom: 0; }
.sess-list li > div { display: grid; gap: 2px; min-width: 0; }
.sess-list li span:not(.tone-chip) { color: var(--muted); font-size: 12.5px; }
.mfa-users { margin-top: 14px; display: grid; gap: 4px; }
.mfa-users > div { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; font-size: 13.5px; padding: 6px 0; border-top: 1px solid var(--line); }
.mfa-users small { color: var(--muted); }
.sess-list .tone-chip { justify-self: start; margin-top: 2px; }

/* =========================================================================================
   Setup wizard (#/setup)
   ========================================================================================= */
.setup-shell { min-height: 100vh; background: var(--bg); }
.setup-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 28px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.setup-head-right { display: flex; align-items: center; gap: 14px; }
.setup-progress-text { color: var(--muted); font-size: 13px; }
.setup-progress { height: 3px; background: var(--line); }
.setup-progress span { display: block; height: 100%; background: var(--accent); transition: width .3s ease; }
.setup-body {
  max-width: 1040px; margin: 0 auto; padding: 40px 28px 80px;
  display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 32px; align-items: start;
}
.setup-rail { display: grid; gap: 4px; position: sticky; top: 24px; }
.setup-rail-item {
  display: flex; align-items: flex-start; gap: 12px; width: 100%; padding: 10px 12px;
  border: 0; border-radius: var(--radius-sm); background: none; color: var(--ink-soft);
  font: inherit; text-align: left; cursor: pointer;
}
.setup-rail-item:hover { background: var(--surface-3); }
.setup-rail-item.active { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line), var(--shadow-xs); }
.setup-rail-item strong { display: block; font-size: 13.5px; font-weight: 600; }
.setup-rail-item small { display: block; font-size: 12px; color: var(--muted); }
.setup-rail-num {
  width: 24px; height: 24px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center;
  border: 1.5px solid var(--line-strong); font-size: 12px; font-weight: 600; color: var(--muted);
}
.setup-rail-item.active .setup-rail-num { border-color: var(--accent); color: var(--accent); }
.setup-rail-item.done .setup-rail-num { background: var(--ok-text); border-color: var(--ok-text); color: #fff; }
.setup-card { padding: 32px; }
.setup-card h2 { font-size: 22px; margin: 0 0 6px; letter-spacing: -.02em; }
.setup-lead { color: var(--ink-soft); margin: 0 0 22px; max-width: 60ch; }
.setup-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); }
.setup-actions-right { display: flex; gap: 8px; align-items: center; }
.setup-actions .btn-primary { width: auto; min-width: 150px; }
.btn-link-muted { background: none; color: var(--muted); box-shadow: none; }
.btn-link-muted:hover:not(:disabled) { color: var(--ink); background: var(--surface-3); }
.setup-swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.setup-swatch {
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--surface); cursor: pointer;
  box-shadow: 0 0 0 1px var(--line-strong);
}
.setup-swatch.on { box-shadow: 0 0 0 2px var(--ink); }
.setup-swatch-custom { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-soft); cursor: pointer; margin-left: 4px; }
.setup-swatch-custom input { width: 30px; height: 30px; padding: 0; border: 0; background: none; cursor: pointer; }
.setup-logo { display: flex; align-items: center; gap: 14px; }
.setup-logo-preview, .setup-preview-brand > span, .setup-preview-brand img {
  width: 52px; height: 52px; border-radius: 12px; overflow: hidden; display: grid; place-items: center;
  background: var(--surface-3); border: 1px solid var(--line); color: var(--ink-soft); font-weight: 700;
}
.setup-logo-preview img { width: 100%; height: 100%; object-fit: cover; }
.setup-logo-actions { display: flex; gap: 6px; align-items: center; }
.setup-logo-actions label.btn { margin: 0; cursor: pointer; }
.setup-preview { margin-top: 8px; border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); padding: 18px; background: var(--surface-2); }
.setup-preview-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; font-family: var(--font-display); }
.setup-preview-brand > span, .setup-preview-brand img { width: 30px; height: 30px; border-radius: 8px; font-size: 11px; object-fit: cover; }
.setup-preview-btn { background: var(--p); color: #fff; border-radius: 10px; padding: 11px; text-align: center; font-weight: 600; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18); }
.setup-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.setup-checks label {
  display: flex; align-items: center; gap: 8px; margin: 0; padding: 9px 12px; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); font-weight: 500;
}
.setup-list { display: grid; gap: 6px; margin-bottom: 16px; }
.setup-list > div {
  display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2);
}
.setup-list span { color: var(--muted); font-size: 13px; }
.setup-invite { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; background: var(--surface-2); }
.setup-invite-row { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.setup-invite-row code {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); font-size: 13px;
}
.setup-done { display: grid; gap: 6px; }
.setup-done-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); color: var(--ink-soft); text-decoration: none;
}
.setup-done-row:hover { background: var(--surface-2); }
.setup-done-row span { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); font-size: 12px; }
.setup-done-row.ok { color: var(--ink); }
.setup-done-row.ok span { background: var(--ok-bg); color: var(--ok-text); }
.setup-next { display: grid; gap: 4px; margin-top: 18px; padding: 14px 16px; border-radius: var(--radius-md); background: var(--accent-soft); color: var(--ink-soft); }
.setup-next strong { color: var(--ink); }
@media (max-width: 820px) {
  .setup-body { grid-template-columns: 1fr; padding: 20px 14px 60px; gap: 16px; }
  .setup-rail { position: static; display: flex; overflow-x: auto; }
  .setup-rail-item { width: auto; white-space: nowrap; }
  .setup-rail-item small { display: none; }
  .setup-card { padding: 22px 18px; }
  .setup-head { padding: 12px 14px; }
  .setup-progress-text { display: none; }
}

/* =========================================================================================
   Status page (#/status)
   ========================================================================================= */
.status-shell { max-width: 760px; }
.status-hero {
  display: flex; gap: 16px; align-items: flex-start; padding: 24px; margin-bottom: 16px;
  border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-sm);
}
.status-hero h1 { font-size: 22px; margin: 0 0 4px; }
.status-hero p { margin: 0; color: var(--ink-soft); }
.status-dot { width: 14px; height: 14px; border-radius: 50%; margin-top: 7px; flex-shrink: 0; background: var(--muted); box-shadow: 0 0 0 5px color-mix(in srgb, currentColor 0%, transparent); }
.status-operational .status-dot { background: #22A06B; box-shadow: 0 0 0 5px rgba(34, 160, 107, .15); }
.status-degraded .status-dot, .status-maintenance .status-dot { background: #D9932B; box-shadow: 0 0 0 5px rgba(217, 147, 43, .15); }
.status-down .status-dot { background: #D9483B; box-shadow: 0 0 0 5px rgba(217, 72, 59, .15); }
.status-list { padding: 6px 20px; }
.status-row { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.status-row:last-child { border-bottom: 0; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 550; color: var(--ink-soft); }
.status-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status-pill.status-operational i { background: #22A06B; }
.status-pill.status-degraded i, .status-pill.status-pending i, .status-pill.status-maintenance i { background: #D9932B; }
.status-pill.status-down i { background: #D9483B; }
.status-meta { margin-top: 12px; }

/* =========================================================================================
   Settings > Health
   ========================================================================================= */
.health-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.health-operational { color: var(--ok-text); }
.health-degraded, .health-maintenance { color: var(--warn-text); }
.health-down { color: var(--err-text); }
.health-errors { display: grid; gap: 6px; }
.health-error { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.health-error.resolved { opacity: .6; }
.health-error summary {
  list-style: none; display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 10px;
  align-items: center; padding: 10px 12px; cursor: pointer; font-size: 13px;
}
.health-error summary::-webkit-details-marker { display: none; }
.health-src { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-3); border-radius: 5px; padding: 2px 6px; }
.health-msg { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.health-count { font-variant-numeric: tabular-nums; color: var(--ink-soft); font-weight: 600; }
.health-when { color: var(--muted); font-size: 12px; white-space: nowrap; }
.health-detail { padding: 0 12px 12px; display: grid; gap: 8px; }
.health-detail pre {
  margin: 0; padding: 10px; max-height: 220px; overflow: auto; font-size: 11.5px; line-height: 1.5;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; white-space: pre-wrap; word-break: break-word;
}
.health-detail .btn { justify-self: start; }
@media (max-width: 600px) {
  .health-error summary { grid-template-columns: minmax(0, 1fr) auto; }
  .health-src, .health-when { display: none; }
}

/* Sidebar header: brand on the left, theme toggle and notifications on the right. */
.shell-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 16px 12px 12px 14px;
}
.shell-top .shell-brand { min-width: 0; padding: 2px 4px; }
.shell-tools { flex-shrink: 0; gap: 4px; }
.shell-tools .icon-btn,
.shell-tools .notif-bell { width: 32px; height: 32px; border-radius: var(--radius-sm); }
.shell-theme svg { width: 16px; height: 16px; }
.mobile-header-tools { display: flex; gap: 6px; align-items: center; }

/* Banners with an action: the button keeps its own size instead of taking the whole row
   (the old global "primary buttons are full width" rule squashed the text into a sliver). */
.warn-box, .error-box, .confirm-box { flex-wrap: wrap; gap: 12px; }
.warn-box > div, .warn-box > span, .error-box > span, .confirm-box > .txt { flex: 1 1 260px; min-width: 0; }
.warn-box .btn, .error-box .btn, .confirm-box .btn,
.warn-box a.btn, .error-box a.btn { width: auto; flex: 0 0 auto; white-space: nowrap; }

/* Phones: the Settings tab strip scrolls sideways inside itself, never the page. */
@media (max-width: 900px) {
  .manage-layout { min-width: 0; max-width: 100%; }
  .manage-layout > * { min-width: 0; max-width: 100%; }
  .manage-side { overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
  .manage-side::-webkit-scrollbar { display: none; }
}

/* Long permission names wrap instead of pushing the page sideways on phones. */
.perm-chip { white-space: normal; max-width: 100%; overflow-wrap: anywhere; line-height: 1.35; }
.perm-chip-wrap { min-width: 0; max-width: 100%; }
.task-game-icon.placeholder { display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 20px; color: var(--accent); }

/* =========================================================================================
   Version mismatch (deploy in progress)
   ========================================================================================= */
.version-card { max-width: 480px; text-align: center; }
.version-card h2 { margin: 6px 0 8px; }
.version-card p { color: var(--ink-soft); margin: 0 auto 18px; max-width: 40ch; }
.sc-art { width: 240px; max-width: 80%; height: auto; display: block; margin: 0 auto 6px; }
.sc-cable { stroke: var(--line-strong); stroke-width: 7; stroke-linecap: round; }
.sc-body { fill: var(--surface-3); stroke: var(--ink); stroke-width: 2.5; }
.sc-pin, .sc-socket { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.sc-spark path { stroke: #E9A23B; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.sc-spark { animation: sc-flicker 1.6s steps(1) infinite; transform-origin: 180px 75px; }
@keyframes sc-flicker {
  0%, 100% { opacity: 1; }
  8% { opacity: .2; }
  12% { opacity: 1; }
  46% { opacity: .5; }
  50% { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { .sc-spark { animation: none; } }
.version-meta {
  display: inline-flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 12px;
  padding: 8px 14px; margin-bottom: 16px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface-2); color: var(--muted); font-size: 12.5px;
}
.version-meta b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.version-sep { width: 4px; height: 4px; border-radius: 50%; background: var(--line-strong); }
.version-status { display: flex; justify-content: center; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.version-status .boot-mark { width: 16px; height: 16px; border-width: 2px; }
