/* ==========================================================================
   TeachConnect — design system
   --------------------------------------------------------------------------
   One stylesheet, no build step. Sections:
    01 Tokens (light / dark)          14 Messages
    02 Reset & base                   15 Resources, files & ratings
    03 Typography                     16 PD events, credits, certificates
    04 Layout                         17 AI tools
    05 Header, nav, footer            18 Profile
    06 Buttons                        19 Admin
    07 Forms                          20 Landing page
    08 Cards                          21 Auth pages
    09 Feedback (alerts, badges…)     22 Error page
    10 Navigation (tabs, dropdown…)   23 Utilities
    11 Lists, media & avatars         24 Responsive
    12 Stats & tables                 25 Motion preferences
    13 Feed: composer, posts          26 Print
   ========================================================================== */

/* ==========================================================================
   01 Tokens
   ========================================================================== */
:root {
  color-scheme: light;

  /* Brand */
  --color-primary: #4338ca;          /* indigo 700 — fills, links */
  --color-primary-hover: #3730a3;
  --color-primary-soft: #eef0ff;
  --color-primary-soft-2: #dfe3ff;
  --color-primary-border: #c7cdfb;
  --color-on-primary: #ffffff;
  --color-link: #4338ca;

  --color-accent: #f2a93b;           /* "pencil" marigold — highlights */
  --color-accent-strong: #b45309;
  --color-accent-soft: #fff4de;
  --color-coral: #e8604c;
  --color-coral-soft: #fdebe7;

  --color-success: #0f766e;          /* teal */
  --color-success-soft: #e3f6f3;
  --color-success-border: #9fdcd3;
  --color-warning: #b45309;
  --color-warning-soft: #fff4de;
  --color-warning-border: #f7d49a;
  --color-danger: #c2410c;
  --color-danger-strong: #b91c1c;
  --color-danger-soft: #fdecea;
  --color-danger-text: #b91c1c;
  --tint-bg: 13%;
  --tint-fg: 100%;
  --toast-bg: #1d1b2c;
  --toast-fg: #ffffff;
  --grad-text: linear-gradient(100deg, #4338ca 10%, #7c6cf2 50%, #e8604c 95%);
  --color-danger-border: #f5b8ae;
  --color-info: #1d64c9;
  --color-info-soft: #e7f0fd;
  --color-info-border: #b3cdf5;

  /* Neutrals (warm paper) */
  --color-bg: #f6f5f1;
  --color-bg-grad: #f1effa;
  --color-surface: #ffffff;
  --color-surface-2: #f3f2ee;
  --color-surface-3: #e9e7e1;
  --color-elevated: #ffffff;
  --color-text: #1d1b2c;
  --color-text-2: #3d3b50;
  --color-muted: #625f73;
  --color-subtle: #767485;
  --color-border: #e5e2da;
  --color-border-strong: #d2cec4;
  --color-overlay: rgba(20, 18, 40, .45);
  --color-header: rgba(255, 255, 255, .86);
  --color-gold: #b8860b;
  --color-gold-soft: #fbf1d6;
  --color-gold-text: #7a5300;
  --color-gold-border: #ecd38e;
  --color-star: #f59e0b;
  --color-star-empty: #d6d3cb;

  /* Avatars (initials) */
  --avatar-sat: 70%;
  --avatar-bg-l: 89%;
  --avatar-fg-l: 26%;

  /* Theme toggle visibility */
  --show-when-light: inline-block;
  --show-when-dark: none;

  /* Type */
  --font-sans: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: Georgia, "Times New Roman", Times, serif;
  --font-script: "Great Vibes", "Snell Roundhand", "Apple Chancery", cursive;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --fs-xs: .75rem;
  --fs-sm: .8125rem;
  --fs-base: .9375rem;
  --fs-md: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.3125rem;
  --fs-2xl: 1.625rem;
  --fs-3xl: 2rem;
  --fs-display: clamp(2.25rem, 1.4rem + 3.4vw, 3.75rem);
  --lh-tight: 1.2;
  --lh: 1.6;

  /* Space */
  --sp-1: .25rem;
  --sp-2: .5rem;
  --sp-3: .75rem;
  --sp-4: 1rem;
  --sp-5: 1.25rem;
  --sp-6: 1.5rem;
  --sp-8: 2rem;
  --sp-10: 2.5rem;
  --sp-12: 3rem;
  --sp-16: 4rem;
  --gutter: 24px;

  /* Radii */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-pill: 999px;

  /* Shadows (indigo-tinted) */
  --shadow-xs: 0 1px 2px rgba(29, 27, 60, .05);
  --shadow-sm: 0 1px 2px rgba(29, 27, 60, .05), 0 1px 3px rgba(29, 27, 60, .04);
  --shadow: 0 2px 4px rgba(29, 27, 60, .04), 0 6px 16px rgba(29, 27, 60, .06);
  --shadow-md: 0 4px 8px rgba(29, 27, 60, .05), 0 12px 28px rgba(29, 27, 60, .09);
  --shadow-lg: 0 10px 20px rgba(29, 27, 60, .08), 0 24px 56px rgba(29, 27, 60, .14);
  --ring: 0 0 0 3px rgba(67, 56, 202, .28);
  --focus: #4338ca;

  /* Layout */
  --header-h: 64px;
  --mobile-nav-h: 64px;
  --container: 1200px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --t-fast: 120ms;
  --t: 200ms;
}

/* Dark palette — applied explicitly, or by OS preference unless the user picked light */
[data-theme="dark"] {
  color-scheme: dark;
  --color-primary: #5b54e8;
  --color-primary-hover: #6d67f0;
  --color-primary-soft: #23244a;
  --color-primary-soft-2: #2d2f60;
  --color-primary-border: #43459a;
  --color-on-primary: #ffffff;
  --color-link: #aab4ff;
  --color-accent: #f5b454;
  --color-accent-strong: #f7c16f;
  --color-accent-soft: #3a2c14;
  --color-coral: #f07a66;
  --color-coral-soft: #3d201c;
  --color-success: #4fd1c0;
  --color-success-soft: #13302f;
  --color-success-border: #1f5a55;
  --color-warning: #f5b454;
  --color-warning-soft: #362914;
  --color-warning-border: #6b4d1a;
  --color-danger: #fb8c74;
  --color-danger-strong: #f87171;
  --color-danger-soft: #3a1c1a;
  --color-danger-text: #fb8c74;
  --tint-bg: 23%;
  --tint-fg: 50%;
  --toast-bg: #ecebf6;
  --toast-fg: #1d1b2c;
  --grad-text: linear-gradient(100deg, #aab4ff 10%, #c4b5fd 50%, #f5b454 95%);
  --color-danger-border: #6e2e27;
  --color-info: #7fb2ff;
  --color-info-soft: #172842;
  --color-info-border: #274a7c;
  --color-bg: #0f1020;
  --color-bg-grad: #15163a;
  --color-surface: #17182c;
  --color-surface-2: #1f2038;
  --color-surface-3: #292a46;
  --color-elevated: #1d1e36;
  --color-text: #ecebf6;
  --color-text-2: #cfcee0;
  --color-muted: #a3a2bb;
  --color-subtle: #8a89a3;
  --color-border: #2b2c48;
  --color-border-strong: #3a3b5c;
  --color-overlay: rgba(0, 0, 0, .6);
  --color-header: rgba(18, 19, 38, .82);
  --color-gold: #e0b44c;
  --color-gold-soft: #33290f;
  --color-gold-text: #f3cf74;
  --color-gold-border: #5f4b17;
  --color-star-empty: #45466a;
  --avatar-sat: 45%;
  --avatar-bg-l: 30%;
  --avatar-fg-l: 90%;
  --show-when-light: none;
  --show-when-dark: inline-block;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3), 0 1px 3px rgba(0, 0, 0, .2);
  --shadow: 0 2px 4px rgba(0, 0, 0, .25), 0 6px 16px rgba(0, 0, 0, .25);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, .3), 0 12px 28px rgba(0, 0, 0, .35);
  --shadow-lg: 0 10px 20px rgba(0, 0, 0, .35), 0 24px 56px rgba(0, 0, 0, .45);
  --ring: 0 0 0 3px rgba(141, 150, 255, .4);
  --focus: #aab4ff;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --color-primary: #5b54e8;
    --color-primary-hover: #6d67f0;
    --color-primary-soft: #23244a;
    --color-primary-soft-2: #2d2f60;
    --color-primary-border: #43459a;
    --color-on-primary: #ffffff;
    --color-link: #aab4ff;
    --color-accent: #f5b454;
    --color-accent-strong: #f7c16f;
    --color-accent-soft: #3a2c14;
    --color-coral: #f07a66;
    --color-coral-soft: #3d201c;
    --color-success: #4fd1c0;
    --color-success-soft: #13302f;
    --color-success-border: #1f5a55;
    --color-warning: #f5b454;
    --color-warning-soft: #362914;
    --color-warning-border: #6b4d1a;
    --color-danger: #fb8c74;
    --color-danger-strong: #f87171;
    --color-danger-soft: #3a1c1a;
    --color-danger-text: #fb8c74;
    --tint-bg: 23%;
    --tint-fg: 50%;
    --toast-bg: #ecebf6;
    --toast-fg: #1d1b2c;
    --grad-text: linear-gradient(100deg, #aab4ff 10%, #c4b5fd 50%, #f5b454 95%);
    --color-danger-border: #6e2e27;
    --color-info: #7fb2ff;
    --color-info-soft: #172842;
    --color-info-border: #274a7c;
    --color-bg: #0f1020;
    --color-bg-grad: #15163a;
    --color-surface: #17182c;
    --color-surface-2: #1f2038;
    --color-surface-3: #292a46;
    --color-elevated: #1d1e36;
    --color-text: #ecebf6;
    --color-text-2: #cfcee0;
    --color-muted: #a3a2bb;
    --color-subtle: #8a89a3;
    --color-border: #2b2c48;
    --color-border-strong: #3a3b5c;
    --color-overlay: rgba(0, 0, 0, .6);
    --color-header: rgba(18, 19, 38, .82);
    --color-gold: #e0b44c;
    --color-gold-soft: #33290f;
    --color-gold-text: #f3cf74;
    --color-gold-border: #5f4b17;
    --color-star-empty: #45466a;
    --avatar-sat: 45%;
    --avatar-bg-l: 30%;
    --avatar-fg-l: 90%;
    --show-when-light: none;
    --show-when-dark: inline-block;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3), 0 1px 3px rgba(0, 0, 0, .2);
    --shadow: 0 2px 4px rgba(0, 0, 0, .25), 0 6px 16px rgba(0, 0, 0, .25);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, .3), 0 12px 28px rgba(0, 0, 0, .35);
    --shadow-lg: 0 10px 20px rgba(0, 0, 0, .35), 0 24px 56px rgba(0, 0, 0, .45);
    --ring: 0 0 0 3px rgba(141, 150, 255, .4);
    --focus: #aab4ff;
  }
}

/* ==========================================================================
   02 Reset & base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 16px);
  background: var(--color-bg);
}
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh);
  color: var(--color-text);
  background-color: var(--color-bg);
  background-image: radial-gradient(1200px 480px at 85% -120px, var(--color-bg-grad), transparent 70%);
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg, video, canvas { display: block; max-width: 100%; }
img { height: auto; }
svg.icon { display: inline-block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: var(--color-link); text-decoration: none; text-underline-offset: .18em; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, h5, h6 { margin: 0 0 .5em; line-height: var(--lh-tight); font-weight: 700; letter-spacing: -.015em; color: var(--color-text); }
h1 { font-size: var(--fs-3xl); font-weight: 800; letter-spacing: -.025em; }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-md); }
h5, h6 { font-size: var(--fs-base); }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
ul, ol { margin: 0 0 1em; padding-left: 1.3em; }
hr { border: 0; border-top: 1px solid var(--color-border); margin: var(--sp-6) 0; }
small { font-size: var(--fs-sm); }
code, kbd, pre, samp { font-family: var(--font-mono); font-size: .9em; }
code { background: var(--color-surface-2); padding: .1em .35em; border-radius: var(--radius-xs); }
pre { background: var(--color-surface-2); padding: var(--sp-4); border-radius: var(--radius); overflow: auto; }
pre code { background: none; padding: 0; }
blockquote { margin: 0 0 1em; padding: .25em 0 .25em 1em; border-left: 3px solid var(--color-accent); color: var(--color-text-2); }
table { border-collapse: collapse; width: 100%; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; font-weight: 700; }
dialog { color: inherit; }
::selection { background: var(--color-primary-soft-2); color: var(--color-text); }
[hidden] { display: none !important; }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

.icon { width: 1.15em; height: 1.15em; flex-shrink: 0; vertical-align: -.18em; stroke-width: 2; }
.icon-sm { width: .95em; height: .95em; }
.icon-lg { width: 1.5em; height: 1.5em; }

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 1000;
  padding: 10px 16px;
  background: var(--color-primary);
  color: var(--color-on-primary);
  border-radius: var(--radius-sm);
  font-weight: 700;
  box-shadow: var(--shadow-md);
  transition: top var(--t) var(--ease);
}
.skip-link:focus { top: 12px; text-decoration: none; }

/* ==========================================================================
   03 Typography
   ========================================================================== */
.text-muted { color: var(--color-muted) !important; }
.text-sm { font-size: var(--fs-sm); }
.text-xs { font-size: var(--fs-xs); }
.text-lg { font-size: var(--fs-lg); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.fw-bold { font-weight: 700; }
.mono { font-family: var(--font-mono); font-size: .9em; letter-spacing: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.line-clamp-2, .line-clamp-3 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-2 { -webkit-line-clamp: 2; line-clamp: 2; }
.line-clamp-3 { -webkit-line-clamp: 3; line-clamp: 3; }
.lead { font-size: var(--fs-lg); color: var(--color-text-2); line-height: 1.6; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .4em;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--color-link);
  margin-bottom: var(--sp-2);
}

.prose { font-size: var(--fs-base); line-height: 1.7; color: var(--color-text); overflow-wrap: anywhere; }
.prose > * + * { margin-top: .85em; }
.prose p { margin: 0; }
.prose p + p { margin-top: .85em; }
.prose h2 { font-size: var(--fs-xl); margin-top: 1.6em; }
.prose h3 { font-size: var(--fs-lg); margin-top: 1.4em; }
.prose h2:first-child, .prose h3:first-child { margin-top: 0; }
.prose ul, .prose ol { margin: 0; padding-left: 1.4em; }
.prose li + li { margin-top: .35em; }
.prose a { text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); }
.prose img { border-radius: var(--radius); }
.hashtag { font-weight: 600; color: var(--color-link); }

/* ==========================================================================
   04 Layout
   ========================================================================== */
.container, .container-narrow, .container-wide {
  width: 100%;
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container { max-width: calc(var(--container) + var(--gutter) * 2); }
.container-narrow { max-width: calc(720px + var(--gutter) * 2); }
.container-wide { max-width: calc(1440px + var(--gutter) * 2); }
.container .container-narrow, .container .container, .container-narrow.container { padding-inline: 0; }
.container.container-narrow { max-width: calc(720px + var(--gutter) * 2); padding-inline: var(--gutter); }

.site-main {
  flex: 1 0 auto;
  width: 100%;
  padding-block: var(--sp-8) var(--sp-16);
}
body.is-bare .site-main { padding: 0; }
.site-main > .container.section { padding-top: 0; }

.page-grid {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 300px;
  gap: var(--sp-6);
  align-items: start;
}
.page-grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: var(--sp-6);
  align-items: start;
}
.col-left, .col-main, .col-right { min-width: 0; display: flex; flex-direction: column; gap: var(--sp-5); }
.col-left > *, .col-main > *, .col-right > * { margin: 0; }

.stack, .stack-sm, .stack-lg { display: flex; flex-direction: column; }
.stack { gap: var(--sp-4); }
.stack-sm { gap: var(--sp-2); }
.stack-lg { gap: var(--sp-8); }
.stack > *, .stack-sm > *, .stack-lg > * { margin-block: 0; }
.stack > .tag, .stack-sm > .tag, .stack > .badge, .stack-sm > .badge, .stack > .credit-pill, .stack-sm > .credit-pill, .stack-sm > .chip { align-self: flex-start; }

.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); min-width: 0; }
.row-between { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3); min-width: 0; }
.row > .truncate, .row-between > .truncate { flex: 1 1 0; }

.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: var(--sp-5); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-5); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-5); }
.section { padding-block: var(--sp-12); }
.sticky { position: sticky !important; top: calc(var(--header-h) + var(--sp-5)); z-index: 1; }

.divider { height: 1px; background: var(--color-border); border: 0; margin: var(--sp-4) 0; }

/* Page header */
.page-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: var(--sp-6);
  row-gap: var(--sp-1);
  align-items: end;
  margin-bottom: var(--sp-6);
}
.page-header > :not(.page-actions) { grid-column: 1; margin-block: 0; }
.page-title { font-size: var(--fs-3xl); font-weight: 800; letter-spacing: -.03em; margin: 0; line-height: 1.15; }
.page-title .icon { color: var(--color-link); }
.page-subtitle { color: var(--color-muted); font-size: var(--fs-md); margin: var(--sp-1) 0 0; max-width: 68ch; }
.page-actions { grid-column: 2; grid-row: 1 / span 4; align-self: center; display: flex; flex-wrap: wrap; gap: var(--sp-2); justify-content: flex-end; }
.breadcrumbs {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  font-size: var(--fs-sm); color: var(--color-muted); margin-bottom: var(--sp-2);
  list-style: none; padding: 0;
}
.breadcrumbs ol, .breadcrumbs ul { display: contents; list-style: none; }
.breadcrumbs li { display: inline-flex; align-items: center; gap: 6px; }
.breadcrumbs li + li::before,
.breadcrumbs:not(:has(> svg, > [aria-hidden="true"])) > :is(a, span) + :is(a, span)::before { content: "/"; color: var(--color-subtle); margin-right: 6px; }
.breadcrumbs .icon { width: 14px; height: 14px; color: var(--color-subtle); }
.breadcrumbs > [aria-hidden="true"] { color: var(--color-subtle); }
.breadcrumbs a { color: var(--color-muted); font-weight: 500; }
.breadcrumbs a:hover { color: var(--color-link); }
.breadcrumbs [aria-current] { color: var(--color-text); font-weight: 600; }

/* ==========================================================================
   05 Header, nav, footer
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--color-header);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--color-border);
}
.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--color-text);
  font-weight: 800;
  font-size: 1.125rem;
  letter-spacing: -.03em;
  flex-shrink: 0;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  color: #fff;
  background:
    radial-gradient(circle at 78% 18%, rgba(242, 169, 59, .95) 0 5px, transparent 6px),
    linear-gradient(140deg, #6366f1 0%, #4338ca 55%, #312e81 100%);
  box-shadow: 0 4px 12px rgba(67, 56, 202, .35), inset 0 1px 0 rgba(255, 255, 255, .25);
  transition: transform var(--t) var(--ease);
}
.brand-mark .icon { width: 20px; height: 20px; }
.brand:hover .brand-mark { transform: rotate(-6deg) scale(1.04); }
.brand-name span, .brand-name em { color: var(--color-link); font-style: normal; }

.header-search {
  position: relative;
  flex: 0 1 280px;
  min-width: 160px;
}
.header-search .icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-subtle);
  pointer-events: none;
  width: 17px; height: 17px;
}
.header-search input {
  width: 100%;
  height: 40px;
  padding: 0 14px 0 38px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: var(--color-surface-2);
  color: var(--color-text);
  font-size: var(--fs-sm);
  transition: background var(--t), border-color var(--t), box-shadow var(--t);
}
.header-search input::placeholder { color: var(--color-subtle); }
.header-search input:hover { border-color: var(--color-border-strong); }
.header-search input:focus { outline: none; background: var(--color-surface); border-color: var(--color-primary); box-shadow: var(--ring); }
.header-search input::-webkit-search-cancel-button { cursor: pointer; }

.main-nav {
  display: flex;
  align-items: stretch;
  height: 100%;
  margin-inline: auto;
  gap: 2px;
}
.nav-link {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 72px;
  padding: 0 10px;
  color: var(--color-muted);
  font-size: var(--fs-xs);
  font-weight: 600;
  white-space: nowrap;
  border-radius: 0;
  transition: color var(--t-fast);
}
.nav-link .icon { width: 22px; height: 22px; transition: transform var(--t) var(--ease); }
.nav-link:hover { color: var(--color-text); text-decoration: none; }
.nav-link:hover .icon { transform: translateY(-1px); }
.nav-link::after {
  content: "";
  position: absolute;
  left: 14px; right: 14px; bottom: -1px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--color-primary);
  transform: scaleX(0);
  transition: transform var(--t) var(--ease);
}
.nav-link.is-active { color: var(--color-link); }
.nav-link.is-active::after { transform: scaleX(1); }
.nav-link:focus-visible { outline-offset: -4px; border-radius: var(--radius-sm); }

.nav-badge {
  position: absolute;
  top: 7px;
  left: calc(50% + 6px);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--radius-pill);
  background: #d6412e;
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 0 0 2px var(--color-surface);
  animation: badge-in 300ms var(--ease);
}
.icon-btn .nav-badge { top: 2px; left: auto; right: -2px; }

.guest-nav { display: flex; align-items: center; gap: 4px; margin-left: var(--sp-6); }
.guest-nav .nav-link {
  flex-direction: row;
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  font-size: var(--fs-sm);
  border-radius: var(--radius-pill);
  color: var(--color-text-2);
}
.guest-nav .nav-link::after { display: none; }
.guest-nav .nav-link:hover { background: var(--color-surface-2); }

.header-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; flex-shrink: 0; }
.main-nav + .header-actions { margin-left: 0; }

.icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--color-muted);
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);
}
.icon-btn .icon { width: 20px; height: 20px; }
.icon-btn:hover { background: var(--color-surface-2); color: var(--color-text); text-decoration: none; }
.icon-btn:active { transform: scale(.94); }
.icon-btn:focus-visible { border-radius: var(--radius-pill); }

.theme-toggle .theme-icon-dark { display: var(--show-when-light); }
.theme-toggle .theme-icon-light { display: var(--show-when-dark); }
.theme-toggle:hover .icon { animation: spin-in 500ms var(--ease); }

.user-menu > summary {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px 3px 3px;
  border-radius: var(--radius-pill);
  color: var(--color-muted);
  transition: background var(--t-fast);
}
.user-menu > summary:hover, .user-menu[open] > summary { background: var(--color-surface-2); }
.user-menu[open] > summary .icon { transform: rotate(180deg); }
.user-menu > summary .icon { transition: transform var(--t); }
.user-menu .dropdown-menu { min-width: 240px; }

.flash-wrap { margin-bottom: var(--sp-4); }
.flash-wrap .alert { box-shadow: var(--shadow-sm); animation: slide-down 280ms var(--ease); }

/* Footer */
.site-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
  padding-block: var(--sp-10) var(--sp-8);
}
.footer-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr);
  gap: var(--sp-4) var(--sp-10);
  align-items: start;
}
.footer-brand p { margin-top: var(--sp-3); max-width: 38ch; }
.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--sp-2) var(--sp-6);
  padding-top: 8px;
}
.footer-links a { color: var(--color-text-2); font-size: var(--fs-sm); font-weight: 500; }
.footer-links a:hover { color: var(--color-link); }
.footer-copy { grid-column: 1 / -1; margin: var(--sp-4) 0 0; padding-top: var(--sp-5); border-top: 1px solid var(--color-border); }

/* Mobile bottom nav (authed) — shown below 860px */
.mobile-nav {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 110;
  height: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom, 0px));
  padding: 0 6px env(safe-area-inset-bottom, 0px);
  background: var(--color-header);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--color-border);
  box-shadow: 0 -4px 20px rgba(29, 27, 60, .06);
}
.mobile-nav-link {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--color-muted);
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius);
}
.mobile-nav-link span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mobile-nav-link .icon { width: 22px; height: 22px; }
.mobile-nav-link:hover { text-decoration: none; color: var(--color-text); }
.mobile-nav-link[aria-current], .mobile-nav-link.is-active { color: var(--color-link); }

/* ==========================================================================
   06 Buttons
   ========================================================================== */
.btn {
  --btn-bg: var(--color-surface);
  --btn-fg: var(--color-text);
  --btn-border: var(--color-border-strong);
  --btn-hover-bg: var(--color-surface-2);
  --btn-spinner: currentColor;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--btn-border);
  border-radius: var(--radius-sm);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: var(--fs-sm);
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), box-shadow var(--t), transform var(--t-fast);
}
.btn .icon { width: 17px; height: 17px; }
.btn:hover { background: var(--btn-hover-bg); text-decoration: none; color: var(--btn-fg); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }
.btn:disabled, .btn.is-disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; pointer-events: none; }

.btn-primary {
  --btn-bg: var(--color-primary);
  --btn-fg: var(--color-on-primary);
  --btn-border: transparent;
  --btn-hover-bg: var(--color-primary-hover);
  box-shadow: 0 1px 2px rgba(49, 46, 129, .25), inset 0 1px 0 rgba(255, 255, 255, .12);
}
.btn-primary:hover { box-shadow: 0 4px 14px rgba(67, 56, 202, .3); }
.btn-secondary {
  --btn-bg: var(--color-primary-soft);
  --btn-fg: var(--color-link);
  --btn-border: transparent;
  --btn-hover-bg: var(--color-primary-soft-2);
}
.btn-ghost {
  --btn-bg: transparent;
  --btn-fg: var(--color-text-2);
  --btn-border: transparent;
  --btn-hover-bg: var(--color-surface-2);
}
.btn-outline {
  --btn-bg: transparent;
  --btn-fg: var(--color-text);
  --btn-border: var(--color-border-strong);
  --btn-hover-bg: var(--color-surface-2);
}
.btn-danger {
  --btn-bg: var(--color-danger-strong);
  --btn-fg: #fff;
  --btn-border: transparent;
  --btn-hover-bg: #991b1b;
}
.btn-success {
  --btn-bg: #0f766e;
  --btn-fg: #fff;
  --btn-border: transparent;
  --btn-hover-bg: #115e59;
}
.btn-accent {
  --btn-bg: var(--color-accent);
  --btn-fg: #2a1a00;
  --btn-border: transparent;
  --btn-hover-bg: #f5b654;
  box-shadow: 0 4px 14px rgba(242, 169, 59, .35);
}
.btn-sm { height: 32px; padding: 0 12px; font-size: var(--fs-xs); gap: 6px; border-radius: 7px; }
.btn-sm .icon { width: 15px; height: 15px; }
.btn-lg { height: 50px; padding: 0 24px; font-size: var(--fs-md); border-radius: var(--radius); }
.btn-lg .icon { width: 19px; height: 19px; }
.btn-block { display: flex; width: 100%; }
.btn-icon { width: 40px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }
.btn-icon.btn-lg { width: 50px; }
.btn-group { display: inline-flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.btn-group.is-attached { gap: 0; }
.btn-group.is-attached > .btn:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; }
.btn-group.is-attached > .btn:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
button.btn-link, .btn-link { background: none; border: 0; padding: 0; color: var(--color-link); font-weight: 600; cursor: pointer; }

/* Double-submit guard feedback */
form.is-submitting, form.is-busy { cursor: progress; }
form.is-busy [type="submit"] { opacity: .7; pointer-events: none; }
.follow-form { display: inline-flex; margin: 0; }
.message-status { padding: 0 6px; margin-top: 2px; }
form.is-submitting [type="submit"], form.is-submitting button:not([type]) { color: transparent !important; pointer-events: none; }
form.is-submitting [type="submit"]::after, form.is-submitting button.btn:not([type])::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--btn-fg, currentColor);
  border-right-color: transparent;
  animation: spin 700ms linear infinite;
}
form.is-submitting .dropdown-item[type="submit"] { color: var(--color-muted) !important; }
form.is-submitting .dropdown-item[type="submit"]::after { display: none; }

/* ==========================================================================
   07 Forms
   ========================================================================== */
.form { display: flex; flex-direction: column; gap: var(--sp-5); }
.form-group { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.form-label { font-size: var(--fs-sm); font-weight: 650; color: var(--color-text); }
.form-label .text-muted { font-weight: 500; }
.required { color: var(--color-danger-text); margin-left: 2px; }
.form-control {
  display: block;
  width: 100%;
  min-height: 42px;
  padding: 9px 13px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--fs-base);
  line-height: 1.45;
  transition: border-color var(--t-fast), box-shadow var(--t), background var(--t);
  -webkit-appearance: none;
  appearance: none;
}
.form-control::placeholder { color: var(--color-subtle); }
.form-control:hover { border-color: color-mix(in srgb, var(--color-border-strong) 60%, var(--color-muted)); }
.form-control:focus { outline: none; border-color: var(--color-primary); box-shadow: var(--ring); }
.form-control:disabled, .form-control[readonly] { background: var(--color-surface-2); color: var(--color-muted); }
textarea.form-control { min-height: 96px; resize: vertical; }
textarea.form-control[rows="1"], textarea.form-control[rows="2"] { min-height: 42px; }
select.form-control {
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238c8a9b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
}
select.form-control[multiple] { background-image: none; padding-right: 13px; min-height: 120px; }
input[type="color"].form-control { padding: 4px; height: 42px; width: 64px; cursor: pointer; }
input[type="file"].form-control { padding: 8px; }
input[type="date"].form-control, input[type="time"].form-control { min-height: 42px; }
.form-control.is-invalid { border-color: var(--color-danger-strong); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 3px rgba(185, 28, 28, .2); }
.form-help { font-size: var(--fs-xs); color: var(--color-muted); margin: 0; }
.form-error { font-size: var(--fs-xs); color: var(--color-danger-text); font-weight: 600; margin: 0; display: flex; gap: 4px; align-items: center; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); padding-top: var(--sp-2); }
.form-actions .btn-primary:first-child:last-child { min-width: 140px; }

.check {
  display: inline-flex;
  align-items: flex-start;
  gap: 10px;
  font-size: var(--fs-base);
  cursor: pointer;
  line-height: 1.45;
}
.check input[type="checkbox"], .check input[type="radio"] {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: var(--color-primary);
  cursor: pointer;
}
.check-list { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-5); }

.input-group { position: relative; display: flex; align-items: center; min-width: 0; }
.input-group > .icon {
  position: absolute;
  left: 13px;
  color: var(--color-subtle);
  pointer-events: none;
  width: 17px;
  height: 17px;
  z-index: 1;
}
.input-group > .icon ~ .form-control, .input-group > .icon + .form-control { padding-left: 40px; }
.input-group > .form-control { flex: 1 1 auto; min-width: 0; }
.input-group > .btn { flex-shrink: 0; }
.input-group > .form-control + .btn { margin-left: -1px; border-top-left-radius: 0; border-bottom-left-radius: 0; height: 42px; }
.input-group > .form-control:has(+ .btn) { border-top-right-radius: 0; border-bottom-right-radius: 0; }

.file-drop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: var(--sp-6) var(--sp-4);
  border: 2px dashed var(--color-border-strong);
  border-radius: var(--radius);
  background: var(--color-surface-2);
  color: var(--color-muted);
  text-align: center;
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: border-color var(--t), background var(--t), color var(--t);
}
.file-drop > .icon { width: 28px; height: 28px; color: var(--color-link); }
.file-drop strong { color: var(--color-text); }
.file-drop:hover, .file-drop:focus-within, .file-drop.is-dragover {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
  color: var(--color-text-2);
}
.file-drop input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.file-drop:focus-within { box-shadow: var(--ring); }

/* ==========================================================================
   08 Cards
   ========================================================================== */
.card {
  position: relative;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
/* Cards without structural children get default padding */
.card:not(:has(> .card-body, > .card-header, > .card-footer, > .group-banner, > .profile-cover, > .table-wrap, > .list, > .conversation-list, > .post-image, > .card-media)) { padding: var(--sp-5); }
.card.card-flush { padding: 0; overflow: hidden; }
.card-body { padding: var(--sp-5); }
.card-body + .card-body { border-top: 1px solid var(--color-border); }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--color-border);
}
.card-header > * { margin: 0; }
.card-title {
  font-size: var(--fs-md);
  font-weight: 700;
  letter-spacing: -.01em;
  margin: 0;
  line-height: 1.35;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-text);
}
.card-title > a { color: inherit; }
.card-title .icon { color: var(--color-link); width: 18px; height: 18px; }
.card-title.line-clamp-2 { display: -webkit-box; }
.card-footer {
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--color-border);
  background: color-mix(in srgb, var(--color-surface-2) 55%, var(--color-surface));
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.card-header:first-child { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.card-hover { transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease), border-color var(--t); }
.card-hover:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--color-primary-border); }
a.card-link, .card-link { display: block; color: inherit; text-decoration: none; }
a.card-link:hover { text-decoration: none; color: inherit; }
.card-link:hover .card-title { color: var(--color-link); }
.card-link:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-lg); }
.card-accent { border-top: 0; overflow: hidden; }
.card-accent::before {
  content: "";
  display: block;
  height: 5px;
  background: linear-gradient(90deg, var(--accent, var(--color-primary)), color-mix(in srgb, var(--accent, var(--color-primary)) 55%, var(--color-accent)));
}
.card.card-accent:not(:has(> .card-body, > .card-header)) { padding-top: 0; }
.card.card-accent:not(:has(> .card-body, > .card-header))::before { margin: 0 calc(var(--sp-5) * -1) var(--sp-5); }

/* ==========================================================================
   09 Feedback
   ========================================================================== */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface-2);
  color: var(--color-text);
  font-size: var(--fs-sm);
  line-height: 1.5;
}
.alert > .icon { width: 19px; height: 19px; margin-top: 0; flex-shrink: 0; }
.alert > span, .alert > div, .alert > p { flex: 1 1 auto; min-width: 0; margin: 0; }
.alert strong { font-weight: 700; }
.alert-success { background: var(--color-success-soft); border-color: var(--color-success-border); }
.alert-success > .icon { color: var(--color-success); }
.alert-error, .alert-danger { background: var(--color-danger-soft); border-color: var(--color-danger-border); }
.alert-error > .icon, .alert-danger > .icon { color: var(--color-danger-text); }
.alert-info { background: var(--color-info-soft); border-color: var(--color-info-border); }
.alert-info > .icon { color: var(--color-info); }
.alert-warning { background: var(--color-warning-soft); border-color: var(--color-warning-border); }
.alert-warning > .icon { color: var(--color-warning); }
.alert-close {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin: -3px -4px -3px 0;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--color-muted);
}
.alert-close:hover { background: rgba(0, 0, 0, .06); color: var(--color-text); }
.alert-close .icon { width: 16px; height: 16px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 21px;
  padding: 0 8px;
  border-radius: var(--radius-pill);
  background: var(--color-surface-3);
  color: var(--color-text-2);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  vertical-align: middle;
  letter-spacing: .01em;
}
.badge .icon { width: 12px; height: 12px; }
.badge-primary { background: var(--color-primary); color: var(--color-on-primary); }
.badge-success { background: var(--color-success-soft); color: var(--color-success); }
.badge-warning { background: var(--color-warning-soft); color: var(--color-warning); }
.badge-danger { background: var(--color-danger-soft); color: var(--color-danger-text); }
.badge-muted { background: var(--color-surface-2); color: var(--color-muted); }
.badge-info { background: var(--color-info-soft); color: var(--color-info); }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-xs);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  color: var(--color-text-2);
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tag .icon { width: 12px; height: 12px; color: var(--color-muted); }
a.tag:hover { border-color: var(--color-primary-border); color: var(--color-link); text-decoration: none; }
.tag-standard, .tag.mono { font-family: var(--font-mono); font-size: 11px; background: var(--color-primary-soft); border-color: var(--color-primary-border); color: var(--color-link); }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; min-width: 0; }
.tag-list > li { display: contents; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-text-2);
  font-size: var(--fs-sm);
  font-weight: 600;
  white-space: nowrap;
  transition: all var(--t-fast);
}
.chip .icon { width: 15px; height: 15px; }
.chip:hover { border-color: var(--color-primary-border); color: var(--color-link); background: var(--color-primary-soft); text-decoration: none; }
.chip.is-active {
  background: var(--color-text);
  border-color: var(--color-text);
  color: var(--color-bg);
}
.chip .badge { height: 18px; padding: 0 6px; margin-right: -6px; }
.chip.is-active .badge { background: rgba(255, 255, 255, .2); color: inherit; }
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-list.is-scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--sp-2);
  padding: var(--sp-12) var(--sp-6);
  color: var(--color-muted);
  border: 1.5px dashed var(--color-border-strong);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 50% 0%, var(--color-primary-soft), transparent 60%),
    var(--color-surface);
}
.card .empty-state { border: 0; background: transparent; }
.empty-state-icon {
  width: 56px;
  height: 56px;
  padding: 14px;
  border-radius: 18px;
  background: var(--color-primary-soft);
  color: var(--color-link);
  margin-bottom: var(--sp-2);
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--color-primary-soft) 45%, transparent);
}
.empty-state h3 { margin: 0; font-size: var(--fs-lg); color: var(--color-text); }
.empty-state p { margin: 0; max-width: 46ch; }
.empty-state .btn { margin-top: var(--sp-3); }

.skeleton {
  display: block;
  min-height: 1em;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--color-surface-2) 25%, var(--color-surface-3) 45%, var(--color-surface-2) 65%);
  background-size: 300% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  color: transparent !important;
}
.skeleton * { visibility: hidden; }

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2.5px solid var(--color-primary-soft-2);
  border-top-color: var(--color-primary);
  animation: spin 700ms linear infinite;
  vertical-align: middle;
  flex-shrink: 0;
}
.spinner.is-lg, .spinner-lg { width: 36px; height: 36px; border-width: 3.5px; }

.toast-wrap {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
  max-width: calc(100vw - 32px);
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
  max-width: 380px;
  padding: 12px 16px 12px 14px;
  border-radius: var(--radius);
  background: var(--toast-bg);
  color: var(--toast-fg);
  font-size: var(--fs-sm);
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(12px) scale(.97);
  transition: opacity var(--t) var(--ease), transform var(--t) var(--ease);
  pointer-events: auto;
}
.toast::before {
  content: "";
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #aab4ff;
  box-shadow: 0 0 0 4px rgba(170, 180, 255, .2);
}
.toast-success::before { background: #4fd1c0; box-shadow: 0 0 0 4px rgba(79, 209, 192, .2); }
.toast-error::before { background: #fb8c74; box-shadow: 0 0 0 4px rgba(251, 140, 116, .22); }
.toast.is-visible { opacity: 1; transform: none; }

.progress {
  position: relative;
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--color-surface-3);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: var(--value, 0%);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--color-primary), #7c6cf2);
  transition: width 600ms var(--ease);
}
.progress.is-success .progress-bar { background: linear-gradient(90deg, #0f766e, #2dd4bf); }
.progress.is-gold .progress-bar, .progress.is-accent .progress-bar { background: linear-gradient(90deg, #d4a017, #f2a93b); }

/* ==========================================================================
   10 Navigation
   ========================================================================== */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--color-border);
  overflow-x: auto;
  scrollbar-width: none;
  margin-bottom: var(--sp-5);
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 11px 14px;
  border: 0;
  background: none;
  color: var(--color-muted);
  font-size: var(--fs-sm);
  font-weight: 650;
  white-space: nowrap;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: color var(--t-fast), background var(--t-fast);
}
.tab .icon { width: 16px; height: 16px; }
.tab:hover { color: var(--color-text); background: var(--color-surface-2); text-decoration: none; }
.tab::after {
  content: "";
  position: absolute;
  left: 10px; right: 10px; bottom: -1px;
  height: 2.5px;
  border-radius: 2px;
  background: var(--color-primary);
  transform: scaleX(0);
  transition: transform var(--t) var(--ease);
}
.tab.is-active { color: var(--color-text); }
.tab.is-active::after { transform: scaleX(1); }
.tab .badge { height: 18px; padding: 0 6px; }

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: var(--sp-8);
}
.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 38px;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text-2);
  font-size: var(--fs-sm);
  font-weight: 650;
  transition: all var(--t-fast);
}
.page-link .icon { width: 16px; height: 16px; }
a.page-link:hover { border-color: var(--color-primary-border); background: var(--color-primary-soft); color: var(--color-link); text-decoration: none; }
.page-link.is-active { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-on-primary); box-shadow: 0 4px 12px rgba(67, 56, 202, .25); }
.page-link.is-disabled { opacity: .45; cursor: not-allowed; }
.page-gap { padding: 0 4px; color: var(--color-subtle); }

.dropdown { position: relative; display: inline-block; }
.dropdown > summary { list-style: none; cursor: pointer; user-select: none; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown > summary::marker { content: ""; }
.dropdown > summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-pill); }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 200;
  min-width: 210px;
  max-width: min(320px, calc(100vw - 24px));
  padding: 6px;
  background: var(--color-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  animation: pop-in 160ms var(--ease);
  transform-origin: top left;
}
.dropdown-menu-right { left: auto; right: 0; transform-origin: top right; }
.dropdown-menu form { margin: 0; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--color-text);
  font-size: var(--fs-sm);
  font-weight: 550;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}
.dropdown-item .icon { width: 17px; height: 17px; color: var(--color-muted); }
.dropdown-item:hover, .dropdown-item:focus-visible { background: var(--color-surface-2); text-decoration: none; color: var(--color-text); outline: none; }
.dropdown-item:hover .icon { color: var(--color-link); }
.dropdown-item.is-danger, .dropdown-item.text-danger { color: var(--color-danger-text); }
.dropdown-item.is-danger .icon { color: currentColor; }
.dropdown-divider { height: 1px; margin: 6px 4px; background: var(--color-border); }
.dropdown-header {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 10px 10px;
  font-size: var(--fs-sm);
  line-height: 1.35;
}
.dropdown-header strong { font-weight: 700; }
.post-menu .dropdown > summary, .dropdown > summary.btn-icon, .dropdown > summary.icon-btn { display: inline-grid; }
.dropdown > summary.btn:not(.btn-icon) { display: inline-flex; }

/* ==========================================================================
   11 Lists, media & avatars
   ========================================================================== */
.list { display: flex; flex-direction: column; list-style: none; margin: 0; padding: 0; }
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px var(--sp-5);
  color: inherit;
  min-width: 0;
  position: relative;
  transition: background var(--t-fast);
}
.list-item + .list-item { border-top: 1px solid var(--color-border); }
a.list-item:hover, .list-item.is-link:hover { background: var(--color-surface-2); text-decoration: none; }
.card-body .list-item, .col-left .card-body .list-item, .col-right .card-body .list-item { padding-inline: 0; }
.card-body a.list-item:hover { background: transparent; }
.card-body > .list:first-child > .list-item:first-child { padding-top: 0; }
.card-body > .list:last-child > .list-item:last-child { padding-bottom: 0; }
.card-body a.list-item:hover .list-item-title { color: var(--color-link); }
.list-item-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; }
.list-item-body > .row-between, .list-item-body > .row, .list-item-body > .truncate, .list-item-body > .list-item-title, .list-item-body > .list-item-meta { align-self: stretch; }
.list-item-title { font-weight: 650; font-size: var(--fs-base); color: var(--color-text); line-height: 1.35; margin: 0; }
.list-item-title a { color: inherit; }
.list-item-title a:hover { color: var(--color-link); }
.list-item-meta { font-size: var(--fs-sm); color: var(--color-muted); line-height: 1.4; }
.list-item > .btn, .list-item > form, .list-item > .dropdown, .list-item > .badge { flex-shrink: 0; }
.list-item.is-unread { background: color-mix(in srgb, var(--color-primary-soft) 70%, transparent); }
.list-item.is-unread::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 50%;
  width: 7px;
  height: 7px;
  margin-top: -3.5px;
  border-radius: 50%;
  background: var(--color-primary);
}
.list-item.is-unread .list-item-title { font-weight: 750; }
.list-item > .icon, .list-item-icon {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  padding: 9px;
  border-radius: 11px;
  background: var(--color-primary-soft);
  color: var(--color-link);
}

.avatar {
  --size: 40px;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  object-fit: cover;
  background: var(--color-surface-3);
  font-size: calc(var(--size) * .38);
  font-weight: 750;
  line-height: 1;
  letter-spacing: -.02em;
  user-select: none;
  vertical-align: middle;
}
.avatar-xs { --size: 24px; font-size: 10px; }
.avatar-sm { --size: 32px; }
.avatar-md { --size: 44px; }
.avatar-lg { --size: 64px; }
.avatar-xl { --size: 112px; }
.avatar-initials {
  background: hsl(var(--avatar-hue, 240) var(--avatar-sat) var(--avatar-bg-l));
  color: hsl(var(--avatar-hue, 240) 55% var(--avatar-fg-l));
  box-shadow: inset 0 0 0 1px hsl(var(--avatar-hue, 240) 40% 50% / .12);
}
.avatar-stack { display: inline-flex; align-items: center; }
.avatar-stack > .avatar { box-shadow: 0 0 0 2px var(--color-surface); }
.avatar-stack > .avatar + .avatar { margin-left: -9px; }
.avatar-stack > .avatar-more, .avatar-stack > span:not(.avatar) { margin-left: 8px; font-size: var(--fs-xs); color: var(--color-muted); font-weight: 600; }

.media { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.media-body { flex: 1 1 auto; min-width: 0; }
.verified {
  display: inline-flex;
  vertical-align: -.12em;
  color: var(--color-link);
  margin-left: 2px;
}
.verified .icon { width: 1em; height: 1em; fill: color-mix(in srgb, currentColor 15%, transparent); }
.user-link { color: var(--color-text); font-weight: 700; }
.user-link:hover { color: var(--color-link); }

/* ==========================================================================
   12 Stats, tables & meta lists
   ========================================================================== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
  gap: var(--sp-4);
}
.stat {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 14px;
  align-items: center;
  padding: var(--sp-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.stat > :not(.stat-icon) { grid-column: 2; }
.stat:not(:has(> .stat-icon)) { display: flex; flex-direction: column; justify-content: center; }
a.stat { color: inherit; transition: border-color var(--t), box-shadow var(--t), transform var(--t) var(--ease); }
a.stat:hover { text-decoration: none; border-color: var(--color-primary-border); box-shadow: var(--shadow); transform: translateY(-2px); }
.stat-icon {
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--color-primary-soft);
  color: var(--color-link);
}
.stat-icon .icon { width: 22px; height: 22px; }
.stat:nth-child(4n+2) .stat-icon { background: var(--color-success-soft); color: var(--color-success); }
.stat:nth-child(4n+3) .stat-icon { background: var(--color-accent-soft); color: var(--color-accent-strong); }
.stat:nth-child(4n+4) .stat-icon { background: var(--color-coral-soft); color: var(--color-coral); }
.stat-value { font-size: var(--fs-2xl); font-weight: 800; letter-spacing: -.03em; line-height: 1.1; color: var(--color-text); font-variant-numeric: tabular-nums; }
.stat-label { font-size: var(--fs-sm); color: var(--color-muted); font-weight: 550; line-height: 1.35; }

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  -webkit-overflow-scrolling: touch;
}
.card > .table-wrap, .card-body > .table-wrap:only-child { border: 0; border-radius: inherit; }
.table { width: 100%; font-size: var(--fs-sm); border-collapse: separate; border-spacing: 0; }
.table th, .table td { padding: 12px 16px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--color-border); }
.table th {
  position: sticky;
  top: 0;
  background: var(--color-surface-2);
  color: var(--color-muted);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  white-space: nowrap;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--t-fast); }
.table tbody tr:hover { background: color-mix(in srgb, var(--color-surface-2) 60%, transparent); }
.table td.text-right, .table th.text-right { text-align: right; }
.text-left { text-align: left; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tfoot td { font-weight: 700; background: var(--color-surface-2); border-bottom: 0; }

.meta-list {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 10px 18px;
  margin: 0;
  font-size: var(--fs-sm);
}
.meta-list dt { color: var(--color-muted); font-weight: 550; display: flex; align-items: center; gap: 7px; }
.meta-list dt .icon { width: 16px; height: 16px; }
.meta-list dd { margin: 0; color: var(--color-text); font-weight: 600; overflow-wrap: anywhere; }
.meta-list > div { display: contents; }

/* ==========================================================================
   13 Feed: composer, posts, reactions, comments
   ========================================================================== */
.composer {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-4) var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  transition: box-shadow var(--t), border-color var(--t);
}
.composer:focus-within { border-color: var(--color-primary-border); box-shadow: var(--shadow), 0 0 0 4px color-mix(in srgb, var(--color-primary-soft) 70%, transparent); }
.composer > .row:first-child, .composer-top { align-items: flex-start; flex-wrap: nowrap; }
.composer-input, textarea.composer-input {
  width: 100%;
  min-height: 52px;
  padding: 10px 2px;
  border: 0;
  background: transparent;
  color: var(--color-text);
  font-size: var(--fs-md);
  line-height: 1.55;
  resize: none;
}
.composer-input:focus { outline: none; box-shadow: none; }
.composer-input::placeholder { color: var(--color-subtle); }
.composer-tools { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.composer-tools .form-control { width: auto; min-width: 0; flex: 1 1 140px; min-height: 36px; padding-block: 6px; font-size: var(--fs-sm); }
.composer-tools select.form-control { flex: 0 1 170px; }
.composer-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--color-border);
}
.composer-footer .btn-ghost { color: var(--color-muted); }
.composer-footer .btn-ghost .icon { color: var(--color-link); }
.composer-footer > :last-child { margin-left: auto; }

.post {
  position: relative;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-5) var(--sp-5) var(--sp-3);
  min-width: 0;
  transition: box-shadow var(--t), border-color var(--t);
}
.post:hover { box-shadow: var(--shadow); }
.post.is-pinned { border-color: var(--color-gold-border); }
.post:target { border-color: var(--color-primary); box-shadow: var(--ring); }
.pinned-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-bottom: var(--sp-3);
  padding: 3px 9px 3px 7px;
  border-radius: var(--radius-pill);
  background: var(--color-gold-soft);
  color: var(--color-gold-text);
  font-size: var(--fs-xs);
  font-weight: 700;
}
.pinned-label .icon { width: 13px; height: 13px; }
.post-header { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.post-header > .avatar, .post-header > a > .avatar { margin-top: 1px; }
.post-header > div:not(.post-menu), .post-author-wrap { flex: 1 1 auto; min-width: 0; }
.post-author { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; font-weight: 700; line-height: 1.3; min-width: 0; }
.post-author .user-link { color: var(--color-text); }
.post-author .text-muted, .post-author .text-sm { font-weight: 500; }
.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 6px;
  margin-top: 2px;
  font-size: var(--fs-xs);
  color: var(--color-muted);
  line-height: 1.4;
}
.post-meta > * + *::before { content: "·"; margin-right: 6px; color: var(--color-subtle); }
.post-meta > .icon + *::before, .post-meta > .icon::before { content: none; }
.post-meta a { color: var(--color-muted); font-weight: 600; }
.post-meta a:hover { color: var(--color-link); }
.post-meta .icon { width: 13px; height: 13px; }
.post-menu { margin-left: auto; flex-shrink: 0; margin-top: -4px; margin-right: -8px; }
.post-menu > summary, .post-menu summary {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--color-muted);
}
.post-menu summary:hover { background: var(--color-surface-2); color: var(--color-text); }
.post-body { margin-top: var(--sp-3); font-size: var(--fs-base); line-height: 1.65; overflow-wrap: anywhere; }
.post-body a:not(.hashtag) { text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); }
.post-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--sp-3); }
.post-image {
  display: block;
  margin-top: var(--sp-3);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
}
.post-image img, img.post-image { width: 100%; max-height: 520px; object-fit: cover; }
.post-attachment {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: var(--sp-3);
  padding: 10px 14px 10px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface-2);
  color: var(--color-text);
  min-width: 0;
  transition: border-color var(--t-fast), background var(--t-fast);
}
a.post-attachment:hover { border-color: var(--color-primary-border); background: var(--color-primary-soft); text-decoration: none; }
.post-attachment > div, .post-attachment > span:not(.file-icon) { flex: 1 1 auto; min-width: 0; }
.post-attachment strong, .post-attachment .fw-bold { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-sm); }
.post-attachment > .icon:last-child { color: var(--color-muted); }
.post-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  margin-top: var(--sp-3);
  font-size: var(--fs-xs);
  color: var(--color-muted);
}
.post-stats a { color: var(--color-muted); }
.post-stats a:hover { color: var(--color-link); }
.post-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--color-border);
}
.post-actions > form { margin: 0; display: contents; }
.reaction-picker { display: flex; flex-wrap: wrap; gap: 6px; margin-right: auto; }
.reaction-picker form { display: contents; }
.reaction-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px 0 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-muted);
  font-size: var(--fs-sm);
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), transform var(--t-fast);
}
.reaction-btn:hover { background: var(--color-surface-2); border-color: var(--color-border-strong); color: var(--color-text); transform: translateY(-1px); }
.reaction-btn:active { transform: scale(.94); }
.reaction-emoji {
  display: inline-block;
  font-size: 16px;
  line-height: 1;
  transition: transform var(--t) var(--ease);
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}
.reaction-btn:hover .reaction-emoji { transform: scale(1.2) rotate(-6deg); }
.reaction-count { min-width: .6em; }
.reaction-count:empty { display: none; }
.reaction-btn.is-active {
  background: var(--color-primary-soft);
  border-color: var(--color-primary-border);
  color: var(--color-link);
}
.reaction-btn.is-active .reaction-emoji, .reaction-btn.is-popping .reaction-emoji { animation: reaction-pop 420ms var(--ease); }
.post.is-new, .comment.is-new, .message.is-new { animation: new-item 1.6s var(--ease); }
.comment.is-new .comment-bubble { animation: new-bubble 1.6s var(--ease); }
.reaction-btn[data-reaction="love"].is-active, .reaction-btn[value="love"].is-active { background: var(--color-coral-soft); border-color: color-mix(in srgb, var(--color-coral) 40%, transparent); color: var(--color-coral); }
.reaction-btn[data-reaction="celebrate"].is-active, .reaction-btn[value="celebrate"].is-active { background: var(--color-accent-soft); border-color: color-mix(in srgb, var(--color-accent) 50%, transparent); color: var(--color-accent-strong); }
.reaction-btn[data-reaction="insightful"].is-active, .reaction-btn[value="insightful"].is-active { background: var(--color-warning-soft); border-color: var(--color-warning-border); color: var(--color-warning); }
.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 11px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-muted);
  font-size: var(--fs-sm);
  font-weight: 650;
  transition: background var(--t-fast), color var(--t-fast);
}
.action-btn .icon { width: 17px; height: 17px; }
.action-btn:hover { background: var(--color-surface-2); color: var(--color-text); text-decoration: none; }
.action-btn.is-active { color: var(--color-link); }
.action-btn.is-active .icon { fill: currentColor; fill-opacity: .18; }

.comments {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--color-border);
}
.post-actions + .comments { border-top: 0; padding-top: 0; }
.comment { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.comment > .avatar, .comment > a > .avatar { margin-top: 2px; }
.comment > div:not(.comment-bubble), .comment-content { flex: 1 1 auto; min-width: 0; }
.comment-bubble {
  display: inline-block;
  max-width: 100%;
  padding: 9px 14px 10px;
  border-radius: 4px 18px 18px 18px;
  background: var(--color-surface-2);
  font-size: var(--fs-sm);
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.comment-bubble .user-link { font-size: var(--fs-sm); display: inline-block; margin-bottom: 1px; }
.comment-bubble > .text-muted, .comment-bubble .comment-author-title { font-size: var(--fs-xs); }
.comment.is-mine .comment-bubble { background: var(--color-primary-soft); }
.comment-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 12px;
  margin: 4px 0 0 12px;
  font-size: var(--fs-xs);
  color: var(--color-muted);
  font-weight: 600;
}
.comment-meta button, .comment-meta a {
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-muted);
  font-size: inherit;
  font-weight: 700;
}
.comment-meta button:hover, .comment-meta a:hover { color: var(--color-link); text-decoration: underline; }
.comment-meta form { display: inline; margin: 0; }
.comment-replies {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  margin-top: var(--sp-3);
  padding-left: var(--sp-3);
  border-left: 2px solid var(--color-border);
}
.comment-form {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}
.comment-form .form-control {
  flex: 1 1 auto;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 20px;
  background: var(--color-surface-2);
  border-color: transparent;
  font-size: var(--fs-sm);
}
.comment-form .form-control:focus { background: var(--color-surface); border-color: var(--color-primary); }
.comment-form textarea.form-control { min-height: 40px; resize: none; }
.comment-form .btn { flex-shrink: 0; border-radius: 20px; }
.comment-form > .avatar { margin-top: 4px; }

/* ==========================================================================
   Groups
   ========================================================================== */
.group-card {
  --accent: var(--color-primary);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease), border-color var(--t);
  color: inherit;
  min-width: 0;
  padding: 0 !important;
}
.group-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--accent) 35%, var(--color-border)); text-decoration: none; }
.group-card > .card-body, .group-card > .group-card-body { padding: 0 var(--sp-5) var(--sp-5); flex: 1 1 auto; display: flex; flex-direction: column; gap: 8px; }
.group-card > .card-footer { margin-top: auto; }
.group-card .card-title a { color: inherit; }
.group-card .card-title a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.group-card .btn, .group-card form, .group-card .dropdown { position: relative; z-index: 2; }

.group-banner {
  --accent: var(--color-primary);
  position: relative;
  min-height: 84px;
  background-color: var(--accent);
  background-image:
    radial-gradient(circle at 18% 120%, rgba(255, 255, 255, .28) 0 22%, transparent 23%),
    radial-gradient(circle at 92% -30%, rgba(255, 255, 255, .2) 0 30%, transparent 31%),
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 80%, #fff) 0%, var(--accent) 45%, color-mix(in srgb, var(--accent) 65%, #0b0930) 100%);
  color: #fff;
  overflow: hidden;
}
.group-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, .22) 1px, transparent 1.4px);
  background-size: 14px 14px;
  -webkit-mask-image: linear-gradient(100deg, transparent 30%, #000 100%);
  mask-image: linear-gradient(100deg, transparent 30%, #000 100%);
  pointer-events: none;
}
/* standalone banner (group page hero) */
.group-banner:not(.group-card > .group-banner) {
  min-height: 180px;
  border-radius: var(--radius-lg);
  padding: var(--sp-8) var(--sp-6) var(--sp-6);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  box-shadow: var(--shadow);
}
.card > .group-banner:first-child { border-radius: var(--radius-lg) var(--radius-lg) 0 0; box-shadow: none; }
.group-banner > * { position: relative; z-index: 1; }
.group-banner h1, .group-banner h2, .group-banner .page-title { color: #fff; text-shadow: 0 1px 12px rgba(0, 0, 0, .18); }
.group-banner a:not(.btn) { color: #fff; }
.group-banner .text-muted, .group-banner p { color: rgba(255, 255, 255, .88) !important; }
.group-banner .badge { background: rgba(255, 255, 255, .22); color: #fff; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.group-banner .tag { background: rgba(255, 255, 255, .18); border-color: rgba(255, 255, 255, .28); color: #fff; }
.group-avatar {
  --accent: var(--color-primary);
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(140deg, color-mix(in srgb, var(--accent) 75%, #fff), var(--accent));
  color: #fff;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -.02em;
  box-shadow: 0 0 0 4px var(--color-surface), var(--shadow);
}
.group-avatar .icon { width: 26px; height: 26px; }
.group-card .group-avatar { margin: -28px 0 4px var(--sp-5); }
.group-card > .group-avatar + .card-body, .group-card > .group-avatar + div { padding-top: 0; }
.group-avatar.is-sm, .list-item .group-avatar, .col-left .group-avatar, .col-right .group-avatar { width: 38px; height: 38px; border-radius: 11px; font-size: .9rem; box-shadow: none; }
.list-item .group-avatar .icon { width: 18px; height: 18px; }
.group-avatar.is-lg { width: 88px; height: 88px; border-radius: 24px; font-size: 2rem; }
.member-count { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-sm); color: var(--color-muted); font-weight: 600; }
.member-count .icon { width: 15px; height: 15px; }

/* ==========================================================================
   14 Messages
   ========================================================================== */
.messenger {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  height: calc(100vh - var(--header-h) - 190px);
  height: calc(100dvh - var(--header-h) - 190px);
  min-height: 480px;
  max-height: 900px;
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 0 !important;
}
.conversation-list {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--color-border);
  background: color-mix(in srgb, var(--color-surface-2) 35%, var(--color-surface));
  overflow-y: auto;
  overscroll-behavior: contain;
}
.conversation-list > .card-header, .conversation-list > .card-body:first-of-type { flex-shrink: 0; }
.conversation-list > .card-header { position: sticky; top: 0; z-index: 2; background: inherit; }
.conversation-list > .card-body { padding: var(--sp-3) var(--sp-4); border-top: 0; }
.conversation {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin: 0 8px 2px;
  border-radius: var(--radius);
  color: inherit;
  transition: background var(--t-fast);
  min-width: 0;
}
.conversation:hover { background: var(--color-surface-2); text-decoration: none; }
.conversation.is-active { background: var(--color-primary-soft); }
.conversation.is-active::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--color-primary);
}
.conversation .list-item-body { gap: 2px; }
.conversation .list-item-title { font-size: var(--fs-sm); }
.conversation-preview { font-size: var(--fs-sm); color: var(--color-muted); min-width: 0; }
.conversation.is-unread .list-item-title, .conversation.is-unread .conversation-preview { font-weight: 750; color: var(--color-text) !important; }
.conversation .row-between { flex-wrap: nowrap; }
.conversation .avatar { box-shadow: 0 0 0 2px var(--color-surface); }

.thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--color-surface); }
.thread-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  min-width: 0;
}
.thread-header h2 { font-size: var(--fs-md); }
.thread-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--sp-5);
  background:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--color-border) 70%, transparent) 1px, transparent 0) 0 0 / 22px 22px,
    color-mix(in srgb, var(--color-surface-2) 40%, var(--color-surface));
}
.thread-messages > .card { margin: auto; width: min(560px, 100%); }
.thread-messages:focus-visible { outline-offset: -3px; }
.message-day, .thread-messages > .message-divider {
  align-self: stretch;
  display: flex;
  justify-content: center;
  margin: var(--sp-3) 0;
  font-size: 11px;
  font-weight: 700;
  color: var(--color-muted);
}
.message-day > span, .message-divider > span {
  padding: 3px 12px;
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
}
.message {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: min(78%, 620px);
  align-self: flex-start;
  animation: message-in 240ms var(--ease);
}
.message + .message:not(.message-mine), .message-mine + .message-mine { margin-top: -2px; }
.message-bubble {
  max-width: 100%;
  padding: 9px 14px;
  border-radius: 18px 18px 18px 5px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-size: var(--fs-base);
  line-height: 1.5;
  overflow-wrap: anywhere;
  box-shadow: var(--shadow-xs);
}
.message-bubble a { color: inherit; text-decoration: underline; }
.message-time { display: block; margin-top: 3px; padding: 0 6px; font-size: 11px; color: var(--color-muted); font-weight: 550; }
.message-mine { align-self: flex-end; align-items: flex-end; }
.message-mine .message-bubble {
  background: linear-gradient(160deg, #5b54e8, var(--color-primary));
  border-color: transparent;
  color: #fff;
  border-radius: 18px 18px 5px 18px;
  box-shadow: 0 2px 8px rgba(67, 56, 202, .22);
}
.message-mine .message-bubble a.hashtag { color: #fff; }
.message-status { align-self: flex-end; }
.message-mine .message-time { text-align: right; }
.message.is-pending { opacity: .6; }
.message.is-failed .message-bubble { outline: 2px solid var(--color-danger-strong); }
.thread-compose {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}
.thread-compose .form-control {
  flex: 1 1 200px;
  min-height: 44px;
  max-height: 180px;
  padding: 11px 16px;
  border-radius: 22px;
  background: var(--color-surface-2);
  border-color: transparent;
  resize: none;
}
.thread-compose .form-control:focus { background: var(--color-surface); border-color: var(--color-primary); }
.thread-compose .btn { height: 44px; border-radius: 22px; padding: 0 18px; }
.thread-compose .form-help { flex-basis: 100%; padding-left: 16px; margin-top: -2px; }

/* ==========================================================================
   15 Resources, files & ratings
   ========================================================================== */
.resource-card { display: flex; flex-direction: column; }
.resource-card > .card-body { flex: 1 1 auto; }
.resource-card .card-title { font-size: var(--fs-md); }
.resource-card .card-title a { color: inherit; }
.resource-card .card-title a::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: var(--radius-lg); }
.resource-card .btn, .resource-card form { position: relative; z-index: 2; }

.file-icon {
  --fi: #64748b;
  position: relative;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--fi) var(--tint-bg), var(--color-surface));
  color: color-mix(in srgb, var(--fi) var(--tint-fg), #fff);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fi) 22%, transparent);
}
.file-icon .icon { width: 22px; height: 22px; }
.file-icon[data-ext]::after {
  content: attr(data-ext);
  position: absolute;
  bottom: -5px;
  right: -6px;
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--fi);
  color: #fff;
  font-size: 8.5px;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: .03em;
  text-transform: uppercase;
  box-shadow: 0 0 0 2px var(--color-surface);
}
.file-icon[data-ext=""]::after { display: none; }
.file-icon.is-lg { width: 64px; height: 64px; border-radius: 16px; }
.file-icon.is-lg .icon { width: 30px; height: 30px; }
.file-icon.is-sm { width: 34px; height: 34px; border-radius: 9px; }
.file-icon.is-sm .icon { width: 17px; height: 17px; }
.file-icon[data-ext="pdf"] { --fi: #dc2626; }
.file-icon[data-ext="doc"], .file-icon[data-ext="docx"], .file-icon[data-ext="txt"] { --fi: #2563eb; }
.file-icon[data-ext="ppt"], .file-icon[data-ext="pptx"] { --fi: #ea580c; }
.file-icon[data-ext="xls"], .file-icon[data-ext="xlsx"], .file-icon[data-ext="csv"] { --fi: #16a34a; }
.file-icon[data-ext="jpg"], .file-icon[data-ext="jpeg"], .file-icon[data-ext="png"], .file-icon[data-ext="gif"], .file-icon[data-ext="webp"] { --fi: #9333ea; }
.file-icon[data-ext="zip"] { --fi: #6b7280; }
.file-icon[data-ext="link"], .file-icon[data-ext="url"] { --fi: #0d9488; }

.rating { display: inline-flex; align-items: center; gap: 1px; color: var(--color-star-empty); vertical-align: middle; }
.rating .icon { width: 16px; height: 16px; fill: currentColor; stroke-width: 1.5; }
.rating .is-filled { color: var(--color-star); }
.rating + .text-muted, .rating + span { margin-left: 4px; }
.rating.is-lg .icon { width: 22px; height: 22px; }

/* CSS-only star input. Markup: inputs in DESCENDING order (5→1), each followed by its label:
   <div class="rating-input"><input type="radio" id="r5" name="rating" value="5"><label for="r5">…star…</label> … </div> */
.rating-input {
  display: inline-flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  gap: 2px;
  border: 0;
  padding: 0;
  margin: 0;
}
.rating-input input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.rating-input label {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  color: var(--color-star-empty);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  transition: color var(--t-fast), transform var(--t-fast), background var(--t-fast);
}
.rating-input label .icon { width: 28px; height: 28px; fill: currentColor; stroke-width: 1.4; }
.rating-input label:hover,
.rating-input label:hover ~ label,
.rating-input input:checked ~ label { color: var(--color-star); }
.rating-input label:hover { transform: scale(1.15) rotate(-6deg); }
.rating-input:hover input:checked ~ label:not(:hover):not(:hover ~ label) { color: color-mix(in srgb, var(--color-star) 45%, var(--color-star-empty)); }
.rating-input input:focus-visible + label { outline: 2px solid var(--focus); outline-offset: 1px; }
.rating-input legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ==========================================================================
   16 PD: events, credits, certificates, verification
   ========================================================================== */
.event-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: var(--sp-4);
  padding: var(--sp-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease), border-color var(--t);
  min-width: 0;
  color: inherit;
}
a.event-card:hover, .event-card.card-hover:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--color-primary-border); text-decoration: none; }
.event-card.is-past { opacity: .8; }
.event-card .card-title a { color: inherit; }
.event-card .card-title a::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: var(--radius-lg); }
.event-card .btn, .event-card form { position: relative; z-index: 2; }
.event-date {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 64px;
  overflow: hidden;
  border-radius: 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: 0 1px 0 var(--color-border), 0 3px 0 -1px var(--color-surface-3), 0 4px 10px rgba(29, 27, 60, .06);
  text-align: center;
  line-height: 1;
}
.event-month {
  display: block;
  width: 100%;
  padding: 5px 0 4px;
  background: linear-gradient(180deg, var(--color-coral), color-mix(in srgb, var(--color-coral) 80%, #7f1d1d));
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.event-day {
  display: block;
  padding: 7px 0 8px;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--color-text);
}
.event-date .text-xs, .event-weekday { display: block; margin-top: -4px; padding-bottom: 6px; font-size: 10px; font-weight: 700; color: var(--color-muted); text-transform: uppercase; }
.event-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.event-body > * { margin: 0; }
.event-body .card-title { font-size: var(--fs-md); }

.credit-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 11px 0 8px;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, var(--color-gold-soft), color-mix(in srgb, var(--color-gold-soft) 70%, var(--color-accent)));
  border: 1px solid var(--color-gold-border);
  color: var(--color-gold-text);
  font-size: var(--fs-xs);
  font-weight: 750;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.credit-pill .icon { width: 14px; height: 14px; color: var(--color-gold); }

/* Certificate — fixed "paper" palette, identical in light & dark */
.certificate {
  --cert-ink: #1f2a44;
  --cert-text: #3b3f4a;
  --cert-gold: #b8860b;
  --cert-gold-2: #d4af37;
  --cert-paper: #fdfaf1;
  position: relative;
  width: 100%;
  max-width: 1056px;
  aspect-ratio: 11 / 8.5;
  margin: var(--sp-5) auto 0;
  padding: 18px;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(255, 255, 255, .9), transparent 70%),
    radial-gradient(circle at 0 0, rgba(212, 175, 55, .08), transparent 40%),
    radial-gradient(circle at 100% 100%, rgba(212, 175, 55, .08), transparent 40%),
    var(--cert-paper);
  border: 2px solid var(--cert-gold);
  box-shadow: inset 0 0 0 6px var(--cert-paper), inset 0 0 0 7px rgba(184, 134, 11, .55), var(--shadow-lg);
  color: var(--cert-text);
  font-family: var(--font-serif);
  container-type: inline-size;
  overflow: hidden;
  border-radius: 4px;
}
.certificate-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  height: 100%;
  padding: 5.5cqw 8cqw 5cqw;
  border: 1px solid rgba(184, 134, 11, .6);
  outline: 3px double rgba(184, 134, 11, .55);
  outline-offset: -9px;
  gap: 1.3cqw;
  background:
    linear-gradient(var(--cert-gold), var(--cert-gold)) 14px 14px / 64px 2px no-repeat,
    linear-gradient(var(--cert-gold), var(--cert-gold)) 14px 14px / 2px 64px no-repeat,
    linear-gradient(var(--cert-gold), var(--cert-gold)) calc(100% - 14px) 14px / 64px 2px no-repeat,
    linear-gradient(var(--cert-gold), var(--cert-gold)) calc(100% - 14px) 14px / 2px 64px no-repeat,
    linear-gradient(var(--cert-gold), var(--cert-gold)) 14px calc(100% - 14px) / 64px 2px no-repeat,
    linear-gradient(var(--cert-gold), var(--cert-gold)) 14px calc(100% - 14px) / 2px 64px no-repeat,
    linear-gradient(var(--cert-gold), var(--cert-gold)) calc(100% - 14px) calc(100% - 14px) / 64px 2px no-repeat,
    linear-gradient(var(--cert-gold), var(--cert-gold)) calc(100% - 14px) calc(100% - 14px) / 2px 64px no-repeat,
    repeating-linear-gradient(45deg, rgba(184, 134, 11, .025) 0 2px, transparent 2px 9px);
}
/* diamond ornaments top & bottom center */
.certificate-inner::before, .certificate-inner::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 12px;
  height: 12px;
  background: var(--cert-gold);
  transform: translateX(-50%) rotate(45deg);
  box-shadow: 0 0 0 3px var(--cert-paper), 0 0 0 4px rgba(184, 134, 11, .6);
}
.certificate-inner::before { top: -7px; }
.certificate-inner::after { bottom: -7px; }
.certificate .eyebrow, .certificate-org {
  font-family: var(--font-sans);
  font-size: max(11px, 1.15cqw);
  letter-spacing: .32em;
  text-transform: uppercase;
  color: var(--cert-gold);
  font-weight: 700;
  margin: 0;
}
.certificate-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 4.4cqw, 3rem);
  font-weight: 400;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--cert-ink);
  line-height: 1.1;
}
.certificate-title small, .certificate-title span {
  display: block;
  margin-top: .45em;
  font-size: .36em;
  letter-spacing: .35em;
  color: var(--cert-gold);
}
.certificate-name {
  display: inline-block;
  margin: .6cqw 0 .2cqw;
  padding: 0 5cqw .15em;
  min-width: 50%;
  border-bottom: 1.5px solid var(--cert-gold);
  font-family: var(--font-script);
  font-size: clamp(2.1rem, 7cqw, 4.6rem);
  font-weight: 400;
  line-height: 1.15;
  color: var(--cert-ink);
  letter-spacing: 0;
}
.certificate-body {
  max-width: 72cqw;
  margin: 0;
  font-size: clamp(.8rem, 1.75cqw, 1.15rem);
  line-height: 1.6;
  color: var(--cert-text);
}
.certificate-body p { margin: 0 0 .4em; }
.certificate-body strong { color: var(--cert-ink); font-weight: 700; }
.certificate-body .credit-pill { font-family: var(--font-sans); background: rgba(212, 175, 55, .14); border-color: rgba(184, 134, 11, .45); color: #7a5300; }
.certificate-signatures {
  display: flex;
  justify-content: center;
  gap: 8cqw;
  width: 100%;
  margin-top: auto;
  padding-top: 2cqw;
}
.certificate-signatures > * {
  flex: 0 1 30%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-family: var(--font-sans);
  font-size: max(10px, 1.05cqw);
  color: #5b5f6a;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 600;
}
.certificate-signatures .signature, .certificate-signatures > * > :first-child:not(:only-child) {
  display: block;
  width: 100%;
  padding-bottom: 4px;
  margin-bottom: 4px;
  border-bottom: 1px solid #3b3f4a;
  font-family: var(--font-script);
  font-size: clamp(1.1rem, 2.8cqw, 1.9rem);
  color: var(--cert-ink);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.certificate-seal {
  position: absolute;
  right: 7cqw;
  bottom: 6.5cqw;
  z-index: 2;
  display: grid;
  place-items: center;
  width: clamp(72px, 12cqw, 124px);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #fff6c8 0, #f3d77a 22%, #d4a017 58%, #a8770a 100%);
  color: #5a3d00;
  text-align: center;
  font-family: var(--font-sans);
  font-size: clamp(7px, .95cqw, 10px);
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  line-height: 1.25;
  box-shadow:
    0 0 0 3px #f8e7a8,
    0 0 0 5px #b8860b,
    0 6px 16px rgba(120, 80, 0, .35),
    inset 0 -4px 10px rgba(120, 80, 0, .35),
    inset 0 3px 6px rgba(255, 255, 255, .5);
  transform: rotate(-8deg);
}
.certificate-seal::before {
  content: "";
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  border: 1.5px dashed rgba(90, 61, 0, .5);
}
.certificate-seal:has(> svg:not(.icon)) { background: none; box-shadow: none; filter: drop-shadow(0 6px 10px rgba(120, 80, 0, .3)); }
.certificate-seal:has(> svg:not(.icon))::before { display: none; }
.certificate-seal > svg:not(.icon) { width: 100%; height: 100%; }
.certificate-seal .icon { width: 40%; height: 40%; margin: 0 auto 2px; stroke-width: 1.6; color: #5a3d00; }
.certificate-seal > * { position: relative; }
.certificate-footer {
  position: absolute;
  left: 7cqw;
  right: 7cqw;
  bottom: 3.2cqw;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  font-family: var(--font-sans);
  font-size: max(9px, .95cqw);
  color: #6b6f7a;
  text-align: left;
}
.certificate-footer > :last-child:not(:first-child) { text-align: right; }
.certificate-footer img, .certificate-footer canvas, .certificate-footer svg, .certificate-qr { width: clamp(48px, 7cqw, 80px); height: auto; background: #fff; padding: 3px; border-radius: 4px; }
.certificate-inner > .certificate-hash { align-self: stretch; margin-top: 1.5cqw; margin-right: 16cqw; text-align: left; flex-wrap: nowrap; min-width: 0; }
.certificate-inner > .certificate-hash > * { min-width: 0; }
.certificate-hash {
  font-family: var(--font-mono);
  font-size: max(8.5px, .85cqw);
  color: #6b6f7a;
  word-break: break-all;
  letter-spacing: .02em;
}
body.is-certificate { background: var(--color-surface-2); }
body.is-certificate .site-main { padding: var(--sp-6) var(--gutter) var(--sp-12); }

.verify-result {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-4);
  padding: var(--sp-6);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  box-shadow: var(--shadow);
  animation: slide-down 360ms var(--ease);
}
.verify-result > .icon, .verify-result-icon {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  padding: 13px;
  border-radius: 50%;
}
.verify-result h2, .verify-result h3 { margin-bottom: 4px; }
.verify-result.is-valid { background: linear-gradient(135deg, var(--color-success-soft), var(--color-surface) 70%); border-color: var(--color-success-border); }
.verify-result.is-valid > .icon, .verify-result.is-valid .verify-result-icon { background: #0f766e; color: #fff; box-shadow: 0 0 0 6px color-mix(in srgb, #0f766e 18%, transparent); }
.verify-result.is-valid h2, .verify-result.is-valid h3 { color: var(--color-success); }
.verify-result.is-invalid { background: linear-gradient(135deg, var(--color-danger-soft), var(--color-surface) 70%); border-color: var(--color-danger-border); }
.verify-result.is-invalid > .icon, .verify-result.is-invalid .verify-result-icon { background: #b91c1c; color: #fff; box-shadow: 0 0 0 6px color-mix(in srgb, #b91c1c 18%, transparent); }
.verify-result.is-invalid h2, .verify-result.is-invalid h3 { color: var(--color-danger-text); }
.verify-result > div { flex: 1 1 auto; min-width: 0; }

/* ==========================================================================
   17 AI tools
   ========================================================================== */
.ai-tool-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: var(--sp-5);
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  color: inherit;
  cursor: pointer;
  text-align: left;
  transition: border-color var(--t), box-shadow var(--t), transform var(--t) var(--ease), background var(--t);
  min-width: 0;
}
.ai-tool-card > svg.icon:first-of-type, .ai-tool-card .ai-tool-icon {
  width: 44px;
  height: 44px;
  padding: 11px;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(140deg, #7c6cf2, #4338ca);
  box-shadow: 0 4px 12px rgba(67, 56, 202, .28);
}
.ai-tool-card:nth-child(6n+2) > svg.icon:first-of-type { background: linear-gradient(140deg, #2dd4bf, #0f766e); box-shadow: 0 4px 12px rgba(15, 118, 110, .25); }
.ai-tool-card:nth-child(6n+3) > svg.icon:first-of-type { background: linear-gradient(140deg, #f6c35c, #d97706); box-shadow: 0 4px 12px rgba(217, 119, 6, .25); }
.ai-tool-card:nth-child(6n+4) > svg.icon:first-of-type { background: linear-gradient(140deg, #f59482, #e8604c); box-shadow: 0 4px 12px rgba(232, 96, 76, .25); }
.ai-tool-card:nth-child(6n+5) > svg.icon:first-of-type { background: linear-gradient(140deg, #60a5fa, #1d64c9); box-shadow: 0 4px 12px rgba(29, 100, 201, .25); }
.ai-tool-card:nth-child(6n+6) > svg.icon:first-of-type { background: linear-gradient(140deg, #c084fc, #9333ea); box-shadow: 0 4px 12px rgba(147, 51, 234, .25); }
.ai-tool-card h3, .ai-tool-card .card-title { margin: 4px 0 0; font-size: var(--fs-md); }
.ai-tool-card p { margin: 0; font-size: var(--fs-sm); color: var(--color-muted); }
.ai-tool-card:hover { border-color: var(--color-primary-border); transform: translateY(-2px); box-shadow: var(--shadow); text-decoration: none; color: inherit; }
.ai-tool-card input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.ai-tool-card:has(input:focus-visible) { box-shadow: var(--ring); }
.ai-tool-card.is-active, .ai-tool-card:has(input:checked) {
  border-color: var(--color-primary);
  background: linear-gradient(160deg, var(--color-primary-soft), var(--color-surface) 75%);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 18%, transparent), var(--shadow);
}
.ai-tool-card.is-active::after, .ai-tool-card:has(input:checked)::after {
  content: "";
  position: absolute;
  top: 14px;
  right: 14px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 13px no-repeat;
  animation: reaction-pop 320ms var(--ease);
}

.ai-result {
  position: relative;
  overflow: hidden;
  border-color: var(--color-primary-border);
}
.ai-result::before {
  content: "";
  display: block;
  height: 4px;
  background: linear-gradient(90deg, #4338ca, #7c6cf2 35%, #2dd4bf 70%, #f2a93b);
}
.card.ai-result:not(:has(> .card-body, > .card-header)) { padding-top: 0; }
.card.ai-result:not(:has(> .card-body, > .card-header))::before { margin: 0 calc(var(--sp-5) * -1) var(--sp-5); }
.ai-result .prose h2, .ai-result .prose h3 { color: var(--color-text); }
.ai-result .prose h3 { font-size: var(--fs-md); }
.ai-section {
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--color-surface-2) 55%, var(--color-surface));
  border: 1px solid var(--color-border);
}
.card.ai-section { box-shadow: none; }
.ai-section + .ai-section { margin-top: var(--sp-3); }
.ai-section > h3, .ai-section > h4, .ai-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-sm);
  font-weight: 750;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--color-link);
  margin-bottom: var(--sp-2);
}
.ai-section ul { padding-left: 1.2em; margin: 0; }
.ai-section li + li { margin-top: 4px; }
.ai-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: var(--sp-8);
  color: var(--color-muted);
  font-weight: 600;
  font-size: var(--fs-sm);
}
.ai-loading::before {
  content: "";
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2.5px solid var(--color-primary-soft-2);
  border-top-color: var(--color-primary);
  animation: spin 700ms linear infinite;
}
.ai-loading:has(.spinner)::before { display: none; }
.ai-loading span, .ai-loading p {
  background: linear-gradient(90deg, var(--color-muted) 30%, var(--color-primary) 50%, var(--color-muted) 70%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 1.8s linear infinite;
  margin: 0;
}

/* ==========================================================================
   18 Profile
   ========================================================================== */
.profile-cover {
  --accent: #4338ca;
  position: relative;
  height: 200px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background:
    linear-gradient(rgba(255, 255, 255, .09) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, rgba(255, 255, 255, .09) 1px, transparent 1px) 0 0 / 24px 24px,
    radial-gradient(circle at 85% 20%, rgba(242, 169, 59, .75), transparent 32%),
    radial-gradient(circle at 12% 110%, rgba(45, 212, 191, .55), transparent 40%),
    linear-gradient(120deg, #312e81 0%, var(--accent) 45%, #7c6cf2 100%);
  overflow: hidden;
}
.profile-cover::after {
  content: "∑  π  √  ∞  △  ✎";
  position: absolute;
  right: 28px;
  bottom: 14px;
  font-size: 22px;
  letter-spacing: 14px;
  color: rgba(255, 255, 255, .22);
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
}
.profile-cover img { width: 100%; height: 100%; object-fit: cover; }
.profile-header {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4) var(--sp-5);
  padding: 0 var(--sp-6) var(--sp-6);
  align-items: flex-start;
}
.profile-avatar {
  flex-shrink: 0;
  margin-top: -56px;
  border-radius: 50%;
  box-shadow: 0 0 0 5px var(--color-surface), var(--shadow-md);
  background: var(--color-surface);
}
.profile-avatar .avatar, .profile-avatar.avatar { --size: 128px; font-size: 44px; }
.profile-info { flex: 1 1 300px; min-width: 0; padding-top: var(--sp-3); }
.profile-info h1 { font-size: var(--fs-2xl); margin: 0 0 2px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.profile-info .lead, .profile-info > p { margin: 0; font-size: var(--fs-md); }
.profile-info .row { margin-top: var(--sp-2); font-size: var(--fs-sm); color: var(--color-muted); gap: 4px 14px; }
.profile-info .row .icon { width: 15px; height: 15px; }
.profile-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-self: flex-start; padding-top: var(--sp-4); }
.profile-stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-8);
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--color-border);
  font-size: var(--fs-sm);
  color: var(--color-muted);
}
.profile-stats > * { display: flex; flex-direction: column; color: inherit; }
.profile-stats.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 0; padding: 0; }
.profile-stats .stat { border: 0; border-radius: 0; box-shadow: none; background: none; padding: var(--sp-4) var(--sp-5); text-align: center; align-items: center; }
.profile-stats .stat + .stat { border-left: 1px solid var(--color-border); }
.profile-stats a.stat:hover { transform: none; background: var(--color-surface-2); box-shadow: none; }
.profile-stats .stat-value { font-size: var(--fs-xl); }
.profile-stats a:hover { text-decoration: none; color: var(--color-link); }
.profile-stats strong, .profile-stats .stat-value { font-size: var(--fs-xl); font-weight: 800; color: var(--color-text); letter-spacing: -.02em; line-height: 1.2; font-variant-numeric: tabular-nums; }

/* ==========================================================================
   19 Admin
   ========================================================================== */
.admin-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: var(--sp-6);
  align-items: start;
}
.admin-layout > :not(.admin-nav) { min-width: 0; }
.admin-nav {
  position: sticky;
  top: calc(var(--header-h) + var(--sp-5));
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--sp-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.admin-nav .eyebrow, .admin-nav h2 { padding: 6px 10px 4px; margin: 0; font-size: var(--fs-xs); }
.admin-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--color-text-2);
  font-size: var(--fs-sm);
  font-weight: 600;
  transition: background var(--t-fast), color var(--t-fast);
}
.admin-nav a .icon { width: 18px; height: 18px; color: var(--color-muted); }
.admin-nav a .badge { margin-left: auto; }
.admin-nav a:hover { background: var(--color-surface-2); text-decoration: none; color: var(--color-text); }
.admin-nav a.is-active { background: var(--color-primary-soft); color: var(--color-link); }
.admin-nav a.is-active .icon { color: currentColor; }

/* ==========================================================================
   20 Landing page
   ========================================================================== */
body.is-landing .site-main { padding-top: 0; padding-bottom: 0; }
body.is-landing { background-image: none; }
.hero {
  position: relative;
  overflow: hidden;
  padding: var(--sp-16) 0 var(--sp-16);
  isolation: isolate;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(900px 520px at 88% 10%, color-mix(in srgb, #7c6cf2 22%, transparent), transparent 70%),
    radial-gradient(700px 480px at 70% 100%, color-mix(in srgb, #f2a93b 18%, transparent), transparent 70%),
    radial-gradient(600px 420px at 0% 0%, color-mix(in srgb, #2dd4bf 12%, transparent), transparent 70%);
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(color-mix(in srgb, var(--color-primary) 7%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--color-primary) 7%, transparent) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-mask-image: radial-gradient(ellipse at 70% 40%, #000 10%, transparent 65%);
  mask-image: radial-gradient(ellipse at 70% 40%, #000 10%, transparent 65%);
}
.hero > .container {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  align-items: center;
  gap: var(--sp-12);
}
.hero-content { display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-5); }
.hero-content > * { margin: 0; }
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px 5px 6px;
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--color-text-2);
}
.hero-badge .badge { background: var(--color-accent); color: #2a1a00; }
.hero h1 {
  font-size: var(--fs-display);
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: 1.04;
  max-width: 14ch;
}
.text-gradient, .hero h1 em {
  font-style: normal;
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero .lead { font-size: clamp(1.05rem, .95rem + .4vw, 1.25rem); max-width: 52ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); }
.hero-note { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: var(--fs-sm); color: var(--color-muted); }
.hero-note span { display: inline-flex; align-items: center; gap: 6px; }
.hero-note .icon { color: var(--color-success); width: 16px; height: 16px; }

.hero-visual {
  position: relative;
  min-height: 460px;
  perspective: 1200px;
}
.hero-card {
  position: absolute;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--sp-4) var(--sp-5);
  animation: float 7s ease-in-out infinite;
  --r: 0deg;
  transform: rotate(var(--r));
}
.hero-card-post { top: 36px; left: 6%; right: 4%; max-width: 440px; --r: -2deg; z-index: 2; }
.hero-card-cert { bottom: 34px; left: -2%; --r: 3deg; animation-delay: -2.5s; z-index: 3; display: flex; align-items: center; gap: 12px; padding: 14px 18px 14px 14px; }
.hero-card-standard { bottom: 110px; right: -2%; --r: -4deg; animation-delay: -4.5s; z-index: 3; padding: 12px 16px; }
.hero-card-ai { top: 0; right: -3%; --r: 5deg; animation-delay: -1.2s; z-index: 1; padding: 10px 14px; display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); font-weight: 700; }
.hero-card-ai .icon { color: #7c6cf2; }
.hero-card .post-header { gap: 10px; }
.hero-card .post-body { font-size: var(--fs-sm); margin-top: 10px; }
.hero-card .post-actions { margin-top: 10px; padding-top: 10px; }
.hero-card .reaction-btn { height: 30px; font-size: var(--fs-xs); pointer-events: none; }
.hero-card-cert .hero-card-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6c8 0, #f3d77a 25%, #d4a017 65%, #a8770a 100%);
  color: #5a3d00;
  box-shadow: 0 0 0 3px #f8e7a8, 0 4px 10px rgba(120, 80, 0, .3);
}
.hero-card-cert strong { display: block; font-size: var(--fs-md); letter-spacing: -.01em; }
.hero-card-cert span { font-size: var(--fs-xs); color: var(--color-muted); }
.hero-card-standard .tag { font-size: 12px; }
.hero-card-standard .row { gap: 6px; }
.hero-blob {
  position: absolute;
  inset: 12% 6% 8% 10%;
  z-index: 0;
  border-radius: 42% 58% 55% 45% / 45% 40% 60% 55%;
  background: linear-gradient(140deg, color-mix(in srgb, #7c6cf2 40%, transparent), color-mix(in srgb, #2dd4bf 30%, transparent) 60%, color-mix(in srgb, #f2a93b 35%, transparent));
  filter: blur(40px);
  opacity: .6;
}

.landing-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr));
  gap: var(--sp-4);
  padding: var(--sp-6);
  margin-top: calc(var(--sp-4) * -1);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  position: relative;
  z-index: 2;
}
.landing-stat { text-align: center; padding: var(--sp-2); }
.landing-stat dd { margin: 0; }
.landing-title { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.4rem); font-weight: 800; letter-spacing: -.035em; margin: 0 0 var(--sp-3); }
.cta-band a:not(.btn) { color: #fff; text-decoration: underline; }
.landing-stat + .landing-stat { border-left: 1px solid var(--color-border); }
.landing-stat strong { display: block; font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.25rem); font-weight: 800; letter-spacing: -.04em; line-height: 1.1; color: var(--color-text); font-variant-numeric: tabular-nums; }
.landing-stat span { font-size: var(--fs-sm); color: var(--color-muted); font-weight: 600; }

.section-head { max-width: 680px; margin: 0 auto var(--sp-10); text-align: center; }
.section-head h2 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.4rem); font-weight: 800; letter-spacing: -.035em; margin-bottom: var(--sp-3); }
.section-head p:not(.eyebrow) { color: var(--color-muted); font-size: var(--fs-lg); }
.section-head .eyebrow { margin-bottom: var(--sp-3); }
.section-head.is-left { margin-left: 0; text-align: left; }

.features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-5);
}
.feature {
  --accent: var(--color-primary);
  position: relative;
  padding: var(--sp-6);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease), border-color var(--t);
  overflow: hidden;
}
.feature::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -40px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%);
  transition: transform 400ms var(--ease);
}
.feature:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--accent) 35%, var(--color-border)); }
.feature:hover::after { transform: scale(1.6); }
.feature h3 { font-size: var(--fs-lg); margin: var(--sp-4) 0 var(--sp-2); }
.feature p { color: var(--color-muted); margin: 0; font-size: var(--fs-base); }
.feature-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent) var(--tint-bg), var(--color-surface));
  color: color-mix(in srgb, var(--accent) var(--tint-fg), #fff);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 20%, transparent);
}
.feature-icon .icon { width: 24px; height: 24px; }

.how-it-works {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-8);
  counter-reset: step;
  position: relative;
}
.how-it-works::before {
  content: "";
  position: absolute;
  top: 27px;
  left: 16%;
  right: 16%;
  border-top: 2px dashed var(--color-border-strong);
  z-index: 0;
}
.step { position: relative; text-align: center; padding: 0 var(--sp-3); }
.step::before {
  counter-increment: step;
  content: counter(step);
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin: 0 auto var(--sp-4);
  border-radius: 50%;
  background: var(--color-surface);
  border: 2px solid var(--color-link);
  color: var(--color-link);
  font-size: 1.35rem;
  font-weight: 800;
  box-shadow: 0 0 0 6px var(--color-bg), var(--shadow);
}
.step h3 { font-size: var(--fs-lg); margin-bottom: var(--sp-2); }
.step p { color: var(--color-muted); margin: 0 auto; max-width: 34ch; }

.landing-band {
  background: var(--color-surface);
  border-block: 1px solid var(--color-border);
}
.landing-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--sp-12);
  align-items: center;
}
.check-list-lg { list-style: none; padding: 0; margin: var(--sp-5) 0 0; display: flex; flex-direction: column; gap: var(--sp-4); }
.check-list-lg li { display: flex; gap: 12px; align-items: flex-start; }
.check-list-lg li > .icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 6px;
  border-radius: 50%;
  background: var(--color-success-soft);
  color: var(--color-success);
}
.check-list-lg strong { display: block; color: var(--color-text); }
.check-list-lg span { color: var(--color-muted); font-size: var(--fs-sm); }

.ai-demo {
  position: relative;
  padding: var(--sp-5);
  border-radius: var(--radius-xl);
  background: linear-gradient(160deg, #1e1b4b, #312e81 60%, #4338ca);
  color: #e0e7ff;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.ai-demo::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 90% 0%, rgba(242, 169, 59, .35), transparent 40%), radial-gradient(circle at 0% 100%, rgba(45, 212, 191, .3), transparent 40%);
  pointer-events: none;
}
.ai-demo > * { position: relative; }
.ai-demo-head { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); font-weight: 700; margin-bottom: var(--sp-4); color: #fff; }
.ai-demo-head .dot { width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 255, 255, .25); }
.ai-demo-head .dot:first-child { background: #f87171; }
.ai-demo-head .dot:nth-child(2) { background: #fbbf24; }
.ai-demo-head .dot:nth-child(3) { background: #34d399; margin-right: 8px; }
.ai-demo-input {
  padding: 12px 14px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .14);
  font-size: var(--fs-sm);
  color: #c7d2fe;
  margin-bottom: var(--sp-3);
}
.ai-demo-output { display: grid; gap: 10px; }
.ai-demo-output > div {
  padding: 12px 14px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .96);
  color: #1d1b2c;
  font-size: var(--fs-sm);
  line-height: 1.5;
}
.ai-demo-output b { display: flex; align-items: center; gap: 6px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #4338ca; margin-bottom: 2px; }
.ai-demo-output > div:nth-child(2) b { color: #0f766e; }
.ai-demo-output > div:nth-child(3) b { color: #b45309; }
.ai-demo-safety { display: inline-flex; align-items: center; gap: 6px; margin-top: var(--sp-3); padding: 5px 12px; border-radius: var(--radius-pill); background: rgba(45, 212, 191, .18); color: #99f6e4; font-size: var(--fs-xs); font-weight: 700; }

.testimonial {
  position: relative;
  padding: var(--sp-6);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.testimonial > .icon:first-child {
  width: 40px;
  height: 40px;
  padding: 9px;
  border-radius: 12px;
  background: var(--color-accent-soft);
  color: var(--color-accent-strong);
  margin-bottom: var(--sp-3);
}
.testimonial h3 { font-size: var(--fs-md); margin-bottom: 6px; }
.testimonial p { color: var(--color-muted); font-size: var(--fs-sm); margin: 0; }
.testimonial blockquote { border: 0; padding: 0; font-size: var(--fs-lg); color: var(--color-text); }

.logo-cloud {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: var(--sp-3) var(--sp-8);
  color: var(--color-subtle);
  font-weight: 700;
  font-size: var(--fs-sm);
}
.logo-cloud > * { display: inline-flex; align-items: center; gap: 8px; filter: grayscale(1); opacity: .85; }

.cta-band {
  position: relative;
  overflow: hidden;
  padding: var(--sp-12) var(--sp-8);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 100% 0%, rgba(242, 169, 59, .45), transparent 40%),
    radial-gradient(circle at 0% 100%, rgba(45, 212, 191, .35), transparent 45%),
    linear-gradient(130deg, #312e81, #4338ca 55%, #6d5df0);
  color: #fff;
  text-align: center;
  box-shadow: 0 24px 60px rgba(67, 56, 202, .3);
  isolation: isolate;
}
.cta-band::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(rgba(255, 255, 255, .16) 1px, transparent 1.4px);
  background-size: 18px 18px;
  -webkit-mask-image: linear-gradient(180deg, #000, transparent 90%);
  mask-image: linear-gradient(180deg, #000, transparent 90%);
}
.cta-band h2 { color: #fff; font-size: clamp(1.6rem, 1.2rem + 1.8vw, 2.5rem); font-weight: 800; letter-spacing: -.035em; margin-bottom: var(--sp-3); }
.cta-band p { color: rgba(255, 255, 255, .85); font-size: var(--fs-lg); max-width: 56ch; margin: 0 auto var(--sp-6); }
.cta-band .hero-actions, .cta-band .row { justify-content: center; }
.cta-band .btn-primary { --btn-bg: #fff; --btn-fg: #312e81; --btn-hover-bg: #eef0ff; }
.cta-band .btn-ghost, .cta-band .btn-outline { --btn-fg: #fff; --btn-border: rgba(255, 255, 255, .4); --btn-hover-bg: rgba(255, 255, 255, .12); }

/* ==========================================================================
   21 Auth pages
   ========================================================================== */
.auth-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  min-height: 100vh;
  min-height: 100dvh;
}
.auth-page > :first-child:not(.auth-aside), .auth-main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: var(--sp-10) var(--gutter);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}
.auth-page > .auth-card { align-self: center; padding: var(--sp-10) var(--gutter); max-width: calc(420px + var(--gutter) * 2); }
.auth-card h1 { font-size: var(--fs-3xl); margin: 0; }
.auth-card > p, .auth-card .page-subtitle { color: var(--color-muted); margin: 0; }
.auth-brand { display: flex; margin-bottom: var(--sp-4); }
.auth-brand .brand, .auth-brand.brand { font-size: 1.25rem; }
.auth-footer { font-size: var(--fs-sm); color: var(--color-muted); text-align: center; padding-top: var(--sp-4); border-top: 1px solid var(--color-border); }
.auth-footer p { margin: 0; }
.auth-divider { display: flex; align-items: center; gap: 12px; font-size: var(--fs-xs); color: var(--color-subtle); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--color-border); }
.auth-aside {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--sp-6);
  padding: var(--sp-12) clamp(2rem, 5vw, 5rem);
  overflow: hidden;
  isolation: isolate;
  color: #fff;
  background:
    radial-gradient(circle at 85% 10%, rgba(242, 169, 59, .55), transparent 35%),
    radial-gradient(circle at 10% 95%, rgba(45, 212, 191, .45), transparent 40%),
    linear-gradient(150deg, #1e1b4b 0%, #312e81 40%, #4338ca 75%, #6d5df0 100%);
}
.auth-aside::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(255, 255, 255, .06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .06) 1px, transparent 1px);
  background-size: 36px 36px;
}
.auth-aside::after {
  content: "";
  position: absolute;
  right: -120px;
  bottom: -120px;
  z-index: -1;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  border: 60px solid rgba(255, 255, 255, .06);
}
.auth-aside h2, .auth-aside h3 { color: #fff; }
.auth-aside h2 { font-size: clamp(1.6rem, 1.1rem + 1.6vw, 2.5rem); font-weight: 800; letter-spacing: -.035em; line-height: 1.12; max-width: 18ch; }
.auth-aside p, .auth-aside li { color: rgba(255, 255, 255, .85); }
.auth-aside a { color: #fff; text-decoration: underline; }
.auth-aside ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px; }
.auth-aside li { display: flex; gap: 12px; align-items: flex-start; }
.auth-aside li > .icon { flex-shrink: 0; width: 30px; height: 30px; padding: 6px; border-radius: 9px; background: rgba(255, 255, 255, .14); color: #fde68a; }
.auth-aside svg:not(.icon) { max-width: 100%; height: auto; }
.auth-aside .card { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .18); color: #fff; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: 0 20px 40px rgba(0, 0, 0, .2); }
.auth-aside .text-muted { color: rgba(255, 255, 255, .7) !important; }
.auth-aside .eyebrow { color: #fde68a; }

/* ==========================================================================
   22 Error page
   ========================================================================== */
.error-page {
  text-align: center;
  padding: var(--sp-12) var(--sp-6) !important;
  margin-top: var(--sp-8);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
}
.error-code {
  font-size: clamp(4.5rem, 3rem + 7vw, 8rem);
  font-weight: 800;
  letter-spacing: -.06em;
  line-height: 1;
  background: linear-gradient(120deg, #4338ca, #7c6cf2 50%, #f2a93b);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: var(--sp-2);
}
.error-page h1 { font-size: var(--fs-2xl); margin: 0; }
.error-page p { max-width: 44ch; }
.error-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--sp-3); margin-top: var(--sp-4); }

/* ==========================================================================
   23 Utilities
   ========================================================================== */
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: var(--sp-1) !important; }
.mt-2 { margin-top: var(--sp-2) !important; }
.mt-3 { margin-top: var(--sp-4) !important; }
.mt-4 { margin-top: var(--sp-6) !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: var(--sp-1) !important; }
.mb-2 { margin-bottom: var(--sp-2) !important; }
.mb-3 { margin-bottom: var(--sp-4) !important; }
.mb-4 { margin-bottom: var(--sp-6) !important; }
.p-0 { padding: 0 !important; }
.pt-0 { padding-top: 0 !important; }
.nowrap { flex-wrap: nowrap !important; white-space: nowrap; }
.gap-sm { gap: var(--sp-2) !important; }
.gap-lg { gap: var(--sp-6) !important; }
.w-full { width: 100% !important; }
.hidden { display: none !important; }
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.show-mobile { display: none !important; }
.text-success { color: var(--color-success) !important; }
.text-danger { color: var(--color-danger-text) !important; }
.text-warning { color: var(--color-warning) !important; }
.text-primary { color: var(--color-link) !important; }

/* ==========================================================================
   Animations
   ========================================================================== */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes slide-down { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes message-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes badge-in { 0% { transform: scale(0); } 70% { transform: scale(1.2); } 100% { transform: scale(1); } }
@keyframes reaction-pop { 0% { transform: scale(1); } 35% { transform: scale(1.5) rotate(-10deg); } 65% { transform: scale(.9) rotate(4deg); } 100% { transform: scale(1); } }
@keyframes new-item { 0% { opacity: 0; transform: translateY(-6px); } 20% { opacity: 1; transform: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 30%, transparent); } 100% { box-shadow: var(--shadow-sm); } }
@keyframes new-bubble { 0%, 30% { background: var(--color-primary-soft-2); } 100% { background: var(--color-surface-2); } }
@keyframes spin-in { from { transform: rotate(-90deg) scale(.7); } to { transform: none; } }
@keyframes float { 0%, 100% { transform: rotate(var(--r)) translateY(0); } 50% { transform: rotate(var(--r)) translateY(-10px); } }

/* ==========================================================================
   24 Responsive
   ========================================================================== */
@media (max-width: 1180px) {
  .nav-link { min-width: 64px; padding: 0 6px; }
  .header-search { flex-basis: 220px; }
}
@media (max-width: 1100px) {
  .page-grid { grid-template-columns: 240px minmax(0, 1fr); }
  .page-grid > .col-right { display: none; }
  .page-grid-2 { grid-template-columns: minmax(0, 1fr) 280px; }
  /* header: icon-only nav */
  .main-nav .nav-link { min-width: 48px; padding: 0 10px; }
  .main-nav .nav-link > span:not(.nav-badge) {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  .main-nav .nav-badge { top: 10px; left: calc(50% + 4px); }
  .hero > .container { gap: var(--sp-8); }
  .features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .hero > .container { grid-template-columns: minmax(0, 1fr); }
  .hero-visual { min-height: 420px; max-width: 560px; width: 100%; margin: 0 auto; }
  .hero h1 { max-width: 18ch; }
  .landing-split { grid-template-columns: minmax(0, 1fr); gap: var(--sp-8); }
  .auth-page { grid-template-columns: minmax(0, 1fr); }
  .auth-aside { display: none; }
  .admin-layout { grid-template-columns: minmax(0, 1fr); }
  .admin-nav {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 6px;
  }
  .admin-nav .eyebrow, .admin-nav h2 { display: none; }
  .admin-nav a { flex-shrink: 0; }
}
@media (max-width: 860px) {
  :root { --gutter: 20px; }
  .page-grid, .page-grid-2 { grid-template-columns: minmax(0, 1fr); }
  .page-grid > .col-left { display: none; }
  .page-grid > .col-left.show-mobile-stack, .page-grid-2 > .col-right { display: flex; }
  .sticky { position: static !important; }
  .main-nav { display: none; }
  .header-search { flex: 1 1 auto; max-width: 420px; margin-left: auto; }
  .header-search + .main-nav + .header-actions { margin-left: 0; }
  .mobile-nav { display: flex; }
  body.is-authed:not(.is-bare) { padding-bottom: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom, 0px)); }
  body.is-authed:not(.is-bare) .toast-wrap { bottom: calc(var(--mobile-nav-h) + 16px + env(safe-area-inset-bottom, 0px)); }
  .messenger {
    grid-template-columns: minmax(0, 1fr);
    height: calc(100dvh - var(--header-h) - var(--mobile-nav-h) - 120px);
    min-height: 420px;
  }
  .messenger .conversation-list { border-right: 0; }
  .messenger.has-thread .conversation-list { display: none; }
  .messenger:not(.has-thread) .thread { display: none; }
  .footer-inner { grid-template-columns: minmax(0, 1fr); }
  .footer-links { justify-content: flex-start; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .how-it-works { grid-template-columns: minmax(0, 1fr); gap: var(--sp-6); }
  .how-it-works::before { display: none; }
  .step { display: grid; grid-template-columns: 56px 1fr; column-gap: var(--sp-4); text-align: left; padding: 0; }
  .step::before { grid-row: 1 / span 2; margin: 0; }
  .step h3 { margin-top: 6px; }
  .step p { margin: 0; }
  .landing-stat + .landing-stat { border-left: 0; }
  .guest-nav { display: none; }
}
@media (max-width: 760px) {
  .certificate { aspect-ratio: auto; padding: 10px; }
  .certificate-inner { padding: 40px 22px 30px; gap: 10px; outline-offset: -7px; }
  .certificate-title { font-size: 1.45rem; }
  .certificate-name { font-size: 2.4rem; padding-inline: 12px; }
  .certificate-body { max-width: none; font-size: .9rem; }
  .certificate-signatures { flex-direction: column; align-items: center; gap: 14px; padding-top: 12px; }
  .certificate-signatures > * { width: 80%; font-size: 10px; }
  .certificate-signatures .signature, .certificate-signatures > * > :first-child:not(:only-child) { font-size: 1.5rem; }
  .certificate-seal { position: relative; right: auto; bottom: auto; width: 96px; margin: 6px auto 0; }
  .certificate-inner > .certificate-hash { margin-right: 0; flex-wrap: wrap; font-size: 9px; }
  .certificate-footer { position: static; flex-wrap: wrap; }
}
@media (max-width: 700px) {
  :root { --gutter: 16px; --header-h: 58px; }
  h1 { font-size: var(--fs-2xl); }
  .page-title { font-size: var(--fs-2xl); }
  .site-main { padding-block: var(--sp-5) var(--sp-10); }
  .header-search { display: none; }
  .header-actions { margin-left: auto; }
  .brand-mark { width: 34px; height: 34px; }
  .page-header { grid-template-columns: minmax(0, 1fr); }
  .page-actions { grid-column: 1; grid-row: auto; justify-content: flex-start; margin-top: var(--sp-3); }
  .form-row { grid-template-columns: minmax(0, 1fr); }
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .features { grid-template-columns: minmax(0, 1fr); }
  .hide-mobile { display: none !important; }
  .show-mobile { display: revert !important; }
  .btn.show-mobile, .btn-icon.show-mobile, .icon-btn.show-mobile { display: inline-flex !important; }
  .card-body { padding: var(--sp-4); }
  .card:not(:has(> .card-body, > .card-header, > .card-footer, > .group-banner, > .profile-cover, > .table-wrap, > .list, > .conversation-list, > .post-image, > .card-media)) { padding: var(--sp-4); }
  .card-header { padding: var(--sp-3) var(--sp-4); }
  .card-footer { padding: var(--sp-3) var(--sp-4); }
  .list-item { padding-inline: var(--sp-4); }
  .post { padding: var(--sp-4) var(--sp-4) var(--sp-2); border-radius: var(--radius); }
  .reaction-btn { height: 32px; padding: 0 10px 0 8px; }
  .action-btn { padding: 0 8px; }
  .action-btn > span:not(.sr-only):not(.reaction-count) { font-size: var(--fs-xs); }
  .message { max-width: 88%; }
  .thread-messages { padding: var(--sp-3); }
  .thread-header { padding: 10px 12px; }
  .conversation { padding: 10px 12px; margin-inline: 4px; }
  .event-card { padding: var(--sp-4); gap: var(--sp-3); }
  .event-date { width: 56px; }
  .event-day { font-size: 1.35rem; }
  .profile-cover { height: 140px; border-radius: var(--radius) var(--radius) 0 0; }
  .profile-cover::after { display: none; }
  .profile-header { padding: 0 var(--sp-4) var(--sp-4); }
  .profile-avatar { margin-top: -48px; }
  .profile-avatar .avatar, .profile-avatar.avatar { --size: 96px; font-size: 34px; }
  .profile-stats { padding: var(--sp-3) var(--sp-4); gap: var(--sp-2) var(--sp-6); }
  .hero { padding: var(--sp-10) 0 var(--sp-12); }
  .hero-visual { min-height: 470px; }
  .hero-card-post { left: 0; right: 0; top: 48px; }
  .hero-card-ai { right: 0; top: 0; }
  .hero-card-cert { left: 0; bottom: 6px; }
  .hero-card-standard { right: 0; bottom: 96px; }
  .landing-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: var(--sp-4); border-radius: var(--radius-lg); }
  .cta-band { padding: var(--sp-10) var(--sp-5); border-radius: var(--radius-lg); }
  .section { padding-block: var(--sp-10); }
  .section-head { margin-bottom: var(--sp-8); }
  .stat { padding: var(--sp-4); column-gap: 10px; }
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: var(--sp-3); }
  .stat-value { font-size: var(--fs-xl); }
  .stat-icon { width: 40px; height: 40px; border-radius: 12px; }
  .table th, .table td { padding: 10px 12px; }
  .toast-wrap { left: 16px; right: 16px; align-items: stretch; }
  .toast { max-width: none; }
  .certificate-signatures { gap: 4cqw; }
  .error-page { padding: var(--sp-10) var(--sp-4) !important; }
}
@media (max-width: 420px) {
  .header-actions { gap: 2px; }
  .icon-btn { width: 38px; height: 38px; }
  .brand-name { font-size: 1.05rem; }
  .is-guest .header-actions .btn-ghost { display: none; }
  .hero-actions .btn { flex: 1 1 100%; }
  .reaction-btn { padding: 0 8px 0 7px; gap: 4px; }
  .reaction-picker { gap: 4px; }
  .page-link > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .page-link { min-width: 34px; padding: 0 8px; }
  .pagination { gap: 4px; }
}

/* ==========================================================================
   24b QA refinements (visual QA pass): edge cases found with real data,
   very long names/URLs, 390px screens and dark mode.
   ========================================================================== */
/* lists rendered as chips/tags never show bullets */
ul.chip-list, ol.chip-list, ul.tag-list, ol.tag-list { list-style: none; padding: 0; margin: 0; }
/* inline text links need more than colour to stand out (WCAG 1.4.1) */
p a:not([class]), li a:not([class]), .form-help a:not([class]) { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); }
p a:not([class]):hover, li a:not([class]):hover { text-decoration-color: currentColor; }
/* long unbroken strings (URLs, codes) never push layouts wider */
.card p, .list-item-body, .comment-bubble, .media-body { overflow-wrap: break-word; }
/* filter bars: fields grow to share the row, buttons sit on the baseline */
.row > .form-group { flex: 1 1 190px; }
.row:has(> .form-group) { align-items: flex-end; }
.row > .form-group + .form-actions, .row > .form-actions:last-child { padding-top: 0; }
/* progress bars inside a row (rating distribution, usage meters) */
.row > .progress.w-full { flex: 1 1 0; width: auto; min-width: 60px; }
.row > .progress.w-full ~ span, .row > span:has(+ .progress) { flex-shrink: 0; white-space: nowrap; min-width: 2.2em; }
/* star rating: the numeric value is text, not an empty star */
.rating > span:not(.icon) { color: var(--color-text); }
.rating > span.text-muted { color: var(--color-muted); font-weight: 500; }
/* post header: one-line author name + title, meta never starts with a stray dot */
.post-author .user-link { min-width: 0; max-width: calc(100% - 26px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-meta { flex-wrap: nowrap; }
.post-meta > * { flex-shrink: 0; }
.post-meta > .truncate { flex-shrink: 1; min-width: 3em; }
/* avatar stacks: small avatars overlap less so initials stay legible */
.avatar-stack > .avatar-xs + .avatar, .avatar-stack > .avatar + .avatar-xs { margin-left: -5px; }
/* tables: truncated cells get a cap, in-cell rows stay on one line */
.table .truncate { max-width: min(26rem, 60vw); }
.table td > .row, .table td > form.row { flex-wrap: nowrap; align-items: flex-start; }
.table td > .row > div { min-width: 0; }
.table td > form.row { align-items: center; }
.table td > form.row .form-control { min-width: 150px; }
.table .group-avatar { width: 38px; height: 38px; border-radius: 11px; font-size: .9rem; flex-shrink: 0; box-shadow: none; }
/* AI assistant picker: icon beside text, single padding */
.ai-tool-card { padding: 0; }
.ai-tool-card > .card-body { padding: var(--sp-5); flex-wrap: nowrap; align-items: flex-start; gap: 14px; }
.ai-tool-card > .card-body > div { flex: 1 1 auto; min-width: 0; padding-right: 22px; }
.ai-tool-card .stat-icon { flex-shrink: 0; }
.ai-tool-card .card-title { margin: 2px 0 4px; }
/* card headers that use the eyebrow style (notification day groups) */
.card-header .card-title.eyebrow { font-size: var(--fs-xs); letter-spacing: .08em; color: var(--color-muted); }
/* group accent picker: compact swatches */
.check > .group-avatar.is-sm { width: 22px; height: 22px; border-radius: 7px; box-shadow: none; flex-shrink: 0; }
.check:has(> .group-avatar) { gap: 8px; align-items: center; }
/* auth pages: the form fills the card instead of shrinking to its content */
.auth-card > form, .auth-card > .form { align-self: stretch; }
/* certificates are paper: keep light ink in dark mode */
.certificate { color-scheme: light; --color-text: #1f2a44; --color-text-2: #3b3f4a; --color-muted: #5b5f6a; --color-subtle: #6b6e78; --color-link: #3730a3; --color-border: #e6dcc0; }
.certificate a { color: var(--color-link); }

@media (max-width: 700px) {
  /* tabs: tighter, icon-free so 4 tabs fit on a phone */
  .tabs { gap: 0; }
  .tab { padding: 10px 11px; }
  .tab > .icon { display: none; }
  .tab::after { left: 8px; right: 8px; }
  /* composer + inline filters: selects share the row evenly */
  .composer-tools .form-control, .composer-tools select.form-control { flex: 1 1 calc(50% - 8px); }
  .composer-tools input.form-control { flex-basis: 100%; }
  .composer-footer { flex-wrap: wrap; row-gap: var(--sp-2); }
  /* alerts with an action button: button drops under the text */
  .alert:has(> form, > .btn) { flex-wrap: wrap; }
  .alert:has(> form, > .btn) > span { flex: 1 1 calc(100% - 30px); }
  .alert > form, .alert > .btn { margin-left: 29px; }
  /* tables scroll sideways with readable columns instead of squashing */
  .table-wrap > .table { min-width: 600px; }
  /* verification result stacks */
  .verify-result { flex-direction: column; padding: var(--sp-5) var(--sp-4); gap: var(--sp-3); }
  .verify-result > .icon, .verify-result-icon { width: 48px; height: 48px; padding: 11px; }
  /* profile stats: one row of five */
  .profile-stats.stat-grid { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); padding: 0; }
  .profile-stats .stat { padding: var(--sp-3) 4px; }
  .profile-stats .stat:nth-child(n) { border-left: 0; }
  .profile-stats .stat + .stat { border-left: 1px solid var(--color-border); }
  .profile-stats strong, .profile-stats .stat-value { font-size: var(--fs-lg); }
  .profile-stats .stat-label { font-size: var(--fs-xs); line-height: 1.25; text-align: center; }
  /* AI picker */
  .ai-tool-card > .card-body { padding: var(--sp-4); }
  /* list rows with a trailing action: keep long titles/meta to two lines */
  .list-item-title { overflow-wrap: anywhere; }
  .list-item:has(> form, > .btn) .list-item-title,
  .list-item:has(> form, > .btn) .list-item-meta { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
  /* scrolling tables keep a readable first column */
  .table-wrap > .table th:first-child, .table-wrap > .table td:first-child { min-width: 190px; }
  /* breadcrumbs: the current page title truncates instead of wrapping */
  .breadcrumbs [aria-current] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; max-width: 100%; }
}

/* ==========================================================================
   25 Motion preferences
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .hero-card { animation: none; }
  .card-hover:hover, .group-card:hover, .feature:hover, a.event-card:hover, .ai-tool-card:hover { transform: none; }
}

/* ==========================================================================
   26 Print
   Certificate pages should pass body_class 'is-certificate' and the
   .certificate element gets its own named landscape page (Chromium/Edge).
   ========================================================================== */
@page { margin: 12mm; }
@page cert { size: letter landscape; margin: 0; }
@media print {
  :root, [data-theme="dark"] {
    color-scheme: light;
    --color-bg: #fff;
    --color-surface: #fff;
    --color-surface-2: #f5f5f5;
    --color-text: #000;
    --color-text-2: #222;
    --color-muted: #444;
    --color-border: #ccc;
    --color-link: #000;
  }
  html, body { background: #fff !important; color: #000; }
  body { display: block; padding: 0 !important; }
  .site-header, .site-footer, .mobile-nav, .skip-link, .flash-wrap, .toast-wrap,
  .main-nav, .no-print, .page-actions, .post-actions, .comment-form, .composer,
  .pagination, .btn, .theme-toggle, .dropdown { display: none !important; }
  .site-main { padding: 0 !important; }
  .container, .container-narrow, .container-wide { max-width: none; padding: 0; }
  .card, .post, .stat, .event-card, .table-wrap { box-shadow: none !important; break-inside: avoid; }
  .page-grid, .page-grid-2, .admin-layout { display: block; }
  .col-left, .col-right, .admin-nav { display: none !important; }
  a { color: inherit; text-decoration: none; }
  .prose a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .85em; color: #555; }

  .certificate {
    page: cert;
    width: 11in;
    height: 8.5in;
    max-width: none;
    aspect-ratio: auto;
    margin: 0;
    border-radius: 0;
    box-shadow: inset 0 0 0 6px var(--cert-paper), inset 0 0 0 7px rgba(184, 134, 11, .55);
    break-inside: avoid;
    break-after: avoid;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  body.is-certificate .site-main > *:not(:has(.certificate)):not(.certificate) { display: none !important; }
  body.is-certificate .certificate ~ *, body.is-certificate .certificate + * { display: none !important; }
  .certificate-seal, .verify-result, .credit-pill, .event-month, .group-banner, .profile-cover, .badge {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
