/* ==========================================================================
   OUTSYDE design system (compact, app-style)
   Font: Manrope only (self-hosted). Colours, radii and shadows are CSS custom
   properties; the admin Appearance settings override them via an inline
   :root block emitted by Theme::css() in the page head.
   Sections: 1 tokens · 2 base · 3 layout · 4 navigation · 5 components
             6 forms · 7 feed · 8 pages · 9 admin · 10 utilities · 11 responsive · 12 a11y
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url('../fonts/manrope-latin-wght-normal.woff2') format('woff2'); }

:root {
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  /* Type scale: body 14.4px, metadata 12.5px, page headings 22-28px */
  --fs-body: .9rem;
  --fs-small: .8rem;
  --fs-meta: .78rem;
  --fs-h1: clamp(1.4rem, 1.15rem + 1vw, 1.75rem);
  --fs-h2: 1.1rem;
  --fs-h3: .98rem;
  --lh: 1.5;

  /* Colour (overridden by Theme::css) */
  --bg: #0c0c12; --surface: #14141d; --surface-2: #1b1b27; --surface-3: #242433;
  --border: #2a2a3c; --border-strong: #3d3d55;
  --text: #f5f5fb; --text-muted: #b9b9cf; --text-subtle: #9393ad;
  --primary: #7c3aed; --primary-hover: #6d28d9; --primary-soft: rgba(124,58,237,.16); --on-primary: #ffffff;
  --link: #a78bfa; --secondary: #22d3ee; --accent: #22d3ee;
  --success: #34d399; --warning: #fbbf24; --danger: #f87171;
  --like: #f43f5e; --repost: #10b981;

  /* Shape and rhythm */
  --radius-sm: 8px; --radius: 12px; --radius-lg: 18px; --radius-btn: 8px; --radius-pill: 999px;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.28);
  --space-1: .25rem; --space-2: .5rem; --space-3: .75rem; --space-4: 1rem; --space-5: 1.35rem; --space-6: 1.75rem; --space-7: 2.5rem; --space-8: 3.5rem;
  --container: 1120px;
  --sidebar-w: 232px;
  --col-w: 600px;
  --rail-w: 300px;
  --header-h: 56px;
  --bottom-nav-h: 56px;
  --btn-h: 36px;
  --input-h: 38px;
  --focus: 0 0 0 3px color-mix(in srgb, var(--accent) 50%, transparent);
}

/* 2. Base ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font-family: var(--font); font-size: var(--fs-body); line-height: var(--lh); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
h1, h2, h3, h4 { font-family: var(--font); line-height: 1.25; margin: 0 0 var(--space-3); font-weight: 800; letter-spacing: -.01em; }
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); font-weight: 700; }
h4 { font-size: var(--fs-body); font-weight: 700; }
p { margin: 0 0 var(--space-3); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg, video { max-width: 100%; display: block; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--space-4) 0; }
ul, ol { padding-left: 1.15rem; }
table { border-collapse: collapse; width: 100%; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em; }
pre { background: var(--surface-2); padding: var(--space-3); border-radius: var(--radius-sm); overflow-x: auto; }
::selection { background: var(--primary); color: var(--on-primary); }
.i { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.small { font-size: var(--fs-small); }

/* 3. Layout ---------------------------------------------------------------- */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--space-4); }
.section { padding-block: var(--space-7); }
.section-alt { background: var(--surface); border-block: 1px solid var(--border); }
.page { padding-block: var(--space-5) var(--space-7); min-height: 60vh; }
.page-header { margin-bottom: var(--space-4); max-width: 760px; }
.page-header .lead { color: var(--text-muted); font-size: var(--fs-body); margin: 0; }
.page-header-row { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-4); flex-wrap: wrap; max-width: none; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-4); }
.section-head h2 { margin: 0; font-size: 1.35rem; }
.section-head p { margin: 2px 0 0; }
.grid { display: grid; gap: var(--space-4); }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack > * + * { margin-top: var(--space-3); }
.row { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.row-between { justify-content: space-between; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--space-5); align-items: start; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-3); }

body.layout-public, body.layout-auth { display: flex; flex-direction: column; }
body.layout-public > main, body.layout-auth > main { flex: 1 0 auto; }

/* App shell: sidebar | main column + right rail */
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; max-width: calc(var(--sidebar-w) + 1280px); margin-inline: auto; }
.app-main { display: flex; flex-direction: column; min-width: 0; min-height: 100vh; border-left: 1px solid var(--border); }
.app-main > main { flex: 1 0 auto; }
.app-grid { display: grid; grid-template-columns: minmax(0, var(--col-w)) var(--rail-w); gap: 0; justify-content: start; }
.app-col { min-width: 0; border-right: 1px solid var(--border); min-height: 70vh; }
.col-head { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); padding: var(--space-3) var(--space-4) 0; }
.col-head .tabs { margin: 0 calc(var(--space-4) * -1); gap: 0; }
.col-head-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding-bottom: var(--space-3); }
.col-head h1.page-title { margin: 0; font-size: 1.15rem; }
.col-head .feed-search { margin-bottom: var(--space-2); }
.app-col > .alert, .app-col > .empty, .app-col > .panel, .app-col > .notice-inline, .app-col > .pagination { margin: var(--space-3) var(--space-4); }
.app-col > .empty { border-radius: var(--radius); }
.app-footer { display: flex; gap: var(--space-4); flex-wrap: wrap; padding: var(--space-4); color: var(--text-subtle); font-size: var(--fs-meta); }
.app-footer a { color: var(--text-subtle); }
.notice-inline { padding: var(--space-3) var(--space-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text-muted); font-size: var(--fs-small); }

.auth-shell { display: grid; place-items: center; padding: var(--space-5) var(--space-4); min-height: 100vh; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-6); box-shadow: var(--shadow); }
.auth-card h1 { font-size: 1.5rem; }
.auth-brand { display: inline-flex; margin-bottom: var(--space-4); }

/* 4. Navigation ------------------------------------------------------------ */
.skip-link { position: absolute; left: var(--space-4); top: -60px; background: var(--primary); color: var(--on-primary); padding: var(--space-2) var(--space-4); border-radius: var(--radius-sm); z-index: 1000; font-weight: 700; }
.skip-link:focus { top: var(--space-3); text-decoration: none; }

.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 800; font-size: 1.1rem; letter-spacing: .01em; color: var(--text); min-width: 0; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; font-size: .95rem; flex-shrink: 0; }
.brand-logo { max-height: 32px; width: auto; max-width: 160px; object-fit: contain; }
.brand-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.site-header { position: sticky; top: 0; z-index: 50; height: var(--header-h); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.site-header .container { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); max-width: 1180px; }
.nav-links { display: flex; align-items: center; gap: 2px; list-style: none; margin: 0; padding: 0; }
.nav-links a { display: block; padding: .4rem .75rem; border-radius: var(--radius-sm); color: var(--text-muted); font-weight: 600; font-size: .88rem; }
.nav-links a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav-links a[aria-current="page"] { color: var(--text); background: var(--surface-3); }
.nav-actions { display: flex; align-items: center; gap: var(--space-2); }
.site-nav { display: flex; align-items: center; gap: var(--space-4); }
.nav-toggle { display: none; }

.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--bg); padding: var(--space-4) var(--space-3); display: flex; flex-direction: column; gap: var(--space-3); }
.sidebar .brand { padding: var(--space-1) var(--space-2) var(--space-2); }
.side-section-title { font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-subtle); font-weight: 800; padding: 0 var(--space-3); margin: var(--space-2) 0 var(--space-1); }
.side-nav { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: .7rem; padding: .5rem .75rem; border-radius: var(--radius-pill); color: var(--text); font-weight: 600; font-size: .92rem; min-height: 40px; position: relative; }
.side-nav a .i { width: 20px; height: 20px; }
.side-nav a:hover { background: var(--surface-2); text-decoration: none; }
.side-nav a[aria-current="page"] { font-weight: 800; background: var(--surface-2); }
.side-nav a[aria-current="page"] .i { stroke-width: 2.3; color: var(--primary); }
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--primary); color: var(--on-primary); font-size: .7rem; font-weight: 800; display: inline-grid; place-items: center; }
.side-compose { margin-top: var(--space-1); height: 42px; border-radius: var(--radius-pill); }
.side-user { margin-top: auto; padding-top: var(--space-3); display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.side-user-info { display: flex; align-items: center; gap: var(--space-2); min-width: 0; color: var(--text); }
.side-user-info:hover { text-decoration: none; }
.side-user-text { display: grid; min-width: 0; line-height: 1.25; }
.side-user-name { font-weight: 700; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user-handle { color: var(--text-subtle); font-size: var(--fs-meta); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-topbar { display: none; }
.sidebar-backdrop { display: none; }
.banner-warn { background: color-mix(in srgb, var(--warning) 16%, var(--bg)); color: var(--text); border-bottom: 1px solid color-mix(in srgb, var(--warning) 50%, transparent); padding: .5rem var(--space-4); font-size: var(--fs-small); }
.dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }

.bottom-nav { display: none; }

.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding-block: var(--space-5); color: var(--text-muted); font-size: var(--fs-small); }
.footer-grid { display: flex; justify-content: space-between; gap: var(--space-5); flex-wrap: wrap; align-items: flex-start; }
.footer-about { max-width: 360px; }
.footer-links, .social-links { display: flex; gap: var(--space-3); flex-wrap: wrap; list-style: none; margin: 0; padding: 0; }
.footer-links a, .social-links a { color: var(--text-muted); }
.footer-links a:hover, .social-links a:hover { color: var(--text); }
.footer-note { width: 100%; margin: 0; padding-top: var(--space-3); border-top: 1px solid var(--border); color: var(--text-subtle); font-size: var(--fs-meta); }

/* 5. Components ------------------------------------------------------------ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: var(--btn-h); padding: .4rem 1rem; border-radius: var(--radius-btn); border: 1px solid transparent; font-weight: 700; font-size: .86rem; line-height: 1.2; text-align: center; cursor: pointer; transition: background .15s, border-color .15s, transform .05s; text-decoration: none; }
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface-3); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: #b42318; color: #fff; }
.btn-sm { min-height: 30px; padding: .25rem .75rem; font-size: .78rem; }
.btn-lg { min-height: 44px; padding: .6rem 1.4rem; font-size: .95rem; }
.btn-block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.link-button { background: none; border: 0; padding: 0; color: var(--link); text-decoration: underline; cursor: pointer; font: inherit; }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; color: var(--text-muted); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.icon-btn-sm { width: 30px; height: 30px; }
.icon-btn[disabled] { opacity: .4; cursor: not-allowed; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; min-width: 0; transition: border-color .15s, transform .15s; }
.card.is-link:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.card-media { aspect-ratio: 16 / 9; background: var(--surface-3); overflow: hidden; position: relative; }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-media-fallback { width: 100%; height: 100%; display: grid; place-items: center; font-weight: 800; font-size: 2rem; color: #fff; background: linear-gradient(135deg, var(--primary), var(--secondary)); }
.card-body { padding: var(--space-3) var(--space-4) var(--space-4); display: flex; flex-direction: column; gap: var(--space-2); flex: 1; min-width: 0; }
.card-title { font-size: 1rem; margin: 0; overflow-wrap: anywhere; }
.card-title a { color: var(--text); }
.card-meta { color: var(--text-muted); font-size: var(--fs-small); }
.card-text { color: var(--text-muted); font-size: var(--fs-small); margin: 0; overflow-wrap: anywhere; }
.card-footer { margin-top: auto; padding-top: var(--space-2); display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-4); }
.panel + .panel, .panel + form.panel, form.panel + .panel { margin-top: var(--space-3); }
.panel h2, .panel h3 { margin-bottom: var(--space-3); }
.panel-flush { padding: 0; }

.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .55rem; border-radius: var(--radius-pill); font-size: .7rem; font-weight: 800; background: var(--surface-3); color: var(--text); border: 1px solid var(--border-strong); white-space: nowrap; }
.badge-primary { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 50%, transparent); color: var(--link); }
.badge-success { background: color-mix(in srgb, var(--success) 14%, transparent); border-color: color-mix(in srgb, var(--success) 50%, transparent); color: var(--success); }
.badge-warning { background: color-mix(in srgb, var(--warning) 14%, transparent); border-color: color-mix(in srgb, var(--warning) 50%, transparent); color: var(--warning); }
.badge-danger { background: color-mix(in srgb, var(--danger) 14%, transparent); border-color: color-mix(in srgb, var(--danger) 50%, transparent); color: var(--danger); }
.verified { display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: var(--primary); color: var(--on-primary); }
.verified .i { width: 10px; height: 10px; stroke-width: 3; }

.avatar { border-radius: 50%; object-fit: cover; flex-shrink: 0; display: inline-grid; place-items: center; color: #fff; font-weight: 800; background: var(--surface-3); }
.avatar-s24 { width: 24px; height: 24px; font-size: .7rem; } .avatar-s32 { width: 32px; height: 32px; font-size: .85rem; }
.avatar-s36 { width: 36px; height: 36px; font-size: .9rem; } .avatar-s40 { width: 40px; height: 40px; font-size: 1rem; }
.avatar-s48 { width: 48px; height: 48px; font-size: 1.1rem; } .avatar-s64 { width: 64px; height: 64px; font-size: 1.4rem; }
.avatar-s96 { width: 96px; height: 96px; font-size: 2rem; } .avatar-s104 { width: 104px; height: 104px; font-size: 2.2rem; }
.avatar-0 { background: #6d28d9; } .avatar-1 { background: #0e7490; } .avatar-2 { background: #b45309; } .avatar-3 { background: #be185d; } .avatar-4 { background: #047857; }

.alert { display: flex; gap: var(--space-3); padding: .6rem var(--space-3); border-radius: var(--radius-sm); border: 1px solid; margin-bottom: var(--space-3); font-size: var(--fs-small); }
.alert ul { margin: 0; padding-left: 1.1rem; }
.alert-success { background: color-mix(in srgb, var(--success) 12%, var(--surface)); border-color: color-mix(in srgb, var(--success) 55%, transparent); }
.alert-error { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 60%, transparent); }
.alert-warning { background: color-mix(in srgb, var(--warning) 12%, var(--surface)); border-color: color-mix(in srgb, var(--warning) 55%, transparent); }
.alert-info { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.flash-region { padding: var(--space-3) var(--space-4) 0; }
.flash-region:empty { display: none; }
.flash-region.flash-floating { position: fixed; top: var(--space-3); left: 50%; transform: translateX(-50%); z-index: 200; width: min(92vw, 420px); padding: 0; }
.toast-stack { position: fixed; bottom: calc(var(--space-4) + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 300; display: grid; gap: var(--space-2); width: min(92vw, 380px); pointer-events: none; }
.toast { background: var(--surface-3); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: .6rem .9rem; font-size: var(--fs-small); box-shadow: var(--shadow); animation: toast-in .18s ease; pointer-events: auto; }
.toast.is-error { border-color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.empty { text-align: center; padding: var(--space-6) var(--space-4); background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); color: var(--text-muted); }
.empty h3 { color: var(--text); margin-bottom: var(--space-2); }
.empty p { max-width: 44ch; margin-inline: auto; font-size: var(--fs-small); }
.empty-inline { color: var(--text-muted); padding: var(--space-3) var(--space-4); margin: 0; font-size: var(--fs-small); }

.pagination { display: flex; gap: var(--space-2); justify-content: center; align-items: center; flex-wrap: wrap; margin-top: var(--space-4); }
.pagination a, .pagination span { min-width: 34px; min-height: 34px; display: inline-grid; place-items: center; padding: 0 .7rem; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); color: var(--text); font-weight: 600; font-size: .82rem; }
.pagination a:hover { background: var(--surface-2); text-decoration: none; }
.pagination [aria-current="page"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.pagination .is-disabled { opacity: .45; }

.table-wrap { position: relative; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.table th, .table td { padding: .6rem .8rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; font-size: var(--fs-small); }
.table th { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); background: var(--surface-2); white-space: nowrap; font-weight: 800; }
.table tbody th { text-transform: none; letter-spacing: 0; font-size: var(--fs-small); color: var(--text); background: transparent; font-weight: 600; }
.table tr:last-child td, .table tr:last-child th { border-bottom: 0; }
.bar { display: inline-block; height: 6px; min-width: 2px; border-radius: 3px; background: var(--primary); vertical-align: middle; margin-right: 6px; max-width: 60%; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--space-3); margin-bottom: var(--space-4); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-3) var(--space-4); }
.stat-link { color: inherit; }
.stat-link:hover { border-color: var(--border-strong); text-decoration: none; }
.stat-n, .stat-value { font-size: 1.5rem; font-weight: 800; line-height: 1.15; }
.stat-l, .stat-label { color: var(--text-muted); font-size: var(--fs-small); }
.stat-s { color: var(--text-subtle); font-size: var(--fs-meta); margin-top: 2px; }
.panel .stat-grid { margin-bottom: var(--space-3); }
.stat-inline { display: flex; gap: var(--space-4); flex-wrap: wrap; color: var(--text-muted); font-size: var(--fs-small); }
.stat-inline strong { color: var(--text); font-size: 1.05rem; margin-right: .25rem; }

.tabs { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-4); }
.tab { flex: 1 1 0; text-align: center; padding: .7rem var(--space-3); color: var(--text-muted); font-weight: 700; font-size: .86rem; border-bottom: 3px solid transparent; position: relative; white-space: nowrap; }
.tab:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.tab.is-active { color: var(--text); font-weight: 800; border-bottom-color: var(--primary); }
.chip { display: inline-flex; align-items: center; min-height: 32px; padding: .25rem .85rem; border-radius: var(--radius-pill); border: 1px solid var(--border-strong); color: var(--text-muted); font-weight: 700; font-size: .8rem; background: transparent; }
.chip:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.chip[aria-current="true"], .chip[aria-current="page"], .chip.is-active { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }

.meta-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); }
.meta-list li { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: var(--space-3); }
.meta-list .k { color: var(--text-subtle); font-size: var(--fs-meta); text-transform: uppercase; letter-spacing: .05em; font-weight: 800; padding-top: 2px; }

/* Dropdown menu (<details>) */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel { position: absolute; right: 0; top: calc(100% + 4px); z-index: 60; min-width: 190px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow); padding: 4px; display: grid; }
.menu-panel.menu-up { top: auto; bottom: calc(100% + 4px); }
.menu-item { display: flex; align-items: center; gap: .6rem; width: 100%; padding: .5rem .7rem; border: 0; background: transparent; color: var(--text); font-size: .84rem; font-weight: 600; text-align: left; border-radius: var(--radius-sm); cursor: pointer; }
.menu-item:hover { background: var(--surface-2); text-decoration: none; }
.menu-item .i { width: 16px; height: 16px; }
.menu-danger { color: var(--danger); }
.menu-sub > summary { list-style: none; }
.menu-sub > summary::-webkit-details-marker { display: none; }
.menu-sub .report-form { padding: var(--space-2); }

/* 6. Forms ----------------------------------------------------------------- */
.form { display: grid; gap: var(--space-3); }
.field { display: grid; gap: .3rem; min-width: 0; }
.label { font-weight: 700; font-size: .82rem; color: var(--text); }
.label .req { color: var(--danger); margin-left: .15rem; }
.input, select.input, textarea.input, .form textarea, .form input[type="text"], .form select {
  width: 100%; min-height: var(--input-h); padding: .45rem .75rem; background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-size: .9rem; line-height: 1.4;
}
textarea.input, .form textarea { min-height: 90px; resize: vertical; }
.input-sm { min-height: 32px; padding: .25rem .6rem; font-size: .82rem; }
.input::placeholder, textarea::placeholder { color: var(--text-subtle); opacity: 1; }
.input:hover { border-color: var(--text-subtle); }
.input:focus, .form textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.input:disabled, .input[readonly] { opacity: .6; cursor: not-allowed; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 2.2rem; }
select.input option { background: var(--surface-2); color: var(--text); }
.help { color: var(--text-subtle); font-size: var(--fs-meta); margin: 0; }
.field-error { color: var(--danger); font-size: var(--fs-small); margin: 0; font-weight: 600; }
.input.is-invalid { border-color: var(--danger); }
.check { display: flex; gap: .55rem; align-items: flex-start; font-size: var(--fs-small); }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--primary); flex-shrink: 0; }
.hp-field { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }
.inline-form { display: inline; }
.search-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-2); }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--space-3); align-items: end; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-3); margin-bottom: var(--space-4); }
.feed-search { position: relative; display: flex; align-items: center; gap: var(--space-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 0 var(--space-3); margin: var(--space-3) 0; }
.feed-search > .i { color: var(--text-subtle); }
.feed-search input[type="search"] { flex: 1; min-width: 0; height: 36px; background: transparent; border: 0; outline: none; font-size: .88rem; }
.feed-search:focus-within { border-color: var(--accent); box-shadow: var(--focus); }
.app-col > .feed-search { margin: var(--space-3) var(--space-4); }

.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: .65rem 0; border-bottom: 1px solid var(--border); }
.toggle-row:last-of-type { border-bottom: 0; }
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.switch input[type="checkbox"] { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.switch-ui { position: absolute; inset: 0; border-radius: 11px; background: var(--surface-3); border: 1px solid var(--border-strong); transition: background .15s; }
.switch-ui::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-muted); transition: transform .15s, background .15s; }
.switch input:checked + .switch-ui { background: var(--primary); border-color: var(--primary); }
.switch input:checked + .switch-ui::after { transform: translateX(18px); background: var(--on-primary); }
.switch input:focus-visible + .switch-ui { box-shadow: var(--focus); }

/* 7. Feed ------------------------------------------------------------------ */
.composer { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: var(--space-3); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); }
.composer-form { min-width: 0; position: relative; }
.composer textarea { width: 100%; border: 0; outline: none; background: transparent; resize: none; font-size: 1rem; line-height: 1.45; padding: .4rem 0; min-height: 52px; color: var(--text); }
.composer-previews { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.composer-previews:empty { display: none; }
.preview { position: relative; width: 84px; height: 84px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border-strong); }
.preview img { width: 100%; height: 100%; object-fit: cover; }
.preview button { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.7); color: #fff; display: grid; place-items: center; padding: 0; }
.composer-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); border-top: 1px solid var(--border); margin-top: var(--space-2); padding-top: var(--space-2); }
.composer-tools, .composer-submit { display: flex; align-items: center; gap: var(--space-1); }
.composer-tools .icon-btn { color: var(--primary); }
.composer-submit { gap: var(--space-3); }
.pill-select { height: 30px; border-radius: var(--radius-pill); border: 1px solid var(--border-strong); background: var(--surface-2); padding: 0 .75rem; font-size: .78rem; font-weight: 700; max-width: 150px; }
.counter { font-size: var(--fs-meta); color: var(--text-subtle); font-variant-numeric: tabular-nums; min-width: 2.2em; text-align: right; }
.counter.is-near { color: var(--warning); }
.counter.is-over { color: var(--danger); font-weight: 800; }
.emoji-panel { position: absolute; z-index: 40; left: 0; top: 100%; width: min(320px, 100%); max-height: 200px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow); padding: var(--space-2); display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.emoji-panel[hidden] { display: none; }
.emoji-panel button { border: 0; background: transparent; font-size: 1.15rem; border-radius: 6px; height: 34px; }
.emoji-panel button:hover { background: var(--surface-2); }

.post { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); background: transparent; transition: background .12s; }
.post:hover { background: color-mix(in srgb, var(--surface) 55%, transparent); }
.post.is-hidden { opacity: .75; }
.post-banner { display: flex; align-items: center; gap: .4rem; margin: 0 0 .25rem 48px; color: var(--text-subtle); font-size: var(--fs-meta); font-weight: 700; }
.post-banner .i { width: 14px; height: 14px; }
.post-banner a { color: var(--text-subtle); }
.post-banner-warn { color: var(--warning); }
.post-grid { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: var(--space-3); }
.post-body { min-width: 0; }
.post-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-2); margin-bottom: 2px; }
.post-who { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; min-width: 0; line-height: 1.3; }
.post-author { font-weight: 800; color: var(--text); font-size: .9rem; }
.post-handle { color: var(--text-subtle); font-size: var(--fs-small); }
a.post-handle:hover { color: var(--text-muted); }
.post-community { display: flex; align-items: center; gap: .3rem; font-size: var(--fs-meta); color: var(--text-subtle); margin-bottom: 2px; }
.post-community .i { width: 13px; height: 13px; }
.post-title { font-size: 1rem; margin: 0 0 .2rem; overflow-wrap: anywhere; }
.post-text { color: var(--text); font-size: .93rem; line-height: 1.5; overflow-wrap: anywhere; word-break: break-word; }
.post-text a { color: var(--link); }
.post-media { display: grid; gap: 3px; margin-top: var(--space-2); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); max-height: 420px; }
.post-media a { display: block; overflow: hidden; background: var(--surface-3); }
.post-media img { width: 100%; height: 100%; object-fit: cover; }
.post-media.media-1 { grid-template-columns: 1fr; } .post-media.media-1 img { max-height: 420px; }
.post-media.media-2 { grid-template-columns: 1fr 1fr; aspect-ratio: 16 / 9; }
.post-media.media-3 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; aspect-ratio: 16 / 9; } .post-media.media-3 a:first-child { grid-row: span 2; }
.post-media.media-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; aspect-ratio: 16 / 9; }
.post-actions { display: flex; align-items: center; justify-content: space-between; gap: var(--space-1); margin-top: var(--space-2); max-width: 440px; margin-left: -8px; }
.post-actions form, .post-actions > .menu { display: inline-flex; }
.act { display: inline-flex; align-items: center; gap: .3rem; min-height: 32px; padding: 0 .5rem; border: 0; background: transparent; color: var(--text-subtle); font-size: var(--fs-small); font-weight: 600; border-radius: var(--radius-pill); cursor: pointer; }
.act .i { width: 17px; height: 17px; }
.act:hover { background: var(--primary-soft); color: var(--link); text-decoration: none; }
.act.on { color: var(--link); }
.act-red:hover, .act-red.on { color: var(--like); background: color-mix(in srgb, var(--like) 12%, transparent); }
.act-red.on .i { fill: var(--like); }
.act-green:hover, .act-green.on { color: var(--repost); background: color-mix(in srgb, var(--repost) 12%, transparent); }
.act-static { cursor: default; } .act-static:hover { background: transparent; color: var(--text-subtle); }
.act[disabled] { opacity: .4; cursor: not-allowed; }
.act[aria-pressed="true"] .i { stroke-width: 2.4; }
.act-sm { min-height: 26px; font-size: var(--fs-meta); padding: 0 .4rem; }
.act-sm .i { width: 14px; height: 14px; }
.share-menu .menu-panel { right: auto; left: 0; }
.report-form { display: grid; gap: var(--space-2); min-width: 210px; }
.comments-region { margin: var(--space-2) 0 0 52px; border-top: 1px solid var(--border); }
.load-more { text-align: center; padding: var(--space-4); }
.post-mini { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.mod-delete { padding: 0 var(--space-4) var(--space-2); }

.thread { padding-bottom: var(--space-2); }
.pad { padding: var(--space-3) var(--space-4); margin: 0; font-size: var(--fs-small); }
.comment-form { display: grid; gap: var(--space-2); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); position: relative; }
.comment-form textarea { width: 100%; min-height: 40px; resize: none; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: .5rem .7rem; font-size: .9rem; }
.comment-form textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.comment-form-bar { display: flex; align-items: center; justify-content: space-between; }
.comment-form.is-compact { padding: var(--space-2) 0; border: 0; }
.comment { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: var(--space-2); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); }
.comment-reply { padding: var(--space-2) 0 0; border: 0; }
.comment-replies { margin-top: var(--space-2); border-left: 2px solid var(--border); padding-left: var(--space-3); }
.comment-head { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; line-height: 1.3; }
.comment-text { font-size: .9rem; overflow-wrap: anywhere; margin-top: 2px; }
.comment-actions { display: flex; align-items: center; gap: var(--space-1); flex-wrap: wrap; margin-top: 2px; margin-left: -6px; }
.comment-actions form { display: inline-flex; }
.inline-details { display: inline-block; }
.inline-details > summary { list-style: none; cursor: pointer; }
.inline-details > summary::-webkit-details-marker { display: none; }
.inline-details[open] { display: block; flex-basis: 100%; }
.inline-details[open] > summary { display: inline-flex; }
.comment.is-removing { opacity: .4; }

.person-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) 0; }
.person-main { flex: 1; min-width: 0; line-height: 1.3; }
.person-main .post-author { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-bio { color: var(--text-muted); font-size: var(--fs-meta); margin-top: 2px; }
.list-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-2) var(--space-4); }
.list-panel .person-row + .person-row { border-top: 1px solid var(--border); }
.app-col > [data-explore-results] { padding: var(--space-3) var(--space-4); }
.app-col > [data-explore-results] .post, .app-col > [data-explore-results] [data-feed-list] { margin-inline: calc(var(--space-4) * -1); }
.community-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 1.2rem; background: var(--surface-3); border: 1px solid var(--border-strong); flex-shrink: 0; color: var(--text); font-weight: 800; }
.check-pill { position: relative; display: inline-flex; }
.check-pill input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.check-pill span { display: inline-flex; align-items: center; min-height: 28px; padding: 0 .8rem; border-radius: var(--radius-pill); border: 1px solid var(--border-strong); font-size: .78rem; font-weight: 700; color: var(--text-muted); }
.check-pill input:checked + span { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.check-pill input:focus-visible + span { box-shadow: var(--focus); }

.rail { padding: var(--space-3) var(--space-4); display: grid; gap: var(--space-3); align-content: start; position: sticky; top: 0; max-height: 100vh; overflow-y: auto; }
.rail-search { display: flex; align-items: center; gap: var(--space-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 0 var(--space-3); }
.rail-search input { flex: 1; min-width: 0; height: 38px; background: transparent; border: 0; outline: none; font-size: .88rem; }
.rail-search:focus-within { border-color: var(--accent); box-shadow: var(--focus); }
.rail-search .i { color: var(--text-subtle); }
.rail-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-3) var(--space-4); }
.rail-card h2 { font-size: 1rem; margin-bottom: var(--space-2); }
.rail-more { display: block; margin-top: var(--space-2); font-size: var(--fs-small); font-weight: 700; }
.trend { display: grid; gap: 1px; padding: .35rem 0; color: var(--text); }
.trend:hover { text-decoration: none; }
.trend:hover .trend-tag { color: var(--link); }
.trend-tag { font-weight: 800; font-size: .88rem; overflow-wrap: anywhere; }
.rail-foot { color: var(--text-subtle); font-size: var(--fs-meta); }
.rail-foot a { color: var(--text-subtle); }

.notif-list { list-style: none; margin: 0; padding: 0; }
.notif { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: var(--space-3); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); }
.notif.is-unread { background: var(--primary-soft); }
.notif-icon { width: 34px; height: 34px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; color: var(--link); }
.notif-title { font-weight: 700; color: var(--text); }

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 400; background: rgba(0,0,0,.88); display: grid; place-items: center; padding: var(--space-4); }
.lightbox img { max-width: 96vw; max-height: 90vh; object-fit: contain; border-radius: var(--radius-sm); }
.lightbox button { position: absolute; top: var(--space-3); right: var(--space-3); background: rgba(255,255,255,.14); color: #fff; border: 0; width: 40px; height: 40px; border-radius: 50%; }

/* 8. Pages ----------------------------------------------------------------- */
/* Hero slider */
.hero-slider { position: relative; background: var(--bg); border-bottom: 1px solid var(--border); overflow: hidden; }
.hero-track { position: relative; display: grid; }
.hero-slide { grid-area: 1 / 1; position: relative; display: flex; align-items: center; min-height: clamp(340px, 52vh, 520px); padding-block: var(--space-7); opacity: 0; visibility: hidden; transition: opacity .5s ease, visibility .5s; background: radial-gradient(800px 380px at 85% -10%, color-mix(in srgb, var(--primary) 40%, transparent), transparent 60%), radial-gradient(600px 320px at 0% 110%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%), var(--bg); }
.hero-slide.is-active { opacity: 1; visibility: visible; z-index: 1; }
html:not(.js) .hero-slide:first-child { opacity: 1; visibility: visible; }
.hero-media, .hero-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-overlay { position: absolute; inset: 0; background: linear-gradient(90deg, #000 0%, rgba(0,0,0,.6) 60%, rgba(0,0,0,.25) 100%); }
.hero-slide .hero-inner { position: relative; z-index: 2; }
.hero-slide.align-center .hero-inner { text-align: center; }
.hero-slide.align-center .hero-inner > * { margin-inline: auto; }
.hero-slide.align-center .hero-actions { justify-content: center; }
.hero-inner > * { max-width: 680px; }
.hero-inner h1, .hero-inner .hero-h { font-size: clamp(1.6rem, 1.2rem + 2.2vw, 2.6rem); letter-spacing: -.02em; margin-bottom: var(--space-3); }
.hero-slide:has(.hero-media) h1, .hero-slide:has(.hero-media) .hero-h, .hero-slide:has(.hero-media) .lead, .hero-slide:has(.hero-media) .hero-counts { color: #fff; }
.hero-inner .lead { font-size: 1.02rem; color: var(--text-muted); max-width: 54ch; }
.hero-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-top: var(--space-4); }
.hero-counts { margin-top: var(--space-4); color: var(--text-muted); font-size: var(--fs-small); }
.hero-controls { position: absolute; z-index: 5; left: 50%; bottom: var(--space-3); transform: translateX(-50%); display: flex; align-items: center; gap: var(--space-2); background: rgba(0,0,0,.45); border-radius: var(--radius-pill); padding: 2px var(--space-2); }
.hero-controls .icon-btn { color: #fff; width: 30px; height: 30px; }
.hero-dots { display: flex; gap: 6px; }
.hero-dot { width: 9px; height: 9px; padding: 0; border-radius: 50%; border: 0; background: rgba(255,255,255,.45); }
.hero-dot.is-active { background: #fff; transform: scale(1.2); }
.steps { counter-reset: s; list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-3); }
.steps li { counter-increment: s; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-4); }
.steps li::before { content: counter(s); display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--primary-soft); color: var(--link); font-weight: 800; margin-bottom: var(--space-2); }
.steps h3 { margin-bottom: var(--space-1); }
.steps p { color: var(--text-muted); margin: 0; font-size: var(--fs-small); }
.promo { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-5); align-items: center; }
.promo.has-image { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
.promo-img { width: 100%; border-radius: var(--radius); max-height: 280px; object-fit: cover; }
.cta-box { max-width: 620px; }

.community-hero { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-5); margin-bottom: var(--space-4); display: grid; gap: var(--space-3); }
.community-hero .community-icon { width: 60px; height: 60px; font-size: 1.8rem; border-radius: 16px; }
.community-card .community-icon { flex-shrink: 0; }

.blog-featured { display: grid; grid-template-columns: 1.1fr 1fr; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: var(--space-5); }
.blog-featured .card-media { aspect-ratio: auto; min-height: 240px; }
.blog-featured .card-body { padding: var(--space-5); justify-content: center; }
.blog-featured h2 { font-size: clamp(1.25rem, 1rem + 1.2vw, 1.75rem); }
.article-header { max-width: 720px; margin-inline: auto; margin-bottom: var(--space-4); }
.article-cover { max-width: 960px; margin: 0 auto var(--space-5); border-radius: var(--radius-lg); overflow: hidden; aspect-ratio: 21 / 9; background: var(--surface-3); }
.article-cover img { width: 100%; height: 100%; object-fit: cover; }
.prose { max-width: 68ch; margin-inline: auto; font-size: 1rem; line-height: 1.75; color: var(--text); }
.prose h2, .prose h3 { margin-top: var(--space-5); }
.prose p { margin-bottom: 1.1rem; overflow-wrap: anywhere; }
.prose blockquote { margin: var(--space-4) 0; padding: var(--space-1) var(--space-4); border-left: 3px solid var(--primary); color: var(--text-muted); font-style: italic; }
.prose img { border-radius: var(--radius); margin-block: var(--space-4); }
.prose a { text-decoration: underline; }

.ticket-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-4); align-items: center; }
.ticket-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1rem; letter-spacing: .08em; background: var(--surface-3); padding: .4rem .75rem; border-radius: var(--radius-sm); display: inline-block; border: 1px dashed var(--border-strong); }
.qr { background: #fff; padding: 8px; border-radius: var(--radius-sm); width: 160px; height: 160px; display: grid; place-items: center; color: #111; font-size: .78rem; text-align: center; }
.qr img, .qr svg { width: 100%; height: 100%; }

.profile-cover { height: 160px; border-radius: var(--radius-lg); background: linear-gradient(135deg, var(--primary), var(--secondary)); overflow: hidden; }
.profile-cover img { width: 100%; height: 100%; object-fit: cover; }
.profile-head { display: flex; gap: var(--space-4); align-items: flex-end; flex-wrap: wrap; margin: -40px var(--space-4) var(--space-4); position: relative; }
.profile-head .avatar { border: 4px solid var(--bg); }
.profile-head h1 { font-size: 1.35rem; }

.error-page { text-align: center; max-width: 480px; padding: var(--space-5); }
.error-code { font-size: clamp(3.5rem, 3rem + 5vw, 6rem); font-weight: 800; color: var(--primary); line-height: 1; letter-spacing: -.04em; }
.error-message { color: var(--text-muted); }
.error-detail { text-align: left; max-height: 220px; overflow: auto; font-size: .76rem; }

/* Onboarding wizard */
.wizard { width: 100%; max-width: 560px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-5); box-shadow: var(--shadow); }
.wizard-top { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-4); }
.wizard-bar { flex: 1; height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.wizard-bar span { display: block; height: 100%; background: var(--primary); border-radius: 3px; transition: width .25s ease; }
.wizard-step { min-height: 260px; }
.wizard-step[hidden] { display: none; }
.wizard-step h1, .wizard-step h2 { font-size: 1.4rem; }
.wizard-brand { margin-bottom: var(--space-4); }
.wizard-nav { display: flex; justify-content: space-between; gap: var(--space-2); margin-top: var(--space-4); padding-top: var(--space-3); border-top: 1px solid var(--border); }
.wizard-nav .btn[hidden] { display: none; }
.wizard-nav [data-wizard-next] { margin-left: auto; }
.feature-list { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-3); }
.feature-list li { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: var(--space-3); align-items: center; }
.feature-list p { margin: 0; color: var(--text-muted); font-size: var(--fs-small); }
.feature-ico { width: 40px; height: 40px; border-radius: 12px; background: var(--primary-soft); color: var(--link); display: grid; place-items: center; }
.interest-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--space-2); }
.interest { position: relative; display: block; }
.interest input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.interest-card { display: flex; align-items: center; gap: .6rem; min-height: 52px; padding: .5rem .75rem; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface-2); font-weight: 700; font-size: .86rem; }
.interest-ico { font-size: 1.25rem; }
.interest input:checked + .interest-card { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.interest input:focus-visible + .interest-card { box-shadow: var(--focus); }
.avatar-pick { display: flex; align-items: center; gap: var(--space-4); margin-bottom: var(--space-4); }
.suggest-block + .suggest-block { margin-top: var(--space-4); }
.suggest-block h3 { margin-bottom: var(--space-2); }

/* 9. Admin ----------------------------------------------------------------- */
.admin-nav { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); margin-bottom: var(--space-4); padding-bottom: var(--space-3); border-bottom: 1px solid var(--border); }
.admin-nav-group { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.admin-nav-label { font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-subtle); font-weight: 800; margin-right: 4px; }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-2); }
.checklist li { display: flex; align-items: center; gap: var(--space-2); }
.check-ico { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; flex-shrink: 0; }
.checklist .is-done .check-ico { background: var(--success); border-color: var(--success); color: #fff; }
.checklist .is-done .check-ico .i { width: 12px; height: 12px; stroke-width: 3; }
.checklist .is-done { color: var(--text-muted); }
.brand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-3); }
.brand-card { display: grid; gap: var(--space-2); align-content: start; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-3); }
.brand-preview { height: 110px; display: grid; place-items: center; border-radius: var(--radius-sm); background: repeating-conic-gradient(var(--surface-3) 0 25%, var(--surface) 0 50%) 0 0 / 16px 16px; overflow: hidden; }
.brand-preview.is-light { background: #fff; }
.brand-preview img { max-height: 100%; max-width: 100%; object-fit: contain; }
.color-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: var(--space-3); }
.color-input { display: flex; gap: var(--space-2); align-items: center; }
.color-input input[type="color"] { width: 38px; height: var(--input-h); padding: 2px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2); cursor: pointer; flex-shrink: 0; }
.preview-box { margin-top: var(--space-4); padding: var(--space-4); border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--bg); }
.preview-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-4); color: var(--text); }
.preview-card p { color: var(--text-muted); }
.slide-list { list-style: none; padding: 0; margin: 0 0 var(--space-4); display: grid; gap: var(--space-2); }
.slide-row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-2) var(--space-3); }
.slide-thumb { width: 96px; height: 54px; border-radius: var(--radius-sm); background: var(--surface-3); overflow: hidden; display: grid; place-items: center; flex-shrink: 0; }
.slide-thumb img { width: 100%; height: 100%; object-fit: cover; }
.slide-info { flex: 1; min-width: 180px; }
.slide-actions { margin-left: auto; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: var(--space-3); }
.media-tile { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.media-tile img { width: 100%; height: 130px; object-fit: cover; }
.media-tile figcaption { display: grid; gap: 2px; padding: var(--space-2) var(--space-3); word-break: break-all; }

/* 10. Utilities ------------------------------------------------------------ */
.text-muted { color: var(--text-muted); }
.text-subtle { color: var(--text-subtle); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; } .mt-2 { margin-top: var(--space-2); } .mt-4 { margin-top: var(--space-4); } .mt-5 { margin-top: var(--space-5); } .mt-6 { margin-top: var(--space-6); }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: var(--space-2); } .mb-4 { margin-bottom: var(--space-4); } .mb-5 { margin-bottom: var(--space-5); }
.hidden, [hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 11. Responsive ----------------------------------------------------------- */
/* Right rail hides first, then the sidebar collapses to icons, then the bottom nav takes over. */
@media (max-width: 1100px) {
  .app-grid { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .app-col { border-right: 0; max-width: 680px; margin-inline: auto; }
  .split { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1024px) {
  .grid-4, .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  :root { --sidebar-w: 68px; }
  .sidebar .brand-name, .side-nav a > span:not(.dot), .side-compose span, .side-user-text, .side-section-title { display: none; }
  .sidebar .brand { justify-content: center; padding-inline: 0; }
  .side-nav a { justify-content: center; padding-inline: 0; }
  .nav-badge { position: absolute; top: 2px; right: 6px; margin: 0; min-width: 16px; height: 16px; font-size: .6rem; }
  .side-compose { padding-inline: 0; }
  .side-user { flex-direction: column; }
}
@media (max-width: 760px) {
  :root { --sidebar-w: 0px; }
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .app-main { border-left: 0; padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom)); }
  .app-topbar { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 40; height: var(--header-h); padding-inline: var(--space-3); background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
  .col-head { top: var(--header-h); }
  html.js .sidebar { position: fixed; z-index: 70; inset: 0 auto 0 0; width: min(84vw, 300px); transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow); background: var(--surface); }
  html.js body.nav-open .sidebar { transform: none; }
  html.js body.nav-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.6); }
  html:not(.js) .sidebar { position: static; height: auto; width: auto; }
  html.js body.nav-open { overflow: hidden; }
  /* restore labels inside the drawer */
  .sidebar .brand-name, .side-nav a > span, .side-compose span, .side-user-text, .side-section-title { display: revert; }
  .side-nav a { justify-content: flex-start; padding-inline: .75rem; }
  .side-user { flex-direction: row; }
  .nav-badge { position: static; margin-left: auto; min-width: 20px; height: 20px; font-size: .7rem; }
  .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: color-mix(in srgb, var(--bg) 96%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--border); }
  .bottom-nav a { display: grid; place-items: center; align-content: center; gap: 1px; color: var(--text-subtle); font-size: .64rem; font-weight: 700; }
  .bottom-nav a:hover { text-decoration: none; }
  .bottom-nav a[aria-current="page"] { color: var(--text); }
  .bottom-nav a[aria-current="page"] .i { color: var(--primary); stroke-width: 2.4; }
  .blog-featured { grid-template-columns: minmax(0, 1fr); }
  .blog-featured .card-media { min-height: 0; aspect-ratio: 16 / 9; }
  .promo.has-image { grid-template-columns: minmax(0, 1fr); }
  .toast-stack { bottom: calc(var(--bottom-nav-h) + var(--space-3)); }
}
@media (max-width: 900px) {
  .site-header .container { position: relative; }
  html.js .nav-toggle { display: inline-grid; }
  html.js .site-nav { position: absolute; top: var(--header-h); left: 0; right: 0; background: var(--surface); border-bottom: 1px solid var(--border); padding: var(--space-3) var(--space-4) var(--space-4); display: none; flex-direction: column; align-items: stretch; gap: var(--space-3); }
  html.js .site-nav.is-open { display: flex; }
  html.js .site-nav .nav-links { flex-direction: column; align-items: stretch; }
  html.js .site-nav .nav-links a { padding: .65rem .8rem; }
  html.js .site-nav .nav-actions { flex-direction: column; align-items: stretch; }
  html:not(.js) .site-header { position: static; height: auto; padding-block: var(--space-2); }
  html:not(.js) .site-header .container { flex-wrap: wrap; height: auto; }
}
@media (max-width: 720px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .section { padding-block: var(--space-6); }
  .hero-slide { min-height: 380px; padding-block: var(--space-6) var(--space-7); }
  .ticket-card { grid-template-columns: minmax(0, 1fr); }
  .meta-list li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .search-bar { grid-template-columns: minmax(0, 1fr); }
  .auth-card, .wizard { padding: var(--space-4); }
  .profile-head { margin-inline: var(--space-2); }
  .hero-actions .btn { flex: 1 1 100%; }
  .post-banner { margin-left: 0; }
  .comments-region { margin-left: 0; }
  .comment-actions { margin-left: 0; }
}

/* 12. Accessibility -------------------------------------------------------- */
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.input:focus-visible, .composer textarea:focus-visible, .feed-search input:focus-visible, .rail-search input:focus-visible { outline: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .btn, .input, .card, .panel, .chip { border: 1px solid CanvasText; }
}
@media print {
  .sidebar, .bottom-nav, .app-topbar, .rail, .site-header { display: none !important; }
}

/* 13. Additions: video, follow, suggestions, FAB, mobile polish ---------------- */
.post[data-href] { cursor: pointer; }
.post-follow { display: inline-flex; margin-left: auto; }
.post-who { flex: 1; }
.post-follow .btn { min-height: 26px; padding: .1rem .7rem; font-size: .72rem; }
.post-video { background: #000; display: block; }
.post-media video { width: 100%; max-height: 420px; display: block; background: #000; }
.post-media.media-1 .post-video { grid-column: 1 / -1; }
.preview video { width: 100%; height: 100%; object-fit: cover; }
.media-tile video { width: 100%; height: 130px; object-fit: cover; background: #000; }

.suggest-strip { display: none; padding: var(--space-3) 0 var(--space-2); border-bottom: 1px solid var(--border); }
.suggest-strip h2 { font-size: .95rem; padding: 0 var(--space-4); margin-bottom: var(--space-2); }
.strip-scroll { display: flex; gap: var(--space-2); overflow-x: auto; padding: 0 var(--space-4) var(--space-2); scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
.strip-card { flex: 0 0 min(78%, 270px); scroll-snap-align: start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-2) var(--space-3); }
@media (max-width: 1100px) { .suggest-strip { display: block; } }

.fab { display: none; position: fixed; right: var(--space-4); bottom: calc(var(--bottom-nav-h) + var(--space-4) + env(safe-area-inset-bottom)); z-index: 44; width: 52px; height: 52px; border-radius: 50%; background: var(--primary); color: var(--on-primary); place-items: center; box-shadow: var(--shadow); }
.fab:hover { text-decoration: none; background: var(--primary-hover); }
.fab .i { width: 22px; height: 22px; }

@media (max-width: 760px) {
  .fab { display: grid; }
  body { font-size: .92rem; }
  .input, select.input, textarea.input, .form textarea, .form input[type="text"], .form select, .comment-form textarea, .composer textarea, .feed-search input[type="search"], .rail-search input { font-size: 16px; }
  .app-col > .alert, .app-col > .empty, .app-col > .panel, .app-col > .notice-inline, .app-col > .pagination { margin-inline: var(--space-3); }
  .col-head { padding-inline: var(--space-3); }
  .col-head .tabs { margin-inline: calc(var(--space-3) * -1); flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .col-head .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 1 0 auto; padding: .65rem var(--space-3); }
  .composer { padding: var(--space-3); grid-template-columns: 36px minmax(0, 1fr); gap: var(--space-2); }
  .composer-avatar .avatar { width: 36px; height: 36px; }
  .composer-bar { flex-wrap: wrap; }
  .pill-select { max-width: 42vw; }
  .post { padding: var(--space-3); }
  .post-grid { grid-template-columns: 36px minmax(0, 1fr); gap: var(--space-2); }
  .post-grid .avatar { width: 36px; height: 36px; }
  .post-actions { max-width: none; margin-left: -6px; }
  .act { min-height: 38px; padding: 0 .55rem; }
  .act .i { width: 19px; height: 19px; }
  .post-media { max-height: none; }
  .post-media.media-1 img, .post-media video { max-height: 70vh; }
  .menu-panel { min-width: 170px; max-width: calc(100vw - 24px); }
  .share-menu .menu-panel { left: auto; right: 0; }
  .emoji-panel { width: min(320px, calc(100vw - 24px)); grid-template-columns: repeat(7, 1fr); }
  .comment { padding: var(--space-3); }
  .comment-replies { padding-left: var(--space-2); }
  .comments-region { margin-left: 0; }
  .person-row .btn { min-height: 32px; }
  .profile-cover { height: 120px; border-radius: var(--radius); }
  .profile-head { margin-top: -36px; gap: var(--space-3); }
  .profile-head .avatar { width: 84px; height: 84px; }
  .split { gap: var(--space-4); }
  .admin-nav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: var(--space-4); }
  .admin-nav-group { flex-wrap: nowrap; flex-shrink: 0; }
  .page { padding-block: var(--space-4) var(--space-6); }
  .page-header-row { flex-direction: column; align-items: stretch; }
  .slide-row { align-items: flex-start; }
  .slide-actions { margin-left: 0; width: 100%; }
  .form-actions .btn { flex: 1 1 auto; }
  .toggle-row { gap: var(--space-3); }
  .auth-shell:has(.wizard) { place-items: start center; }
  .wizard-step { min-height: 0; }
  .interest-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-inner h1, .hero-inner .hero-h { font-size: 1.6rem; }
  .hero-controls { bottom: var(--space-2); }
  .lightbox img { max-width: 100vw; }
}
@media (max-width: 380px) {
  .bottom-nav a { font-size: .58rem; }
  .brand-name { max-width: 9em; }
}

/* 14. Layout fixes: wide pages, tables, stats, menus inside tables, admin nav ---- */
.post-more { display: inline-block; margin-top: 2px; font-size: .85rem; font-weight: 700; color: var(--link); }
.p-3 { padding: var(--space-3); } .mb-3 { margin-bottom: var(--space-3); }

/* Pages inside the signed-in shell use the room they are given */
.app-main > main > .container { max-width: 1180px; padding-inline: var(--space-5); }
.app-main > main > .container.page { padding-top: var(--space-5); }
.app-main .page-header { max-width: none; }
.app-main .page-header > .lead { max-width: 70ch; }

/* Stat tiles: long currency values wrap instead of overflowing */
.stat-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); }
.stat { min-width: 0; }
.stat-n, .stat-value { font-size: clamp(1.15rem, 1rem + .8vw, 1.5rem); overflow-wrap: anywhere; }

/* Tables: keep columns readable, scroll sideways on small screens, never clip menus */
.table-wrap { max-width: 100%; -webkit-overflow-scrolling: touch; }
.table { min-width: 620px; }
.table td { overflow-wrap: anywhere; }
.table td .btn, .table td .menu { margin: 0 4px 4px 0; }
.table-wrap .menu-panel { position: static; box-shadow: none; margin-top: 6px; min-width: 230px; background: var(--surface-2); }
.table-wrap .menu[open] { display: block; }
.table-wrap details.menu > summary { list-style: none; cursor: pointer; }
.table-wrap details.menu > summary::-webkit-details-marker { display: none; }
.table-wrap .menu-panel .form { gap: var(--space-2); }

/* Admin section bar: tidy blocks on desktop, one scrolling line on phones */
.admin-nav { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-3); gap: var(--space-2) var(--space-5); }
.admin-nav-group { gap: 6px; }
.admin-nav-label { flex-basis: 100%; margin: 0 0 2px; }
.panel.form, form.panel { max-width: 820px; }
.panel .form-row + .form-row, .panel .field + .field { margin-top: var(--space-3); }
.panel .form-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-top: var(--space-4); }
.page-header.row, .page-header-row { align-items: flex-end; }

@media (max-width: 1100px) {
  .app-main > main > .container { padding-inline: var(--space-4); }
}
@media (max-width: 760px) {
  .app-main > main > .container { padding-inline: var(--space-3); }
  .admin-nav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: var(--space-2) var(--space-3); gap: var(--space-4); }
  .admin-nav::-webkit-scrollbar { display: none; }
  .admin-nav-group { flex-wrap: nowrap; flex: 0 0 auto; }
  .admin-nav-label { flex-basis: auto; margin: 0 4px 0 0; }
  .admin-nav .chip { white-space: nowrap; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs .chip { white-space: nowrap; flex: 0 0 auto; }
  .page-header h1 { font-size: 1.35rem; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel, form.panel { padding: var(--space-3); }
  .form-row { grid-template-columns: minmax(0, 1fr); }
  .table-wrap .menu-panel { min-width: 200px; }
}

/* 15. Public header: the menu button is for small screens only (an .icon-btn rule was overriding display:none) */
html .site-header .nav-toggle { display: none; }
.site-nav { margin-left: auto; }
.site-header .brand img { max-height: 34px; width: auto; object-fit: contain; border-radius: 6px; }
@media (max-width: 900px) {
  html.js .site-header .nav-toggle { display: inline-grid; margin-left: auto; }
  .site-nav { margin-left: 0; }
}

/* 16. Sitewide app layout: use the full width, centre the feed, no nested scrollbars ---- */
@media (min-width: 1101px) {
  :root { --col-w: 640px; --rail-w: 340px; }
  .app-shell { max-width: none; }
  .app-grid { grid-template-columns: minmax(0, var(--col-w)) var(--rail-w); justify-content: center; }
  .app-main > main > .container { margin-inline: auto; }
}
@media (min-width: 1500px) {
  :root { --sidebar-w: 260px; --col-w: 680px; --rail-w: 360px; }
}
/* Sidebar and right rail scroll quietly with the page instead of showing their own bars */
.sidebar, .rail { scrollbar-width: none; -ms-overflow-style: none; }
.sidebar::-webkit-scrollbar, .rail::-webkit-scrollbar { display: none; }
.sidebar { overscroll-behavior: contain; }
/* Short windows: tighten the sidebar so everything fits */
@media (min-width: 761px) and (max-height: 820px) {
  .sidebar { padding-block: var(--space-2); gap: var(--space-2); }
  .side-nav a { min-height: 34px; padding-block: .3rem; font-size: .88rem; }
  .side-section-title { margin-top: var(--space-1); }
  .side-compose { height: 38px; }
}
/* Rail cards stay inside their column */
.rail-card, .rail-search { min-width: 0; }
.rail-card * { min-width: 0; }

/* 17. Whole post is one big link to the post page (works without JS); real controls sit above it ---- */
.post { position: relative; }
.post-link { position: absolute; inset: 0; z-index: 1; border-radius: 0; }
.post-link:focus-visible { outline-offset: -3px; }
.post .post-avatar, .post .post-who a, .post .post-who .verified, .post .post-follow, .post .post-menu, .post .post-actions,
.post .post-media, .post .post-community a, .post .post-more, .post .post-text a, .post .post-banner a { position: relative; z-index: 2; }
.post .post-who { pointer-events: none; }
.post .post-who > * { pointer-events: auto; }
.post-head { pointer-events: none; }
.post-head > .post-menu { pointer-events: auto; }
.post-head .post-who { pointer-events: none; }
.post[data-href] .post-text, .post[data-href] .post-title { cursor: pointer; }

/* 18. Loading states ------------------------------------------------------------ */
.page-loader { position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 1000; background: linear-gradient(90deg, var(--primary), var(--accent)); opacity: 0; pointer-events: none; }
.page-loader.is-on { opacity: 1; width: 82%; transition: width 8s cubic-bezier(.1,.6,.2,1); }
.page-loader.is-done { opacity: 0; width: 100%; transition: width .2s ease, opacity .35s ease .15s; }
.page-overlay { position: fixed; inset: 0; z-index: 990; display: none; place-items: center; background: color-mix(in srgb, var(--bg) 62%, transparent); backdrop-filter: blur(2px); }
.page-overlay.is-on { display: grid; }
.spinner { width: 38px; height: 38px; border-radius: 50%; border: 3px solid var(--border-strong); border-top-color: var(--primary); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn.is-loading, button.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after, button.is-loading::after { content: ''; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; animation: spin .7s linear infinite; }
.btn.is-loading .i, button.is-loading .i { opacity: 0; }
.act.is-loading::after { border-color: var(--border-strong); border-top-color: var(--primary); }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .spinner, .skeleton { animation-duration: 2s !important; animation-iteration-count: infinite !important; } }

/* 19. Post card alignment: everything stays inside the card and lines up on the same edges ---- */
.post, .post-grid, .post-body, .post-head, .post-text, .post-media, .post-actions { min-width: 0; max-width: 100%; }
.post { overflow: hidden; }
.post-grid { align-items: start; }
.post-menu { margin-right: -8px; }
.post-menu > summary { width: 32px; height: 32px; display: grid; place-items: center; }
.post-media { width: 100%; box-sizing: border-box; }
.post-media img, .post-media video { display: block; width: 100%; }
.post-text { max-width: 100%; white-space: normal; }
.post-more { display: block; width: fit-content; }
.post-actions { margin-left: -8px; width: calc(100% + 8px); max-width: 480px; }
@media (max-width: 760px) {
  .post { padding-inline: var(--space-3); }
  .post-grid { grid-template-columns: 36px minmax(0, 1fr); gap: var(--space-2); }
  .post-actions { max-width: none; }
}

/* 20. Event page ------------------------------------------------------------------ */
.ev-hero { position: relative; min-height: clamp(260px, 38vh, 420px); display: flex; align-items: flex-end; overflow: hidden; background: linear-gradient(135deg, var(--primary), var(--accent)); border-bottom: 1px solid var(--border); }
.ev-hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ev-hero-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.25) 0%, rgba(0,0,0,.35) 40%, var(--bg) 100%); }
.ev-hero-inner { position: relative; z-index: 1; padding-block: var(--space-5) var(--space-5); }
.ev-back { display: inline-flex; align-items: center; gap: .25rem; color: #fff; font-weight: 700; font-size: .85rem; background: rgba(0,0,0,.4); backdrop-filter: blur(6px); padding: .3rem .75rem .3rem .4rem; border-radius: var(--radius-pill); margin-bottom: var(--space-4); }
.ev-back:hover { text-decoration: none; background: rgba(0,0,0,.55); }
.ev-badges { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-2); }
.ev-title { font-size: clamp(1.7rem, 1.2rem + 2.4vw, 2.8rem); line-height: 1.12; margin: 0 0 var(--space-2); max-width: 22ch; overflow-wrap: anywhere; }
.ev-host { margin: 0; color: var(--text-muted); } .ev-host a { font-weight: 700; }
.ev-body { padding-block: var(--space-4) var(--space-7); max-width: 1120px; }
.ev-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); margin-bottom: var(--space-5); }
.ev-fact { display: flex; gap: var(--space-3); align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-3) var(--space-4); min-width: 0; }
.ev-fact > div { display: grid; min-width: 0; line-height: 1.35; }
.ev-fact strong { font-size: .95rem; overflow-wrap: anywhere; }
.ev-fact span { color: var(--text-muted); font-size: var(--fs-small); overflow-wrap: anywhere; }
.ev-ico { flex: 0 0 38px; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: var(--primary-soft); color: var(--link); }
.ev-ico .i { width: 20px; height: 20px; }
.ev-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--space-5); align-items: start; }
.ev-main { display: grid; gap: var(--space-4); min-width: 0; }
.ev-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-5); min-width: 0; }
.ev-card h2 { font-size: 1.1rem; margin-bottom: var(--space-3); }
.ev-card .prose { max-width: none; }
.ev-host-row { display: flex; align-items: center; gap: var(--space-3); color: var(--text); }
.ev-host-row:hover { text-decoration: none; }
.ev-host-row > span { display: grid; flex: 1; min-width: 0; } .ev-host-row small { color: var(--text-muted); }
.ev-acc { border-top: 1px solid var(--border); padding-block: var(--space-3); } .ev-acc:first-child { border-top: 0; padding-top: 0; } .ev-acc:last-child { padding-bottom: 0; }
.ev-acc summary { cursor: pointer; font-weight: 800; list-style: none; display: flex; justify-content: space-between; }
.ev-acc summary::-webkit-details-marker { display: none; } .ev-acc summary::after { content: '+'; color: var(--text-muted); } .ev-acc[open] summary::after { content: '–'; }
.ev-acc p { margin: var(--space-2) 0 0; }
.ev-review { display: flex; gap: var(--space-3); padding-block: var(--space-3); border-top: 1px solid var(--border); } .ev-review:first-of-type { border-top: 0; }
.ev-review > div { min-width: 0; flex: 1; } .ev-review-top { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.ev-stars { color: #f5b301; letter-spacing: 2px; font-size: .9rem; }
.ev-side { position: sticky; top: calc(var(--header-h) + var(--space-3)); }
.ev-ticket { background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); padding: var(--space-4); box-shadow: var(--shadow); }
.ev-ticket h2 { font-size: 1.1rem; }
.ev-tiers { display: grid; gap: var(--space-2); border: 0; padding: 0; margin: 0 0 var(--space-3); min-width: 0; }
.ev-tier { position: relative; display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3); border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface-2); cursor: pointer; }
.ev-tier input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.ev-tier-body { display: grid; min-width: 0; flex: 1; } .ev-tier small { color: var(--text-muted); }
.ev-tier b { white-space: nowrap; }
.ev-tier:has(input:checked), .ev-tier.is-picked { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.ev-tier:has(input:focus-visible) { box-shadow: var(--focus); }
.ev-tier.is-off { opacity: .5; cursor: not-allowed; } .ev-tier.is-static { cursor: default; }
.ev-qty { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-3); font-weight: 700; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: var(--radius-pill); overflow: hidden; }
.stepper button { width: 36px; height: 36px; background: transparent; border: 0; font-size: 1.1rem; font-weight: 800; }
.stepper button:hover { background: var(--surface-3); }
.stepper input { width: 44px; height: 36px; text-align: center; border: 0; background: transparent; font-weight: 800; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ev-sum { margin: 0 0 var(--space-3); padding: var(--space-3); background: var(--surface-2); border-radius: var(--radius); display: grid; gap: 6px; font-size: var(--fs-small); }
.ev-sum > div { display: flex; justify-content: space-between; gap: var(--space-3); } .ev-sum dt { color: var(--text-muted); } .ev-sum dd { margin: 0; font-weight: 700; }
.ev-sum .ev-total { border-top: 1px solid var(--border); padding-top: 6px; font-size: 1rem; } .ev-sum .ev-total dt { color: var(--text); font-weight: 800; }
.ev-share { margin-top: var(--space-3); display: flex; justify-content: center; }
@media (max-width: 960px) {
  .ev-grid { grid-template-columns: minmax(0, 1fr); }
  .ev-side { position: static; order: -1; }
  .ev-facts { grid-template-columns: minmax(0, 1fr); }
  .ev-title { max-width: none; }
}
@media (max-width: 760px) {
  .ev-hero { min-height: 220px; } .ev-card { padding: var(--space-4); }
  .ev-body { padding-inline: var(--space-3); }
}
