/* ==========================================================================
   Stariki design system
   Light, ink-on-paper dashboard: #1f1f1f ink, #f6f7ed cream, #f4f4f4 mist,
   General Sans. Dark mode flips the same tokens (html[data-theme="dark"]).
   ========================================================================== */

/* ---- self-hosted fonts (no external request at render time) ---- */
@font-face { font-family: 'General Sans'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/general-sans/GeneralSans-400.woff2') format('woff2'); }
@font-face { font-family: 'General Sans'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/general-sans/GeneralSans-500.woff2') format('woff2'); }
@font-face { font-family: 'General Sans'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/general-sans/GeneralSans-600.woff2') format('woff2'); }
@font-face { font-family: 'General Sans'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/general-sans/GeneralSans-700.woff2') format('woff2'); }
/* General Sans has no Cyrillic — Inter fills those glyphs in per character */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/inter-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* only the emblem's curved wordmark uses this */
@font-face {
  font-family: 'PT Serif';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/pt-serif-bold-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF;
}

/* ---- design tokens ---- */
:root {
  color-scheme: light;

  --surface: #ffffff;
  --surface-2: #f4f4f4;
  --surface-3: #eaeae6;
  --cream: #f6f7ed;
  --cream-2: #e7e9d6;
  --ink: #1f1f1f;
  --ink-2: #333331;
  --on-ink: #ffffff;
  --on-ink-2: #b9b9b2;

  --text: #1f1f1f;
  --text-2: #5d5d58;
  --text-3: #8e8e87;

  --line: #e8e8e3;
  --line-2: #d8d8d0;

  --accent: #8c1c24;
  --gold: #a8841c;

  --success: #24704a;
  --success-bg: #e6f3eb;
  --warning: #8a5a00;
  --warning-bg: #fbf0d6;
  --danger: #b42318;
  --danger-bg: #fcebe9;
  --info: #2a5ca8;
  --info-bg: #e8effa;

  --hatch: repeating-linear-gradient(-45deg, var(--cream-2) 0 2px, transparent 2px 6px);

  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;

  --shadow-sm: 0 1px 2px rgba(20, 20, 18, 0.05);
  --shadow-md: 0 1px 2px rgba(20, 20, 18, 0.04), 0 6px 18px -6px rgba(20, 20, 18, 0.1);
  --shadow-pop: 0 2px 6px rgba(20, 20, 18, 0.06), 0 18px 40px -12px rgba(20, 20, 18, 0.22);

  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-base: 14px;
  --fs-md: 16px;
  --fs-lg: 19px;
  --fs-xl: 24px;
  --fs-2xl: 32px;
  --fs-3xl: 44px;

  --font: 'General Sans', 'Inter', ui-sans-serif, system-ui, 'Segoe UI', Arial, sans-serif;

  --sidebar-w: 264px;
  --topbar-h: 68px;
  --gutter: 32px;

  --t-fast: 140ms ease;
  --t-base: 200ms ease;
}

html[data-theme='dark'] {
  color-scheme: dark;

  --surface: #161615;
  --surface-2: #1f1f1d;
  --surface-3: #2a2a27;
  --cream: #1d1e18;
  --cream-2: #34362a;
  --ink: #f6f7ed;
  --ink-2: #e2e3d8;
  --on-ink: #1f1f1f;
  --on-ink-2: #55554f;

  --text: #f1f1eb;
  --text-2: #adada4;
  --text-3: #7a7a72;

  --line: #2a2a27;
  --line-2: #3a3a36;

  --accent: #d0545c;
  --gold: #d6b04a;

  --success: #6cc493;
  --success-bg: #17291f;
  --warning: #e0b04f;
  --warning-bg: #2c2412;
  --danger: #f07a6f;
  --danger-bg: #331816;
  --info: #84aef0;
  --info-bg: #17223a;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 22px -8px rgba(0, 0, 0, 0.6);
  --shadow-pop: 0 2px 6px rgba(0, 0, 0, 0.5), 0 22px 48px -12px rgba(0, 0, 0, 0.75);
}

/* ---- base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body.theme {
  margin: 0;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.theme h1, .theme h2, .theme h3, .theme h4 { margin: 0; font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; color: var(--text); }
.theme h1 { font-size: var(--fs-2xl); letter-spacing: -0.02em; }
.theme h2 { font-size: var(--fs-lg); }
.theme h3 { font-size: var(--fs-md); }
.theme h4 { font-size: var(--fs-base); }
.theme p { margin: 0 0 0.75em; color: var(--text-2); }
.theme p:last-child { margin-bottom: 0; }

.theme a { color: var(--text); text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.theme a:hover { text-decoration-color: currentColor; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
::selection { background: var(--cream-2); color: var(--text); }

img { max-width: 100%; }
.icon { display: inline-block; flex-shrink: 0; vertical-align: middle; }
hr, .divider { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute;
  left: 12px; top: -48px;
  z-index: 1000;
  background: var(--ink); color: var(--on-ink) !important;
  padding: 8px 14px; border-radius: var(--r-sm);
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* ==========================================================================
   App shell — sidebar | topbar / page, laid out on the body itself so every
   view keeps the same simple <body> → nav partial → <main> structure
   ========================================================================== */
body.theme.has-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas: 'side top' 'side main';
  min-height: 100vh;
}

.sidebar {
  grid-area: side;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
  z-index: 40;
}
.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--topbar-h);
  padding: 0 20px;
  flex-shrink: 0;
  text-decoration: none;
  color: var(--text) !important;
}
.sidebar__mark {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--on-ink);
  flex-shrink: 0;
}
.sidebar__mark .emblem { color: var(--on-ink); }
.sidebar__name { font-size: var(--fs-md); font-weight: 600; letter-spacing: -0.01em; line-height: 1.1; }
.sidebar__sub { font-size: var(--fs-xs); color: var(--text-3); line-height: 1.2; }
.sidebar .sidebar__close { margin-left: auto; display: none; }

.sidebar__scroll {
  flex: 1;
  overflow-y: auto;
  padding: 6px 12px 16px;
  scrollbar-width: thin;
}

.side-nav { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
.side-nav__item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  color: var(--text-2) !important;
  text-decoration: none;
  font-weight: 500;
  transition: background-color var(--t-fast), color var(--t-fast);
}
.side-nav__item:hover { background: var(--surface-2); color: var(--text) !important; }
.side-nav__item.is-active { background: var(--surface-2); color: var(--text) !important; font-weight: 600; }
.side-nav__item.is-active .side-nav__icon { color: var(--text); }
.side-nav__icon { color: var(--text-3); display: inline-flex; }
.side-nav__label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-nav__badge {
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--on-ink);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.side-nav__badge--soft { background: var(--surface-3); color: var(--text-2); }

.side-group { margin-top: 22px; }
.side-group__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px 8px;
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--text-3);
}
.side-group__title a { color: var(--text-3) !important; text-decoration: none; font-weight: 500; }
.side-group__title a:hover { color: var(--text) !important; }

.side-channel {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  color: var(--text-2) !important;
  text-decoration: none;
  font-weight: 500;
}
.side-channel:hover { background: var(--surface-2); color: var(--text) !important; }
.side-channel__hash {
  display: grid;
  place-items: center;
  width: 22px; height: 22px;
  border-radius: 6px;
  background: var(--cream);
  border: 1px solid var(--cream-2);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
}

.side-member {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  color: inherit !important;
  text-decoration: none;
}
.side-member:hover { background: var(--surface-2); }
.side-member__text { min-width: 0; line-height: 1.25; }
.side-member__name { display: block; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-member__role { display: block; font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar__footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
}
.side-user { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; text-decoration: none; color: inherit !important; border-radius: var(--r-sm); }
.side-user__text { min-width: 0; line-height: 1.25; }
.side-user__name { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user__role { display: block; font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__footer form { margin: 0; }

.sidebar-backdrop { display: none; }

/* ---- topbar ---- */
.topbar {
  grid-area: top;
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--topbar-h);
  padding: 0 var(--gutter);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar .topbar__menu { display: none; }
.topbar__brand { display: none; }
.topbar__spacer { flex: 1; }
.topbar__actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.search { position: relative; flex: 0 1 420px; min-width: 0; }
.search__field {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text-3);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.search__field:focus-within { border-color: var(--line-2); box-shadow: 0 0 0 3px var(--surface-2); }
.search__input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
}
.search__input::placeholder { color: var(--text-3); }
.search__input::-webkit-search-cancel-button { display: none; }
.kbd {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-2);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}
.search__results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  min-width: 320px;
  max-height: min(70vh, 520px);
  overflow-y: auto;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-pop);
  z-index: 60;
}
.search__results[hidden] { display: none; }
.search__group { padding: 8px 10px 4px; font-size: var(--fs-xs); color: var(--text-3); font-weight: 500; }
.search__empty { padding: 14px 12px; color: var(--text-3); }
.search-hit {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  color: var(--text) !important;
  text-decoration: none;
}
.search-hit:hover, .search-hit.is-selected { background: var(--surface-2); }
.search-hit__icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--cream); color: var(--text-2); flex-shrink: 0; }
.search-hit__text { min-width: 0; }
.search-hit__title { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-hit__sub { display: block; font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: capitalize; }
.search__all { display: block; padding: 10px; margin-top: 4px; border-top: 1px solid var(--line); text-align: center; font-weight: 500; text-decoration: none; }

/* ---- page ---- */
.page {
  grid-area: main;
  min-width: 0;
  padding: 28px var(--gutter) 48px;
}
.page--flush { padding-bottom: 24px; }
.narrow { max-width: 760px; }
.narrow-sm { max-width: 520px; }

/* ---- responsive shell ---- */
@media (max-width: 1080px) {
  :root { --gutter: 22px; }
  body.theme.has-shell { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'top' 'main'; }
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: min(300px, 86vw);
    transform: translateX(-100%);
    transition: transform var(--t-base);
    box-shadow: var(--shadow-pop);
    z-index: 90;
  }
  .sidebar .sidebar__close { display: inline-grid; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 15, 14, 0.45);
    z-index: 80;
  }
  .topbar .topbar__menu { display: inline-grid; }
  .topbar__brand { display: flex; align-items: center; gap: 8px; font-weight: 600; text-decoration: none; color: var(--text) !important; }
}
@media (max-width: 720px) {
  :root { --gutter: 16px; --topbar-h: 60px; }
  .topbar { gap: 10px; }
  .topbar__brand span { display: none; }
  .search { flex: 1 1 auto; }
  .search .kbd { display: none; }
  .search__results { position: fixed; top: calc(var(--topbar-h) + 6px); left: 10px; right: 10px; min-width: 0; }
  .topbar__new-label { display: none; }
  .page { padding-top: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; }
}

/* ==========================================================================
   Page head
   ========================================================================== */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.page-head__text { min-width: 0; }
.page-head__eyebrow { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: var(--fs-sm); color: var(--text-3); }
.page-head__title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; overflow-wrap: anywhere; }
.page-head__sub { margin: 6px 0 0 !important; color: var(--text-2); max-width: 640px; }
.page-head__actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.crumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0 0 10px; padding: 0; list-style: none; font-size: var(--fs-sm); color: var(--text-3); }
.crumbs a { color: var(--text-2); text-decoration: none; }
.crumbs a:hover { color: var(--text); text-decoration: underline; }
.crumbs li + li::before { content: '/'; margin-right: 6px; color: var(--line-2); }

/* ==========================================================================
   Stats band — the cream strip of charts and headline numbers
   ========================================================================== */
.stats-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  background: var(--cream);
  border: 1px solid var(--cream-2);
  border-radius: var(--r-xl);
  margin-bottom: 28px;
  overflow: hidden;
}
.stat-block {
  position: relative;
  padding: 22px 24px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.stat-block + .stat-block { border-left: 1px solid var(--cream-2); }
.stat-block__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.stat-block__label { font-weight: 500; color: var(--text); }
.stat-block__note { font-size: var(--fs-xs); color: var(--text-3); }
.stat-block--split { display: grid; grid-template-rows: 1fr 1fr; padding: 0; }
.stat-block--split > .big-stat { padding: 20px 24px; }
.stat-block--split > .big-stat + .big-stat { border-top: 1px solid var(--cream-2); }

.big-stat { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.big-stat__value {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--fs-3xl);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.big-stat__value small { font-size: 0.55em; font-weight: 500; letter-spacing: -0.01em; color: var(--text-2); }
.big-stat__value.is-negative { color: var(--danger); }
.big-stat__label { display: flex; align-items: center; gap: 6px; margin-top: 8px; color: var(--text-2); }
a.big-stat { text-decoration: none; color: inherit !important; border-radius: var(--r-md); }
a.big-stat:hover .big-stat__arrow { transform: translateX(3px); color: var(--text); }
.big-stat__arrow { transition: transform var(--t-fast), color var(--t-fast); color: var(--text-3); }

/* paired bar chart — solid ink for the current series, hatched for the comparison */
.bars {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(var(--n, 7), minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  min-height: 132px;
}
.bars__col { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; height: 100%; }
.bars__pair { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 4px; }
.bar {
  position: relative;
  width: min(16px, 42%);
  min-height: 4px;
  border-radius: 6px 6px 3px 3px;
  transition: height 400ms ease;
}
.bar--solid { background: var(--ink); }
.bar--hatch { background: var(--hatch), var(--surface); border: 1px solid var(--cream-2); }
.bar[data-value]:hover::after {
  content: attr(data-value);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--on-ink);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
}
.bars__label { font-size: var(--fs-xs); color: var(--text-3); }
.bars__col.is-today .bars__label { color: var(--text); font-weight: 600; }
.legend { display: flex; align-items: center; gap: 14px; font-size: var(--fs-xs); color: var(--text-2); }
.legend__item { display: inline-flex; align-items: center; gap: 6px; }
.legend__swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--ink); }
.legend__swatch--hatch { background: var(--hatch), var(--surface); border: 1px solid var(--cream-2); }

/* semicircle tick gauge (ticks drawn in partials/gauge.ejs) */
.gauge { position: relative; display: grid; place-items: center; flex: 1; }
.gauge svg { width: 100%; max-width: 260px; height: auto; display: block; }
.gauge__tick { stroke: var(--cream-2); stroke-width: 2.4; stroke-linecap: round; }
.gauge__tick.is-on { stroke: var(--ink); }
.gauge__center { position: absolute; left: 0; right: 0; bottom: 4px; text-align: center; }
.gauge__value { font-size: var(--fs-2xl); font-weight: 600; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.gauge__label { margin-top: 4px; font-size: var(--fs-sm); color: var(--text-2); }

.stats-band--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stats-band--1 { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 1180px) {
  .stats-band:not(.stats-band--2):not(.stats-band--1) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-band:not(.stats-band--2):not(.stats-band--1) > .stat-block:nth-child(3) { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--cream-2); }
  .stats-band > .stat-block:nth-child(3).stat-block--split { grid-template-rows: none; grid-template-columns: 1fr 1fr; }
  .stats-band > .stat-block:nth-child(3).stat-block--split > .big-stat + .big-stat { border-top: 0; border-left: 1px solid var(--cream-2); }
}
@media (max-width: 720px) {
  .stats-band, .stats-band.stats-band--2, .stats-band:not(.stats-band--2):not(.stats-band--1) { grid-template-columns: minmax(0, 1fr); }
  .stats-band > .stat-block + .stat-block { border-left: 0; border-top: 1px solid var(--cream-2); }
  .stats-band > .stat-block:nth-child(3).stat-block--split { grid-template-columns: minmax(0, 1fr); }
  .stats-band > .stat-block:nth-child(3).stat-block--split > .big-stat + .big-stat { border-left: 0; border-top: 1px solid var(--cream-2); }
  .big-stat__value { font-size: 36px; }
  .stat-block { padding: 18px; }
  .stat-block--split > .big-stat { padding: 18px; }
}

/* ==========================================================================
   Toolbar — quick filter, chips, segmented controls
   ========================================================================== */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.toolbar__group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.toolbar__title { display: flex; align-items: center; gap: 10px; font-size: var(--fs-md); font-weight: 600; }

.filter-input {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text-3);
  min-width: 0;
  width: 240px;
  max-width: 100%;
}
.filter-input:focus-within { border-color: var(--line-2); box-shadow: 0 0 0 3px var(--surface-2); }
.filter-input input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; height: 100%; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2) !important;
  font: inherit;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.chip:hover { border-color: var(--line-2); color: var(--text) !important; }
.chip.is-active { background: var(--ink); border-color: var(--ink); color: var(--on-ink) !important; }
.chip__count { font-size: var(--fs-xs); color: inherit; opacity: 0.7; font-variant-numeric: tabular-nums; }

.seg {
  display: inline-flex;
  padding: 3px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.seg__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-2) !important;
  font: inherit;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}
.seg__btn:hover { color: var(--text) !important; }
.seg__btn.is-active { background: var(--surface); color: var(--text) !important; box-shadow: var(--shadow-sm); }

/* ==========================================================================
   Board (kanban) and cards
   ========================================================================== */
.board {
  position: relative;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(236px, 1fr);
  gap: 18px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}
.board__col { display: flex; flex-direction: column; min-width: 0; scroll-snap-align: start; }
.board__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 2px 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.board__title { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 600; }
.board__title span:not(.board__count):not(.board__dot) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dot, var(--text-3)); flex-shrink: 0; }
.board__count {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.board__cards { display: flex; flex-direction: column; gap: 12px; }
.board__empty {
  display: grid;
  place-items: center;
  min-height: 96px;
  padding: 16px;
  border: 1px dashed var(--line-2);
  border-radius: var(--r-lg);
  color: var(--text-3);
  font-size: var(--fs-sm);
  text-align: center;
}
.board__more { color: var(--text-3); font-size: var(--fs-sm); text-align: center; padding: 6px; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }

.k-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 16px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  color: var(--text);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
  min-width: 0;
}
.k-card:hover { border-color: var(--line-2); box-shadow: var(--shadow-md); }
.k-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.k-card__title { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: var(--fs-md); font-weight: 600; line-height: 1.3; }
.k-card__title > span:last-child { min-width: 0; overflow-wrap: anywhere; }
/* the whole card is the link, but buttons/menus inside stay clickable on top */
.k-card__link { color: inherit !important; text-decoration: none; }
.k-card__link::after { content: ''; position: absolute; inset: 0; border-radius: inherit; }
.k-card .menu, .k-card button, .k-card form, .k-card__foot a { position: relative; z-index: 2; }
.k-card__desc {
  margin: 0 !important;
  color: var(--text-2);
  font-size: var(--fs-sm);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.k-card__desc.is-empty { color: var(--text-3); font-style: italic; }
.k-card__rows { display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-sm); color: var(--text-2); }
.k-card__row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.k-card__row .icon { color: var(--text-3); }
.k-card__row span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.k-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.k-card__meta { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: var(--fs-sm); }
.meta-count { display: inline-flex; align-items: center; gap: 5px; font-variant-numeric: tabular-nums; }
.k-card__thumb { width: 100%; aspect-ratio: 16 / 7; object-fit: cover; border-radius: var(--r-md); background: var(--surface-2); display: block; }

.k-card--dark { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.k-card--dark:hover { border-color: var(--ink); }
.k-card--dark .k-card__title, .k-card--dark .k-card__link { color: var(--on-ink) !important; }
.k-card--dark .k-card__desc, .k-card--dark .k-card__rows, .k-card--dark .k-card__meta { color: var(--on-ink-2); }
.k-card--dark .k-card__row .icon { color: var(--on-ink-2); }
.k-card--dark .date-chip { background: rgba(127, 127, 127, 0.18); border-color: transparent; color: var(--on-ink); }
.k-card--dark .menu__trigger { color: var(--on-ink-2); }
.k-card--dark .menu__trigger:hover { background: rgba(127, 127, 127, 0.2); color: var(--on-ink); }
.k-card--dark .pill { background: rgba(127, 127, 127, 0.2); color: var(--on-ink); }
.k-card--muted { background: var(--surface-2); border-color: var(--surface-2); }
.k-card--muted:hover { border-color: var(--line-2); }

.date-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: 500;
  white-space: nowrap;
}
.k-card--muted .date-chip { background: var(--surface); }

/* ==========================================================================
   Kebab / dropdown menu — built on <details>, so it works without JS
   ========================================================================== */
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu__trigger {
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  margin: -4px -6px 0 0;
  border-radius: var(--r-xs);
  color: var(--text-3);
  cursor: pointer;
}
.menu__trigger:hover, .menu[open] > .menu__trigger { background: var(--surface-2); color: var(--text); }
.menu__list {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 190px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-pop);
  z-index: 50;
}
.menu--up .menu__list { top: auto; bottom: calc(100% + 6px); }
.menu--left .menu__list { right: auto; left: 0; }
.menu__list form { margin: 0; }
.menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--text) !important;
  font: inherit;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.menu__item .icon { color: var(--text-3); }
.menu__item:hover { background: var(--surface-2); }
.menu__item--danger, .menu__item--danger .icon { color: var(--danger) !important; }
.menu__item--danger:hover { background: var(--danger-bg); }
.menu__sep { height: 1px; margin: 6px 4px; background: var(--line); }
.menu__label { padding: 6px 10px 4px; font-size: var(--fs-xs); color: var(--text-3); }

/* ==========================================================================
   Panels and detail layouts
   ========================================================================== */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  min-width: 0;
}
:not(.grid-2):not(.grid-3):not(.layout-split):not(.stack) > .panel + .panel { margin-top: 20px; }
.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.panel__title { display: flex; align-items: center; gap: 10px; font-size: var(--fs-md); font-weight: 600; margin: 0; }
.panel__sub { font-size: var(--fs-sm); color: var(--text-3); }
.panel__body { padding: 20px; }
.panel__body--flush { padding: 0; }
.panel__body--divided { border-top: 1px solid var(--line); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px 16px; align-items: end; }
.panel__foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.panel--cream { background: var(--cream); border-color: var(--cream-2); }
.panel--cream .panel__head, .panel--cream .panel__foot { border-color: var(--cream-2); }
.panel--danger { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }

.layout-split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.layout-split--wide-side { grid-template-columns: minmax(0, 1fr) 400px; }
.layout-split > * + * { margin-top: 0; }
.stack { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.stack > .panel + .panel { margin-top: 0; }
.cluster { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 1080px) {
  .layout-split, .layout-split--wide-side { grid-template-columns: minmax(0, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .panel__head, .panel__body { padding-left: 16px; padding-right: 16px; }
}

/* label / value rows on detail pages */
.dl { margin: 0; display: grid; grid-template-columns: minmax(110px, 160px) minmax(0, 1fr); }
.dl > dt, .dl > dd { padding: 11px 0; border-bottom: 1px solid var(--line); margin: 0; }
.dl > dt { color: var(--text-3); font-weight: 500; padding-right: 12px; }
.dl > dd { color: var(--text); overflow-wrap: anywhere; min-width: 0; }
.dl > dt:last-of-type, .dl > dd:last-of-type { border-bottom: 0; }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); }
.prose.is-empty { color: var(--text-3); font-style: italic; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font: inherit;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none !important;
  cursor: pointer;
  user-select: none;
  transition: background-color var(--t-fast), border-color var(--t-fast), color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
.btn:active:not(:disabled):not(.is-disabled) { transform: translateY(1px); }
.btn:disabled, .btn.is-disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--on-ink) !important; }
.btn-primary:hover:not(:disabled) { background: var(--ink-2); border-color: var(--ink-2); }

.btn-secondary { background: var(--surface); border-color: var(--line-2); color: var(--text) !important; }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); }

.btn-ghost { background: transparent; color: var(--text-2) !important; }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text) !important; }

.btn-destructive { background: var(--surface); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); color: var(--danger) !important; }
.btn-destructive:hover:not(:disabled) { background: var(--danger); border-color: var(--danger); color: #fff !important; }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff !important; }
.btn-danger-solid:hover:not(:disabled) { filter: brightness(0.92); }

.btn-sm { height: 32px; padding: 0 12px; border-radius: var(--r-sm); font-size: var(--fs-sm); gap: 6px; }
.btn-lg { height: 46px; padding: 0 22px; font-size: var(--fs-md); }
.btn-block { width: 100%; }
.btn-icon { width: 40px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }

.icon-btn {
  appearance: none;
  display: inline-grid;
  place-items: center;
  width: 36px; height: 36px;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  text-decoration: none;
  transition: background-color var(--t-fast), color var(--t-fast);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn--bordered { border: 1px solid var(--line); }

.btn-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn-loading > * { visibility: hidden; }
.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  border: 2px solid currentColor;
  border-color: var(--text-3);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}
.btn-primary.btn-loading::after { border-color: var(--on-ink); border-top-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

.inline-form { display: inline-flex; margin: 0; }
.actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.table .actions { flex-wrap: nowrap; justify-content: flex-end; }

/* ==========================================================================
   Forms
   ========================================================================== */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; min-width: 0; }
.field > label, .label { font-weight: 500; color: var(--text); font-size: var(--fs-sm); }
.field > label .hint, .label .hint { font-weight: 400; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .field--full { grid-column: 1 / -1; }
.form-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.form-section { padding-top: 20px; margin-top: 4px; border-top: 1px solid var(--line); }
.form-section__title { font-size: var(--fs-md); font-weight: 600; margin: 0 0 4px; }
.form-section__hint { color: var(--text-3); font-size: var(--fs-sm); margin: 0 0 14px !important; }
@media (max-width: 720px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }

.input {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
textarea.input { height: auto; min-height: 92px; padding: 10px 12px; line-height: 1.5; resize: vertical; }
select.input {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238e8e87' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}
.input-sm { height: 34px; font-size: var(--fs-sm); }
.input::placeholder { color: var(--text-3); }
.input:hover { border-color: var(--text-3); }
.input:focus, .input:focus-visible { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 12%, transparent); }
.input.is-invalid, .input:user-invalid { border-color: var(--danger); }
.input:disabled { opacity: 0.55; cursor: not-allowed; background: var(--surface-2); }
input[type='file'].input { height: auto; padding: 8px; }
input[type='file']::file-selector-button {
  margin-right: 10px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-xs);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
input[type='color'] { width: 42px; height: 42px; padding: 3px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); cursor: pointer; }
input[type='checkbox'], input[type='radio'] { width: 16px; height: 16px; accent-color: var(--ink); cursor: pointer; vertical-align: middle; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; }
.check input { margin: 0; }

.rating { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.rating__opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  cursor: pointer;
  transition: background-color var(--t-fast), border-color var(--t-fast), color var(--t-fast);
  min-width: 0;
}
.rating__opt:hover { border-color: var(--text-3); }
.rating__num { font-weight: 600; font-size: var(--fs-md); line-height: 1.1; }
.rating__text { font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.rating input:checked + .rating__opt { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.rating input:checked + .rating__opt .rating__text { color: var(--on-ink-2); }
.rating input:focus-visible + .rating__opt { outline: 2px solid var(--ink); outline-offset: 2px; }

/* multi-select as toggle pills (property owners) */
.pick-list { display: flex; flex-wrap: wrap; gap: 6px; }
.pick { cursor: pointer; }
.pick__body {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 10px 0 5px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-weight: 500;
  white-space: nowrap;
  transition: background-color var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.pick:hover .pick__body { border-color: var(--text-3); color: var(--text); }
.pick__tick { display: none; }
.pick__note { font-size: 11px; color: var(--text-3); }
.pick input:checked + .pick__body { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.pick input:checked + .pick__body .pick__tick { display: inline-flex; }
.pick input:checked + .pick__body .pick__note { color: var(--on-ink-2); }
.pick input:focus-visible + .pick__body { outline: 2px solid var(--ink); outline-offset: 2px; }

/* waiting-for-approval rows on Admin → Users */
.approve-row { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; padding: 14px 20px; border-top: 1px solid var(--cream-2); }
.approve-row__fields { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.approve-row__fields .input { width: auto; min-width: 150px; background-color: var(--surface); }
@media (max-width: 720px) {
  .approve-row { padding: 14px 16px; }
  .approve-row__fields, .approve-row__fields .input { width: 100%; }
}

/* "Continue with Discord" — Discord's own blurple, as their brand guide asks */
.btn-discord { background: #5865f2; border-color: #5865f2; color: #fff !important; }
.btn-discord:hover:not(:disabled) { background: #4752c4; border-color: #4752c4; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--text-3); font-size: var(--fs-xs); }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* expandable rows: summary line, edit form when opened (properties on Manage) */
.xrow { border-bottom: 1px solid var(--line); }
.xrow:last-child { border-bottom: 0; }
.xrow > summary {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.4fr) auto 20px;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  cursor: pointer;
  list-style: none;
}
.xrow > summary::-webkit-details-marker { display: none; }
.xrow > summary:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.xrow > summary .xrow__chev { color: var(--text-3); transition: transform var(--t-fast); }
.xrow[open] > summary .xrow__chev { transform: rotate(180deg); }
.xrow[open] > summary { background: var(--surface-2); }
.xrow__title { min-width: 0; }
.xrow__title strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xrow__title span { display: block; font-size: var(--fs-xs); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xrow__people { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--text-2); font-size: var(--fs-sm); }
.xrow__people > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xrow__body { padding: 16px 20px 20px; border-top: 1px solid var(--line); background: var(--surface); }
.xrow__actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
@media (max-width: 720px) {
  .xrow > summary { grid-template-columns: minmax(0, 1fr) 20px; gap: 6px 12px; padding: 12px 16px; }
  .xrow__people { grid-column: 1; grid-row: 2; }
  .xrow > summary .muted.nowrap { display: none; }
  .xrow > summary .xrow__chev { grid-column: 2; grid-row: 1 / span 2; }
  .xrow__body { padding: 14px 16px 16px; }
}

.field-hint { font-size: var(--fs-xs); color: var(--text-3); }
.field-error { font-size: var(--fs-xs); color: var(--danger); }
.char-count { font-size: var(--fs-xs); color: var(--text-3); text-align: right; font-variant-numeric: tabular-nums; }
.char-count.is-over { color: var(--danger); }

.input-prefix { position: relative; }
.input-prefix > span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.input-prefix > .input { padding-left: 26px; }
input:checked + .seg__btn--radio { background: var(--surface); color: var(--text) !important; box-shadow: var(--shadow-sm); }
input:focus-visible + .seg__btn--radio { outline: 2px solid var(--ink); outline-offset: 1px; }

.input-with-btn { display: flex; gap: 8px; }
.input-with-btn .input { flex: 1; }

/* repeating rows (ingredients, steps, heist items, deposit lines) */
.dynamic-group { display: flex; flex-direction: column; gap: 8px; }
.dynamic-group [data-rows] { display: flex; flex-direction: column; gap: 8px; }
.dynamic-row { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)) auto; gap: 8px; align-items: center; }
.dynamic-row--steps { grid-template-columns: 28px minmax(0, 1fr) auto; }
.row-number {
  display: grid;
  place-items: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--cream);
  border: 1px solid var(--cream-2);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-2);
}
.dynamic-group [data-add] { align-self: flex-start; }
.dynamic-group [data-rows]:empty + [data-add] { margin-top: 0; }
@media (max-width: 720px) {
  .dynamic-row { grid-template-columns: minmax(0, 1fr) auto; }
  .dynamic-row > .input:not(:first-child) { grid-column: 1; }
  .dynamic-row > .remove-row { grid-row: 1; grid-column: 2; }
  .dynamic-row { padding: 10px; border: 1px solid var(--line); border-radius: var(--r-md); }
  .dynamic-row--steps { grid-template-columns: 28px minmax(0, 1fr) auto; padding: 0; border: 0; }
  .dynamic-row--steps > .input { grid-column: 2 !important; }
  .dynamic-row--steps > .remove-row { grid-column: 3 !important; }
}

/* ==========================================================================
   Alerts, pills, badges, avatars
   ========================================================================== */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  line-height: 1.45;
}
.alert .icon { margin-top: 1px; }
.alert--danger, .auth-error { background: var(--danger-bg); border-color: color-mix(in srgb, var(--danger) 25%, transparent); color: var(--danger); }
.alert--success { background: var(--success-bg); border-color: color-mix(in srgb, var(--success) 25%, transparent); color: var(--success); }
.alert--warning { background: var(--warning-bg); border-color: color-mix(in srgb, var(--warning) 25%, transparent); color: var(--warning); }
.alert--info { background: var(--cream); border-color: var(--cream-2); color: var(--text-2); }
.auth-error { padding: 10px 12px; border: 1px solid; border-radius: var(--r-sm); font-size: var(--fs-sm); margin: 0 0 14px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: 600;
  white-space: nowrap;
  text-transform: capitalize;
}
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.85; }
.pill--plain::before { display: none; }
.pill-success { background: var(--success-bg); color: var(--success); }
.pill-warning { background: var(--warning-bg); color: var(--warning); }
.pill-danger { background: var(--danger-bg); color: var(--danger); }
.pill-info { background: var(--info-bg); color: var(--info); }
.pill-ink { background: var(--ink); color: var(--on-ink); }

.rank-badge {
  --badge-color: var(--text-3);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px 0 8px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--badge-color) 35%, var(--line));
  background: color-mix(in srgb, var(--badge-color) 10%, var(--surface));
  color: var(--text);
  font-size: var(--fs-xs);
  font-weight: 600;
  white-space: nowrap;
}
.rank-badge__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--badge-color); flex-shrink: 0; }

.avatar {
  --avatar-color: var(--text-3);
  display: inline-grid;
  place-items: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  background: color-mix(in srgb, var(--avatar-color) 18%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--avatar-color) 30%, var(--line));
  color: color-mix(in srgb, var(--avatar-color) 70%, var(--text));
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--xs { width: 22px; height: 22px; font-size: 9px; }
.avatar--sm { width: 26px; height: 26px; font-size: 10px; }
.avatar--lg { width: 48px; height: 48px; font-size: 16px; }
.avatar--xl { width: 72px; height: 72px; font-size: 24px; }
.avatar--ink { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { border: 2px solid var(--surface); margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }

.meter { display: inline-flex; align-items: center; gap: 3px; vertical-align: middle; }
.meter__seg { width: 14px; height: 6px; border-radius: 999px; background: var(--surface-3); }
.meter__seg.is-filled { background: var(--ink); }
.meter--hot .meter__seg.is-filled { background: var(--danger); }
.k-card--dark .meter__seg { background: rgba(127, 127, 127, 0.3); }
.k-card--dark .meter__seg.is-filled { background: var(--on-ink); }

.color-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 50%; vertical-align: middle; border: 1px solid rgba(0, 0, 0, 0.08); flex-shrink: 0; }

/* ==========================================================================
   Tables
   ========================================================================== */
/* position: relative makes this the containing block for absolutely
   positioned children (e.g. .sr-only header labels) — otherwise they escape
   the scroll clip and widen the whole page on narrow screens */
.table-scroll { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; min-width: 0; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-base); }
.table th {
  text-align: left;
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--text-3);
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  background: var(--surface);
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); color: var(--text); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color var(--t-fast); }
.table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.table a { font-weight: 500; text-decoration: none; }
.table a:hover { text-decoration: underline; }
.table .num, .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .nowrap { white-space: nowrap; }
.table .muted, .muted { color: var(--text-3); }
.table .clip { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table .table-total-row td { border-top: 1px solid var(--line-2); border-bottom: 0; font-weight: 600; background: var(--cream); }
.table input.input, .table select.input { height: 36px; }
.panel .table th:first-child, .panel .table td:first-child { padding-left: 20px; }
.panel .table th:last-child, .panel .table td:last-child { padding-right: 20px; }
.cell-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cell-user__text { min-width: 0; line-height: 1.3; }
.cell-user__sub { display: block; font-size: var(--fs-xs); color: var(--text-3); }
.money-in { color: var(--success); }
.money-out { color: var(--danger); }
@media (max-width: 720px) {
  .panel .table th:first-child, .panel .table td:first-child { padding-left: 16px; }
  .panel .table th:last-child, .panel .table td:last-child { padding-right: 16px; }
  .table th, .table td { padding: 10px 10px; }
}

.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 20px; border-top: 1px solid var(--line); color: var(--text-3); font-size: var(--fs-sm); }
.pagination__pages { display: flex; gap: 6px; }

/* ==========================================================================
   Empty states
   ========================================================================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 44px 24px;
  border: 1px dashed var(--line-2);
  border-radius: var(--r-lg);
  background: var(--surface);
}
.empty-state__icon {
  display: grid;
  place-items: center;
  width: 52px; height: 52px;
  margin-bottom: 8px;
  border-radius: 16px;
  background: var(--cream);
  border: 1px solid var(--cream-2);
  color: var(--text-2);
}
.empty-state h3 { font-size: var(--fs-md); }
.empty-state p { max-width: 360px; margin: 0 0 10px; }
.panel .empty-state { border: 0; border-radius: 0; background: transparent; }

/* ==========================================================================
   Modals, toasts, lightbox
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 15, 14, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-base);
  z-index: 1100;
}
.modal-backdrop.is-open { opacity: 1; pointer-events: auto; }
.modal {
  width: 100%;
  max-width: 440px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-pop);
  transform: translateY(8px) scale(0.98);
  transition: transform var(--t-base);
}
.modal-backdrop.is-open .modal { transform: none; }
.modal__icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--surface-2); color: var(--text); margin-bottom: 14px; }
.modal.is-destructive .modal__icon { background: var(--danger-bg); color: var(--danger); }
.modal-title { font-size: var(--fs-lg) !important; margin: 0 0 6px !important; }
.modal-body { color: var(--text-2); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; flex-wrap: wrap; }

.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  width: min(380px, calc(100vw - 32px));
  z-index: 1200;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 12px 12px 12px 14px;
  background: var(--ink);
  color: var(--on-ink);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-pop);
  font-size: var(--fs-sm);
  line-height: 1.45;
  pointer-events: auto;
  animation: toast-in 220ms ease-out both;
}
.toast.is-leaving { animation: toast-out 180ms ease-in both; }
.toast__icon { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0; margin-top: 0; }
.toast-success .toast__icon { background: #2f9a62; color: #fff; }
.toast-danger .toast__icon, .toast-error .toast__icon { background: #d9473b; color: #fff; }
.toast-warning .toast__icon { background: #d39a24; color: #1f1f1f; }
.toast-info .toast__icon { background: rgba(127, 127, 127, 0.35); color: var(--on-ink); }
.toast__msg { flex: 1; min-width: 0; padding-top: 1px; overflow-wrap: anywhere; }
.toast__close {
  appearance: none;
  display: grid;
  place-items: center;
  width: 22px; height: 22px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--on-ink-2);
  cursor: pointer;
}
.toast__close:hover { color: var(--on-ink); background: rgba(127, 127, 127, 0.2); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }
@media (max-width: 720px) { .toast-stack { right: 16px; left: 16px; bottom: 16px; width: auto; } }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 64px;
  grid-template-rows: 56px minmax(0, 1fr) 44px;
  background: rgba(10, 10, 10, 0.9);
  color: #f1f1eb;
}
.lightbox[hidden] { display: none; }
.lightbox__img { grid-column: 2; grid-row: 2; justify-self: center; align-self: center; max-width: 100%; max-height: 100%; object-fit: contain; border-radius: var(--r-sm); }
.lightbox__btn {
  appearance: none;
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  align-self: center;
  justify-self: center;
}
.lightbox__btn:hover { background: rgba(255, 255, 255, 0.2); }
.lightbox__prev { grid-column: 1; grid-row: 2; }
.lightbox__next { grid-column: 3; grid-row: 2; }
.lightbox__close { grid-column: 3; grid-row: 1; }
.lightbox__bar { grid-column: 1 / -1; grid-row: 3; display: flex; align-items: center; justify-content: center; gap: 16px; font-size: var(--fs-sm); color: #c8c8c0; }
.lightbox__bar a { color: #fff !important; }
@media (max-width: 720px) {
  .lightbox { grid-template-columns: 0 minmax(0, 1fr) 0; }
  .lightbox__prev, .lightbox__next { position: fixed; bottom: 52px; }
  .lightbox__prev { left: 16px; }
  .lightbox__next { right: 16px; }
  .lightbox__close { position: fixed; top: 8px; right: 8px; }
}

/* ==========================================================================
   Attachment gallery
   ========================================================================== */
.attachment-gallery { display: flex; flex-direction: column; gap: 14px; }
.attachment-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; }
.attachment-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.attachment-thumb a { display: block; width: 100%; height: 100%; }
.attachment-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 300ms ease; }
.attachment-thumb:hover img { transform: scale(1.04); }
.attachment-thumb__remove {
  position: absolute;
  top: 6px; right: 6px;
  display: grid;
  place-items: center;
  width: 26px; height: 26px;
  border: 0;
  border-radius: 50%;
  background: rgba(20, 20, 20, 0.7);
  color: #fff;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--t-fast), background-color var(--t-fast);
}
.attachment-thumb:hover .attachment-thumb__remove, .attachment-thumb__remove:focus-visible { opacity: 1; }
.attachment-thumb__remove:hover { background: var(--danger); }
@media (hover: none) { .attachment-thumb__remove { opacity: 1; } }
.dropzone {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px dashed var(--line-2);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text-2);
  transition: border-color var(--t-fast), background-color var(--t-fast);
  flex-wrap: wrap;
}
.dropzone.is-over { border-color: var(--ink); background: var(--cream); }
.dropzone__text { flex: 1; min-width: 160px; font-size: var(--fs-sm); }
.dropzone__text strong { color: var(--text); font-weight: 600; }
.dropzone input[type='file'] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone .btn { position: relative; z-index: 1; }
.attachment-error:empty { display: none; }

/* ==========================================================================
   Activity feed
   ========================================================================== */
.feed { list-style: none; margin: 0; padding: 0; }
.feed__item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); min-width: 0; }
.feed__item:last-child { border-bottom: 0; }
.feed__icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--cream); border: 1px solid var(--cream-2); color: var(--text-2); flex-shrink: 0; }
.feed__text { flex: 1; min-width: 0; }
.feed__title { display: block; font-weight: 500; color: var(--text) !important; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed__title:hover { text-decoration: underline; }
.feed__sub { display: block; font-size: var(--fs-xs); color: var(--text-3); }
.feed__time { font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; }
@media (max-width: 720px) { .feed__item { padding: 12px 16px; } }

/* section shortcut tiles on home */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.tile {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--text) !important;
  text-decoration: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  min-width: 0;
}
.tile:hover { border-color: var(--line-2); box-shadow: var(--shadow-md); }
.tile__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tile__icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--surface-2); color: var(--text); }
.tile__count { font-size: var(--fs-xs); font-weight: 600; color: var(--text-2); background: var(--surface-2); padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.tile__name { font-weight: 600; font-size: var(--fs-md); }
.tile__desc { font-size: var(--fs-sm); color: var(--text-3); line-height: 1.4; }

/* ==========================================================================
   Sub-navigation tabs
   ========================================================================== */
.subnav {
  display: flex;
  gap: 4px;
  margin: 0 0 24px;
  padding: 4px;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  scrollbar-width: none;
}
.subnav::-webkit-scrollbar { display: none; }
.subnav a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--r-sm);
  color: var(--text-2) !important;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.subnav a:hover { color: var(--text) !important; }
.subnav a.is-active { background: var(--surface); color: var(--text) !important; box-shadow: var(--shadow-sm); }
.subnav__badge { min-width: 20px; padding: 1px 6px; border-radius: 999px; background: var(--ink); color: var(--on-ink); font-size: 11px; font-weight: 600; text-align: center; }

/* ==========================================================================
   Property deposits
   ========================================================================== */
.deposit-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px 104px 116px 36px;
  gap: 8px;
  align-items: center;
}
.deposit-line--head { font-size: var(--fs-xs); color: var(--text-3); font-weight: 500; padding: 0 2px; }
.deposit-line__each, .deposit-line__total { font-variant-numeric: tabular-nums; color: var(--text-2); text-align: right; white-space: nowrap; }
.deposit-line__total { color: var(--text); font-weight: 600; }
/* storage-only property: prices and the payout don't apply */
.is-storage .deposit-line__each, .is-storage .deposit-line__total,
.is-storage .deposit-line--head span:nth-child(3), .is-storage .deposit-line--head span:nth-child(4) { visibility: hidden; }
.is-storage .deposit-total { display: none; }
.deposit-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 8px 0 0 !important;
  padding: 16px 18px;
  border-radius: var(--r-md);
  background: var(--cream);
  border: 1px solid var(--cream-2);
  color: var(--text-2) !important;
  font-weight: 500;
}
.deposit-total strong { font-size: var(--fs-xl); font-weight: 600; color: var(--text); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
@media (max-width: 720px) {
  .deposit-line { grid-template-columns: minmax(0, 1fr) 76px 36px; }
  .deposit-line--head, .deposit-line__each, .deposit-line__total { display: none; }
}

/* ==========================================================================
   Checklist (heist items) and steps (crafting recipes)
   ========================================================================== */
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.checklist li:last-child { border-bottom: 0; }
.checklist label { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; width: 100%; }
.checklist input { margin-top: 3px; }
.checklist input:checked ~ .checklist__text .checklist__name { text-decoration: line-through; color: var(--text-3); }
.checklist__text { min-width: 0; flex: 1; }
.checklist__name { font-weight: 500; }
.checklist__sub { display: block; font-size: var(--fs-sm); color: var(--text-3); overflow-wrap: anywhere; }

.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps li { position: relative; display: flex; gap: 14px; padding: 12px 20px; border-bottom: 1px solid var(--line); counter-increment: step; overflow-wrap: anywhere; }
.steps li:last-child { border-bottom: 0; }
.steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 26px; height: 26px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--ink);
  color: var(--on-ink);
  font-size: var(--fs-xs);
  font-weight: 600;
}

/* ==========================================================================
   Chat
   ========================================================================== */
.chat {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  height: calc(100vh - var(--topbar-h) - 28px - 24px - 76px);
  min-height: 460px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--surface);
}
.chat__channels { border-right: 1px solid var(--line); padding: 12px; overflow-y: auto; background: var(--surface); }
.chat__channels-title { padding: 4px 8px 10px; font-size: var(--fs-xs); color: var(--text-3); font-weight: 500; }
.channel-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.channel-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  color: var(--text-2) !important;
  text-decoration: none;
  font-weight: 500;
}
.channel-list a:hover { background: var(--surface-2); color: var(--text) !important; }
.channel-list a.active { background: var(--surface-2); color: var(--text) !important; font-weight: 600; }
.channel-list .side-channel__hash { flex-shrink: 0; }
.channel-list__unread { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.channel-list__lock { margin-left: auto; color: var(--text-3); }
.chat__main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); min-height: 58px; }
.chat__title { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: var(--fs-md); min-width: 0; }
.chat__status { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; }
.chat__status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.chat__status.is-online::before { background: #2f9a62; }
.chat__status.is-offline::before { background: var(--danger); }
.chat__channel-btn { display: none; }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px 18px; min-height: 0; overscroll-behavior: contain; }
.chat-day { display: flex; align-items: center; gap: 12px; margin: 16px 0 10px; color: var(--text-3); font-size: var(--fs-xs); font-weight: 500; }
.chat-day::before, .chat-day::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.chat-message { position: relative; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 0 12px; padding: 4px 8px; margin: 0 -8px; border-radius: var(--r-sm); }
.chat-message:hover { background: var(--surface-2); }
.chat-message.is-first { margin-top: 10px; }
.chat-message__avatar { grid-row: span 2; }
.chat-message:not(.is-first) .chat-message__avatar { visibility: hidden; height: 0; }
.chat-message__meta { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.chat-message:not(.is-first) .chat-message__meta { display: none; }
.chat-message__author { font-weight: 600; }
.chat-message__time { font-size: var(--fs-xs); color: var(--text-3); }
.chat-message__body { margin: 0 !important; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-message__actions { position: absolute; top: 2px; right: 6px; display: none; }
.chat-message:hover .chat-message__actions, .chat-message:focus-within .chat-message__actions { display: flex; }
.chat-message.is-pending { opacity: 0.55; }
.chat__older { display: flex; justify-content: center; margin-bottom: 8px; }
.chat__composer { display: flex; align-items: flex-end; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); }
.chat__composer textarea { flex: 1; min-height: 42px; max-height: 160px; height: 42px; resize: none; padding-top: 10px; }
.chat__composer-meta { display: flex; justify-content: space-between; padding: 0 16px 10px; font-size: var(--fs-xs); color: var(--text-3); }
.chat__placeholder { display: grid; place-items: center; height: 100%; color: var(--text-3); text-align: center; gap: 6px; }
.spinner { width: 22px; height: 22px; border: 2px solid var(--line-2); border-top-color: var(--ink); border-radius: 50%; animation: spin 800ms linear infinite; }
@media (max-width: 860px) {
  .chat { grid-template-columns: minmax(0, 1fr); height: calc(100vh - var(--topbar-h) - 120px); }
  .chat__channels { display: none; }
  .chat.show-channels .chat__channels { display: block; border-right: 0; }
  .chat.show-channels .chat__main { display: none; }
  .chat__channel-btn { display: inline-grid; }
}

/* ==========================================================================
   Permissions matrix
   ========================================================================== */
.perm-section + .perm-section { margin-top: 16px; }
.perm-table th:not(:first-child), .perm-table td:not(:first-child) { text-align: center; width: 110px; }
.perm-table td.is-unused input { opacity: 0.3; }
.perm-help { font-size: var(--fs-sm); color: var(--text-3); margin: 4px 0 0 !important; }
.perm-section + .perm-section { margin-top: 0; }
.sticky-save {
  position: sticky;
  bottom: 16px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  margin-top: 20px;
  padding: 12px 14px 12px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
}
.flip-y { transform: rotate(180deg); }

/* ==========================================================================
   Login / auth
   ========================================================================== */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
}
.auth__brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  padding: 40px 48px;
  background: var(--cream);
  border-right: 1px solid var(--cream-2);
  overflow: hidden;
}
.auth__logo { display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: var(--fs-md); }
.auth__crest { color: var(--ink); opacity: 0.9; align-self: center; }
.auth__crest .emblem { color: var(--ink); }
.auth__tagline { font-size: var(--fs-2xl); font-weight: 600; line-height: 1.15; letter-spacing: -0.02em; max-width: 420px; color: var(--text); }
.auth__note { color: var(--text-3); font-size: var(--fs-sm); }
.auth__form-wrap { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--surface); }
.auth-form { width: 100%; max-width: 360px; }
.auth-form h1 { font-size: var(--fs-xl); margin-bottom: 6px; }
.auth-form > p { margin-bottom: 24px; }
.password-field { position: relative; }
.password-field .input { padding-right: 44px; }
.password-field__toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.caps-warning { display: none; font-size: var(--fs-xs); color: var(--warning); }
.caps-warning.is-on { display: block; }
@media (max-width: 860px) {
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth__brand { padding: 24px; flex-direction: row; align-items: center; border-right: 0; border-bottom: 1px solid var(--cream-2); }
  .auth__crest, .auth__tagline, .auth__note { display: none; }
  .auth__form-wrap { align-items: flex-start; padding-top: 48px; }
}

/* ==========================================================================
   Error pages
   ========================================================================== */
.error-page { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 64px 20px; max-width: 520px; margin: 0 auto; }
.error-page__code {
  display: grid;
  place-items: center;
  min-width: 92px;
  height: 52px;
  padding: 0 18px;
  margin-bottom: 8px;
  border-radius: 999px;
  background: var(--cream);
  border: 1px solid var(--cream-2);
  font-size: var(--fs-xl);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.error-page__message { color: var(--text-2); }
.error-page .actions { justify-content: center; margin-top: 10px; }
body.theme.is-bare { min-height: 100vh; display: flex; flex-direction: column; }
.bare-head { display: flex; align-items: center; gap: 12px; padding: 18px 24px; border-bottom: 1px solid var(--line); font-weight: 600; text-decoration: none; color: var(--text) !important; }

/* ==========================================================================
   Emblem
   ========================================================================== */
.emblem { display: block; color: currentColor; }
.emblem--spin { animation: spin 1.4s linear infinite; }

/* ==========================================================================
   Misc utilities
   ========================================================================== */
.hint { font-size: var(--fs-xs); color: var(--text-3); }
.text-2 { color: var(--text-2); }
.strong { font-weight: 600; }
.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.mt-lg { margin-top: 28px !important; }
.mb-lg { margin-bottom: 28px !important; }
.w-full { width: 100%; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 32px 0 14px; }
.section-title h2 { font-size: var(--fs-md); }
.section-title:first-child { margin-top: 0; }
.copy-btn {
  appearance: none;
  position: relative;
  z-index: 2;
  padding: 0;
  border: 0;
  border-bottom: 1px dashed var(--line-2);
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.copy-btn:hover { border-bottom-color: currentColor; }
.k-card--dark .copy-btn { border-bottom-color: rgba(127, 127, 127, 0.5); }
[hidden] { display: none !important; }
[data-view-pane]:not(.is-active) { display: none; }

/* the old dark theme's section-header class, kept for any straggling markup */
.section-header { font-size: var(--fs-lg); font-weight: 600; margin: 0 0 16px; }

/* ---------- peds ---------- */
.page--flush .subnav { margin-bottom: 14px; }
.form-section__title .icon { vertical-align: -2px; color: var(--text-3); margin-right: 2px; }
.ped-roles { display: inline-flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.ped-list { list-style: none; margin: 0; padding: 0; }
.ped-list li { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.ped-list li:last-child { border-bottom: 0; }
.ped-list__main { min-width: 0; flex: 1; }
.ped-list__name { font-weight: 500; overflow-wrap: anywhere; }
.ped-list__say { display: block; margin-top: 2px; }
.ped-list__sub { display: block; margin-top: 2px; font-size: var(--fs-sm); color: var(--text-3); overflow-wrap: anywhere; white-space: pre-line; }
.ped-list__heist { display: block; font-size: var(--fs-xs); font-weight: 600; }
.ped-list__heist a { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; }
.ped-list__value { flex: none; max-width: 45%; text-align: right; font-weight: 600; overflow-wrap: anywhere; }
.ped-list__value--money { color: var(--success); }
