/* SocialSite — one stylesheet shared by every tab and the admin panel. */

/* ---------- theme ----------
   <html data-theme data-accent data-contrast data-font data-density data-motion> is rendered by the
   server (apps/core/themes.py), so there is no flash; a per-browser override (localStorage
   "ss-appearance", Settings -> Appearance -> "This browser only") is applied by a tiny script in
   <head> before the page paints.

   Colors: every color token is declared once below as light-dark(<light>, <dark>); which side
   applies follows `color-scheme`, which data-theme sets ("system" follows the device, "light" and
   "dark" force it). Accent palettes override only the accent tokens; high contrast overrides the
   neutral and status tokens. Every attribute also works on an inner element (the Appearance
   preview uses that).
   Browsers without light-dark() (Chrome < 123, Safari < 17.5, Firefox < 120) get the same values
   from the generated fallback block further down, keyed on the data-theme attribute. Don't edit
   that block by hand: change the light-dark() values here and run
   `python3.12 manage.py theme_fallback` (tests/test_themes.py checks it is up to date).

   Contrast: text, muted text, links (accent) and status colors are at least 4.5:1 (WCAG AA)
   against every background they sit on, in light and dark, in every accent and in high
   contrast (which aims for 7:1); tests/test_themes.py measures it. */
:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --surface-2: #f0ece5;
  --border: #e2dcd2;
  --text: #2a2622;
  --muted: #6f675e;
  --ok: #27703f;
  --ok-soft: #e1f1e6;
  --warn: #805700;
  --warn-soft: #fbf0d6;
  --danger: #b3261e;
  --danger-soft: #f9e0de;
  --info: #2b5f9e;
  --info-soft: #e0eaf7;
  --code-bg: #1e1b18;
  --vote-up: #c2410c;
  --vote-down: #4f46e5;
  --like: #c8102e;
  --backdrop: rgba(0, 0, 0, .45);
  --code-text: #e9e4dc;
  --shadow: 0 1px 2px rgba(40, 30, 20, .06), 0 2px 8px rgba(40, 30, 20, .05);
  --accent: #a34b22; --accent-ink: #ffffff; --accent-soft: #f8e7dd;
  --beer: #e3a12f; --foam: #fffaf0;  /* the site mark; reads on light and dark bars alike */
  /* Community flair (text on its background) */
  --flair-grey: #4b5563; --flair-grey-bg: #eceff3;
  --flair-red: #a4262c; --flair-red-bg: #fbe4e4;
  --flair-orange: #9a4a00; --flair-orange-bg: #fde9d4;
  --flair-gold: #765900; --flair-gold-bg: #fbf1cc;
  --flair-green: #1f6b37; --flair-green-bg: #def2e4;
  --flair-teal: #0b6a66; --flair-teal-bg: #d8f2f0;
  --flair-blue: #1f56a3; --flair-blue-bg: #e0ebfa;
  --flair-purple: #6d35a8; --flair-purple-bg: #efe5fa;
  --flair-pink: #a3266a; --flair-pink-bg: #fbe3ef;
  --paper: #ffffff;  /* HTML email is always shown on white: senders assume it */
  --paper-ink: #1f1f1f;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  /* Spacing (density: comfortable; compact overrides these below) */
  --space: 1rem;        /* card padding, grid gaps */
  --space-s: .75rem;    /* between stacked blocks */
  --row-y: .75rem;      /* thread rows */
  --list-y: .6rem;      /* list items */
  --cell-y: .55rem;     /* table cells */
  --page-y: 1.1rem;     /* top of the page */
  --focus-ring: 2px;
}

@supports (color: light-dark(#000, #fff)) {
  :root, [data-theme] {
    --bg: light-dark(#f6f3ee, #171513);
    --surface: light-dark(#ffffff, #211e1b);
    --surface-2: light-dark(#f0ece5, #2a2622);
    --border: light-dark(#e2dcd2, #3a3530);
    --text: light-dark(#2a2622, #ece6de);
    --muted: light-dark(#6f675e, #a59c91);
    --ok: light-dark(#27703f, #6cc28d);
    --ok-soft: light-dark(#e1f1e6, #1c3226);
    --warn: light-dark(#805700, #e0b04a);
    --warn-soft: light-dark(#fbf0d6, #3a2f15);
    --danger: light-dark(#b3261e, #f08279);
    --danger-soft: light-dark(#f9e0de, #3d1d1b);
    --info: light-dark(#2b5f9e, #7fb0ea);
    --info-soft: light-dark(#e0eaf7, #1b2a3d);
    --code-bg: light-dark(#1e1b18, #0f0d0c);
    --code-text: #e9e4dc;
    --vote-up: light-dark(#c2410c, #fb923c);
    --vote-down: light-dark(#4f46e5, #a5b4fc);
    --like: light-dark(#c8102e, #ff6b81);
    --backdrop: light-dark(rgba(0, 0, 0, .45), rgba(0, 0, 0, .65));
    --shadow: 0 1px 2px light-dark(rgba(40, 30, 20, .06), transparent),
              0 2px 8px light-dark(rgba(40, 30, 20, .05), transparent);
    --flair-grey: light-dark(#4b5563, #c9d1db); --flair-grey-bg: light-dark(#eceff3, #2a3038);
    --flair-red: light-dark(#a4262c, #ff9a9a); --flair-red-bg: light-dark(#fbe4e4, #3d1d1f);
    --flair-orange: light-dark(#9a4a00, #ffb36b); --flair-orange-bg: light-dark(#fde9d4, #3b2614);
    --flair-gold: light-dark(#765900, #f2cd5c); --flair-gold-bg: light-dark(#fbf1cc, #352c10);
    --flair-green: light-dark(#1f6b37, #7fd69c); --flair-green-bg: light-dark(#def2e4, #17311f);
    --flair-teal: light-dark(#0b6a66, #6fd9d1); --flair-teal-bg: light-dark(#d8f2f0, #123230);
    --flair-blue: light-dark(#1f56a3, #8fbdf5); --flair-blue-bg: light-dark(#e0ebfa, #172a42);
    --flair-purple: light-dark(#6d35a8, #c8a5f5); --flair-purple-bg: light-dark(#efe5fa, #2c2140);
    --flair-pink: light-dark(#a3266a, #f59ac7); --flair-pink-bg: light-dark(#fbe3ef, #3c1c2d);
  }
  /* Accent palettes: text on --accent uses --accent-ink; --accent text sits on --bg, --surface,
     --surface-2 and --accent-soft. Every pair is at least 4.5:1 (WCAG AA) in both modes, with and
     without high contrast. */
  :root, [data-accent="tavern"] {
    --accent: light-dark(#a34b22, #e88a5a); --accent-ink: light-dark(#ffffff, #1a1410);
    --accent-soft: light-dark(#f8e7dd, #3b2619);
  }
  [data-accent="ocean"] {
    --accent: light-dark(#1f5fa6, #74b2f0); --accent-ink: light-dark(#ffffff, #0b1622);
    --accent-soft: light-dark(#dfeaf7, #17293e);
  }
  [data-accent="forest"] {
    --accent: light-dark(#2c7543, #67c48f); --accent-ink: light-dark(#ffffff, #0c1a12);
    --accent-soft: light-dark(#dcefe1, #173020);
  }
  [data-accent="grape"] {
    --accent: light-dark(#7b3fb3, #c39df2); --accent-ink: light-dark(#ffffff, #1a1024);
    --accent-soft: light-dark(#efe4fa, #2e2142);
  }
  [data-accent="slate"] {
    --accent: light-dark(#4a5568, #aeb9c9); --accent-ink: light-dark(#ffffff, #11151b);
    --accent-soft: light-dark(#e4e8ee, #262c35);
  }
  [data-accent="rose"] {
    --accent: light-dark(#b0264f, #f28aa8); --accent-ink: light-dark(#ffffff, #1f0d13);
    --accent-soft: light-dark(#fbe3ea, #3d1b26);
  }
  [data-accent="teal"] {
    --accent: light-dark(#0f6f6b, #5fd0c6); --accent-ink: light-dark(#ffffff, #08201e);
    --accent-soft: light-dark(#d9f1ef, #133330);
  }
  [data-accent="amber"] {
    --accent: light-dark(#8a4f00, #f0b44c); --accent-ink: light-dark(#ffffff, #1e1405);
    --accent-soft: light-dark(#fbecd2, #3a2a12);
  }
  [data-accent="indigo"] {
    --accent: light-dark(#4338ca, #a5a8f8); --accent-ink: light-dark(#ffffff, #11112b);
    --accent-soft: light-dark(#e5e5fb, #26264a);
  }
  /* High contrast: black/white surfaces, darker (lighter) text and borders; aims for 7:1. */
  [data-contrast="high"] {
    --bg: light-dark(#ffffff, #000000);
    --surface: light-dark(#ffffff, #0a0a0a);
    --surface-2: light-dark(#f0f0f0, #1a1a1a);
    --border: light-dark(#5c5c5c, #a3a3a3);
    --text: light-dark(#000000, #ffffff);
    --muted: light-dark(#383838, #d6d6d6);
    --ok: light-dark(#0b5527, #8be0a8);
    --ok-soft: light-dark(#e3f3e8, #0c2415);
    --warn: light-dark(#5a3c00, #ffd36b);
    --warn-soft: light-dark(#fff1d1, #2b2208);
    --danger: light-dark(#8c1a14, #ffa199);
    --danger-soft: light-dark(#fde6e4, #300e0c);
    --info: light-dark(#0d437d, #a8ccff);
    --info-soft: light-dark(#e1ecfa, #0d1c31);
    --vote-up: light-dark(#9a3208, #ffb27a);
    --vote-down: light-dark(#3730a3, #c7d0ff);
    --like: light-dark(#a10d25, #ff94a6);
  }
}

/* color-scheme drives light-dark() and the browser's own controls and scrollbars. */
:root, [data-theme="system"] { color-scheme: light dark; }
[data-theme="light"] { color-scheme: light; }
[data-theme="dark"] { color-scheme: dark; }

/* Text size (Settings -> Appearance). Sizes are in rem, so this scales the whole page and still
   respects the browser's own font size setting. */
html[data-font="s"] { font-size: 87.5%; }
html[data-font="l"] { font-size: 112.5%; }
html[data-font="xl"] { font-size: 125%; }

/* Density */
[data-density="compact"] {
  --space: .7rem; --space-s: .5rem; --row-y: .45rem; --list-y: .4rem; --cell-y: .35rem; --page-y: .7rem;
}

/* High contrast, beyond the colors: thicker focus rings, underlined links in text. */
[data-contrast="high"] { --focus-ring: 3px; }
[data-contrast="high"] .md a, [data-contrast="high"] .rich a, [data-contrast="high"] p a,
[data-contrast="high"] .help a, [data-contrast="high"] .thread-meta a { text-decoration: underline; }
[data-contrast="high"] .btn[disabled] { opacity: .7; }

/* Motion: "system" follows the device's reduce-motion setting, "reduce" always stops
   animations and smooth scrolling, "full" keeps them even when the device asks to reduce. */
html[data-motion="reduce"] *, html[data-motion="reduce"] *::before, html[data-motion="reduce"] *::after {
  animation-duration: .01ms !important; animation-iteration-count: 1 !important;
  transition-duration: .01ms !important; transition-delay: 0s !important; scroll-behavior: auto !important;
}
@media (prefers-reduced-motion: reduce) {
  html:not([data-motion="full"]) *, html:not([data-motion="full"]) *::before, html:not([data-motion="full"]) *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; transition-delay: 0s !important; scroll-behavior: auto !important;
  }
}

/* BEGIN generated fallback: python3.12 manage.py theme_fallback (do not edit by hand) */
@supports not (color: light-dark(#000, #fff)) {
  [data-theme] {
    --bg: #f6f3ee;
    --surface: #ffffff;
    --surface-2: #f0ece5;
    --border: #e2dcd2;
    --text: #2a2622;
    --muted: #6f675e;
    --ok: #27703f;
    --ok-soft: #e1f1e6;
    --warn: #805700;
    --warn-soft: #fbf0d6;
    --danger: #b3261e;
    --danger-soft: #f9e0de;
    --info: #2b5f9e;
    --info-soft: #e0eaf7;
    --code-bg: #1e1b18;
    --code-text: #e9e4dc;
    --vote-up: #c2410c;
    --vote-down: #4f46e5;
    --like: #c8102e;
    --backdrop: rgba(0, 0, 0, .45);
    --shadow: 0 1px 2px rgba(40, 30, 20, .06), 0 2px 8px rgba(40, 30, 20, .05);
    --flair-grey: #4b5563;
    --flair-grey-bg: #eceff3;
    --flair-red: #a4262c;
    --flair-red-bg: #fbe4e4;
    --flair-orange: #9a4a00;
    --flair-orange-bg: #fde9d4;
    --flair-gold: #765900;
    --flair-gold-bg: #fbf1cc;
    --flair-green: #1f6b37;
    --flair-green-bg: #def2e4;
    --flair-teal: #0b6a66;
    --flair-teal-bg: #d8f2f0;
    --flair-blue: #1f56a3;
    --flair-blue-bg: #e0ebfa;
    --flair-purple: #6d35a8;
    --flair-purple-bg: #efe5fa;
    --flair-pink: #a3266a;
    --flair-pink-bg: #fbe3ef;
  }
  [data-accent="tavern"] {
    --accent: #a34b22;
    --accent-ink: #ffffff;
    --accent-soft: #f8e7dd;
  }
  [data-accent="ocean"] {
    --accent: #1f5fa6;
    --accent-ink: #ffffff;
    --accent-soft: #dfeaf7;
  }
  [data-accent="forest"] {
    --accent: #2c7543;
    --accent-ink: #ffffff;
    --accent-soft: #dcefe1;
  }
  [data-accent="grape"] {
    --accent: #7b3fb3;
    --accent-ink: #ffffff;
    --accent-soft: #efe4fa;
  }
  [data-accent="slate"] {
    --accent: #4a5568;
    --accent-ink: #ffffff;
    --accent-soft: #e4e8ee;
  }
  [data-accent="rose"] {
    --accent: #b0264f;
    --accent-ink: #ffffff;
    --accent-soft: #fbe3ea;
  }
  [data-accent="teal"] {
    --accent: #0f6f6b;
    --accent-ink: #ffffff;
    --accent-soft: #d9f1ef;
  }
  [data-accent="amber"] {
    --accent: #8a4f00;
    --accent-ink: #ffffff;
    --accent-soft: #fbecd2;
  }
  [data-accent="indigo"] {
    --accent: #4338ca;
    --accent-ink: #ffffff;
    --accent-soft: #e5e5fb;
  }
  [data-contrast="high"] {
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-2: #f0f0f0;
    --border: #5c5c5c;
    --text: #000000;
    --muted: #383838;
    --ok: #0b5527;
    --ok-soft: #e3f3e8;
    --warn: #5a3c00;
    --warn-soft: #fff1d1;
    --danger: #8c1a14;
    --danger-soft: #fde6e4;
    --info: #0d437d;
    --info-soft: #e1ecfa;
    --vote-up: #9a3208;
    --vote-down: #3730a3;
    --like: #a10d25;
  }
  [data-theme="dark"] {
    --bg: #171513;
    --surface: #211e1b;
    --surface-2: #2a2622;
    --border: #3a3530;
    --text: #ece6de;
    --muted: #a59c91;
    --ok: #6cc28d;
    --ok-soft: #1c3226;
    --warn: #e0b04a;
    --warn-soft: #3a2f15;
    --danger: #f08279;
    --danger-soft: #3d1d1b;
    --info: #7fb0ea;
    --info-soft: #1b2a3d;
    --code-bg: #0f0d0c;
    --vote-up: #fb923c;
    --vote-down: #a5b4fc;
    --like: #ff6b81;
    --backdrop: rgba(0, 0, 0, .65);
    --shadow: 0 1px 2px transparent, 0 2px 8px transparent;
    --flair-grey: #c9d1db;
    --flair-grey-bg: #2a3038;
    --flair-red: #ff9a9a;
    --flair-red-bg: #3d1d1f;
    --flair-orange: #ffb36b;
    --flair-orange-bg: #3b2614;
    --flair-gold: #f2cd5c;
    --flair-gold-bg: #352c10;
    --flair-green: #7fd69c;
    --flair-green-bg: #17311f;
    --flair-teal: #6fd9d1;
    --flair-teal-bg: #123230;
    --flair-blue: #8fbdf5;
    --flair-blue-bg: #172a42;
    --flair-purple: #c8a5f5;
    --flair-purple-bg: #2c2140;
    --flair-pink: #f59ac7;
    --flair-pink-bg: #3c1c2d;
  }
  [data-theme="dark"][data-accent="tavern"] {
    --accent: #e88a5a;
    --accent-ink: #1a1410;
    --accent-soft: #3b2619;
  }
  [data-theme="dark"][data-accent="ocean"] {
    --accent: #74b2f0;
    --accent-ink: #0b1622;
    --accent-soft: #17293e;
  }
  [data-theme="dark"][data-accent="forest"] {
    --accent: #67c48f;
    --accent-ink: #0c1a12;
    --accent-soft: #173020;
  }
  [data-theme="dark"][data-accent="grape"] {
    --accent: #c39df2;
    --accent-ink: #1a1024;
    --accent-soft: #2e2142;
  }
  [data-theme="dark"][data-accent="slate"] {
    --accent: #aeb9c9;
    --accent-ink: #11151b;
    --accent-soft: #262c35;
  }
  [data-theme="dark"][data-accent="rose"] {
    --accent: #f28aa8;
    --accent-ink: #1f0d13;
    --accent-soft: #3d1b26;
  }
  [data-theme="dark"][data-accent="teal"] {
    --accent: #5fd0c6;
    --accent-ink: #08201e;
    --accent-soft: #133330;
  }
  [data-theme="dark"][data-accent="amber"] {
    --accent: #f0b44c;
    --accent-ink: #1e1405;
    --accent-soft: #3a2a12;
  }
  [data-theme="dark"][data-accent="indigo"] {
    --accent: #a5a8f8;
    --accent-ink: #11112b;
    --accent-soft: #26264a;
  }
  [data-theme="dark"][data-contrast="high"] {
    --bg: #000000;
    --surface: #0a0a0a;
    --surface-2: #1a1a1a;
    --border: #a3a3a3;
    --text: #ffffff;
    --muted: #d6d6d6;
    --ok: #8be0a8;
    --ok-soft: #0c2415;
    --warn: #ffd36b;
    --warn-soft: #2b2208;
    --danger: #ffa199;
    --danger-soft: #300e0c;
    --info: #a8ccff;
    --info-soft: #0d1c31;
    --vote-up: #ffb27a;
    --vote-down: #c7d0ff;
    --like: #ff94a6;
  }
  @media (prefers-color-scheme: dark) {
    [data-theme="system"] {
      --bg: #171513;
      --surface: #211e1b;
      --surface-2: #2a2622;
      --border: #3a3530;
      --text: #ece6de;
      --muted: #a59c91;
      --ok: #6cc28d;
      --ok-soft: #1c3226;
      --warn: #e0b04a;
      --warn-soft: #3a2f15;
      --danger: #f08279;
      --danger-soft: #3d1d1b;
      --info: #7fb0ea;
      --info-soft: #1b2a3d;
      --code-bg: #0f0d0c;
      --vote-up: #fb923c;
      --vote-down: #a5b4fc;
      --like: #ff6b81;
      --backdrop: rgba(0, 0, 0, .65);
      --shadow: 0 1px 2px transparent, 0 2px 8px transparent;
      --flair-grey: #c9d1db;
      --flair-grey-bg: #2a3038;
      --flair-red: #ff9a9a;
      --flair-red-bg: #3d1d1f;
      --flair-orange: #ffb36b;
      --flair-orange-bg: #3b2614;
      --flair-gold: #f2cd5c;
      --flair-gold-bg: #352c10;
      --flair-green: #7fd69c;
      --flair-green-bg: #17311f;
      --flair-teal: #6fd9d1;
      --flair-teal-bg: #123230;
      --flair-blue: #8fbdf5;
      --flair-blue-bg: #172a42;
      --flair-purple: #c8a5f5;
      --flair-purple-bg: #2c2140;
      --flair-pink: #f59ac7;
      --flair-pink-bg: #3c1c2d;
    }
    [data-theme="system"][data-accent="tavern"] {
      --accent: #e88a5a;
      --accent-ink: #1a1410;
      --accent-soft: #3b2619;
    }
    [data-theme="system"][data-accent="ocean"] {
      --accent: #74b2f0;
      --accent-ink: #0b1622;
      --accent-soft: #17293e;
    }
    [data-theme="system"][data-accent="forest"] {
      --accent: #67c48f;
      --accent-ink: #0c1a12;
      --accent-soft: #173020;
    }
    [data-theme="system"][data-accent="grape"] {
      --accent: #c39df2;
      --accent-ink: #1a1024;
      --accent-soft: #2e2142;
    }
    [data-theme="system"][data-accent="slate"] {
      --accent: #aeb9c9;
      --accent-ink: #11151b;
      --accent-soft: #262c35;
    }
    [data-theme="system"][data-accent="rose"] {
      --accent: #f28aa8;
      --accent-ink: #1f0d13;
      --accent-soft: #3d1b26;
    }
    [data-theme="system"][data-accent="teal"] {
      --accent: #5fd0c6;
      --accent-ink: #08201e;
      --accent-soft: #133330;
    }
    [data-theme="system"][data-accent="amber"] {
      --accent: #f0b44c;
      --accent-ink: #1e1405;
      --accent-soft: #3a2a12;
    }
    [data-theme="system"][data-accent="indigo"] {
      --accent: #a5a8f8;
      --accent-ink: #11112b;
      --accent-soft: #26264a;
    }
    [data-theme="system"][data-contrast="high"] {
      --bg: #000000;
      --surface: #0a0a0a;
      --surface-2: #1a1a1a;
      --border: #a3a3a3;
      --text: #ffffff;
      --muted: #d6d6d6;
      --ok: #8be0a8;
      --ok-soft: #0c2415;
      --warn: #ffd36b;
      --warn-soft: #2b2208;
      --danger: #ffa199;
      --danger-soft: #300e0c;
      --info: #a8ccff;
      --info-soft: #0d1c31;
      --vote-up: #ffb27a;
      --vote-down: #c7d0ff;
      --like: #ff94a6;
    }
  }
}
/* END generated fallback */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: .9375rem/1.5 var(--font);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .6rem; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .8rem; }
code, pre, .mono { font-family: var(--mono); font-size: .88em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hidden, [hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: .9rem;
  height: 48px; padding: 0 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { display: inline-flex; align-items: center; gap: .45rem; font-weight: 750; font-size: 1.02rem; letter-spacing: -.01em; color: var(--text); white-space: nowrap; }
.brand:hover { text-decoration: none; }
/* The site mark (templates/partials/_brand_mark.html): two mugs clinking. */
.brand-mark { width: 30px; height: 30px; flex: none; overflow: visible; }
.brand-mark .glass, .brand-mark .splash { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.brand-mark .beer { fill: var(--beer); }
.brand-mark .foam { fill: var(--foam); stroke: currentColor; stroke-width: 1.3; stroke-linejoin: round; }
.brand-mark .splash { stroke: var(--beer); stroke-width: 1.8; }
.tabs { display: flex; gap: .1rem; overflow-x: auto; flex: 1; scrollbar-width: none; align-items: center; height: 100%; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .3rem .65rem; border-radius: 999px; color: var(--muted); white-space: nowrap; font-weight: 550; font-size: .93rem;
}
/* Line icons beside the tab names (templates/partials/_tab_icon.html). */
.tab-icon { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
/* Vault and Mail sit at the right end of the bar, next to the account controls (TAB_RIGHT). */
.tabs-spacer { flex: 1 1 .5rem; }
@media (max-width: 640px) {
  .brand-name { display: none; }  /* the mark alone on phones; the link keeps its aria-label */
}
.tabs a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.tabs a.active { background: var(--accent-soft); color: var(--accent); }
.topbar-right { display: flex; align-items: center; gap: .3rem; }
.topbar .avatar { width: 30px; height: 30px; font-size: .8rem; }
.topbar .theme-toggle button, .topbar .bell { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.bell { position: relative; display: inline-flex; padding: .35rem; border-radius: 999px; color: var(--muted); }
.bell:hover { background: var(--surface-2); text-decoration: none; }
.bell .count {
  position: absolute; top: -2px; right: -4px; min-width: 18px; padding: 0 5px;
  background: var(--accent); color: var(--accent-ink); border-radius: 999px; font-size: .7rem; text-align: center;
}
details.menu { position: relative; }
details.menu > summary { list-style: none; cursor: pointer; }
details.menu > summary::-webkit-details-marker { display: none; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 190px; padding: .35rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.menu-panel a, .menu-panel button {
  display: block; width: 100%; text-align: left; padding: .45rem .6rem; border-radius: 6px;
  color: var(--text); background: none; border: 0; font: inherit; cursor: pointer;
}
.menu-panel a:hover, .menu-panel button:hover { background: var(--surface-2); text-decoration: none; }

.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: .85rem;
}
.avatar.lg { width: 64px; height: 64px; font-size: 1.4rem; }

/* ---------- layout ---------- */
.page { max-width: 1180px; margin: 0 auto; padding: var(--page-y) 1rem 3rem; }
.page.narrow { max-width: 760px; }
.page > h1:first-child, .page > .messages + h1 { margin-top: .1rem; }
.grid { display: grid; gap: var(--space); align-items: start; }
.grid.two { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid.stats { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
@media (max-width: 800px) { .grid.two { grid-template-columns: minmax(0, 1fr); } }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: var(--space-s); }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--space); box-shadow: var(--shadow); min-width: 0;
}
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .75rem; }
.card-head h2, .card-head h3 { margin: 0; }
.stat .num { font-size: 1.6rem; font-weight: 700; }
.stat .label { color: var(--muted); font-size: .85rem; }

.banner { padding: .6rem 1rem; text-align: center; background: var(--info-soft); color: var(--info); }
.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.msg { padding: .6rem .85rem; border-radius: 8px; margin-bottom: .4rem; background: var(--info-soft); color: var(--info); }
.msg.success { background: var(--ok-soft); color: var(--ok); }
.msg.error { background: var(--danger-soft); color: var(--danger); }
.msg.warning { background: var(--warn-soft); color: var(--warn); }

/* ---------- forms & buttons ---------- */
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .25rem; }
input:not([type]), input[type=text], input[type=password], input[type=email], input[type=number], input[type=url],
input[type=search], input[type=tel], input[type=date], input[type=datetime-local], select, textarea {
  width: 100%; padding: .55rem .7rem; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: var(--focus-ring) solid var(--accent); outline-offset: 1px;
}
.field { margin-bottom: .9rem; }
.field .help { color: var(--muted); font-size: .82rem; margin-top: .2rem; }
.field .errors, .errorlist { color: var(--danger); font-size: .85rem; margin: .2rem 0 0; padding: 0; list-style: none; }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
.check input { width: auto; }
ul.checks { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; }
ul.checks label { display: flex; gap: .5rem; align-items: center; font-weight: 500; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  padding: .5rem .95rem; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--danger); border-color: var(--danger-soft); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.sm { padding: .3rem .6rem; font-size: .85rem; }
.btn.ghost { border-color: transparent; background: none; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
form.inline { display: inline; }

/* ---------- tables & lists ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: var(--cell-y) .75rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: var(--list-y) 0; border-bottom: 1px solid var(--border); }
.list > li:last-child { border-bottom: 0; }

.pill {
  display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 600;
  background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.pill-ok, .pill-succeeded, .pill-active, .pill-open { background: var(--ok-soft); color: var(--ok); }
.pill-running, .pill-queued, .pill-pending { background: var(--info-soft); color: var(--info); }
.pill-failed, .pill-banned, .pill-revoked { background: var(--danger-soft); color: var(--danger); }
.pill-suspended, .pill-cancelled, .pill-skipped, .pill-expired, .pill-actioned { background: var(--warn-soft); color: var(--warn); }

/* ---------- feed / content ---------- */
.post { display: grid; grid-template-columns: 40px 1fr; gap: .75rem; }
.post .meta { color: var(--muted); font-size: .85rem; }
.post .body { white-space: pre-wrap; overflow-wrap: anywhere; margin: .3rem 0 .5rem; }
.post .actions { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.comments { margin-top: .6rem; padding-left: .75rem; border-left: 2px solid var(--border); }
.comment { font-size: .92rem; margin-bottom: .4rem; overflow-wrap: anywhere; }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }
.stub { border: 1px dashed var(--border); background: var(--surface-2); border-radius: var(--radius); padding: 1rem; color: var(--muted); }

/* ---------- forum ---------- */
a.plain, a.plain:hover { color: inherit; text-decoration: none; }
.text { color: var(--text); }
.pill-accent { background: var(--accent-soft); color: var(--accent); }
.seg { display: inline-flex; gap: .15rem; padding: .2rem; background: var(--surface-2); border-radius: 999px; flex-wrap: wrap; }
.seg a { padding: .25rem .7rem; border-radius: 999px; color: var(--muted); font-weight: 500; }
.seg a:hover { color: var(--text); text-decoration: none; }
.seg a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.community-card { color: inherit; display: flex; flex-direction: column; gap: .3rem; }
.community-card:hover { text-decoration: none; border-color: var(--accent); }
.community-card h2 { margin: 0; }
.community-card p { margin: 0; }
.community-card-title { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.community-card-title h2 { overflow-wrap: anywhere; }
.community-icon {
  display: inline-grid; place-items: center; flex: none; width: 2rem; height: 2rem; border-radius: 50%;
  object-fit: cover; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: .9rem;
}
.community-icon.sm { width: 1.4rem; height: 1.4rem; font-size: .7rem; }
.community-icon.lg { width: 3rem; height: 3rem; font-size: 1.2rem; }
.community-icon.xl { width: 4rem; height: 4rem; font-size: 1.6rem; border: 3px solid var(--surface); }
a.community-link, .community-link { display: inline-flex; align-items: center; gap: .45rem; min-width: 0; }
.community-header { margin-bottom: 1rem; }
.community-banner {
  display: block; width: 100%; height: 160px; object-fit: cover; border-radius: var(--radius);
  background: var(--surface-2);
}
.community-title { display: flex; align-items: center; gap: .75rem; }
.community-title h1 { margin: 0; overflow-wrap: anywhere; }
.community-title-text { min-width: 0; }
.community-header.has-banner .community-title { margin: 0 0 0 1rem; align-items: flex-end; }
.community-header.has-banner .community-icon.xl { margin-top: -2rem; box-shadow: var(--shadow); }
.community-banner-preview { display: block; width: 100%; max-height: 120px; object-fit: cover; border-radius: 8px; margin-bottom: .4rem; }
.danger-zone { border-color: var(--danger-soft); }
input.search-sm { width: 200px; }
@media (max-width: 640px) {
  .community-banner { height: 96px; }
  .community-icon.xl { width: 3.25rem; height: 3.25rem; font-size: 1.3rem; }
  .community-header.has-banner .community-title { margin-left: .6rem; }
  .community-header.has-banner .community-icon.xl { margin-top: -1.6rem; }
  input.search-sm { width: 100%; }
  .row.between > form[role=search] { flex: 1 1 100%; }
}
.thread-list { list-style: none; margin: 0; padding: 0; }
.thread-row { display: flex; gap: .75rem; padding: var(--row-y) var(--space); border-bottom: 1px solid var(--border); align-items: flex-start; }
.thread-row:last-child { border-bottom: 0; }
.thread-row.empty, .thread-list > .empty { display: block; }
.thread-main { min-width: 0; flex: 1; }
.thread-title { color: var(--text); font-weight: 600; font-size: 1.02rem; overflow-wrap: anywhere; }
.thread-title:visited { color: var(--muted); }
.thread-meta { margin-top: .25rem; gap: .4rem; }
.thread-head { display: flex; gap: .75rem; align-items: flex-start; }
.thread-head h1 { margin: 0 0 .25rem; overflow-wrap: anywhere; }
.thread .actions, .reply .actions { gap: .3rem; margin-top: .5rem; align-items: flex-start; }
.vote { display: flex; flex-direction: column; align-items: center; gap: 0; min-width: 2.25rem; margin: 0; }
.vote.vote-inline { flex-direction: row; gap: .1rem; min-width: 0; }
.vote-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 26px; padding: 0;
  border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer;
}
.vote-btn:hover:not([disabled]) { background: var(--surface-2); }
.vote-btn.up.on, .vote-score.up { color: var(--vote-up); }
.vote-btn.down.on, .vote-score.down { color: var(--vote-down); }
.vote-btn[disabled] { cursor: default; opacity: .45; }
.vote-score { font-weight: 700; font-size: .9rem; min-width: 1.5rem; text-align: center; }
.link-box {
  display: flex; flex-direction: column; gap: .1rem; margin: .75rem 0; padding: .6rem .8rem;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); overflow-wrap: anywhere;
}
.link-box:hover { text-decoration: none; border-color: var(--accent); }
.link-domain { font-weight: 600; color: var(--text); }
.link-url { font-size: .85rem; color: var(--muted); }
.forum-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .5rem; margin: .75rem 0; }
.forum-images a { display: block; background: var(--surface-2); border-radius: 8px; overflow: hidden; }
.forum-images img { display: block; width: 100%; height: 180px; object-fit: cover; }
.forum-images.single { grid-template-columns: 1fr; }
.forum-images.single img { height: auto; max-height: 560px; object-fit: contain; }
.md { overflow-wrap: anywhere; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 .6rem; }
.md ul, .md ol { margin: 0 0 .6rem; padding-left: 1.4rem; }
.md blockquote { margin: 0 0 .6rem; padding: .1rem 0 .1rem .8rem; border-left: 3px solid var(--border); color: var(--muted); }
.md code { background: var(--surface-2); padding: .05rem .3rem; border-radius: 4px; }
.md pre { background: var(--code-bg); color: var(--code-text); padding: .7rem .8rem; border-radius: 8px; overflow-x: auto; margin: 0 0 .6rem; }
.md pre code { background: none; padding: 0; color: inherit; }
.replies { margin-top: .5rem; }
.reply { margin-top: .6rem; }
.reply-node > summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; font-size: .88rem; }
.reply-node > summary::-webkit-details-marker { display: none; }
.twisty { display: inline-block; width: 1rem; text-align: center; color: var(--muted); font-family: var(--mono); }
.twisty::before { content: "−"; }
.reply-node:not([open]) > summary .twisty::before { content: "+"; }
.collapsed-note { display: none; }
.reply-node:not([open]) > summary .collapsed-note { display: inline; }
.reply-content { margin-left: .45rem; padding-left: .9rem; border-left: 2px solid var(--border); }
.reply-content:hover { border-left-color: var(--muted); }
.reply-content > .md { margin-top: .2rem; }
.children { margin-top: .1rem; }
.continue { display: inline-block; margin-top: .5rem; font-size: .88rem; font-weight: 600; }
details.inline-form { display: inline-block; }
details.inline-form > summary { list-style: none; }
details.inline-form > summary::-webkit-details-marker { display: none; }
details.inline-form[open] { display: block; flex-basis: 100%; order: 10; }
details.inline-form[open] > summary { background: var(--surface-2); }
details.inline-form form { margin-top: .4rem; }
.reply-compose { margin-bottom: .5rem; }
fieldset.picker { border: 1px solid var(--border); border-radius: 8px; padding: .6rem; }
fieldset.picker legend { font-weight: 600; font-size: .9rem; padding: 0 .3rem; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .5rem; }
.pick { display: flex; flex-direction: column; gap: .2rem; font-weight: 400; cursor: pointer; position: relative; }
.pick img { width: 100%; height: 80px; object-fit: cover; border-radius: 6px; border: 2px solid transparent; background: var(--surface-2); }
.pick input { position: absolute; top: 4px; left: 4px; width: auto; }
.pick input:checked + img { border-color: var(--accent); }
.field ul.radio-list, .field div > div > label { font-weight: 500; }
input[type=radio], input[type=checkbox] { accent-color: var(--accent); }

/* ---------- photos ---------- */
.pgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; }
@media (min-width: 700px) { .pgrid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; } }
.pgrid-strip { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.ptile {
  position: relative; display: block; aspect-ratio: 1; overflow: hidden; background: var(--surface-2);
  border-radius: 4px; color: var(--text);
}
@media (min-width: 700px) { .ptile { border-radius: 8px; } }
.ptile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.ptile:hover img { transform: scale(1.03); }
.ptile:hover { text-decoration: none; }
.ptile-wait { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--muted); font-size: .85rem; }
.ptile-multi, .ptile-stats, .ptile-who {
  position: absolute; background: var(--surface); color: var(--text); border-radius: 6px; opacity: .92;
  font-size: .78rem; font-weight: 600; padding: .1rem .35rem;
}
.ptile-multi { top: 6px; right: 6px; padding: .15rem; display: inline-flex; }
.ptile-stats { left: 6px; bottom: 6px; display: none; }
.ptile:hover .ptile-stats, .ptile:focus-visible .ptile-stats { display: block; }
.ptile-who { left: 6px; bottom: 6px; max-width: calc(100% - 12px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ptile-more { grid-column: 1 / -1; text-align: center; padding: 1rem; }
.album-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(160px, 200px); gap: .75rem; overflow-x: auto; padding: .5rem 0; }
.album-row.wrap { grid-auto-flow: row; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); overflow: visible; }
.album-card { display: flex; flex-direction: column; gap: .2rem; padding: .5rem; color: var(--text); }
.album-card:hover { text-decoration: none; border-color: var(--accent); }
.album-cover { display: block; aspect-ratio: 1; border-radius: 6px; overflow: hidden; background: var(--surface-2); }
.album-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
img.mini, span.mini { width: 48px; height: 48px; border-radius: 6px; object-fit: cover; display: inline-flex; background: var(--surface-2); }
.photo-post { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 860px) { .photo-post { grid-template-columns: minmax(0, 1fr); } }
#post-media { min-width: 0; }
.carousel { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; outline-offset: 2px; }
.slides { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; scrollbar-width: none; }
.slides::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; margin: 0; scroll-snap-align: center; min-width: 0; display: flex; flex-direction: column; }
.slide-media { flex: 1 0 auto; width: 100%; max-height: 78vh; display: flex; align-items: center; justify-content: center; background: var(--surface-2); margin: 0 auto; }
.slide-media img { display: block; width: 100%; height: 100%; max-height: 78vh; object-fit: contain; }
.slide-wait { display: flex; flex-direction: column; align-items: center; gap: .5rem; color: var(--muted); padding: 3rem 1rem; text-align: center; }
.slide-info { display: flex; flex-wrap: wrap; gap: .4rem .6rem; align-items: center; padding: .5rem .75rem; border-top: 1px solid var(--border); }
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .55rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.chip:hover { text-decoration: none; }
.carousel-btn {
  position: absolute; top: 40%; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); opacity: .9; font-size: 1.5rem; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; padding: 0 0 .15rem;
}
.carousel-btn:hover { opacity: 1; }
.carousel-btn.prev { left: .6rem; }
.carousel-btn.next { right: .6rem; }
.carousel-dots { display: flex; justify-content: center; gap: .3rem; padding: .45rem; }
.carousel-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--border); }
.carousel-dots span.on { background: var(--accent); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { :root:not([data-motion="full"]) .spinner { animation: none; } :root:not([data-motion="full"]) .slides { scroll-behavior: auto; } :root:not([data-motion="full"]) .ptile img { transition: none; } }
.photo-side .md { overflow-wrap: anywhere; }
.photo-comments { max-height: 50vh; overflow-y: auto; }
.photo-comments .comment { margin-bottom: .6rem; }
.comment-meta { display: flex; gap: .6rem; align-items: center; margin-top: .1rem; }
button.linkish { border: 0; background: none; padding: 0; font: inherit; color: var(--muted); cursor: pointer; font-weight: 600; }
button.linkish:hover { color: var(--text); text-decoration: underline; }
.like-form { display: inline-flex; align-items: center; gap: .4rem; margin: 0; }
.like-btn { border: 0; background: none; padding: .2rem; cursor: pointer; color: var(--text); display: inline-flex; border-radius: 6px; }
.like-btn:hover { background: var(--surface-2); }
.like-btn.on { color: var(--like); }
.like-count { font-weight: 600; }
.preview-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: .4rem; margin-top: .5rem; }
.preview-strip img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; background: var(--surface-2); }
.preview-strip .warn { grid-column: 1 / -1; color: var(--danger); font-size: .85rem; }


.progress { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); }

/* ---------- chat ---------- */
.page.chat-page { max-width: none; padding: 0; }
.chat-app {
  display: grid; grid-template-columns: 64px 240px minmax(0, 1fr); height: calc(100dvh - 53px);
  position: relative; background: var(--bg); overflow: hidden;
}
.chat-app.has-panel { grid-template-columns: 64px 240px minmax(0, 1fr) 340px; }
.chat-rail { display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: .6rem 0; background: var(--surface-2); border-right: 1px solid var(--border); overflow-y: auto; }
.chat-rail hr { width: 32px; margin: .1rem 0; }
.rail-item {
  position: relative; width: 44px; height: 44px; border-radius: 14px; border: 0; cursor: pointer; flex: none;
  background: var(--surface); color: var(--text); font-weight: 700; font-size: .9rem; box-shadow: var(--shadow);
}
.rail-item:hover, .rail-item.active { background: var(--accent); color: var(--accent-ink); border-radius: 12px; }
.rail-item.add { color: var(--accent); font-size: 1.4rem; }
.rail-item .chat-badge { position: absolute; right: -4px; bottom: -4px; }
.chat-dot { position: absolute; left: -6px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: var(--text); }
.chat-side { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-right: 1px solid var(--border); }
.chat-side-head { display: flex; flex-direction: column; gap: .35rem; padding: .6rem .75rem; border-bottom: 1px solid var(--border); min-height: 52px; justify-content: center; }
.side-title { display: flex; align-items: center; justify-content: space-between; gap: .4rem; min-width: 0; }
.side-title strong, .chat-side-head > strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-tools .chat-level { width: 100%; }
.chat-side-list { flex: 1; overflow-y: auto; padding: .4rem; }
.chat-cat { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: .8rem .5rem .25rem; }
.chat-chan { display: flex; align-items: center; gap: .4rem; padding: .32rem .5rem; border-radius: 6px; color: var(--muted); }
.chat-chan:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.chat-chan.active { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.chat-chan.unread { color: var(--text); font-weight: 700; }
.chat-chan.muted-ch { opacity: .6; }
.chan-icon { width: 1.1rem; text-align: center; flex: none; }
.chan-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-badge { min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--surface-2); color: var(--text); font-size: .7rem; font-weight: 700; text-align: center; line-height: 18px; }
.chat-badge.mention { background: var(--danger); color: var(--surface); }
.chat-me { display: flex; align-items: center; gap: .45rem; padding: .6rem .75rem; border-top: 1px solid var(--border); background: var(--surface-2); }
.presence { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--border); border: 2px solid var(--surface); box-sizing: content-box; }
.presence.online { background: var(--ok); }
.presence.idle, .presence.away { background: var(--warn); }
.voice-afk-tag { margin-left: .35rem; padding: 0 .3rem; border-radius: 4px; font-size: .68rem; font-weight: 650; letter-spacing: .03em; color: var(--muted); border: 1px solid var(--border); line-height: 1.35; }
.voice-afk-back { white-space: nowrap; }
.voice-dock-back { width: 100%; margin-top: .35rem; overflow: hidden; text-overflow: ellipsis; }
.pad { padding: .75rem; }
.pad-x { padding: 0 .75rem; }
.chat-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.chat-main.drop::after { content: "Drop files to attach"; position: absolute; inset: 8px; border: 2px dashed var(--accent); border-radius: var(--radius); display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.chat-head { display: flex; align-items: center; gap: .5rem; padding: .55rem .75rem; border-bottom: 1px solid var(--border); background: var(--surface); min-height: 52px; }
.chat-title { flex: 1; min-width: 0; display: flex; gap: .6rem; align-items: baseline; overflow: hidden; white-space: nowrap; }
.chat-title .muted { overflow: hidden; text-overflow: ellipsis; }
.chat-tools { display: flex; gap: .2rem; align-items: center; }
.chat-level { width: auto; padding: .25rem .4rem; font-size: .8rem; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 32px; padding: 0 .3rem; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; font-size: 1rem; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.chat-nav-toggle { display: none; }
.chat-status { padding: .4rem .75rem; background: var(--warn-soft); color: var(--warn); font-size: .85rem; }
.chat-scroll { flex: 1; overflow-y: auto; padding: .5rem 0 .75rem; }
.chat-more { text-align: center; color: var(--muted); font-size: .85rem; padding: .75rem; }
.cmsg { position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr); column-gap: .7rem; padding: .35rem 1rem .15rem; }
.cmsg:hover { background: var(--surface-2); }
.cmsg.grouped { padding-top: 0; }
.cmsg.grouped > .avatar, .cmsg.grouped .msg-head { display: none; }
.cmsg.grouped .msg-body { grid-column: 2; }
.cmsg.mentions-me { background: var(--warn-soft); box-shadow: inset 3px 0 0 var(--warn); }
.cmsg.flash { background: var(--accent-soft); transition: background .3s; }
.msg-replyto { grid-column: 2; cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cmsg > .avatar { margin-top: .15rem; }
.msg-body { min-width: 0; }
.msg-head { display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; }
.msg-text { overflow-wrap: anywhere; }
.msg-text p { margin: 0 0 .25rem; }
.mention { background: var(--accent-soft); color: var(--accent); border-radius: 4px; padding: 0 .2rem; font-weight: 600; }
.msg-files { display: flex; flex-wrap: wrap; gap: .4rem; margin: .3rem 0; align-items: flex-start; }
.msg-image img { display: block; max-width: 100%; height: auto; border-radius: 8px; object-fit: cover; background: var(--surface-2); }
.msg-file { display: inline-flex; gap: .6rem; align-items: center; padding: .45rem .7rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); }
.msg-card { display: flex; flex-direction: column; gap: .1rem; max-width: 460px; margin: .35rem 0; padding: .5rem .75rem; border-left: 3px solid var(--accent); border-radius: 6px; background: var(--surface); color: var(--text); }
.msg-card:hover { text-decoration: none; background: var(--surface-2); }
.msg-reactions { display: flex; flex-wrap: wrap; gap: .3rem; margin: .25rem 0; }
.reaction { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: .05rem .5rem; font: inherit; font-size: .85rem; cursor: pointer; }
.reaction.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.thread-link { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; }
.msg-actions { position: absolute; right: .75rem; top: -14px; display: none; gap: .1rem; padding: .1rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); z-index: 2; }
.cmsg:hover .msg-actions, .cmsg:focus-within .msg-actions, .cmsg.show-actions .msg-actions { display: flex; }
/* "Alice is typing…": the line keeps its height when empty so the messages don't jump */
.chat-typing { display: flex; align-items: center; gap: .45rem; min-height: 1.5rem; padding: 0 1rem; line-height: 1.5rem; overflow: hidden; }
.chat-typing .typing-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-typing strong { color: var(--text); font-weight: 600; }
.typing-dots { display: inline-flex; align-items: center; gap: 3px; flex: none; height: 1rem; }
.typing-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); opacity: .35; animation: typing-dot 1.2s ease-in-out infinite; }
.typing-dots i:nth-child(2) { animation-delay: .15s; }
.typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes typing-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .35; } 30% { transform: translateY(-4px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { :root:not([data-motion="full"]) .typing-dots i { animation: none; opacity: .8; } }
html[data-motion="reduce"] .typing-dots i { animation: none; opacity: .8; }
.chat-composer { padding: 0 .75rem .75rem; position: relative; }
.chat-composer-bar { display: flex; justify-content: space-between; align-items: center; padding: .3rem .6rem; background: var(--surface-2); border-radius: 8px 8px 0 0; }
.chat-input-row { display: flex; align-items: flex-end; gap: .3rem; padding: .35rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.chat-input-row textarea { border: 0; padding: .4rem; resize: none; max-height: 200px; background: transparent; }
.chat-input-row textarea:focus { outline: none; }
.chat-input-row:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.chat-files { display: flex; flex-wrap: wrap; gap: .4rem; }
.chat-files:not(:empty) { padding: .4rem 0; }
.file-chip { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .3rem .2rem .5rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); max-width: 220px; }
.file-chip img { width: 32px; height: 32px; object-fit: cover; border-radius: 4px; }
.file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-suggest { position: absolute; left: .75rem; right: .75rem; bottom: 100%; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); overflow: hidden; }
.suggest-item { text-align: left; border: 0; background: none; padding: .45rem .7rem; color: var(--text); font: inherit; cursor: pointer; }
.suggest-item:hover, .suggest-item:focus, .suggest-item.active { background: var(--surface-2); }
/* "/" in the chat box: /hal and its commands (chat.js slashSuggest) */
.chat-suggest.slash { max-height: min(46vh, 22rem); overflow-y: auto; }
.suggest-cmd { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.suggest-cmd.active { box-shadow: inset 3px 0 0 var(--accent); }
.suggest-name { font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace); font-weight: 600; white-space: nowrap; }
.suggest-args { font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace); color: var(--muted); font-size: .85em; }
.suggest-hint { flex: 1 1 12rem; }
.suggest-group { padding: .35rem .7rem .1rem; text-transform: uppercase; letter-spacing: .04em; font-size: .7rem; }
/* voice: the stage (video grid) sits above the channel's text chat; the connection bar and the
   participant tree are in the sidebar. A speaking participant's mic icon, avatar and tile light
   up in --ok; muted is --danger, server-muted is --warn. */
.vi { width: 1em; height: 1em; flex: none; vertical-align: -.15em; }
.chat-main.voice-view .chat-voice { flex: 3 1 0; }
.chat-main.voice-view .chat-scroll { flex: 2 1 0; border-top: 1px solid var(--border); }
.chat-main.voice-solo .chat-scroll, .chat-main.voice-solo .chat-typing, .chat-main.voice-solo .chat-composer { display: none; }
/* a focused camera or screen share: the stage takes most of the column, the chat stays usable below */
.chat-main.voice-view.voice-theater .chat-voice { flex: 5 1 0; }
.chat-main.voice-view.voice-theater .chat-scroll { flex: 1 1 0; min-height: 90px; }
.chat-voice { display: flex; flex-direction: column; min-height: 0; gap: .5rem; padding: .6rem .75rem; background: var(--surface-2); }
.chat-voice.is-here { box-shadow: inset 3px 0 0 var(--ok); }
.voice-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.voice-head-title { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: .6rem; }
.voice-head-title strong { font-size: 1.05rem; white-space: nowrap; }
.voice-state { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.voice-join { font-size: 1rem; padding: .55rem 1.3rem; }
.voice-elsewhere { color: var(--muted); }
.voice-here-pill { display: inline-flex; align-items: center; gap: .35rem; padding: .05rem .5rem; border-radius: 999px; background: var(--ok-soft); color: var(--ok); font-size: .72rem; font-weight: 700; white-space: nowrap; }
.voice-here-pill.lg { font-size: .85rem; padding: .3rem .75rem; }
.voice-grid { flex: 1; min-height: 120px; display: grid; gap: .5rem; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); grid-auto-rows: minmax(120px, 1fr); overflow-y: auto; align-content: center; }
.voice-grid[data-count="1"] { grid-template-columns: minmax(0, 720px); justify-content: center; }
.voice-grid.has-focus { grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); grid-template-rows: minmax(160px, 1fr); grid-auto-rows: 96px; align-content: stretch; }
.voice-grid.has-focus .voice-tile { min-height: 0; }
.voice-grid.has-focus .voice-tile.focus { grid-column: 1 / -1; grid-row: 1; }
.voice-grid.has-focus .voice-tile:not(.focus) .voice-avatar { width: 40px; height: 40px; font-size: 1.1rem; }
/* nobody has video: light cards instead of black boxes */
.chat-main.voice-view.voice-compact:not(.voice-solo) .chat-voice { flex: 0 1 auto; max-height: 62%; }
.voice-grid.audio-only { flex: 0 1 auto; grid-auto-rows: 132px; grid-template-columns: repeat(auto-fit, minmax(150px, 190px)); justify-content: center; align-content: center; }
.voice-grid.audio-only[data-count="1"] { grid-template-columns: minmax(0, 260px); }
.voice-grid.audio-only .voice-tile { background: var(--surface); color: var(--text); border: 1px solid var(--border); min-height: 0; place-items: start center; padding-top: 18px; }
.voice-grid.audio-only .voice-name { background: none; color: var(--text); padding: 0; }
.voice-grid.audio-only .voice-label { justify-content: center; }
.voice-grid.audio-only .voice-label .voice-status { background: none; }
.voice-grid.audio-only .voice-status .st-mic, .voice-grid.audio-only .voice-status .st-badge { color: var(--muted); }
.voice-grid.audio-only .voice-tile .voice-q i { background: var(--border); }
.voice-grid.audio-only .voice-tile-tools .icon-btn { background: var(--surface-2); color: var(--text); }
.voice-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .45rem; text-align: center; padding: 1rem; border: 2px dashed var(--border); border-radius: var(--radius); color: var(--text); }
.voice-empty-icon { width: 2.4rem; height: 2.4rem; color: var(--muted); }
.voice-tile { position: relative; display: grid; place-items: center; overflow: hidden; min-height: 120px; border-radius: var(--radius); background: var(--code-bg); color: var(--code-text); outline: 3px solid transparent; outline-offset: -3px; cursor: pointer; transition: outline-color .12s, box-shadow .12s; }
.voice-tile:focus-visible { outline-color: var(--accent); }
.voice-tile.speaking { outline: 4px solid var(--ok); outline-offset: -4px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 35%, transparent), 0 0 18px color-mix(in srgb, var(--ok) 45%, transparent); }
.voice-tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: none; background: var(--code-bg); }
.voice-tile.has-video video { display: block; }
.voice-tile.mirror video { transform: scaleX(-1); }
.voice-tile.has-video .voice-avatar { display: none; }
.voice-tile.roster { cursor: default; opacity: .85; }
/* full screen: the grid is the full-screen element and the chosen tile (.fs) fills it; the rest wait underneath (voice.js) */
/* 2026-11-16: this file and voice.js were changed once more so they get new names; the names from the deploy before were
   answered 404 for a moment and browsers kept that answer (deploy/caddy/socialsite.caddy no longer lets them). */
.voice-grid:fullscreen { display: block; position: relative; width: 100vw; height: 100vh; padding: 0; margin: 0; background: black; overflow: hidden; }
.voice-grid:fullscreen .voice-tile, .voice-grid:fullscreen .voice-empty { display: none; }
.voice-grid:fullscreen .voice-tile.fs { display: grid; position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; border-radius: 0; outline: 0; box-shadow: none; background: black; cursor: default; }
.voice-grid:fullscreen .voice-tile.fs video { background: black; }
.voice-grid:fullscreen::backdrop { background: black; }
.voice-avatar { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-size: 1.6rem; font-weight: 700; transition: box-shadow .12s; }
.voice-tile.speaking .voice-avatar { box-shadow: 0 0 0 4px var(--ok); }
.voice-label { position: absolute; left: .4rem; bottom: .4rem; right: .4rem; display: flex; align-items: center; gap: .35rem; pointer-events: none; }
.voice-label > * { flex: none; }
.voice-name { max-width: 100%; flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: .1rem .45rem; border-radius: 6px; background: var(--backdrop); color: var(--code-text); font-size: .82rem; font-weight: 600; }
.voice-label .voice-status { padding: .15rem .3rem; border-radius: 6px; background: var(--backdrop); }
.voice-tile-tools { position: absolute; top: .35rem; right: .35rem; display: flex; gap: .2rem; opacity: 0; transition: opacity .15s; }
.voice-tile:hover .voice-tile-tools, .voice-tile:focus-within .voice-tile-tools { opacity: 1; }
.voice-tile-tools .icon-btn { background: var(--backdrop); color: var(--code-text); }
.voice-float { position: absolute; left: 50%; bottom: 30%; font-size: 2.2rem; animation: voice-float 2.2s ease-out forwards; pointer-events: none; }
@keyframes voice-float { from { transform: translate(-50%, 0) scale(.6); opacity: 0; } 15% { opacity: 1; transform: translate(-50%, -10px) scale(1.1); } to { transform: translate(-50%, -90px) scale(1); opacity: 0; } }
.voice-controls { display: flex; align-items: center; justify-content: center; gap: .4rem; flex-wrap: wrap; }
.voice-note { text-align: center; margin: 0; }
.voice-btn { min-width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 1.15rem; cursor: pointer; display: inline-grid; place-items: center; padding: 0 .55rem; transition: box-shadow .12s, background .12s; }
.voice-btn:hover:not(:disabled) { background: var(--accent-soft); }
.voice-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.voice-btn:disabled { opacity: .45; cursor: not-allowed; }
.voice-btn.off { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-soft); }
.voice-btn.locked { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-soft); opacity: 1; }
.voice-btn.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.voice-btn.leave { background: var(--danger); color: var(--surface); border-color: var(--danger); }
.voice-btn.voice-mic.speaking { background: var(--ok); color: var(--surface); border-color: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 35%, transparent), 0 0 12px color-mix(in srgb, var(--ok) 55%, transparent); }
.voice-reacts { display: inline-flex; gap: 1px; padding: 0 .3rem; border-left: 1px solid var(--border); border-right: 1px solid var(--border); margin: 0 .2rem; }
.voice-react { width: 38px; height: 38px; border: 0; background: none; border-radius: 8px; font-size: 1.25rem; cursor: pointer; }
.voice-react:hover, .voice-react:focus-visible { background: var(--surface-2); }
.chat-popover.voice-menu.voice-react-menu { flex-direction: row; min-width: 0; max-width: none; gap: 2px; }
/* push to talk: hold with a finger or the mouse */
.voice-ptt-hold { display: inline-flex; align-items: center; gap: .4rem; height: 40px; border-radius: 999px; padding: 0 1rem; font-weight: 700; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.voice-ptt-hold .vi { width: 1.15rem; height: 1.15rem; }
.voice-ptt-hold.down { background: var(--ok); color: var(--surface); border-color: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 35%, transparent); }
.voice-q { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
button.voice-q { box-sizing: content-box; border: 0; background: none; padding: 4px 3px; margin: -4px -3px; border-radius: 4px; cursor: pointer; }
button.voice-q:hover, button.voice-q:focus-visible { background: color-mix(in srgb, var(--ok) 18%, transparent); }
.voice-q i { width: 3px; border-radius: 1px; background: var(--border); }
.voice-tile .voice-q i { background: var(--muted); }
.voice-q i:nth-child(1) { height: 4px; } .voice-q i:nth-child(2) { height: 8px; } .voice-q i:nth-child(3) { height: 12px; }
.voice-q.q-excellent i, .voice-q.q-good i:nth-child(-n+2) { background: var(--ok); }
.voice-q.q-poor i:nth-child(1) { background: var(--warn); }
.voice-q.q-lost i:nth-child(1) { background: var(--danger); }
.voice-meter { display: block; height: 4px; border-radius: 2px; background: var(--border); overflow: hidden; }
.voice-meter i { display: block; height: 100%; width: 0; background: var(--ok); transition: width .06s linear; }
.voice-meter.lg { flex: 1; height: 10px; border-radius: 5px; position: relative; }
.voice-gate-mark { position: absolute; top: -2px; bottom: -2px; width: 2px; margin-left: -1px; background: var(--danger); border-radius: 1px; }
.voice-gate-row input[type=range] { width: 100%; }
.voice-dialog input[type=range], .voice-menu input[type=range] { accent-color: var(--accent); }
/* call stats panel and the connection test */
.chat-popover.voice-stats { display: block; width: min(380px, calc(100vw - 24px)); padding: .6rem .7rem; }
.voice-stats-head { justify-content: space-between; margin-bottom: .3rem; }
.voice-stats-table { width: 100%; border-collapse: collapse; }
.voice-stats-table th { text-align: left; font-weight: 500; color: var(--muted); padding: .18rem .5rem .18rem 0; white-space: nowrap; vertical-align: top; }
.voice-stats-table td { padding: .18rem 0; overflow-wrap: anywhere; }
.voice-stats-table td.path-lan, .voice-stats-table td.path-udp { color: var(--ok); font-weight: 600; }
.voice-stats-table td.path-tcp, .voice-stats-table td.path-relay { color: var(--warn); font-weight: 600; }
.voice-stats-table td.bad { color: var(--danger); font-weight: 600; }
.voice-stats-tip { margin: .4rem 0; }
.voice-stats-actions { gap: .4rem; flex-wrap: wrap; }
.voice-test-results { margin-top: .5rem; }
.voice-test-list { margin: 0 0 .5rem; padding: 0; list-style: none; display: flex; flex-direction: column; gap: .35rem; }
.voice-test-list > li { display: grid; grid-template-columns: 1.4rem 1fr; column-gap: .3rem; }
.voice-test-mark { grid-row: span 2; font-weight: 800; text-align: center; color: var(--muted); }
.voice-test-list > li.ok .voice-test-mark { color: var(--ok); }
.voice-test-list > li.fail .voice-test-mark { color: var(--danger); }
.voice-test-list > li.run .voice-test-mark { color: var(--accent); }
.voice-test-logs { margin: .1rem 0 0; padding-left: 1rem; overflow-wrap: anywhere; }
.voice-test-logs .lvl-warning { color: var(--warn); }
.voice-test-logs .lvl-error { color: var(--danger); }
.voice-test-verdict { padding: .5rem .65rem; border-radius: 8px; background: var(--surface-2); }
.voice-test-verdict.good { background: var(--ok-soft); }
.voice-test-verdict.warn { background: var(--warn-soft); }
.voice-test-verdict.bad { background: var(--danger-soft); }
.voice-test-verdict:empty { display: none; }
.voice-test-row { display: flex; align-items: center; gap: .6rem; margin-bottom: .3rem; }
.voice-key-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin: .3rem 0; }
/* status icons: neutral mic, lit while speaking; muted red; server-muted orange; badges */
.voice-status { display: inline-flex; align-items: center; gap: .3rem; flex: none; }
.voice-status .vi { width: 15px; height: 15px; }
.voice-status .st-mic { color: var(--muted); border-radius: 50%; padding: 2px; box-sizing: content-box; margin: -2px; transition: background .12s, color .12s, box-shadow .12s; }
.voice-tile .voice-status .st-mic { color: var(--code-text); }
.speaking .voice-status .st-mic { color: var(--surface); background: var(--ok); box-shadow: 0 0 0 2px color-mix(in srgb, var(--ok) 35%, transparent), 0 0 10px var(--ok); }
.voice-status .st-off { color: var(--danger); }
.voice-status .st-locked { color: var(--warn); }
.voice-status .st-badge { color: var(--info); }
.voice-tile .voice-status .st-badge { color: var(--code-text); }
.voice-live { font-size: .6rem; font-weight: 800; letter-spacing: .04em; padding: 0 .3rem; border-radius: 4px; background: var(--danger); color: var(--surface); line-height: 1.5; }
/* the sidebar: connected channel, participant tree, connection bar */
.chat-chan.voice-connected { position: relative; background: var(--ok-soft); color: var(--text); font-weight: 700; box-shadow: inset 3px 0 0 var(--ok); }
.chat-chan.voice-connected .chan-icon { color: var(--ok); }
.chat-chan.voice-connected.voice-active .chan-icon .vi { animation: voice-pulse 1s ease-in-out infinite; }
@keyframes voice-pulse { 50% { transform: scale(1.18); } }
.chat-chan .voice-count { margin-left: auto; color: var(--muted); }
.chat-chan.drop-target { outline: 2px dashed var(--accent); outline-offset: -2px; background: var(--accent-soft); }
.voice-people { position: relative; display: flex; flex-direction: column; gap: 1px; margin: 0 0 .35rem 1.15rem; padding-left: .8rem; }
.voice-people::before { content: ""; position: absolute; left: 0; top: 0; bottom: .9rem; border-left: 2px solid var(--border); }
.voice-people.is-here::before { border-left-color: var(--ok); }
.voice-person { position: relative; display: flex; align-items: center; gap: .4rem; padding: .12rem .35rem; border-radius: 6px; color: var(--muted); min-height: 28px; border: 0; background: none; font: inherit; text-align: left; }
.voice-person::before { content: ""; position: absolute; left: -.8rem; top: 50%; width: .65rem; border-top: 2px solid var(--border); }
.voice-people.is-here .voice-person::before { border-top-color: var(--ok); }
.voice-person:hover { background: var(--surface-2); color: var(--text); }
.voice-person[draggable="true"] { cursor: grab; }
.voice-more-people { cursor: pointer; color: var(--accent); font-weight: 600; }
.voice-person-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-dot { width: 20px; height: 20px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: .66rem; font-weight: 700; background: var(--surface-2); color: var(--text); box-shadow: 0 0 0 2px transparent; transition: box-shadow .12s; }
.voice-person.speaking .voice-dot { box-shadow: 0 0 0 2px var(--ok); }
.voice-person.speaking .voice-person-name { color: var(--text); }
/* the options button sits over the status icons on hover, so every row's icons line up */
.voice-more { position: absolute; right: .2rem; top: 50%; transform: translateY(-50%); opacity: 0; min-width: 24px; height: 24px; background: var(--surface-2); }
.voice-person:hover .voice-more, .voice-more:focus-visible { opacity: 1; }
.voice-dock { border-top: 2px solid var(--ok); padding: .5rem .6rem .55rem; background: var(--ok-soft); display: flex; flex-direction: column; gap: .4rem; }
.voice-dock.is-connecting { border-top-color: var(--warn); background: var(--warn-soft); }
.voice-conn { display: flex; align-items: center; gap: .5rem; min-width: 0; color: var(--text); }
.voice-conn-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; color: var(--text); border-radius: 6px; padding: .1rem .3rem; margin: -.1rem -.3rem; }
.voice-conn-text:hover { text-decoration: none; background: color-mix(in srgb, var(--ok) 12%, transparent); }
.voice-conn-state { color: var(--ok); font-size: .85rem; }
.voice-dock.is-connecting .voice-conn-state { color: var(--warn); }
.voice-conn-where { font-size: .78rem; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-dock-btns { display: flex; gap: .25rem; justify-content: space-between; }
.voice-dock-btns .voice-btn { min-width: 32px; width: 32px; height: 32px; font-size: 1rem; padding: 0; }
.voice-mini { display: none; }
.voice-mini-btns { display: flex; gap: .3rem; flex: none; }
.voice-share-banner { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .4rem .75rem; background: var(--danger-soft); color: var(--danger); border-bottom: 1px solid var(--border); }
.voice-share-banner .vi { width: 1.2rem; height: 1.2rem; }
.voice-share-banner .small { color: var(--text); flex: 1; min-width: 8rem; }
.chat-popover.voice-menu { display: flex; flex-direction: column; min-width: 220px; max-width: 280px; padding: .3rem; }
.voice-menu-title { padding: .35rem .6rem .2rem; font-weight: 700; }
.voice-menu-item { text-align: left; border: 0; background: none; padding: .45rem .6rem; border-radius: 6px; color: var(--text); font: inherit; cursor: pointer; }
.voice-menu-item:hover, .voice-menu-item:focus-visible { background: var(--surface-2); }
.voice-menu-item.danger { color: var(--danger); }
.voice-menu-vol { display: flex; flex-direction: column; gap: .2rem; padding: .35rem .6rem; }
.voice-dialog { width: min(460px, calc(100vw - 32px)); max-height: calc(100vh - 32px); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.voice-dialog::backdrop { background: var(--backdrop); }
.voice-dialog header { justify-content: space-between; }
.voice-dialog h2 { margin: 0; font-size: 1.15rem; }
.voice-dialog h3 { margin: 1rem 0 .4rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.voice-settings-body .field { display: flex; flex-direction: column; gap: .25rem; margin-bottom: .6rem; }
.voice-settings-body .check { margin-bottom: .35rem; }
@media (prefers-reduced-motion: reduce) {
  :root:not([data-motion="full"]) :is(.voice-float, .chat-chan.voice-connected.voice-active .chan-icon .vi) { animation: none; }
  :root:not([data-motion="full"]) :is(.voice-tile, .voice-btn, .voice-dot, .voice-status .st-mic, .voice-meter i) { transition: none; }
}
html[data-motion="reduce"] :is(.voice-float, .chat-chan.voice-connected.voice-active .chan-icon .vi, .spinner) { animation: none; }
.chat-panel { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-left: 1px solid var(--border); }
.chat-panel-head { display: flex; justify-content: space-between; align-items: center; padding: .55rem .75rem; border-bottom: 1px solid var(--border); min-height: 52px; }
.chat-panel-body { flex: 1; overflow-y: auto; padding-bottom: .5rem; }
.chat-panel .cmsg { padding-left: .75rem; padding-right: .75rem; }
.thread-composer { padding-top: .5rem; border-top: 1px solid var(--border); }
.member-row { display: flex; align-items: center; gap: .5rem; padding: .3rem .75rem; }
.member-row > span:nth-child(2) { flex: 1; font-weight: 600; }
.search-hit { cursor: pointer; border-bottom: 1px solid var(--border); padding-top: .4rem; }
.chat-popover { position: absolute; z-index: 30; display: grid; grid-template-columns: repeat(8, 36px); gap: 2px; padding: .4rem; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); }
.emoji-btn { width: 36px; height: 36px; border: 0; background: none; border-radius: 6px; font-size: 1.25rem; cursor: pointer; }
.emoji-btn:hover, .emoji-btn:focus { background: var(--surface-2); }
@media (max-width: 1100px) {
  .chat-app.has-panel { grid-template-columns: 64px 240px minmax(0, 1fr); }
  .chat-app.has-panel .chat-panel { position: absolute; right: 0; top: 0; bottom: 0; width: min(360px, 100%); z-index: 20; box-shadow: var(--shadow); }
}
@media (max-width: 800px) {
  .chat-app, .chat-app.has-panel { grid-template-columns: minmax(0, 1fr); }
  .chat-rail, .chat-side { display: none; }
  .chat-app[data-view="nav"] { grid-template-columns: 64px minmax(0, 1fr); }
  .chat-app[data-view="nav"] .chat-rail, .chat-app[data-view="nav"] .chat-side { display: flex; }
  .chat-app[data-view="nav"] .chat-main { display: none; }
  .chat-nav-toggle { display: inline-flex; }
  .chat-app.has-panel .chat-panel { width: 100%; }
  .cmsg { padding-left: .6rem; padding-right: .6rem; column-gap: .5rem; }
  .msg-actions { right: .3rem; }
  .chat-title .muted { display: none; }
  .chat-head .chat-level { max-width: 108px; }
  .chat-tools .icon-btn { min-width: 28px; }
  .voice-mini:not([hidden]) { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .4rem .75rem; background: var(--ok-soft); border-bottom: 2px solid var(--ok); }
  .voice-mini .voice-conn { flex: 1; }
  .voice-mini .voice-btn { min-width: 34px; width: 34px; height: 34px; padding: 0; font-size: 1rem; }
  .voice-head-title { flex-basis: 100%; }
  .voice-state { flex: 1; }
  .chat-main.voice-view .chat-voice { flex: 0 0 auto; height: 52vh; }
  .chat-main.voice-solo .chat-voice { flex: 1 1 auto; height: auto; }
  .chat-main.voice-view.voice-theater .chat-voice { flex: 0 0 auto; height: 64vh; }
  .voice-grid { grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr)); grid-auto-rows: minmax(96px, 1fr); }
  .chat-main.voice-view.voice-compact:not(.voice-solo) .chat-voice { height: auto; max-height: 56vh; }
  .voice-grid.audio-only { grid-auto-rows: 112px; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); }
  /* focus: the big tile on top, everyone else in a strip of small tiles under it */
  .voice-grid.has-focus { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); grid-template-rows: minmax(0, 1fr) 68px; grid-auto-rows: 68px; }
  .voice-grid.has-focus .voice-tile:not(.focus) { place-items: start center; padding-top: 6px; }
  .voice-grid.has-focus .voice-tile:not(.focus) .voice-avatar { width: 30px; height: 30px; font-size: .9rem; }
  .voice-grid.has-focus .voice-tile:not(.focus) .voice-name { font-size: .7rem; }
  .voice-grid.has-focus .voice-tile:not(.focus) .voice-label { left: .2rem; right: .2rem; bottom: .2rem; justify-content: center; }
  .voice-grid.has-focus .voice-tile:not(.focus) .voice-icons, .voice-grid.has-focus .voice-tile:not(.focus) .voice-q { display: none; }
  .voice-controls { gap: .3rem; }
  .voice-controls .voice-btn { min-width: 38px; height: 38px; }
}

/* ---------- news ---------- */
.news-top { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.news-h1 { margin: 0; flex: 1; }
.news-h1 a { color: var(--text); }
.news-h1 a:hover { text-decoration: none; }
.news-search input { width: 220px; }
.news-help-btn { min-width: 2.2rem; font-weight: 700; }
.news-shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 1rem; align-items: start; }
.news-nav { position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow-y: auto; padding: .4rem; }
.news-nav-views { display: flex; flex-direction: column; gap: 1px; }
.news-nav-head { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: .7rem .5rem .3rem; cursor: pointer; }
.news-nav-link { display: flex; align-items: center; gap: .45rem; padding: .35rem .5rem; border-radius: 6px; color: var(--text); min-width: 0; }
.news-nav-link:hover { background: var(--surface-2); text-decoration: none; }
.news-nav-link.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.news-nav-label, .news-nav-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.news-nav-link.indent { padding-left: 1.4rem; }
.news-nav-foot { border-top: 1px solid var(--border); margin-top: .4rem; padding: .5rem; }
.news-count { min-width: 1.4rem; padding: 0 .35rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: .72rem; font-weight: 700; text-align: center; }
.news-nav-link.active .news-count { background: var(--accent); color: var(--accent-ink); }
.news-badge { width: 2rem; height: 2rem; flex: none; border-radius: 8px; display: grid; place-items: center; font-weight: 800; font-size: .95rem; }
.news-badge.sm { width: 1.3rem; height: 1.3rem; border-radius: 5px; font-size: .7rem; }
.news-badge.lg { width: 3rem; height: 3rem; border-radius: 12px; font-size: 1.4rem; }
.news-badge.b0 { background: var(--accent-soft); color: var(--accent); }
.news-badge.b1 { background: var(--info-soft); color: var(--info); }
.news-badge.b2 { background: var(--ok-soft); color: var(--ok); }
.news-badge.b3 { background: var(--warn-soft); color: var(--warn); }
.news-badge.b4 { background: var(--danger-soft); color: var(--danger); }
.news-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: .75rem; }
.news-head h2 { margin: 0; }
.news-head p { margin: .15rem 0 0; }
.news-sub { margin: 1rem 0 .5rem; font-size: 1rem; }
.news-list { list-style: none; margin: 0; padding: 0; }
.news-row { display: flex; gap: .75rem; padding: .8rem 1rem; border-bottom: 1px solid var(--border); outline: none; }
.news-list .news-row:last-child { border-bottom: 0; }
.news-row.is-current { box-shadow: inset 3px 0 0 var(--accent); background: var(--surface-2); }
.news-row-main { flex: 1; min-width: 0; }
.news-title { font-weight: 700; color: var(--text); font-size: 1.02rem; line-height: 1.35; overflow-wrap: anywhere; }
.news-title:visited { color: var(--text); }
.news-row.is-read .news-title { font-weight: 500; color: var(--muted); }
.news-row.is-read .news-badge { opacity: .55; }
.news-meta { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .15rem; }
.news-snippet { margin: .35rem 0 0; color: var(--muted); font-size: .9rem; line-height: 1.45; overflow-wrap: anywhere; }
.news-row.is-read .news-snippet { display: none; }
.news-actions { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .45rem; align-items: center; }
.news-actions form { margin: 0; }
.news-act { display: inline-flex; align-items: center; gap: .25rem; padding: .2rem .5rem; border: 1px solid transparent; border-radius: 999px; background: none; color: var(--muted); font: inherit; cursor: pointer; }
.news-act:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.news-act:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.news-act.on { color: var(--accent); border-color: var(--accent-soft); background: var(--accent-soft); font-weight: 600; }
.news-empty, .news-more { list-style: none; padding: 1.5rem 1rem; text-align: center; color: var(--muted); }
.news-welcome h3 { margin-top: 0; }
.news-picks { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.news-picks li { display: flex; gap: .6rem; align-items: center; }
.news-pick-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.news-source-card { margin-bottom: .75rem; }
.news-feedurl code { overflow-wrap: anywhere; }
.news-source-actions { margin-top: .75rem; flex-wrap: wrap; }
.news-error { margin-top: .6rem; padding: .5rem .7rem; border-radius: 8px; background: var(--danger-soft); color: var(--text); overflow-wrap: anywhere; }
.news-error strong { color: var(--danger); }
.news-article { display: block; }
.news-article-title { margin: .4rem 0 .2rem; font-size: 1.45rem; line-height: 1.3; overflow-wrap: anywhere; }
.news-content { margin: 1rem 0; line-height: 1.6; overflow-wrap: anywhere; }
.news-content pre { overflow-x: auto; }
.news-content table { display: block; overflow-x: auto; }
.news-discussion { margin-top: 1rem; }
.news-discussion h3 { margin-top: 0; }
.news-subs-table { width: 100%; }
.news-subs-table td { vertical-align: top; }
.news-import { margin-top: .75rem; padding: .6rem .8rem; background: var(--surface-2); border-radius: 8px; }
.news-keys td { padding: .25rem .6rem .25rem 0; }
.news-help:not([hidden]) { display: grid; }
.news-share-targets { border: 0; padding: 0; margin: 0; }
.news-share-targets select { max-width: 14rem; margin-left: .3rem; }
@media (max-width: 800px) {
  .news-shell { grid-template-columns: minmax(0, 1fr); }
  .news-nav { position: static; max-height: none; order: 2; }
  .news-nav-subs:not([open]) { padding-bottom: 0; }
  .news-search { flex: 1; }
  .news-search input { width: auto; flex: 1; min-width: 0; }
  .news-help-btn { display: none; }
  .news-row { padding: .7rem .75rem; gap: .6rem; }
  .news-subs-table thead { display: none; }
  .news-subs-table tr { display: grid; border-bottom: 1px solid var(--border); padding: .4rem 0; }
}

.news-article-links { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.news-full-status { display: flex; align-items: center; gap: .5rem; color: var(--info); }
.news-full-status .spinner { width: 16px; height: 16px; border-width: 2px; flex: none; }
.news-full-note { margin: .25rem 0 .75rem; }

/* ---------- reading pane (templates/partials/_pane.html, static/js/pane.js) ---------- */
:root { --pane-w: clamp(520px, 52vw, 1100px); --pane-top: 48px; }
.ss-pane { position: fixed; top: var(--pane-top); right: 0; bottom: 0; width: var(--pane-w); z-index: 9; display: flex; flex-direction: column; background: var(--bg); border-left: 1px solid var(--border); box-shadow: var(--shadow); }
.ss-pane-bar { flex: none; display: flex; align-items: center; gap: .3rem; padding: .35rem .6rem; background: var(--surface); border-bottom: 1px solid var(--border); }
.ss-pane-bar .btn[disabled] { opacity: .4; cursor: default; }
.ss-pane-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; padding: 0 .3rem; }
.ss-pane-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: .75rem; outline: none; transition: opacity .12s; }
.ss-pane.is-loading .ss-pane-body { opacity: .5; }
.ss-pane-doc { display: flex; flex-direction: column; min-height: 100%; }
.ss-pane-doc > .messages { margin-bottom: .6rem; }
.ss-pane .news-article-title { font-size: 1.3rem; }
.ss-pane .news-article, .ss-pane .news-discussion, .ss-pane-doc > .messages { width: 100%; max-width: 54rem; margin-left: auto; margin-right: auto; }
.ss-pane .arc-viewer { flex: 1; }
.ss-pane .arc-frame { flex: 1; height: auto; min-height: 55vh; }
.ss-pane .arc-reader { padding: 1rem 1.25rem; }
.ss-pane .grid.two { grid-template-columns: minmax(0, 1fr); }
html.pane-open .page { margin-right: var(--pane-w); }
[data-pane-item].is-open { box-shadow: inset 3px 0 0 var(--accent); background: var(--surface-2); }
.arc-cards.grid .arc-card.is-open { box-shadow: 0 0 0 2px var(--accent); }
@media (max-width: 1699px) {
  html.pane-open .news-shell { grid-template-columns: minmax(0, 1fr); }
  html.pane-open .news-nav { display: none; }
}
@media (max-width: 1099px) {
  .ss-pane { left: 0; width: auto; border-left: 0; }
  html.pane-open { overflow: hidden; }
  html.pane-open .page { margin-right: auto; }
}
@media (max-width: 800px) {
  .ss-pane { top: 0; z-index: 40; }
  .ss-pane-body { padding: .5rem; }
}

/* ---------- archive ---------- */
.arc-top { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .5rem; }
.arc-h1 { margin: 0; flex: 1; }
.arc-h1 a { color: var(--text); }
.arc-h1 a:hover { text-decoration: none; }
.arc-search input { width: 240px; }
.arc-tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; overflow-x: auto; scrollbar-width: none; }
.arc-tabs a { padding: .5rem .8rem; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.arc-tabs a:hover { color: var(--text); text-decoration: none; }
.arc-tabs a.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.arc-bar { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .75rem; }
.arc-filters select { width: auto; }
.arc-layout { display: inline-flex; gap: .2rem; }
.arc-tagcloud { margin-bottom: .75rem; }
.arc-tags { display: flex; flex-wrap: wrap; gap: .25rem; }
.arc-tags .pill:hover { text-decoration: none; background: var(--accent-soft); color: var(--accent); }
.arc-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.arc-cards.grid { grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); }
.arc-cards.list { grid-template-columns: minmax(0, 1fr); gap: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.arc-card { display: flex; flex-direction: column; gap: .45rem; padding: .85rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; }
.arc-cards.list .arc-card { border: 0; border-bottom: 1px solid var(--border); border-radius: 0; flex-direction: row; flex-wrap: wrap; align-items: center; }
.arc-cards.list .arc-card:last-child { border-bottom: 0; }
.arc-cards.list .arc-card-link { flex: 1 1 22rem; }
.arc-card.is-failed { border-color: var(--danger-soft); }
.arc-card-link { display: flex; gap: .7rem; color: var(--text); min-width: 0; }
.arc-card-link:hover { text-decoration: none; }
.arc-card-link:hover .arc-card-title { color: var(--accent); }
.arc-badge { width: 2.2rem; height: 2.2rem; flex: none; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); font-weight: 800; border: 1px solid var(--border); }
.arc-card-main { display: flex; flex-direction: column; min-width: 0; gap: .1rem; }
.arc-card-title { line-height: 1.3; overflow-wrap: anywhere; }
.arc-card-site { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arc-card-desc { color: var(--muted); overflow-wrap: anywhere; }
.arc-card-meta { display: flex; flex-wrap: wrap; gap: .25rem; align-items: center; }
.arc-empty, .arc-more { list-style: none; padding: 2rem 1rem; text-align: center; color: var(--muted); grid-column: 1 / -1; }
.arc-collections { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.arc-coll-head { margin-bottom: 1rem; align-items: flex-start; }
.page.arc-page { max-width: none; }
.arc-viewer { display: flex; flex-direction: column; gap: .6rem; }
.arc-toolbar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .5rem .75rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.arc-toolbar-title { flex: 1 1 14rem; min-width: 0; display: flex; flex-direction: column; }
.arc-toolbar-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arc-toolbar-tools { flex-wrap: wrap; gap: .35rem; }
.arc-toolbar-tools form { margin: 0; }
.arc-versions { display: flex; align-items: center; gap: .35rem; }
.arc-versions select { width: auto; max-width: 16rem; padding: .25rem .4rem; font-size: .85rem; }
.arc-modes { display: inline-flex; gap: .15rem; }
.arc-frame { width: 100%; height: calc(100vh - 13rem); min-height: 420px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--paper); }
.arc-frame-note { margin: 0; }
.arc-status { display: flex; align-items: center; gap: .6rem; padding: .6rem .8rem; border-radius: var(--radius); background: var(--info-soft); color: var(--info); }
.arc-error { padding: .6rem .8rem; border-radius: var(--radius); background: var(--danger-soft); color: var(--text); }
.arc-error strong { color: var(--danger); }
.arc-reader { max-width: 46rem; margin: 0 auto; width: 100%; padding: 1.5rem 2rem; line-height: 1.7; font-size: 1.05rem; overflow-wrap: anywhere; }
.arc-reader h1 { line-height: 1.25; margin-top: 0; }
.arc-reader pre { overflow-x: auto; }
.arc-dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .35rem .9rem; margin: 0 0 1rem; }
.arc-dl dt { color: var(--muted); font-size: .85rem; }
.arc-dl dd { margin: 0; overflow-wrap: anywhere; }
.arc-skipped { margin-bottom: 1rem; }
.msg-card-archive { margin: .2rem 0 0; }
@media (max-width: 800px) {
  .arc-search { flex: 1; }
  .arc-search input { width: auto; flex: 1; min-width: 0; }
  .arc-frame { height: calc(100vh - 16rem); min-height: 360px; }
  .arc-reader { padding: 1rem; font-size: 1rem; }
  .arc-dl { grid-template-columns: minmax(0, 1fr); }
  .arc-versions label { display: none; }
}

/* ---------- admin panel ---------- */
.panel { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100vh - 53px); }
.panel-nav { background: var(--surface); border-right: 1px solid var(--border); padding: 1rem .6rem; }
.panel-nav h4 { margin: 1rem .5rem .35rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.panel-nav h4:first-child { margin-top: 0; }
.panel-nav a { display: flex; justify-content: space-between; padding: .4rem .6rem; border-radius: 6px; color: var(--text); }
.panel-nav a:hover { background: var(--surface-2); text-decoration: none; }
.panel-nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.panel-main { padding: 1.25rem 1.5rem 3rem; min-width: 0; }
@media (max-width: 800px) {
  .panel { grid-template-columns: 1fr; }
  .panel-nav { border-right: 0; border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: .2rem; }
  .panel-nav h4 { display: none; }
  .panel-main { padding: 1rem; }
}
/* site settings: the sections on the left, the chosen section's settings on the right */
.settings-panes { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.settings-nav { position: sticky; top: 4.2rem; max-height: calc(100vh - 5rem); overflow-y: auto; display: flex; flex-direction: column; gap: .1rem; }
.settings-nav a { display: flex; justify-content: space-between; align-items: baseline; gap: .6rem; padding: .4rem .6rem; border-radius: 6px; color: var(--text); line-height: 1.3; }
.settings-nav a:hover { background: var(--surface-2); text-decoration: none; }
.settings-nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.settings-nav .count { color: var(--muted); font-size: .75rem; font-weight: 400; font-variant-numeric: tabular-nums; }
.settings-nav a.active .count { color: inherit; }
.settings-pane { max-width: 760px; }
.settings-pane h2 { margin-top: 0; }
.settings-save { position: sticky; bottom: 0; margin: 1rem calc(-1 * var(--space)) calc(-1 * var(--space)); padding: .75rem var(--space); background: var(--surface); border-top: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius); }
@media (max-width: 1100px) {
  .settings-panes { grid-template-columns: 1fr; }
  .settings-nav { position: static; max-height: none; flex-direction: row; flex-wrap: wrap; gap: .2rem; }
  .settings-pane { max-width: none; }
}
.sudo-badge { font-size: .75rem; padding: .15rem .5rem; border-radius: 999px; background: var(--warn-soft); color: var(--warn); }

/* deploy console */
.console {
  background: var(--code-bg); color: var(--code-text); border-radius: 8px; padding: .75rem;
  max-height: 360px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font: 12.5px/1.45 var(--mono); margin: 0;
}
.step { border: 1px solid var(--border); border-radius: 8px; margin-bottom: .5rem; background: var(--surface); }
.step > summary { display: flex; gap: .6rem; align-items: center; padding: .5rem .75rem; cursor: pointer; list-style: none; }
.step > summary::-webkit-details-marker { display: none; }
.step > summary .phase { font-weight: 600; min-width: 90px; }
.step > summary .target { color: var(--muted); flex: 1; }
.step .console { margin: 0 .5rem .5rem; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* auth pages */
.auth { max-width: 400px; margin: 8vh auto; padding: 0 1rem; }
.auth .card { padding: 1.5rem; }
.auth h1 { text-align: center; }

/* modal (report form) */
.modal-backdrop { position: fixed; inset: 0; background: var(--backdrop); display: grid; place-items: center; z-index: 50; padding: 1rem; }
.modal { background: var(--surface); border-radius: var(--radius); padding: 1.25rem; width: min(440px, 100%); }

/* HTML email keeps the light "paper" its sender designed for, even in dark mode */
.mail-html { background: var(--paper); color: var(--paper-ink); color-scheme: light; padding: 1rem; border-radius: 8px; }

/* ---------- appearance ---------- */
.theme-toggle { display: inline-flex; margin: 0; }
.theme-toggle button {
  display: inline-flex; align-items: center; justify-content: center; padding: .35rem; border: 0; border-radius: 999px;
  background: none; color: var(--muted); cursor: pointer;
}
.theme-toggle button:hover { background: var(--surface-2); color: var(--text); }
.theme-toggle svg { display: none; }
:root[data-theme="system"] .theme-toggle .i-system,
:root[data-theme="light"] .theme-toggle .i-light,
:root[data-theme="dark"] .theme-toggle .i-dark { display: block; }
.corner-toggle { position: fixed; top: .6rem; right: .75rem; z-index: 20; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; }
.choice {
  display: flex; align-items: center; gap: .5rem; padding: .55rem .7rem; margin: 0; font-weight: 500; cursor: pointer;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
}
.choice:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.choice input { width: auto; margin: 0; }
.swatch { width: 18px; height: 18px; border-radius: 50%; flex: none; border: 1px solid var(--border); }
.preview {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; background: var(--bg); color: var(--text);
}
.preview .card { margin-top: .5rem; }
legend.label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .35rem; padding: 0; }
.setting-block { border: 1px solid var(--border); border-radius: 8px; padding: .5rem .75rem; }
.setting-block > summary { cursor: pointer; display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; }
.setting-block[open] > summary { margin-bottom: .6rem; }
table.flags td, table.flags th { padding: .25rem .5rem; }
table.flags input { width: auto; }
ul.checks.two-col { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

/* ---------------------------------------------------------------------------------------------
   Rich text (apps/core/markdown.py) — every tab's member writing. .md is the older name.
   --------------------------------------------------------------------------------------------- */
.rich, .md { overflow-wrap: anywhere; }
.rich > :last-child { margin-bottom: 0; }
.rich p { margin: 0 0 .6rem; }
.rich ul, .rich ol { margin: 0 0 .6rem; padding-left: 1.4rem; }
.rich blockquote { margin: 0 0 .6rem; padding: .1rem 0 .1rem .8rem; border-left: 3px solid var(--border); color: var(--muted); }
.rich code, .rich kbd { background: var(--surface-2); padding: .05rem .3rem; border-radius: 4px; font-family: var(--mono); font-size: .9em; }
.rich kbd { border: 1px solid var(--border); border-bottom-width: 2px; }
.rich pre { background: var(--code-bg); color: var(--code-text); padding: .7rem .8rem; border-radius: 8px; overflow-x: auto; margin: 0 0 .6rem; }
.rich pre code { background: none; padding: 0; color: inherit; }
.rich h2, .rich h3, .rich h4, .md h2, .md h3, .md h4 { margin: .4rem 0 .5rem; line-height: 1.25; }
.rich h2, .md h2 { font-size: 1.25rem; } .rich h3, .md h3 { font-size: 1.1rem; } .rich h4, .md h4 { font-size: 1rem; }
.rich hr, .md hr { border: 0; border-top: 1px solid var(--border); margin: .8rem 0; }
.rich mark, .md mark { background: var(--warn-soft); color: var(--text); padding: 0 .15rem; border-radius: 3px; }
.rich table, .md table { border-collapse: collapse; margin: 0 0 .6rem; display: block; overflow-x: auto; max-width: 100%; }
.rich th, .rich td, .md th, .md td { border: 1px solid var(--border); padding: .3rem .5rem; text-align: left; }
.rich th, .md th { background: var(--surface-2); }
.rich details, .md details { border: 1px solid var(--border); border-radius: 8px; padding: .4rem .7rem; margin: 0 0 .6rem; }
.rich summary, .md summary { cursor: pointer; font-weight: 600; }
.rich img:not(.emoji), .md img:not(.emoji) { display: block; max-width: 100%; height: auto; max-height: 70vh; border-radius: 8px; margin: .3rem 0 .6rem; background: var(--surface-2); }
.rich video, .md video { display: block; max-width: 100%; max-height: 70vh; border-radius: 8px; margin: .3rem 0 .6rem; background: var(--code-bg); }
img.emoji { display: inline-block; width: 1.4em; height: 1.4em; object-fit: contain; vertical-align: -.3em; margin: 0 .05em; }
.spoiler { background: var(--text); color: transparent; border-radius: 3px; padding: 0 .2rem; cursor: pointer; transition: color .15s, background .15s; }
.spoiler img, .spoiler video { visibility: hidden; }
.spoiler.shown { background: var(--surface-2); color: inherit; cursor: auto; }
.spoiler.shown img, .spoiler.shown video { visibility: visible; }

/* Tooltips: [data-tip] elements get a floating label from static/js/editor.js (.ss-tip). */
.ss-tip { position: fixed; z-index: 1000; max-width: 260px; background: var(--text); color: var(--surface); font-size: .75rem;
  font-weight: 500; line-height: 1.3; padding: .3rem .5rem; border-radius: 6px; pointer-events: none; box-shadow: var(--shadow); }
.ss-tip[hidden] { display: none; }

/* The writing toolbar (static/js/editor.js): a tab strip across the top of the text box */
.rte { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); overflow: hidden; }
.rte:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.rte.dropping { border-style: dashed; border-color: var(--accent); background: var(--accent-soft); }
.rte > textarea { border: 0; border-radius: 0; width: 100%; display: block; resize: vertical; background: transparent; box-shadow: none; }
.rte > textarea:focus { outline: none; box-shadow: none; }
.rte-bar { display: flex; align-items: stretch; background: var(--surface-2); border-bottom: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: none; }
.rte-bar::-webkit-scrollbar { display: none; }
.rte-btn { flex: 1 0 auto; min-width: 30px; height: 34px; padding: 0; border: 0; border-radius: 0; background: none; color: var(--muted);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; position: relative; }
.rte-btn svg { width: 18px; height: 18px; flex: none; }
.rte-btn:hover { background: var(--surface); color: var(--text); }
.rte-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.rte-btn[aria-pressed="true"] { background: var(--surface); color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
.rte-sep { flex: none; width: 1px; margin: 7px 0; background: var(--border); }
.rte.compact .rte-more { display: none; }
.rte.compact.show-more .rte-btn.rte-more { display: inline-flex; }
.rte.compact.show-more .rte-sep.rte-more { display: block; }
.rte.compact .rte-btn { height: 30px; }
.rte-preview { padding: .6rem .75rem; min-height: 4rem; }
.rte-help, .rte-status { margin: 0; padding: .35rem .7rem; border-top: 1px solid var(--border); }
.rte-status.error { color: var(--danger); }

/* Emoji picker */
.emoji-picker { position: absolute; z-index: 60; width: min(340px, calc(100vw - 16px)); background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.emoji-picker[hidden] { display: none; }
.ep-search { margin: .5rem .5rem .3rem; width: calc(100% - 1rem); box-sizing: border-box; }
.ep-tabs { display: flex; gap: 1px; padding: 0 .4rem .3rem; border-bottom: 1px solid var(--border); overflow-x: auto; }
.ep-tab { border: 0; background: none; font-size: 1.05rem; padding: .15rem .3rem; border-radius: 5px; cursor: pointer; color: var(--text); }
.ep-tab:hover { background: var(--surface-2); }
.ep-body { height: 260px; overflow-y: auto; padding: .2rem .45rem .5rem; position: relative; }
.ep-h { position: sticky; top: 0; margin: 0; padding: .35rem .1rem .2rem; background: var(--surface); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.ep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(32px, 1fr)); }
.ep-emoji { border: 0; background: none; font-size: 1.35rem; line-height: 1; height: 34px; border-radius: 6px; cursor: pointer; padding: 0; }
.ep-emoji:hover, .ep-emoji:focus-visible { background: var(--surface-2); }
.ep-emoji[hidden] { display: none; }
.ep-emoji img.emoji { width: 26px; height: 26px; vertical-align: middle; margin: 0; }
.ep-hint { grid-column: 1 / -1; margin: .2rem 0; }

/* Reactions (apps/content) */
.reactions { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; margin: .35rem 0; }
.rx { display: inline-flex; align-items: center; gap: .25rem; height: 26px; padding: 0 .5rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: .85rem; cursor: pointer; }
.rx:hover { background: var(--surface-2); }
.rx.mine { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.rx .rx-e { font-size: 1rem; line-height: 1; }
.rx img.emoji { width: 18px; height: 18px; vertical-align: middle; margin: 0; }
.rx-n { font-variant-numeric: tabular-nums; font-weight: 600; }
.rx-add { color: var(--muted); padding: 0 .45rem; gap: 0; }
.rx-add .rx-plus { font-size: .7rem; margin-left: 1px; }
.reactions.compact .rx { height: 22px; font-size: .78rem; padding: 0 .4rem; }
.rx-error { color: var(--danger); }

/* Feeds: bio | timeline | friends */
.page.feeds-page { max-width: 1240px; }
.feeds { display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr) minmax(0, 240px); gap: 1rem; align-items: start; }
#feeds-view { display: contents; }
.feeds-side { position: sticky; top: 4.2rem; max-height: calc(100vh - 5rem); overflow-y: auto; }
.feeds-bio .bio-head { display: flex; gap: .7rem; align-items: center; margin-bottom: .6rem; }
.feeds-bio h2 { margin: 0; font-size: 1.1rem; }
.feeds-bio .bio-text { font-size: .93rem; }
.feeds-bio .bio-empty { color: var(--muted); font-size: .9rem; font-style: italic; }
.feeds-bio .bio-facts { list-style: none; padding: 0; margin: .6rem 0 0; font-size: .85rem; color: var(--muted); }
.feeds-friends h2 { font-size: 1rem; margin: 0 0 .5rem; }
.feeds-friends input[type=search] { width: 100%; margin-bottom: .5rem; }
.friend-list { list-style: none; margin: 0; padding: 0; }
.friend-list a { display: flex; align-items: center; gap: .5rem; padding: .35rem .4rem; border-radius: 8px; color: var(--text); }
.friend-list a:hover { background: var(--surface-2); text-decoration: none; }
.friend-list a.active, .friend-list a[aria-current="true"] { background: var(--accent-soft); color: var(--accent); }
.friend-list .avatar { width: 28px; height: 28px; font-size: .8rem; flex: none; }
.friend-list .fl-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.friend-list .fl-user { font-size: .75rem; color: var(--muted); }
.feeds-person { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .75rem; }
.feeds-person h1 { font-size: 1.15rem; margin: 0; }
.post .body.rich { white-space: normal; }
.post .comment .rich { display: inline; }
.post .comment .rich > p:first-child { display: inline; }
.comment-form { display: flex; gap: .4rem; align-items: flex-end; margin-top: .4rem; }
.comment-form .rte { flex: 1; min-width: 0; }
@media (max-width: 1080px) {
  .feeds { grid-template-columns: minmax(0, 1fr) minmax(0, 240px); }
  .feeds-bio { grid-column: 1 / -1; position: static; max-height: none; }
}
@media (max-width: 760px) {
  .feeds { grid-template-columns: minmax(0, 1fr); }
  .feeds-side { position: static; max-height: none; }
  .feeds-friends { order: -1; }
  .feeds-friends .friend-list { display: flex; gap: .25rem; overflow-x: auto; }
  .feeds-friends .fl-user { display: none; }
}
.chat-input-row .rte.chat { flex: 1; min-width: 0; }
.msg-reactions .reaction img.emoji { width: 16px; height: 16px; vertical-align: -3px; }
.emoticon-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.emoticon-list li { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
img.emoji.lg { width: 32px; height: 32px; vertical-align: middle; }
/* Compact editors (comments, replies, chat) show their toolbar while you write. */
.rte.compact:not(:focus-within):not(.has-text):not(.previewing) .rte-bar { display: none; }
.post .actions .reactions { margin: 0 .3rem 0 0; }

/* News topics */
.topic-strip { display: flex; flex-wrap: wrap; gap: .35rem; margin: 0 0 .75rem; }
.topic-chip { display: inline-flex; align-items: center; gap: .25rem; padding: .25rem .65rem; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); font-size: .85rem; }
.topic-chip:hover { background: var(--accent-soft); border-color: var(--accent); text-decoration: none; }
.topic-chip.ghost { color: var(--muted); border-style: dashed; }
.topic-icon { display: inline-block; width: 1.3rem; text-align: center; flex: none; }
.topic-section { margin-bottom: 1rem; }
.topic-head { display: flex; justify-content: space-between; align-items: baseline; padding: .7rem .9rem .3rem; }
.topic-head h3 { margin: 0; font-size: 1.05rem; }
.topic-picks { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.topic-picks li { display: flex; justify-content: space-between; align-items: center; gap: .75rem; }
.topic-picks li > div { display: flex; flex-direction: column; min-width: 0; }
.topic-bar { margin: 0 0 .6rem; gap: .5rem; flex-wrap: wrap; }
.topic-source-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .15rem .75rem; max-height: 18rem; overflow-y: auto; }
.topic-sources input[type=search] { margin-bottom: .4rem; }
.topic-admin { width: 100%; }
.topic-admin td { vertical-align: middle; }

/* Archiver: changes */
.change-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.change-card { border-left: 4px solid var(--border); }
.change-card.status-new { border-left-color: var(--info); }
.change-card.status-major { border-left-color: var(--danger); }
.change-card.status-dismissed { opacity: .8; }
.change-head { display: flex; justify-content: space-between; gap: .75rem; align-items: flex-start; flex-wrap: wrap; }
.change-title { min-width: 0; flex: 1 1 20rem; overflow-wrap: anywhere; }
.change-stats { display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; }
.diff-count { font: 600 .82rem/1 var(--mono); }
.diff-count.add { color: var(--ok); } .diff-count.del { color: var(--danger); }
.diff-preview { margin: .6rem 0 .2rem; padding: .5rem .6rem; background: var(--surface-2); border-radius: 8px; font: .8rem/1.45 var(--mono);
  white-space: pre-wrap; overflow-wrap: anywhere; max-height: 7.5rem; overflow: hidden; }
.diff-preview .add { color: var(--ok); } .diff-preview .del { color: var(--danger); }
.change-note { background: var(--warn-soft); border-radius: 6px; padding: .35rem .55rem; margin-top: .4rem; }
.change-actions { margin-top: .4rem; flex-wrap: wrap; gap: .4rem; }
.diff { font: .85rem/1.5 var(--mono); max-height: 75vh; overflow: auto; }
.diff-line { display: grid; grid-template-columns: 1.6rem minmax(0, 1fr); padding: .05rem .5rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.diff-line.add { background: var(--ok-soft); }
.diff-line.del { background: var(--danger-soft); text-decoration: line-through; text-decoration-color: var(--danger); }
.diff-line.gap { color: var(--muted); background: var(--surface-2); }
.diff-mark { color: var(--muted); user-select: none; }
.diff-line.add .diff-mark { color: var(--ok); } .diff-line.del .diff-mark { color: var(--danger); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.watch-table td { vertical-align: top; }
.watch-table tr.muted td { color: var(--muted); }
.arc-watchnote { margin: 0 0 .6rem; color: var(--muted); }

/* Mail: messages open in place */
.mail-note { margin: 0; }
.mail-list > li { padding: 0; }
.mail-row > summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 1rem minmax(8rem, 12rem) minmax(0, 1fr) auto;
  gap: .6rem; align-items: baseline; padding: .55rem .2rem; border-radius: 6px; }
.mail-row > summary::-webkit-details-marker { display: none; }
.mail-row > summary:hover { background: var(--surface-2); }
.mail-twisty::before { content: "▸"; color: var(--muted); display: inline-block; transition: transform .15s; }
.mail-row[open] .mail-twisty::before { transform: rotate(90deg); }
.mail-who, .mail-subject { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-row.unread .mail-who, .mail-row.unread .mail-subject { font-weight: 650; }
.mail-preview { margin-left: .4rem; }
.mail-row[open] .mail-preview { display: none; }
.mail-expand { padding: .4rem .4rem 1rem 1.6rem; display: grid; gap: .75rem; }
@media (max-width: 700px) {
  .mail-row > summary { grid-template-columns: 1rem minmax(0, 1fr) auto; }
  .mail-subject { grid-column: 2 / -1; }
}
.preview-strip .heic-tile { aspect-ratio: 1; display: grid; place-items: center; text-align: center; padding: .3rem; font-size: .7rem; border-radius: 6px; background: var(--surface-2); color: var(--muted); overflow-wrap: anywhere; }

/* Security: the two-step switch */
.switch { width: 2.4rem; height: 1.35rem; border-radius: 999px; background: var(--border); position: relative; display: inline-block; margin-left: auto; margin-right: .4rem; }
.switch span { position: absolute; top: 3px; left: 3px; width: calc(1.35rem - 6px); height: calc(1.35rem - 6px); border-radius: 50%; background: var(--surface); transition: left .15s; }
.switch.on { background: var(--ok); }
.switch.on span { left: calc(100% - 1.35rem + 3px); }
.two-step-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .6rem; }
.choice-card { display: flex; flex-direction: column; gap: .25rem; padding: .75rem .85rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); }
.choice-card:hover { border-color: var(--accent); background: var(--accent-soft); text-decoration: none; }
.choice-card .linkish { text-align: left; padding: 0; color: inherit; }

/* Topic icons (News and Archiver) */
.topic-img { width: 1.25em; height: 1.25em; object-fit: contain; vertical-align: -.25em; border-radius: 4px; display: inline-block; }
.topic-emoji { display: inline-block; min-width: 1.25em; text-align: center; }
.icon-field-row { align-items: center; flex-wrap: wrap; gap: .4rem; }
.icon-preview { width: 2.4rem; height: 2.4rem; display: grid; place-items: center; font-size: 1.5rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.icon-preview .topic-img { width: 1.8rem; height: 1.8rem; vertical-align: 0; }
.icon-field input.icon-emoji-input { width: 5rem; text-align: center; font-size: 1.1rem; }
.icon-upload { cursor: pointer; }

/* News preview pictures (our own copies) */
.news-thumb { order: 3; flex: none; width: 132px; height: 88px; border-radius: 8px; overflow: hidden; background: var(--surface-2); align-self: flex-start; }
.news-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.news-hero { margin: .2rem 0 .8rem; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.news-hero img { display: block; width: 100%; max-height: 380px; object-fit: cover; }
@media (max-width: 640px) { .news-thumb { width: 84px; height: 64px; } }

/* Tab strips (Archiver; reusable): folder-style tabs joined to the content below */
.tabbar { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin: .25rem 0 1rem; overflow-x: auto; scrollbar-width: none; }
.tabbar::-webkit-scrollbar { display: none; }
.tabbar .tab { display: inline-flex; align-items: center; gap: .45rem; padding: .55rem .95rem; white-space: nowrap; color: var(--muted);
  font-weight: 550; border: 1px solid transparent; border-bottom: 0; border-radius: 10px 10px 0 0; margin-bottom: -1px; }
.tabbar .tab svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.tabbar .tab:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.tabbar .tab.active { color: var(--accent); background: var(--bg); border-color: var(--border); box-shadow: inset 0 2px 0 var(--accent); }
.tab-count { min-width: 1.35rem; padding: 0 .4rem; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: .72rem; font-weight: 700; line-height: 1.35rem; text-align: center; }
.tab-count.muted-count { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }

/* ---------- communities: views, saved ---------- */
.page-head { margin-bottom: 1rem; }
.forum-nav a { font-size: .92rem; }
.save-form { display: inline; margin: 0; }
button.save-link { font-size: inherit; font-weight: 500; }
button.save-link.on, .save-form .btn.on { color: var(--accent); }
.thread-community { font-weight: 600; color: var(--text); }
time.edited { cursor: help; }

/* ---------- communities: flair, mod queue ---------- */
.flair { display: inline-block; margin-left: .35rem; padding: 0 .45rem; border-radius: 999px; font-size: .72rem;
  font-weight: 650; line-height: 1.5; vertical-align: .08em; white-space: nowrap; max-width: 14rem;
  overflow: hidden; text-overflow: ellipsis; }
.flair-grey { color: var(--flair-grey); background: var(--flair-grey-bg); }
.flair-red { color: var(--flair-red); background: var(--flair-red-bg); }
.flair-orange { color: var(--flair-orange); background: var(--flair-orange-bg); }
.flair-gold { color: var(--flair-gold); background: var(--flair-gold-bg); }
.flair-green { color: var(--flair-green); background: var(--flair-green-bg); }
.flair-teal { color: var(--flair-teal); background: var(--flair-teal-bg); }
.flair-blue { color: var(--flair-blue); background: var(--flair-blue-bg); }
.flair-purple { color: var(--flair-purple); background: var(--flair-purple-bg); }
.flair-pink { color: var(--flair-pink); background: var(--flair-pink-bg); }
.flair-choices { display: flex; flex-wrap: wrap; gap: .4rem .8rem; }
.flair-choice { display: inline-flex; align-items: center; gap: .3rem; font-weight: 500; margin: 0; cursor: pointer; }
.flair-choice input { width: auto; margin: 0; }
.flair-choice .flair { margin-left: 0; }
.flair-list > li { padding: .45rem 0; }
.flair-edit { gap: .4rem; }
.flair-edit .flair { margin-left: 0; min-width: 4rem; text-align: center; }
.flair-edit select { width: auto; }
input.flair-text-input { width: 10rem; flex: 1 1 8rem; }
.flair-assign select { width: auto; min-width: 7rem; padding: .25rem .4rem; font-size: .85rem; }
.queue-item { display: flex; flex-direction: column; gap: .4rem; }
.queue-title { font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.queue-excerpt { color: var(--text); background: var(--surface-2); border-radius: 8px; padding: .45rem .6rem; }
.queue-details { margin: 0; padding-left: 1.1rem; color: var(--muted); }
.queue-actions { margin-top: .2rem; }

/* ---------- communities: link previews ---------- */
.link-card {
  display: flex; gap: 0; margin: .75rem 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
  background: var(--surface-2); color: var(--text); overflow-wrap: anywhere;
}
.link-card:hover { text-decoration: none; border-color: var(--accent); }
.link-card-img { flex: none; width: 200px; min-height: 120px; max-height: 200px; object-fit: cover; background: var(--border); }
.link-card-body { display: flex; flex-direction: column; gap: .2rem; padding: .65rem .85rem; min-width: 0; }
.link-card-title { font-weight: 650; color: var(--text); }
.link-card-desc { font-size: .9rem; color: var(--muted); }
.thread-thumb { flex: none; align-self: center; }
.thread-thumb img { display: block; width: 72px; height: 54px; object-fit: cover; border-radius: 6px; background: var(--surface-2); }
@media (max-width: 640px) {
  .link-card.has-img { flex-direction: column; }
  .link-card-img { width: 100%; height: 160px; max-height: none; }
  .thread-thumb img { width: 56px; height: 44px; }
}

/* ---------- appearance settings ---------- */
.font-sample { font-weight: 700; color: var(--accent); line-height: 1; }
.font-sample-s { font-size: .8rem; } .font-sample-m { font-size: .95rem; }
.font-sample-l { font-size: 1.1rem; } .font-sample-xl { font-size: 1.25rem; }
.flair-edit { display: grid; grid-template-columns: 6.5rem minmax(8rem, 1fr) 7rem auto auto auto; align-items: center; }
@media (max-width: 640px) { .flair-edit { grid-template-columns: 1fr 1fr; } .flair-edit .flair { justify-self: start; } }
/* Apps page (/apps/) */
.apps-page .card.highlight { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }
.apps-page pre { background: var(--code-bg); color: var(--code-text); padding: .6rem .8rem; border-radius: 8px; overflow-x: auto; }
.apps-page pre code { background: none; padding: 0; color: inherit; }
.apps-page .app-card { display: flex; flex-direction: column; gap: .65rem; }
.apps-page .app-card > * { margin: 0; }
.apps-page ol { padding-left: 1.3rem; }
.apps-page ol li + li { margin-top: .3rem; }

/* ---------- voice: other pages in a frame over the chat page during a call ---------- */
html.ss-shell-on, html.ss-shell-on body { overflow: hidden; }
.ss-shell { position: fixed; inset: 0; z-index: 900; display: flex; flex-direction: column; background: var(--bg); }
.ss-shell[hidden] { display: none; }
.ss-shell iframe { flex: 1 1 auto; width: 100%; min-height: 0; border: 0; background: var(--bg); }
.ss-shell-bar { flex: none; display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .35rem .75rem;
  background: var(--ok-soft); border-top: 2px solid var(--ok); padding-bottom: max(.35rem, env(safe-area-inset-bottom)); }
.ss-shell-bar .voice-conn { flex: 1; min-width: 0; }
.ss-shell-btns { display: flex; align-items: center; gap: .35rem; flex: none; }
.ss-shell-btns .voice-btn { min-width: 36px; width: 36px; height: 36px; padding: 0; font-size: 1rem; }
@media (max-width: 520px) { .ss-shell-btns .btn.sm { display: none; } }
/* voice channels join on a double tap: no double-tap zoom on their rows */
.chat-chan { touch-action: manipulation; }

/* Direct message pop-ups (static/js/site.js SSAlerts): bottom right, above everything but the
   voice bar's menus; full width at the bottom on a phone. */
.ss-toasts { position: fixed; right: 16px; bottom: 16px; z-index: 1200; display: flex; flex-direction: column;
  gap: .5rem; width: min(360px, calc(100vw - 32px)); pointer-events: none; }
.ss-toast { pointer-events: auto; display: flex; gap: .65rem; align-items: flex-start; padding: .7rem .8rem;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-left: 4px solid var(--accent);
  border-radius: var(--radius); box-shadow: var(--shadow); animation: ss-toast-in .18s ease-out; }
.ss-toast.leaving { opacity: 0; transform: translateY(6px); transition: opacity .18s, transform .18s; }
.ss-toast-avatar { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--text); font-weight: 600; }
.ss-toast-body { flex: 1; min-width: 0; }
.ss-toast-title { line-height: 1.3; }
.ss-toast-text { margin-top: .15rem; color: var(--text); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3;
  -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.ss-toast-actions { margin-top: .45rem; display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.ss-toast-x { flex: none; border: 0; background: none; color: var(--muted); font-size: 1.25rem; line-height: 1; cursor: pointer;
  padding: 0 .15rem; }
.ss-toast-x:hover { color: var(--text); }
@keyframes ss-toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (max-width: 520px) { .ss-toasts { right: 8px; left: 8px; bottom: 8px; width: auto; } }
html.in-voice-frame .ss-toasts { display: none; }

/* Voice: the microphone sends nothing at all (static/js/voice.js micHealth): a warning mark on every
   mic button; the button's tooltip says what to check. */
.voice-btn.voice-mic { position: relative; }
.voice-btn.voice-mic.mic-warn::after { content: "!"; position: absolute; top: -4px; right: -4px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--warn); color: var(--surface); font: 700 11px/16px system-ui, sans-serif; text-align: center;
  box-shadow: 0 0 0 2px var(--surface); pointer-events: none; }
.voice-btn.voice-mic.mic-warn:not(.off) { border-color: var(--warn); }

/* Studio songs and albums shared to Feeds (templates/hal/_music_card.html, static/js/music.js) */
.music-card { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: .75rem; margin: .5rem 0; padding: .65rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.music-card.is-album { grid-template-columns: 132px minmax(0, 1fr); }
.music-card.is-active { border-color: var(--accent); }
.mc-cover img, .mc-ph { display: block; width: 100%; aspect-ratio: 1; border-radius: 8px; object-fit: cover; background: var(--surface-2); }
.mc-ph { display: flex; align-items: center; justify-content: center; font-size: 2.2rem; color: var(--accent); background: var(--accent-soft); }
.mc-main { min-width: 0; display: flex; flex-direction: column; gap: .35rem; }
.mc-head { display: flex; flex-direction: column; min-width: 0; }
.mc-kind { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.mc-title { font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-sub { color: var(--muted); font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-controls { display: flex; align-items: center; gap: .45rem; }
.music-card .mc-btn { flex: none; width: 2.1rem; height: 2.1rem; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: .85rem; line-height: 1; cursor: pointer; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.music-card .mc-btn.mc-play { width: 2.6rem; height: 2.6rem; border: 0; background: var(--accent); color: var(--accent-ink); font-size: 1rem; }
.music-card .mc-btn:disabled { opacity: .4; cursor: default; }
.music-card .mc-btn:focus-visible, .music-card .mc-track:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mc-seek { flex: 1; min-width: 60px; accent-color: var(--accent); }
.mc-time { flex: none; font-variant-numeric: tabular-nums; font-size: .82rem; color: var(--muted); min-width: 2.6rem; }
.mc-cur { text-align: right; }
.mc-dl { flex: none; font-size: .75rem; font-weight: 600; color: var(--muted); }
.mc-volume { flex: none; display: inline-flex; align-items: center; gap: .3rem; }
.music-card .mc-btn.mc-mute { width: 1.9rem; height: 1.9rem; border-color: transparent; background: none; color: var(--muted); }
.music-card .mc-btn.mc-mute:hover { color: var(--text); background: var(--surface-2); }
.mc-mute .mc-x { display: none; }
.mc-mute.is-muted .mc-x { display: inline; }
.mc-mute.is-muted .mc-wave, .mc-mute.is-quiet .mc-wave2 { display: none; }
.music-card .mc-btn.mc-mute.is-muted { color: var(--danger); }
.mc-vol { width: 5.2rem; accent-color: var(--accent); }
.mc-novol .mc-vol { display: none; }  /* iPhone and iPad: only the device's buttons set the level; mute still works */
.mc-actions { display: flex; align-items: center; gap: .5rem; padding-top: .3rem; border-top: 1px solid var(--border); }
.mc-zip { display: inline-flex; align-items: center; gap: .3rem; font-size: .88rem; font-weight: 600; }
.mc-tracks { list-style: none; margin: 0; padding: 0; max-height: 15.5rem; overflow-y: auto; border-top: 1px solid var(--border); }
.mc-tracks li { display: flex; align-items: center; gap: .3rem; border-bottom: 1px solid var(--border); }
.mc-tracks li:last-child { border-bottom: 0; }
.music-card .mc-track { border-radius: 6px; flex: 1; min-width: 0; display: flex; align-items: center; gap: .55rem; padding: .32rem .25rem; border: 0; background: none; color: var(--text); font: inherit; font-size: .9rem; text-align: left; cursor: pointer; }
.music-card .mc-track:hover { background: var(--surface-2); }
.music-card .mc-track.on { color: var(--accent); font-weight: 600; }
.mc-n { flex: none; width: 1.4rem; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.mc-track.on .mc-n { color: var(--accent); }
.mc-tt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-td { flex: none; color: var(--muted); font-size: .82rem; font-variant-numeric: tabular-nums; }
.mc-note { margin: 0; }
.mc-failed { color: var(--danger); }
.mc-meta { margin-top: .1rem; }
.linklike, .music-card .linklike { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
.linklike:hover { text-decoration: underline; }
@media (max-width: 560px) {  /* cover beside the title; the controls and the songs get the full width */
  .music-card, .music-card.is-album { grid-template-columns: 60px minmax(0, 1fr); gap: .5rem .65rem; }
  .mc-main { display: contents; }
  .mc-head { grid-column: 2; align-self: center; }
  .mc-controls, .mc-tracks, .mc-actions, .mc-note, .mc-meta { grid-column: 1 / -1; }
  .mc-vol { display: none; }  /* a phone has volume buttons; the mute button stays */
  .mc-controls { gap: .35rem; }
  .music-card .mc-btn { width: 1.9rem; height: 1.9rem; }
  .music-card .mc-btn.mc-play { width: 2.3rem; height: 2.3rem; }
  .mc-time.mc-cur { display: none; }
  .mc-seek { min-width: 40px; }
}

/* ---- Help and tutorials (patch 0134): the ? button, the tutorial pop-up, /help/ -------------------------------- */
.help-menu > summary.bell { position: relative; }
.help-dot {
  position: absolute; top: 4px; right: 4px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 2px var(--surface);
}
.help-panel { min-width: 240px; }
.help-panel a { display: flex; flex-direction: column; gap: .1rem; }
.help-sub { color: var(--muted); font-size: .82rem; }
.help-empty { display: block; padding: .3rem .6rem; }
.help-new {
  display: inline-block; padding: 0 .45rem; border-radius: 999px; font-size: .72rem; font-weight: 650;
  background: var(--accent-soft); color: var(--accent); vertical-align: middle;
}
.help-panel a .help-new { align-self: flex-start; }
.tut-modal { width: min(1080px, 100%); max-height: calc(100vh - 2rem); overflow: auto; padding: 1rem 1.1rem; }
.tut-head h2 { margin: 0; }
.tut-summary { margin: .25rem 0 .6rem; }
.tut-actions { margin-top: .75rem; gap: .5rem; flex-wrap: wrap; }
.tut-player { display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: .75rem; align-items: start; }
.tut-stage { background: var(--code-bg); border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9; }
.tut-video { width: 100%; height: 100%; display: block; background: var(--code-bg); }
.tut-side { display: flex; flex-direction: column; gap: .6rem; min-width: 0; }
.tut-chapters { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .1rem; max-height: 340px; overflow: auto; }
.tut-chapters button {
  width: 100%; text-align: left; border: 0; background: none; color: var(--text); font: inherit; cursor: pointer;
  padding: .35rem .5rem; border-radius: 6px; display: flex; gap: .5rem; align-items: baseline;
}
.tut-chapters button:hover { background: var(--surface-2); }
.tut-chapters button.current { background: var(--accent-soft); color: var(--accent); }
.tut-ch-t { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .82rem; min-width: 2.6rem; }
.tut-chapters button.current .tut-ch-t { color: inherit; }
.tut-speed { display: flex; gap: .3rem; align-items: center; flex-wrap: wrap; }
.tut-speed [aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
@media (max-width: 820px) {
  .tut-player { grid-template-columns: minmax(0, 1fr); }
  .tut-chapters { max-height: 180px; }
}
.help-page { max-width: 1100px; margin: 0 auto; }
.tut-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; margin-top: 1rem; }
.tut-card { display: flex; flex-direction: column; gap: .5rem; padding: 0; overflow: hidden; color: var(--text); }
.tut-card:hover { text-decoration: none; border-color: var(--accent); }
.tut-thumb { position: relative; aspect-ratio: 16 / 9; background: var(--surface-2); display: block; }
.tut-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tut-len {
  position: absolute; right: .4rem; bottom: .4rem; padding: 0 .4rem; border-radius: 4px; font-size: .78rem;
  background: var(--backdrop); color: var(--code-text); font-variant-numeric: tabular-nums;
}
.tut-card-body { display: flex; flex-direction: column; gap: .3rem; padding: 0 .8rem .8rem; align-items: flex-start; }
.tut-watched { color: var(--muted); font-size: .8rem; }
.help-detail .tut-player { margin: .75rem 0; }
.tut-transcript { margin-top: 1rem; }
.tut-transcript summary { cursor: pointer; list-style: none; }
.tut-transcript summary h2 { display: inline; font-size: 1.1rem; }
.tut-transcript p { margin: .35rem 0; line-height: 1.5; }
.tut-ts { font-variant-numeric: tabular-nums; font-size: .85rem; margin-right: .35rem; }

/* Planner trip cards (patch 0136): the trip map fills the card's width. It had no rule, so the SVG drew at its own
   620 px and spilled over the next card on the trip list. */
.planner-card-map { display: block; width: 100%; height: auto; border-radius: .5rem; }
