:root {
  color-scheme: light;
  --bg: #f5f1e8;
  --surface: #fffdf8;
  --surface-2: #eee9de;
  --text: #24272d;
  --muted: #6d7078;
  --faint: #93959b;
  --line: #d9d3c7;
  --accent: #3157d5;
  --accent-strong: #2445bb;
  --accent-soft: #e5eaff;
  --danger: #a83a3a;
  --danger-soft: #f8e7e4;
  --success: #32705a;
  --success-soft: #e4f1eb;
  --warning: #916316;
  --warning-soft: #f7edcf;
  --radius-sm: .55rem;
  --radius: .9rem;
  --radius-lg: 1.25rem;
  --shadow-focus: 0 0 0 3px rgba(49, 87, 213, .24);
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-editorial: Georgia, "Times New Roman", serif;
}

html[data-theme="dark"], html[data-theme="system"][data-resolved-theme="dark"] {
  color-scheme: dark;
  --bg: #17191d;
  --surface: #202329;
  --surface-2: #292d34;
  --text: #f0eee8;
  --muted: #b3b5bc;
  --faint: #858991;
  --line: #393d45;
  --accent: #7895ff;
  --accent-strong: #9aafff;
  --accent-soft: #29345d;
  --danger: #f08d88;
  --danger-soft: #4b292b;
  --success: #7dc4a6;
  --success-soft: #254238;
  --warning: #e7bd69;
  --warning-soft: #4a3c22;
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.52;
  text-rendering: optimizeLegibility;
}
img, video { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; }
button, .button, input[type="submit"] { min-height: 44px; }
a { color: var(--accent); text-decoration-thickness: .08em; text-underline-offset: .16em; }
a:hover { color: var(--accent-strong); }
button, a, input, textarea, select, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--accent-soft); }

.skip-link {
  position: fixed;
  left: 1rem;
  top: -5rem;
  z-index: 1000;
  padding: .7rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--text);
  color: var(--bg);
  transition: top .16s ease;
}
.skip-link:focus { top: 1rem; }

.icon {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}
.icon.fill { fill: currentColor; }
.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;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  color: var(--text);
  font-weight: 780;
  font-size: 1.35rem;
  letter-spacing: -.04em;
  text-decoration: none;
}
.brand:hover { color: var(--text); }
.brand img { width: 2.25rem; height: 2.25rem; }
.brand-word { white-space: nowrap; }

.app-shell {
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: 0 1.25rem;
  display: grid;
  grid-template-columns: 214px minmax(0, 690px) minmax(220px, 278px);
  gap: 1.75rem;
  align-items: start;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1.35rem 0 2rem;
  display: flex;
  flex-direction: column;
}
.sidebar .brand { margin: 0 .65rem 1.5rem; }
.nav-list { display: grid; gap: .18rem; }
.nav-link {
  min-height: 46px;
  padding: .65rem .75rem;
  border-radius: .75rem;
  display: flex;
  align-items: center;
  gap: .8rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 620;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: var(--accent-soft); color: var(--accent-strong); }
.nav-link .badge { margin-left: auto; }
.sidebar-create { margin: 1rem .55rem 0; }
.sidebar-account {
  margin-top: auto;
  padding: .65rem;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: .65rem;
  color: var(--text);
  text-decoration: none;
  min-width: 0;
}
.sidebar-account strong, .sidebar-account small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-account small { color: var(--muted); font-weight: 450; }

.main-column { min-width: 0; padding: 1rem 0 5.5rem; }
.topbar {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .2rem 0 .85rem;
}
.topbar h1 {
  margin: 0;
  min-width: 0;
  font-family: var(--font-editorial);
  font-size: clamp(1.55rem, 4vw, 2rem);
  line-height: 1.05;
  letter-spacing: -.025em;
}
.topbar-spacer { flex: 1; }
.mobile-brand { display: none; }

.right-rail {
  position: sticky;
  top: 1rem;
  padding: 1rem 0 3rem;
  display: grid;
  gap: 1rem;
  max-height: calc(100vh - 1rem);
  overflow: auto;
  scrollbar-width: thin;
}
.rail-section {
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}
.rail-section:first-child { border-top: 0; padding-top: 0; }
.rail-title { margin: 0 0 .75rem; font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.rail-list { display: grid; gap: .72rem; }
.rail-user { display: grid; grid-template-columns: 40px minmax(0,1fr); gap: .65rem; align-items: center; color: var(--text); text-decoration: none; }
.rail-user strong, .rail-user small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-user small { color: var(--muted); }
.rail-tag { display: flex; justify-content: space-between; gap: .5rem; color: var(--text); text-decoration: none; padding: .25rem 0; }
.rail-tag span:last-child { color: var(--muted); font-size: .9rem; }

.mobile-nav { display: none; }
.badge {
  display: inline-grid;
  min-width: 1.25rem;
  height: 1.25rem;
  place-items: center;
  padding: 0 .32rem;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-size: .72rem;
  font-weight: 750;
}

.button, button.button {
  border: 1px solid transparent;
  border-radius: .72rem;
  padding: .65rem 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  background: var(--accent);
  color: white;
  font-weight: 700;
  line-height: 1.1;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, transform .15s ease;
}
.button:hover { background: var(--accent-strong); color: white; }
.button:active { transform: translateY(1px); }
.button.secondary { background: transparent; border-color: var(--line); color: var(--text); }
.button.secondary:hover { background: var(--surface-2); border-color: var(--muted); }
.button.soft { background: var(--accent-soft); color: var(--accent-strong); }
.button.soft:hover { background: var(--surface-2); }
.button.danger { background: var(--danger); }
.button.danger:hover { filter: brightness(.92); }
.button.ghost { background: transparent; color: var(--muted); padding-inline: .7rem; }
.button.ghost:hover { background: var(--surface-2); color: var(--text); }
.button.small { min-height: 38px; padding: .5rem .72rem; font-size: .9rem; }
.button.block { width: 100%; }
.button[disabled], button[disabled] { opacity: .58; cursor: not-allowed; transform: none; }
.icon-button {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.icon-button:hover { background: var(--surface-2); color: var(--text); }
.inline-form { display: inline; }
.actions-row { display: flex; flex-wrap: wrap; gap: .65rem; align-items: center; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(1rem, 3vw, 1.4rem);
}
.section {
  border-top: 1px solid var(--line);
  padding: 1.2rem 0;
}
.section:first-child { border-top: 0; }
.section-heading { margin: 0 0 .8rem; font-size: 1.15rem; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: .9rem; }

.flash-stack { display: grid; gap: .65rem; margin-bottom: 1rem; }
.flash {
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: var(--radius-sm);
  padding: .8rem .9rem;
  background: var(--surface);
}
.flash.success { border-left-color: var(--success); background: var(--success-soft); }
.flash.error { border-left-color: var(--danger); background: var(--danger-soft); }
.flash.info { border-left-color: var(--accent); background: var(--accent-soft); }
.flash.warning { border-left-color: var(--warning); background: var(--warning-soft); }

.field { display: grid; gap: .42rem; }
.field + .field { margin-top: 1rem; }
label, .label { font-weight: 680; }
.hint { color: var(--muted); font-size: .88rem; }
.error-text { color: var(--danger); font-size: .9rem; }
input[type="text"], input[type="password"], input[type="url"], input[type="search"], input[type="number"], textarea, select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: .72rem;
  background: var(--surface);
  color: var(--text);
  padding: .72rem .82rem;
  line-height: 1.35;
}
input[type="text"], input[type="password"], input[type="url"], input[type="search"], input[type="number"], select { min-height: 46px; }
textarea { resize: vertical; min-height: 7rem; }
input:hover, textarea:hover, select:hover { border-color: var(--muted); }
input:focus, textarea:focus, select:focus { border-color: var(--accent); outline: 0; box-shadow: var(--shadow-focus); }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); }
.checkbox-row, .radio-row { display: flex; align-items: flex-start; gap: .65rem; }
.checkbox-row input, .radio-row input { width: 1.2rem; height: 1.2rem; margin-top: .15rem; accent-color: var(--accent); flex: 0 0 auto; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1rem; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-top: 1.2rem; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 3.1rem; }
.password-toggle { position: absolute; right: .2rem; top: .1rem; }
.character-count { justify-self: end; font-variant-numeric: tabular-nums; color: var(--muted); font-size: .86rem; }
.character-count.over { color: var(--danger); font-weight: 700; }

.guest-header {
  width: min(1100px, calc(100% - 2rem));
  margin: 0 auto;
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
}
.guest-actions { display: flex; gap: .55rem; }
.guest-main { width: min(1040px, calc(100% - 2rem)); margin: 0 auto; padding: 2rem 0 4rem; }
.guest-grid { display: grid; grid-template-columns: minmax(260px, .72fr) minmax(0, 1.28fr); gap: clamp(1.5rem, 5vw, 4rem); align-items: start; }
.guest-intro { position: sticky; top: 2rem; padding-top: 1rem; }
.guest-intro h1 { font-family: var(--font-editorial); font-size: clamp(2.4rem, 7vw, 4.8rem); line-height: .98; letter-spacing: -.055em; margin: 0 0 1.1rem; }
.guest-intro p { font-size: 1.1rem; color: var(--muted); max-width: 34rem; }
.guest-note { margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }
.guest-feed-title { margin: 0 0 .8rem; font-family: var(--font-editorial); font-size: 1.35rem; }
.guest-footer { width: min(1040px, calc(100% - 2rem)); margin: 0 auto; padding: 1.5rem 0 2rem; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 1rem; color: var(--muted); font-size: .9rem; }
.guest-footer a { color: inherit; }

.auth-shell { width: min(500px, calc(100% - 2rem)); margin: 2.5rem auto 4rem; }
.auth-shell .brand { margin-bottom: 1.8rem; }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: clamp(1.2rem, 5vw, 2rem); }
.auth-card h1 { margin: 0 0 .35rem; font-family: var(--font-editorial); font-size: 2rem; }
.auth-switch { margin-top: 1rem; color: var(--muted); }
.recovery-code {
  display: block;
  width: 100%;
  margin: 1rem 0;
  padding: 1rem;
  border: 1px dashed var(--accent);
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: clamp(.95rem, 4vw, 1.25rem);
  font-weight: 750;
  text-align: center;
  word-break: break-all;
  user-select: all;
}

.feed-tabs { display: flex; border-bottom: 1px solid var(--line); margin-bottom: .15rem; }
.feed-tab { padding: .75rem 1rem; color: var(--muted); text-decoration: none; font-weight: 700; border-bottom: 2px solid transparent; }
.feed-tab.active { color: var(--text); border-bottom-color: var(--accent); }
.composer-prompt { display: flex; align-items: center; gap: .75rem; padding: .9rem 0 1rem; border-bottom: 1px solid var(--line); }
.composer-prompt .button { flex: 1; justify-content: flex-start; background: var(--surface); color: var(--muted); border-color: var(--line); font-weight: 500; }
.composer-prompt .button:hover { background: var(--surface-2); color: var(--text); }
.feed { display: grid; }
.feed > .post-card { border-top: 1px solid var(--line); }
.feed > .post-card:first-child { border-top: 0; }
.feed-end { padding: 1.5rem 0; text-align: center; color: var(--muted); }
.load-more-wrap { padding: 1rem 0; text-align: center; }

.post-card { position: relative; min-width: 0; padding: 1.15rem 0 1.25rem; }
.post-card.detail { padding-top: .5rem; }
.post-header { display: grid; grid-template-columns: 44px minmax(0,1fr) 44px; gap: .7rem; align-items: start; }
.post-author { min-width: 0; }
.post-author-line { display: flex; align-items: baseline; flex-wrap: wrap; gap: .25rem .45rem; }
.post-author-name { color: var(--text); font-weight: 760; text-decoration: none; min-width: 0; overflow-wrap: anywhere; }
.post-username, .post-time { color: var(--muted); font-size: .88rem; overflow-wrap: anywhere; }
.post-meta { display: flex; flex-wrap: wrap; gap: .35rem .6rem; color: var(--muted); font-size: .82rem; }
.post-reason { color: var(--accent-strong); }
.avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--surface-2); border: 1px solid var(--line); flex: 0 0 auto; }
.avatar.small-avatar { width: 36px; height: 36px; }
.avatar.large-avatar { width: clamp(82px, 22vw, 116px); height: clamp(82px, 22vw, 116px); border-width: 4px; border-color: var(--surface); }
.avatar-fallback { display: inline-grid; place-items: center; color: var(--accent-strong); background: var(--accent-soft); font-weight: 800; }
.post-menu { position: relative; justify-self: end; }
.post-menu summary { list-style: none; cursor: pointer; }
.post-menu summary::-webkit-details-marker { display: none; }
.post-menu-popover {
  position: absolute;
  z-index: 20;
  right: 0;
  top: 46px;
  width: min(260px, calc(100vw - 2rem));
  padding: .45rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(20, 22, 28, .13);
}
.post-menu-popover a, .post-menu-popover button, .post-menu-popover summary {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: .55rem;
  background: transparent;
  color: var(--text);
  padding: .6rem .7rem;
  display: flex;
  align-items: center;
  gap: .65rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.post-menu-popover a:hover, .post-menu-popover button:hover, .post-menu-popover summary:hover { background: var(--surface-2); }
.post-menu-popover .danger-link { color: var(--danger); }
.post-menu-popover details { border-top: 1px solid var(--line); margin-top: .25rem; padding-top: .25rem; }
.report-inline { padding: .6rem; display: grid; gap: .5rem; }
.report-inline select, .report-inline textarea { font-size: .9rem; }

.post-content { margin-left: 3.4rem; min-width: 0; }
.post-body { margin: .7rem 0 .85rem; overflow-wrap: anywhere; word-break: break-word; }
.post-body p { margin: 0 0 .75rem; }
.post-body p:last-child { margin-bottom: 0; }
.post-body ul { margin: .5rem 0 .8rem; padding-left: 1.4rem; }
.post-body blockquote { margin: .65rem 0; padding: .15rem 0 .15rem 1rem; border-left: 3px solid var(--accent); color: var(--muted); }
.post-body a { overflow-wrap: anywhere; }
.post-body.collapsed { max-height: 12.5rem; overflow: hidden; position: relative; }
.post-body.collapsed::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4rem; background: linear-gradient(transparent, var(--bg)); pointer-events: none; }
.post-card.detail .post-body.collapsed::after { background: linear-gradient(transparent, var(--bg)); }
.post-expand { border: 0; background: transparent; color: var(--accent); min-height: 36px; padding: 0; font-weight: 700; cursor: pointer; }

.media-grid { display: grid; gap: .3rem; margin: .9rem 0; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
.media-grid.count-1 { grid-template-columns: 1fr; }
.media-grid.count-2, .media-grid.count-4, .media-grid.full-gallery { grid-template-columns: repeat(2, minmax(0,1fr)); }
.media-grid.count-3 { grid-template-columns: 1.35fr .65fr; grid-template-rows: repeat(2, minmax(0,1fr)); }
.media-grid.count-3 .media-item:first-child { grid-row: 1 / 3; }
.media-item { position: relative; min-width: 0; background: var(--surface-2); aspect-ratio: 4 / 3; overflow: hidden; }
.media-grid.count-1 .media-item { aspect-ratio: 16 / 10; max-height: 620px; }
.media-grid.full-gallery .media-item { aspect-ratio: 4 / 3; }
.media-item img { width: 100%; height: 100%; object-fit: cover; }
.media-more { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(22,25,31,.48); color: white; font-weight: 800; font-size: 1.75rem; }
.video-wrap { margin: .9rem 0; border-radius: var(--radius); overflow: hidden; background: #0b0c0f; aspect-ratio: 16/9; }
.video-wrap video { width: 100%; height: 100%; object-fit: contain; }
.file-list { display: grid; gap: .55rem; margin: .9rem 0; }
.file-card { min-width: 0; padding: .75rem; border: 1px solid var(--line); border-radius: .72rem; display: grid; grid-template-columns: 40px minmax(0,1fr) auto; align-items: center; gap: .7rem; color: var(--text); text-decoration: none; }
.file-card:hover { background: var(--surface-2); color: var(--text); }
.file-card strong, .file-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-card small { color: var(--muted); }
.file-icon { width: 40px; height: 40px; border-radius: .55rem; display: grid; place-items: center; color: var(--accent-strong); background: var(--accent-soft); }

.post-actions { display: flex; align-items: center; justify-content: space-between; gap: .35rem; margin-top: .85rem; color: var(--muted); }
.post-action, button.post-action, a.post-action {
  min-height: 40px;
  min-width: 42px;
  border: 0;
  border-radius: 999px;
  padding: .45rem .62rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .38rem;
  background: transparent;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  font-size: .9rem;
}
.post-action:hover { background: var(--surface-2); color: var(--text); }
.post-action.active { color: var(--accent-strong); background: var(--accent-soft); }
.reaction-picker { display: flex; gap: .08rem; }
.reaction-picker .post-action { min-width: 36px; padding-inline: .45rem; }
.reaction-picker .reaction-label { display: none; }
.reaction-total { font-variant-numeric: tabular-nums; }
.post-action-label { display: none; }

.empty-state { padding: clamp(2rem, 8vw, 4.5rem) 1rem; text-align: center; border-top: 1px solid var(--line); }
.empty-state .icon { width: 2.3rem; height: 2.3rem; color: var(--muted); margin-bottom: .8rem; }
.empty-state h2 { font-family: var(--font-editorial); margin: 0 0 .45rem; font-size: 1.55rem; }
.empty-state p { margin: 0 auto 1rem; color: var(--muted); max-width: 30rem; }

.profile-cover { height: clamp(130px, 27vw, 230px); border-radius: var(--radius-lg); background: linear-gradient(135deg, var(--accent-soft), var(--surface-2)); overflow: hidden; border: 1px solid var(--line); }
.profile-cover img { width: 100%; height: 100%; object-fit: cover; }
.profile-head { position: relative; padding: 0 .2rem 1.2rem; border-bottom: 1px solid var(--line); }
.profile-avatar-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-top: clamp(-55px, -10vw, -40px); padding: 0 .7rem; }
.profile-info { padding: .8rem .7rem 0; }
.profile-info h1 { margin: 0; font-family: var(--font-editorial); font-size: clamp(1.8rem, 6vw, 2.4rem); overflow-wrap: anywhere; }
.profile-handle { color: var(--muted); overflow-wrap: anywhere; }
.profile-bio { margin: .75rem 0; white-space: pre-line; overflow-wrap: anywhere; }
.profile-meta { display: flex; flex-wrap: wrap; gap: .5rem 1rem; color: var(--muted); font-size: .9rem; }
.profile-links { display: flex; flex-wrap: wrap; gap: .4rem .8rem; margin-top: .6rem; }
.profile-links a { max-width: 100%; overflow-wrap: anywhere; }
.tag-list { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .7rem; }
.tag { display: inline-flex; align-items: center; min-height: 32px; padding: .3rem .65rem; border-radius: 999px; background: var(--surface-2); color: var(--text); text-decoration: none; font-size: .86rem; }
.profile-stats { display: flex; flex-wrap: wrap; gap: .65rem 1.25rem; margin-top: .9rem; }
.profile-stat { color: var(--muted); text-decoration: none; }
.profile-stat strong { color: var(--text); }
.profile-tabs { display: flex; overflow: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); }
.profile-tabs::-webkit-scrollbar { display: none; }
.profile-tab { flex: 1 0 auto; min-height: 48px; padding: .75rem 1rem; color: var(--muted); text-decoration: none; text-align: center; font-weight: 700; border-bottom: 2px solid transparent; }
.profile-tab.active { color: var(--text); border-bottom-color: var(--accent); }

.comments-section { border-top: 1px solid var(--line); margin-top: .75rem; padding-top: 1.1rem; }
.comment-form { display: grid; grid-template-columns: 40px minmax(0,1fr); gap: .7rem; margin-bottom: 1.25rem; }
.comment-form textarea { min-height: 78px; }
.comment-form-actions { display: flex; justify-content: flex-end; margin-top: .5rem; }
.comment-list { display: grid; gap: 1rem; }
.comment { display: grid; grid-template-columns: 36px minmax(0,1fr); gap: .6rem; min-width: 0; }
.comment.reply { margin-left: 2.9rem; }
.comment-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .35rem .55rem; }
.comment-author { color: var(--text); font-weight: 720; text-decoration: none; overflow-wrap: anywhere; }
.comment-time { color: var(--muted); font-size: .8rem; }
.comment-body { margin-top: .2rem; overflow-wrap: anywhere; }
.comment-body p { margin: 0 0 .45rem; }
.comment-actions { display: flex; gap: .65rem; margin-top: .25rem; }
.comment-actions button { border: 0; background: transparent; color: var(--muted); min-height: 34px; padding: 0; cursor: pointer; font-size: .84rem; }
.comment-actions button:hover { color: var(--text); }
.deleted-comment { color: var(--muted); font-style: italic; }
.reply-form { margin-top: .5rem; display: none; }
.reply-form.open { display: block; }

.editor-panel { border-top: 1px solid var(--line); padding-top: 1rem; }
.editor-toolbar { display: flex; flex-wrap: wrap; gap: .25rem; padding: .35rem; border: 1px solid var(--line); border-bottom: 0; border-radius: .72rem .72rem 0 0; background: var(--surface-2); }
.editor-tool { width: 40px; height: 38px; border: 0; border-radius: .45rem; background: transparent; color: var(--text); cursor: pointer; font-weight: 750; }
.editor-tool:hover { background: var(--surface); }
.editor-textarea { border-radius: 0 0 .72rem .72rem; min-height: 260px; }
.editor-meta { display: flex; justify-content: space-between; gap: .8rem; margin-top: .45rem; }
.editor-preview { display: none; min-height: 180px; padding: 1rem; border: 1px solid var(--line); border-radius: .72rem; background: var(--surface); }
.editor-preview.open { display: block; }
.editor-preview .post-body { margin: 0; }
.upload-zone { margin-top: 1rem; border: 1px dashed var(--muted); border-radius: var(--radius); padding: 1rem; background: var(--surface); }
.upload-zone.dragover { border-color: var(--accent); background: var(--accent-soft); }
.upload-zone input[type="file"] { width: 100%; }
.selected-files { display: grid; gap: .5rem; margin-top: .75rem; }
.selected-file { display: grid; grid-template-columns: 42px minmax(0,1fr) 42px; gap: .65rem; align-items: center; padding: .55rem; background: var(--surface-2); border-radius: .65rem; min-width: 0; }
.selected-file strong, .selected-file small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selected-file small { color: var(--muted); }
.upload-progress { display: none; margin-top: 1rem; }
.upload-progress.active { display: block; }
.progress-track { height: .5rem; border-radius: 999px; overflow: hidden; background: var(--surface-2); }
.progress-bar { width: 0; height: 100%; background: var(--accent); transition: width .1s linear; }
.existing-attachments { display: grid; gap: .5rem; margin-top: .7rem; }
.existing-attachment { display: flex; align-items: center; gap: .65rem; padding: .55rem; border: 1px solid var(--line); border-radius: .65rem; min-width: 0; }
.existing-attachment span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.search-form { display: flex; gap: .5rem; margin-bottom: 1rem; }
.search-form input { flex: 1; }
.search-section { border-top: 1px solid var(--line); padding: 1rem 0; }
.search-section h2 { margin: 0 0 .8rem; font-size: 1.1rem; }
.user-list { display: grid; gap: .25rem; }
.user-row { display: grid; grid-template-columns: 48px minmax(0,1fr) auto; gap: .75rem; align-items: center; padding: .7rem .25rem; color: var(--text); text-decoration: none; min-width: 0; }
.user-row:hover { background: var(--surface-2); }
.user-row strong, .user-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-row small { color: var(--muted); }

.notification-list { display: grid; }
.notification { display: grid; grid-template-columns: 44px minmax(0,1fr) auto; gap: .75rem; align-items: start; padding: 1rem 0; border-top: 1px solid var(--line); color: var(--text); text-decoration: none; }
.notification:first-child { border-top: 0; }
.notification.unread { background: linear-gradient(90deg, var(--accent-soft), transparent 45%); }
.notification-text { min-width: 0; overflow-wrap: anywhere; }
.notification-time { color: var(--muted); font-size: .82rem; white-space: nowrap; }

.settings-layout { display: grid; grid-template-columns: 190px minmax(0,1fr); gap: 1.25rem; min-width: 0; max-width: 100%; }
.settings-nav { display: grid; align-content: start; gap: .2rem; min-width: 0; max-width: 100%; }
.settings-nav a { min-height: 42px; padding: .55rem .65rem; border-radius: .55rem; color: var(--text); text-decoration: none; }
.settings-nav a.active, .settings-nav a:hover { background: var(--surface-2); }
.settings-content { min-width: 0; max-width: 100%; }
.settings-content form, .profile-avatar-row, .profile-avatar-row .field { min-width: 0; max-width: 100%; }
.settings-content input[type="file"] { min-width: 0; max-width: 100%; }
.settings-content h2 { margin-top: 0; font-family: var(--font-editorial); }
.theme-options { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .65rem; }
.theme-option { border: 1px solid var(--line); border-radius: .7rem; padding: .75rem; }
.blocked-list { display: grid; gap: .5rem; }
.blocked-user { display: grid; grid-template-columns: 42px minmax(0,1fr) auto; gap: .7rem; align-items: center; padding: .65rem 0; border-top: 1px solid var(--line); }
.blocked-user:first-child { border-top: 0; }

.admin-tabs { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: 1rem; }
.admin-tabs a { padding: .55rem .75rem; border-radius: .55rem; color: var(--text); text-decoration: none; }
.admin-tabs a.active, .admin-tabs a:hover { background: var(--surface-2); }
.stat-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: .75rem; }
.stat-card { padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.stat-card strong { display: block; font-family: var(--font-editorial); font-size: 1.8rem; line-height: 1; }
.stat-card span { display: block; margin-top: .35rem; color: var(--muted); font-size: .86rem; }
.table-wrap { width: 100%; }
.data-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.data-table th, .data-table td { border-bottom: 1px solid var(--line); padding: .7rem .5rem; text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.data-table th { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.status { display: inline-flex; min-height: 26px; align-items: center; padding: .2rem .48rem; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--surface-2); }
.status.active, .status.reviewed { color: var(--success); background: var(--success-soft); }
.status.blocked, .status.open { color: var(--danger); background: var(--danger-soft); }
.admin-actions { display: flex; flex-wrap: wrap; gap: .35rem; }

.legal { max-width: 760px; }
.legal h1 { font-family: var(--font-editorial); font-size: clamp(2rem, 6vw, 3rem); overflow-wrap: anywhere; hyphens: auto; }
.legal h2 { margin-top: 2rem; font-size: 1.25rem; }
.legal p, .legal li { color: var(--text); }
.error-page { min-height: 70vh; display: grid; place-items: center; text-align: center; padding: 2rem; }
.error-code { font-family: var(--font-editorial); font-size: clamp(4rem, 20vw, 9rem); line-height: .8; color: var(--accent); }
.error-page h1 { font-family: var(--font-editorial); font-size: 2rem; margin: 1rem 0 .4rem; }
.error-page p { color: var(--muted); max-width: 30rem; }

.install-shell { width: min(760px, calc(100% - 2rem)); margin: 2rem auto 4rem; }
.requirements { display: grid; gap: .35rem; margin: 1rem 0; }
.requirement { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.requirement.ok span:last-child { color: var(--success); }
.requirement.fail span:last-child { color: var(--danger); }

@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 190px minmax(0,1fr); max-width: 930px; }
  .right-rail { display: none; }
}

@media (max-width: 760px) {
  body { padding-bottom: 68px; }
  .app-shell { display: block; width: 100%; padding: 0 1rem; }
  .sidebar { display: none; }
  .main-column { padding-top: 0; }
  .topbar { position: sticky; top: 0; z-index: 30; margin: 0 -1rem; padding: .55rem 1rem; min-height: 58px; background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
  .mobile-brand { display: inline-flex; }
  .topbar h1 { font-size: 1.45rem; }
  .mobile-nav {
    position: fixed;
    z-index: 50;
    left: 0;
    right: 0;
    bottom: 0;
    height: 66px;
    display: grid;
    grid-template-columns: repeat(5,1fr);
    padding: .35rem max(.35rem, env(safe-area-inset-left)) max(.35rem, env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface) 96%, transparent);
    backdrop-filter: blur(12px);
  }
  .mobile-nav a { position: relative; display: grid; place-items: center; align-content: center; gap: .14rem; min-width: 0; min-height: 54px; border-radius: .55rem; color: var(--muted); text-decoration: none; font-size: .68rem; }
  .mobile-nav a.active { color: var(--accent-strong); }
  .mobile-nav .icon { width: 1.35rem; height: 1.35rem; }
  .mobile-nav .badge { position: absolute; top: 1px; left: calc(50% + 5px); }
  .mobile-nav .create-mobile { color: white; }
  .mobile-nav .create-mobile .mobile-create-icon { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); }
  .mobile-nav .create-mobile span:last-child { color: var(--muted); }
  .post-content { margin-left: 0; }
  .post-body { margin-top: .8rem; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { display: flex; overflow: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
  .settings-nav::-webkit-scrollbar { display: none; }
  .settings-nav a { flex: 0 0 auto; }
  .stat-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 640px) {
  .guest-header { width: calc(100% - 1.25rem); }
  .guest-actions .secondary { display: none; }
  .guest-main { width: calc(100% - 1.5rem); padding-top: 1rem; }
  .guest-grid { grid-template-columns: 1fr; gap: 1.8rem; }
  .guest-intro { position: static; padding: .4rem 0; }
  .guest-intro h1 { font-size: clamp(2.6rem, 15vw, 4.2rem); }
  .guest-footer { width: calc(100% - 1.5rem); }
  .form-grid { grid-template-columns: 1fr; }
  .theme-options { grid-template-columns: 1fr; }
  .profile-avatar-row { padding-inline: .35rem; flex-wrap: wrap; }
  .profile-info { padding-inline: .35rem; }
  .comment.reply { margin-left: 1.8rem; }
  .post-actions { gap: .1rem; }
  .post-action { padding-inline: .45rem; }
  .reaction-picker .post-action:not(.active):not(:first-child) { display: none; }
  .file-card { grid-template-columns: 38px minmax(0,1fr); }
  .file-card > .icon:last-child { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table thead { display: none; }
  .data-table tr { padding: .65rem 0; border-bottom: 1px solid var(--line); }
  .data-table td { border: 0; padding: .3rem 0 .3rem 42%; position: relative; min-height: 1.8rem; }
  .data-table td::before { content: attr(data-label); position: absolute; left: 0; top: .3rem; width: 38%; color: var(--muted); font-size: .78rem; font-weight: 700; text-transform: uppercase; }
  .admin-actions { padding-left: 0; }
}

@media (max-width: 420px) {
  .app-shell { padding: 0 .75rem; }
  .topbar { margin-inline: -.75rem; padding-inline: .75rem; }
  .post-header { grid-template-columns: 40px minmax(0,1fr) 40px; gap: .55rem; }
  .avatar { width: 40px; height: 40px; }
  .post-card { padding-block: 1rem; }
  .media-grid.count-2, .media-grid.count-4, .media-grid.full-gallery { gap: .2rem; }
  .profile-cover { border-radius: .8rem; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: .5rem; }
  .stat-card { padding: .75rem; }
  .search-form { display: grid; grid-template-columns: minmax(0,1fr) auto; }
  .notification { grid-template-columns: 40px minmax(0,1fr); }
  .notification-time { grid-column: 2; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* =========================================================
   НеМакс 2.1 — product polish
   ========================================================= */
:root {
  --bg: #f4efe5;
  --surface: #fffdf8;
  --surface-2: #ece6da;
  --surface-raised: #fffaf1;
  --text: #24272e;
  --muted: #6b6f78;
  --faint: #94969b;
  --line: #d9d1c4;
  --accent: #2f55c8;
  --accent-strong: #2344ad;
  --accent-soft: #e4e9fb;
  --coral: #e66b55;
  --coral-soft: #f9e5df;
  --radius-sm: .68rem;
  --radius: 1rem;
  --radius-lg: 1.35rem;
  --radius-xl: 1.8rem;
}

html[data-theme="dark"], html[data-theme="system"][data-resolved-theme="dark"] {
  --bg: #17191e;
  --surface: #20232a;
  --surface-2: #2a2e36;
  --surface-raised: #25282f;
  --text: #f3f0e9;
  --muted: #b5b7bd;
  --faint: #858891;
  --line: #3b3e46;
  --accent: #8099f7;
  --accent-strong: #a7b7ff;
  --accent-soft: #2c355b;
  --coral: #f28a74;
  --coral-soft: #4d2e2a;
}

body {
  letter-spacing: -.006em;
  background: var(--bg);
}

h1, h2, h3, p { overflow-wrap: anywhere; }
button, input, textarea, select { border-radius: var(--radius-sm); }
button, .button { touch-action: manipulation; }
.button.button-large { min-height: 50px; padding-inline: 1.25rem; border-radius: .88rem; }
.button.danger-soft { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.button.danger-soft:hover { background: var(--danger); color: #fff; }
.button.is-success { background: var(--success); color: #fff; }

.brand { gap: .72rem; }
.brand-icon {
  width: 42px !important;
  height: 42px !important;
  border-radius: 11px;
  object-fit: contain;
  filter: drop-shadow(0 2px 3px rgba(24, 29, 45, .1));
}
.brand-copy { min-width: 0; display: grid; line-height: 1.02; }
.brand-copy strong { font-family: var(--font-editorial); font-size: 1.48rem; font-weight: 700; letter-spacing: -.045em; }
.brand-copy small { margin-top: .22rem; color: var(--muted); font-size: .68rem; font-weight: 600; letter-spacing: .01em; }
.brand-compact .brand-copy { display: none; }
.brand-compact .brand-icon { width: 38px !important; height: 38px !important; border-radius: 10px; }

.language-switch {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
}
.language-switch form { display: contents; }
.language-option {
  min-height: 30px;
  min-width: 38px;
  padding: .25rem .52rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .04em;
  cursor: pointer;
}
.language-option:hover { color: var(--text); }
.language-option.active { background: var(--text); color: var(--bg); }

.app-shell {
  width: min(1320px, 100%);
  grid-template-columns: 232px minmax(0, 704px) minmax(240px, 292px);
  gap: 1.65rem;
  padding-inline: 1.35rem;
}
.sidebar { padding-top: 1.2rem; }
.sidebar .brand { margin: .1rem .7rem 1.35rem; }
.sidebar-create { margin: .15rem .55rem 1rem; box-shadow: 0 1px 0 rgba(0,0,0,.04); }
.nav-list { gap: .28rem; }
.nav-link { border: 1px solid transparent; border-radius: .85rem; padding-inline: .85rem; }
.nav-link:hover { background: var(--surface); border-color: var(--line); }
.nav-link.active { background: var(--surface); border-color: var(--line); color: var(--accent-strong); }
.nav-link.active .icon { stroke-width: 2.25; }
.sidebar-footer { margin-top: auto; display: grid; gap: .7rem; }
.sidebar-footer > .language-switch { justify-self: start; margin-left: .6rem; }
.sidebar-account {
  margin-top: 0;
  border: 1px solid transparent;
  border-radius: .9rem;
  padding: .6rem;
}
.sidebar-account:hover { background: var(--surface); border-color: var(--line); color: var(--text); }

.main-column { padding-top: .85rem; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  min-height: 64px;
  margin-bottom: .5rem;
  padding: .65rem .2rem;
  background: color-mix(in srgb, var(--bg) 93%, transparent);
  backdrop-filter: blur(12px);
}
.topbar h1 { font-size: clamp(1.45rem, 3vw, 1.88rem); }
.topbar-language { display: none; }
.mobile-brand-wrap { display: none; }
.right-rail { padding-top: 1.35rem; }
.right-rail > .search-form input { background: var(--surface); }
.rail-section { border-top-color: var(--line); }
.rail-title { font-size: .73rem; font-weight: 800; }
.rail-user { padding: .3rem; margin-inline: -.3rem; border-radius: .65rem; }
.rail-user:hover { background: var(--surface); color: var(--text); }
.rail-tag { padding: .38rem .45rem; margin-inline: -.45rem; border-radius: .6rem; }
.rail-tag:hover { background: var(--surface); color: var(--text); }
.rail-art { overflow: hidden; border-radius: var(--radius); border: 1px solid var(--line); padding: 0; background: var(--surface); }
.rail-art img { width: 100%; opacity: .94; }
.rail-legal { display: flex; gap: .35rem; flex-wrap: wrap; }
.rail-legal a { color: var(--muted); text-decoration: none; }

/* Guest experience */
.guest-page { padding-bottom: 0; }
.guest-header {
  width: min(1260px, calc(100% - 2.5rem));
  min-height: 82px;
  border-bottom: 0;
}
.guest-header-tools { display: flex; align-items: center; gap: 1rem; }
.guest-main { width: min(1260px, calc(100% - 2.5rem)); padding: 1rem 0 5rem; }
.guest-hero {
  min-height: min(720px, calc(100vh - 110px));
  display: grid;
  grid-template-columns: minmax(320px, .85fr) minmax(460px, 1.15fr);
  gap: clamp(1.4rem, 4vw, 4rem);
  align-items: center;
  padding: clamp(2rem, 6vw, 5.5rem) 0 4rem;
}
.guest-hero-copy { position: relative; z-index: 1; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  margin-bottom: .7rem;
  color: var(--accent-strong);
  font-size: .73rem;
  font-weight: 820;
  text-transform: uppercase;
  letter-spacing: .095em;
}
.eyebrow::before { content: ""; width: 1.5rem; height: 2px; border-radius: 2px; background: var(--coral); }
.guest-hero h1 {
  max-width: 11ch;
  margin: 0;
  font-family: var(--font-editorial);
  font-size: clamp(3.1rem, 6.1vw, 6.35rem);
  font-weight: 700;
  line-height: .93;
  letter-spacing: -.06em;
}
.guest-hero-copy > p { max-width: 36rem; margin: 1.45rem 0 0; color: var(--muted); font-size: clamp(1.06rem, 1.5vw, 1.22rem); }
.guest-hero-actions { margin-top: 1.7rem; }
.guest-feature-row { margin-top: 2.1rem; display: grid; gap: .62rem; color: var(--muted); font-size: .9rem; }
.guest-feature-row span { display: flex; align-items: center; gap: .58rem; }
.guest-feature-row .icon { color: var(--accent); }
.guest-hero-art {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: clamp(1.25rem, 3vw, 2.3rem);
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(49, 49, 45, .08);
}
.guest-hero-art::after { content: ""; position: absolute; inset: 0; pointer-events: none; border: 1px solid rgba(255,255,255,.45); border-radius: inherit; }
.guest-hero-art img { width: 100%; height: auto; aspect-ratio: 16/9; object-fit: cover; }
.guest-feed-section { padding-top: clamp(2rem, 5vw, 4rem); border-top: 1px solid var(--line); }
.guest-section-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; }
.guest-section-heading h2 { margin: 0; font-family: var(--font-editorial); font-size: clamp(2rem, 4vw, 3.4rem); letter-spacing: -.04em; }
.text-link { display: inline-flex; align-items: center; gap: .4rem; color: var(--text); font-weight: 700; text-decoration: none; }
.text-link .icon { width: 1.05rem; }
.guest-feed-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.15rem; align-items: start; }
.guest-feed-grid .post-card { margin: 0; height: 100%; }
.guest-footer { width: min(1260px, calc(100% - 2.5rem)); justify-content: space-between; }
.footer-links { display: flex; gap: 1rem; }
.footer-links a { text-decoration: none; }

/* Auth and onboarding */
.auth-page .guest-main { width: min(1120px, calc(100% - 2rem)); padding-top: 2.2rem; }
.auth-shell.auth-shell-wide {
  width: 100%;
  max-width: 1080px;
  margin: 1rem auto 4rem;
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(390px, .78fr);
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--surface);
}
.auth-art { position: relative; min-height: 660px; overflow: hidden; background: #f7f0e4; }
.auth-art img { width: 100%; height: 100%; object-fit: cover; }
.auth-art-caption {
  position: absolute;
  left: 1.5rem;
  right: 1.5rem;
  bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 1rem;
  border-radius: .9rem;
  background: rgba(255,253,248,.9);
  color: #24272e;
  backdrop-filter: blur(8px);
}
.auth-art-caption strong { font-family: var(--font-editorial); font-size: 1.35rem; }
.auth-art-caption span { color: #6b6f78; }
.auth-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(1.6rem, 4vw, 3.6rem);
  border: 0;
  border-radius: 0;
  background: var(--surface);
}
.auth-card > .brand { margin: 0 0 2.2rem; }
.auth-card h1 { font-size: clamp(2.1rem, 4vw, 3rem); letter-spacing: -.045em; }
.auth-lead { margin: 0 0 1.5rem; color: var(--muted); }
.auth-card form { display: grid; gap: 1rem; }
.auth-card .field + .field { margin-top: 0; }
.auth-card .button.block { margin-top: .25rem; }
.auth-links { margin-top: 1.4rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: .7rem 1rem; color: var(--muted); font-size: .9rem; }
.consent-row { margin-block: .2rem; color: var(--muted); font-size: .9rem; }
.password-toggle { border: 0; background: transparent; color: var(--muted); cursor: pointer; }

.code-shell { width: min(720px, 100%); margin: 1rem auto 4rem; }
.recovery-card { text-align: center; }
.recovery-icon-wrap { width: 76px; height: 76px; margin: 0 auto 1rem; display: grid; place-items: center; border-radius: 24px; background: var(--accent-soft); color: var(--accent-strong); }
.recovery-icon-wrap .icon { width: 2rem; height: 2rem; }

.onboarding-shell { display: grid; grid-template-columns: minmax(260px, .75fr) minmax(420px, 1.25fr); gap: clamp(1.5rem, 4vw, 3.4rem); align-items: start; padding: 1rem 0 3rem; }
.onboarding-copy { position: sticky; top: 6rem; }
.onboarding-copy h1 { margin: 0; font-family: var(--font-editorial); font-size: clamp(2.4rem, 5vw, 4.4rem); line-height: .98; letter-spacing: -.05em; }
.onboarding-copy p { color: var(--muted); font-size: 1.05rem; }
.onboarding-copy img { margin-top: 1.5rem; border-radius: var(--radius-lg); }
.onboarding-form { padding: clamp(1rem, 3vw, 1.7rem); }
.onboarding-form fieldset { margin: 1.2rem 0 0; padding: 0; border: 0; }
.onboarding-form legend { margin-bottom: .65rem; }
.onboarding-avatar { width: 84px; height: 84px; }
.compact-user-list .user-row { border: 1px solid var(--line); border-radius: .8rem; padding: .65rem; cursor: pointer; }
.compact-user-list .user-row input { width: 1.2rem; height: 1.2rem; accent-color: var(--accent); }
.tag:has(input) { cursor: pointer; }
.tag input { accent-color: var(--accent); }

/* Feed and posts */
.feed-tabs {
  margin: 0 0 .8rem;
  padding: .22rem;
  border: 1px solid var(--line);
  border-radius: .88rem;
  background: var(--surface);
}
.feed-tab { flex: 1; border: 0; border-radius: .65rem; text-align: center; padding: .62rem 1rem; }
.feed-tab.active { border: 0; background: var(--accent-soft); color: var(--accent-strong); }
.composer-prompt {
  margin-bottom: .9rem;
  padding: .72rem .8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  text-decoration: none;
}
.composer-prompt:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); color: var(--text); }
.composer-prompt > span:nth-child(2) { flex: 1; min-width: 0; }
.composer-plus { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: #fff; }
.feed { display: grid; gap: .85rem; }
.feed > .post-card { border-top: 0; }
.post-card {
  padding: 1rem 1.05rem 1.05rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.post-card.detail { padding-top: 1rem; }
.post-content { margin-left: 3.45rem; }
.post-body { font-size: 1.015rem; }
.post-body.collapsed::after, .post-card.detail .post-body.collapsed::after { background: linear-gradient(transparent, var(--surface)); }
.post-time { text-decoration: none; }
.post-time:hover { color: var(--text); }
.post-reason { display: inline-flex; padding: .12rem .4rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); }
.media-grid, .video-wrap { border: 1px solid var(--line); }
.media-item a { display: block; width: 100%; height: 100%; }
.media-item img { transition: transform .22s ease; }
.media-item:hover img { transform: scale(1.015); }
.file-card { background: var(--surface-raised); }
.post-actions { padding-top: .65rem; border-top: 1px solid var(--line); }
.post-action { transition: background-color .15s ease, color .15s ease; }
.reaction-picker .post-action { color: var(--muted); }
.empty-state {
  margin-top: .8rem;
  padding: clamp(2rem, 6vw, 3.8rem) 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.empty-state img { width: min(340px, 80%); margin: 0 auto 1rem; border-radius: 1rem; }
.feed-end { margin: 0; }

/* Profile */
.profile-head { padding-bottom: 1rem; border-bottom: 0; }
.profile-cover { height: clamp(170px, 26vw, 245px); border-radius: var(--radius-lg); background: var(--surface); }
.profile-cover-fallback { width: 100%; height: 100%; overflow: hidden; }
.profile-cover-fallback img { width: 100%; height: 100%; object-fit: cover; opacity: .76; transform: scale(1.06); }
.profile-avatar { width: clamp(88px, 15vw, 112px); height: clamp(88px, 15vw, 112px); border: 5px solid var(--bg); box-shadow: 0 0 0 1px var(--line); }
.profile-actions-row { align-items: end; }
.profile-info { padding-top: .9rem; }
.profile-info h1 { font-size: clamp(2rem, 5vw, 3rem); }
.profile-meta { margin-top: .75rem; }
.profile-stat { display: inline-flex; align-items: baseline; gap: .28rem; }
.profile-stat strong { font-size: 1.05rem; }
.profile-stat span { font-size: .86rem; }
.profile-tabs { margin-bottom: .8rem; padding: .2rem; border: 1px solid var(--line); border-radius: .88rem; background: var(--surface); }
.profile-tab { border: 0; border-radius: .65rem; min-height: 42px; padding: .56rem .75rem; }
.profile-tab.active { border: 0; background: var(--accent-soft); color: var(--accent-strong); }

/* Editor */
.editor-shell { padding-bottom: 3rem; }
.editor-heading { margin: .4rem 0 1.2rem; }
.editor-heading h1 { margin: 0; font-family: var(--font-editorial); font-size: clamp(2.2rem, 5vw, 3.6rem); letter-spacing: -.045em; }
.editor-panel { padding: 0; border: 0; }
.editor-toolbar { padding: .42rem; border-radius: .9rem .9rem 0 0; background: var(--surface-2); }
.editor-toolbar-spacer { flex: 1; }
.editor-textarea { min-height: 340px; padding: 1rem; background: var(--surface); border-radius: 0 0 .9rem .9rem; font-size: 1.04rem; line-height: 1.65; }
.editor-meta { align-items: center; }
.draft-status { opacity: 0; color: var(--success); font-size: .82rem; transition: opacity .18s ease; }
.draft-status.visible { opacity: 1; }
.editor-preview { margin-top: .75rem; }
.upload-zone { position: relative; padding: 1rem; border-color: var(--line); }
.upload-zone.dragover::after { content: attr(data-drop-label); position: absolute; inset: .5rem; display: grid; place-items: center; border-radius: .75rem; background: var(--accent-soft); color: var(--accent-strong); font-weight: 800; }
.upload-zone-title { display: flex; align-items: center; gap: .75rem; margin-bottom: .8rem; }
.upload-zone-title span:last-child { display: grid; }
.upload-zone-title small { color: var(--muted); font-weight: 450; }
.upload-zone-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: .7rem; background: var(--accent-soft); color: var(--accent-strong); }
.editor-actions { justify-content: flex-end; }
.existing-attachments { margin-block: 1rem; }

/* Search, notifications, comments */
.search-page-form { display: flex; gap: .55rem; padding: .7rem; margin-bottom: 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.search-page-form input { border: 0; background: transparent; box-shadow: none; }
.search-page-form input:focus { box-shadow: none; }
.search-section { padding: 1rem; margin-top: .8rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.search-section:first-of-type { margin-top: 0; }
.search-empty { padding: 2rem 1rem; text-align: center; color: var(--muted); }
.user-row { border-radius: .75rem; padding-inline: .55rem; }
.page-actions { display: flex; justify-content: flex-end; margin-bottom: .7rem; }
.notification-list { gap: .55rem; }
.notification {
  padding: .85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.notification:first-child { border-top: 1px solid var(--line); }
.notification.unread { background: linear-gradient(90deg, var(--accent-soft), var(--surface) 58%); }
.notification-text { color: var(--text); text-decoration: none; }
.notification-meta { display: grid; justify-items: end; gap: .35rem; }
.notification-read { width: 22px; height: 22px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.notification-read span { display: block; width: 9px; height: 9px; margin: auto; border-radius: 50%; background: var(--accent); }
.comments-section { margin-top: 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.comments-empty { color: var(--muted); }
.comment-main { min-width: 0; }
.comment-form textarea { background: var(--surface-raised); }

/* Settings */
.settings-layout { grid-template-columns: 205px minmax(0, 1fr); gap: 1rem; }
.settings-nav { position: sticky; top: 5.5rem; }
.settings-nav a { border: 1px solid transparent; border-radius: .72rem; }
.settings-nav a.active { background: var(--surface); border-color: var(--line); color: var(--accent-strong); font-weight: 700; }
.settings-content { padding: clamp(1rem, 3vw, 1.55rem); }
.settings-content form { display: grid; gap: .95rem; }
.settings-content .field + .field { margin-top: 0; }
.settings-avatar-row { margin: 0; padding: 0; align-items: center; justify-content: flex-start; }
.preference-row { padding: .9rem; border: 1px solid var(--line); border-radius: .8rem; background: var(--surface-raised); }
.settings-content hr { width: 100%; border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }
.settings-session-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.settings-session-row h3, .settings-session-row p { margin: 0; }
.compact-empty { margin: 0; padding-block: 1.5rem; }
.blocked-user { padding: .7rem; border: 1px solid var(--line); border-radius: .75rem; background: var(--surface-raised); }
.blocked-user + .blocked-user { margin-top: .55rem; }
.blocked-user:first-child { border-top: 1px solid var(--line); }

/* Administration */
.admin-tabs { flex-wrap: nowrap; overflow-x: auto; padding: .25rem; border: 1px solid var(--line); border-radius: .9rem; background: var(--surface); scrollbar-width: none; }
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tabs a { flex: 0 0 auto; }
.admin-tabs a.active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 750; }
.stat-grid { gap: .85rem; }
.stat-card { padding: 1.15rem; border-radius: var(--radius); }
.stat-card strong { font-size: clamp(1.65rem, 3vw, 2.25rem); }
.admin-section { margin-top: 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.admin-section > h2, .section-title-row h2 { margin: 0 0 .9rem; font-family: var(--font-editorial); font-size: 1.45rem; }
.section-title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.section-title-row a { font-size: .9rem; }
.admin-storage-grid { display: grid; grid-template-columns: minmax(220px, .8fr) minmax(300px, 1.2fr); gap: 1rem; }
.storage-summary { display: flex; flex-direction: column; justify-content: center; }
.storage-summary strong { font-family: var(--font-editorial); font-size: clamp(2.2rem, 5vw, 4rem); line-height: 1; }
.storage-summary p { margin-bottom: 0; color: var(--muted); }
.data-table td small { display: block; color: var(--muted); }
.table-empty { padding: 2rem !important; color: var(--muted); text-align: center !important; }

/* Legal and errors */
.legal { max-width: 760px; margin: 1rem auto 3rem; }
.legal h1 { margin-top: .1rem; }
.legal-lead { font-size: 1.15rem; color: var(--muted) !important; }
.legal section { padding: 1.1rem 0; border-top: 1px solid var(--line); }
.legal h2 { margin: 0 0 .45rem; }
.legal section p { margin: 0; color: var(--muted); }
.error-page { min-height: 62vh; grid-template-columns: minmax(260px, .75fr) minmax(300px, 1fr); gap: 2rem; text-align: left; }
.error-page img { border-radius: var(--radius-lg); }
.error-copy .actions-row { margin-top: 1.2rem; }
.error-code { font-size: clamp(4.2rem, 10vw, 8rem); }

html[data-theme="dark"] .guest-hero-art img,
html[data-theme="dark"] .auth-art img,
html[data-theme="dark"] .onboarding-copy img,
html[data-theme="dark"] .rail-art img,
html[data-theme="system"][data-resolved-theme="dark"] .guest-hero-art img,
html[data-theme="system"][data-resolved-theme="dark"] .auth-art img,
html[data-theme="system"][data-resolved-theme="dark"] .onboarding-copy img,
html[data-theme="system"][data-resolved-theme="dark"] .rail-art img { filter: brightness(.82) saturate(.9); }

@media (max-width: 1120px) {
  .app-shell { grid-template-columns: 205px minmax(0, 1fr); max-width: 980px; }
  .right-rail { display: none; }
  .guest-hero { grid-template-columns: minmax(300px, .85fr) minmax(420px, 1.15fr); }
}

@media (max-width: 820px) {
  .guest-hero { min-height: auto; grid-template-columns: 1fr; padding-top: 2.5rem; }
  .guest-hero h1 { max-width: 12ch; font-size: clamp(3.1rem, 10vw, 5.2rem); }
  .guest-hero-art { order: -1; }
  .guest-feature-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .guest-feature-row span { align-items: flex-start; }
  .auth-shell.auth-shell-wide { grid-template-columns: minmax(0, .8fr) minmax(360px, 1fr); }
  .auth-art { min-height: 620px; }
  .onboarding-shell { grid-template-columns: 1fr; }
  .onboarding-copy { position: static; display: grid; grid-template-columns: 1fr minmax(180px, .5fr); gap: 1rem; align-items: center; }
  .onboarding-copy img { grid-column: 2; grid-row: 1 / 4; margin: 0; }
}

@media (max-width: 760px) {
  .app-shell { padding-inline: .85rem; }
  .main-column { padding-bottom: 5.2rem; }
  .topbar { margin-inline: -.85rem; padding-inline: .85rem; }
  .mobile-brand-wrap { display: inline-flex; }
  .topbar-language { display: inline-flex; }
  .topbar-language .language-option { min-width: 34px; padding-inline: .4rem; }
  .topbar h1 { font-size: 1.32rem; }
  .mobile-nav { height: calc(66px + env(safe-area-inset-bottom)); }
  .post-card { padding: .9rem; border-radius: 1rem; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; padding-bottom: .25rem; border-bottom: 0; }
  .settings-content { border-radius: 1rem; }
  .admin-storage-grid { grid-template-columns: 1fr; }
  .error-page { grid-template-columns: 1fr; text-align: center; padding-inline: .5rem; }
  .error-page img { order: -1; width: min(420px, 100%); margin: auto; }
  .error-copy .actions-row { justify-content: center; }
}

@media (max-width: 680px) {
  .guest-header { width: calc(100% - 1.5rem); min-height: 70px; }
  .guest-header .brand-copy small { display: none; }
  .guest-header-tools { gap: .55rem; }
  .guest-main { width: calc(100% - 1.5rem); padding-top: .3rem; }
  .guest-hero { gap: 1.35rem; padding: 1.15rem 0 3rem; }
  .guest-hero-art { border-radius: 1.25rem; }
  .guest-hero-copy > p { margin-top: 1rem; }
  .guest-feature-row { grid-template-columns: 1fr; margin-top: 1.5rem; }
  .guest-section-heading { align-items: start; flex-direction: column; }
  .guest-feed-grid { grid-template-columns: 1fr; }
  .guest-footer { width: calc(100% - 1.5rem); }
  .auth-page .guest-main { width: calc(100% - 1.25rem); padding-top: .6rem; }
  .auth-shell.auth-shell-wide { grid-template-columns: 1fr; margin-top: .5rem; border-radius: 1.2rem; }
  .auth-art { display: none; }
  .auth-card { padding: 1.35rem; }
  .auth-card > .brand { margin-bottom: 1.7rem; }
  .onboarding-copy { display: block; }
  .onboarding-copy img { display: none; }
  .onboarding-copy h1 { font-size: 2.7rem; }
  .onboarding-form { border-radius: 1rem; }
  .profile-actions-row { flex-wrap: wrap; }
  .profile-actions-row .actions-row { margin-left: auto; }
  .profile-tabs { overflow-x: auto; }
  .profile-tab { flex: 1 0 auto; }
  .settings-session-row { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 480px) {
  body { font-size: 15.5px; }
  .guest-header .brand-copy strong { font-size: 1.25rem; }
  .guest-header .brand-icon { width: 36px !important; height: 36px !important; }
  .guest-actions .secondary { display: none; }
  .guest-header .language-switch { display: none; }
  .guest-hero h1 { font-size: clamp(2.8rem, 14vw, 4.1rem); }
  .guest-hero-actions { display: grid; grid-template-columns: 1fr; }
  .guest-hero-actions .button { width: 100%; }
  .post-header { grid-template-columns: 40px minmax(0, 1fr) 36px; }
  .post-content { margin-left: 0; }
  .post-actions { gap: .05rem; }
  .post-action { min-width: 38px; padding-inline: .4rem; }
  .reaction-picker .post-action:not(.active):not(:first-child) { display: none; }
  .editor-meta { align-items: flex-start; flex-direction: column; gap: .2rem; }
  .editor-actions { display: grid; grid-template-columns: 1fr; }
  .editor-actions .button { width: 100%; }
  .search-page-form { padding: .5rem; }
  .notification { grid-template-columns: 40px minmax(0, 1fr); }
  .notification-meta { grid-column: 2; grid-row: 2; display: flex; align-items: center; justify-content: space-between; width: 100%; }
  .settings-avatar-row { align-items: flex-start; }
  .blocked-user { grid-template-columns: 40px minmax(0, 1fr); }
  .blocked-user form { grid-column: 2; }
  .stat-grid { gap: .5rem; }
  .stat-card { padding: .8rem; }
  .admin-section { padding: .75rem; border-radius: 1rem; }
  .data-table td { padding-left: 40%; }
  .data-table td::before { width: 36%; }
}

@media (max-width: 360px) {
  .app-shell { padding-inline: .65rem; }
  .topbar { margin-inline: -.65rem; padding-inline: .65rem; }
  .topbar-language { display: none; }
  .topbar .icon-button { width: 40px; height: 40px; }
  .guest-header { width: calc(100% - 1rem); }
  .guest-main, .guest-footer { width: calc(100% - 1rem); }
  .post-card { padding: .75rem; }
  .profile-cover { height: 145px; }
  .profile-info { padding-inline: .1rem; }
  .admin-tabs { margin-inline: -.15rem; }
}

/* Installer — product-facing setup */
.install-page { min-width: 320px; background: var(--bg); }
.install-product-shell {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 0 0 4rem;
}
.install-header {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.install-header .brand-copy small { display: block; }
.install-language a { text-decoration: none; }
.install-grid {
  display: grid;
  grid-template-columns: minmax(280px, .82fr) minmax(460px, 1.18fr);
  gap: clamp(1.4rem, 4vw, 4rem);
  align-items: start;
  padding-top: clamp(1rem, 3vw, 2.2rem);
}
.install-intro { min-width: 0; padding-top: clamp(.5rem, 3vw, 2.2rem); }
.install-intro h1 {
  max-width: 9ch;
  margin: 0;
  font-family: var(--font-editorial);
  font-size: clamp(2.7rem, 6vw, 5rem);
  line-height: .96;
  letter-spacing: -.055em;
}
.install-lead { max-width: 31rem; margin: 1.1rem 0 1.5rem; color: var(--muted); font-size: 1.08rem; }
.install-intro > img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.install-form-card {
  margin: 0;
  padding: clamp(1.1rem, 3vw, 2rem);
  border-radius: var(--radius-xl);
}
.install-form-card form { display: grid; gap: 1rem; }
.install-form-card .field + .field { margin-top: 0; }
.form-section-title {
  display: flex;
  align-items: center;
  gap: .8rem;
  margin-top: .25rem;
  color: var(--muted);
  font-size: .77rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.form-section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
.choice-card {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: .7rem;
  align-items: start;
  min-height: 96px;
  padding: .9rem;
  border: 1px solid var(--line);
  border-radius: .9rem;
  background: var(--surface-raised);
  cursor: pointer;
}
.choice-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice-card input { margin-top: .18rem; accent-color: var(--accent); }
.choice-card strong, .choice-card small { display: block; }
.choice-card small { margin-top: .25rem; color: var(--muted); line-height: 1.35; }
.mysql-settings {
  display: grid;
  gap: .85rem;
  padding: .9rem;
  border: 1px solid var(--line);
  border-radius: .9rem;
  background: var(--surface-raised);
}
.mysql-settings[hidden] { display: none !important; }
.requirements-panel {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: .9rem;
  background: var(--surface);
}
.requirements-panel summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .7rem .85rem;
  color: var(--text);
  font-weight: 750;
  cursor: pointer;
  list-style: none;
}
.requirements-panel summary::-webkit-details-marker { display: none; }
.status-dot { width: 9px; height: 9px; margin-left: auto; border-radius: 50%; background: var(--danger); }
.status-dot.ok { background: var(--success); }
.requirements-panel .requirements { max-height: 420px; overflow: auto; margin: 0; padding: 0 .85rem .85rem; }
.requirements-panel .requirement { align-items: start; padding: .65rem 0; }
.requirements-panel .requirement > span:first-child { min-width: 0; }
.requirements-panel .requirement > span:last-child { flex: 0 0 auto; max-width: 42%; text-align: right; font-size: .82rem; }
.requirements-panel .requirement strong, .requirements-panel .requirement small { display: block; }
.requirements-panel .requirement small { margin-top: .18rem; color: var(--muted); font-size: .76rem; line-height: 1.35; }
.install-success {
  width: min(650px, 100%);
  margin: clamp(2rem, 8vw, 7rem) auto;
  padding: clamp(1.7rem, 6vw, 4rem);
  border-radius: var(--radius-xl);
  text-align: center;
}
.install-success > img { width: 112px; height: 112px; margin: 0 auto 1.2rem; border-radius: 30px; }
.install-success .eyebrow { justify-content: center; }
.install-success h1 { margin: .2rem 0 .7rem; font-family: var(--font-editorial); font-size: clamp(2.4rem, 6vw, 4rem); letter-spacing: -.045em; }
.install-success p:not(.eyebrow) { max-width: 32rem; margin: 0 auto 1.5rem; color: var(--muted); }

@media (max-width: 880px) {
  .install-grid { grid-template-columns: minmax(230px, .7fr) minmax(420px, 1.3fr); gap: 1.5rem; }
  .install-intro h1 { font-size: clamp(2.5rem, 7vw, 4rem); }
}
@media (max-width: 720px) {
  .install-product-shell { width: calc(100% - 1.25rem); }
  .install-header { min-height: 70px; }
  .install-header .brand-copy small { display: none; }
  .install-grid { grid-template-columns: 1fr; padding-top: .5rem; }
  .install-intro { padding-top: .25rem; }
  .install-intro h1 { max-width: 11ch; }
  .install-intro > img { display: none; }
  .requirements-panel { margin-bottom: 1rem; }
  .install-form-card { border-radius: 1.1rem; }
}
@media (max-width: 480px) {
  .install-product-shell { width: calc(100% - 1rem); }
  .install-header .brand-icon { width: 36px; height: 36px; }
  .install-header .brand-word { font-size: 1.25rem; }
  .choice-grid, .install-form-card .form-grid { grid-template-columns: 1fr; }
  .choice-card { min-height: 0; }
  .requirements-panel .requirement { display: grid; gap: .35rem; }
  .requirements-panel .requirement > span:last-child { max-width: 100%; text-align: left; }
}

/* Product polish: bilingual controls, richer media viewing and a tighter guest preview. */
.guest-feed-grid > .post-card:first-child { grid-column: 1 / -1; }
.guest-footer .footer-language { margin-left: auto; }
.guest-footer .language-switch { background: var(--surface); }
.settings-language { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: .2rem; }
.field-label { display: block; font-weight: 720; }
.post-action.is-success { color: var(--success); background: var(--success-soft); }

body.lightbox-open { overflow: hidden; }
.media-lightbox {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: clamp(.75rem, 2vw, 1.5rem);
  border: 0;
  background: rgba(12, 14, 18, .94);
  color: #fff;
  overflow: hidden;
}
.media-lightbox[open] {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 52px;
  align-items: center;
  gap: clamp(.35rem, 1.5vw, 1rem);
}
.media-lightbox::backdrop { background: rgba(12, 14, 18, .72); }
.lightbox-figure {
  min-width: 0;
  min-height: 0;
  height: calc(100dvh - clamp(1.5rem, 4vw, 3rem));
  margin: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: .75rem;
  align-items: center;
}
.lightbox-figure img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  border-radius: .75rem;
}
.lightbox-figure figcaption {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  color: rgba(255,255,255,.72);
  font-size: .9rem;
}
.lightbox-figure figcaption a { color: #fff; }
.lightbox-close,
.lightbox-nav {
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.lightbox-close:hover,
.lightbox-nav:hover { background: rgba(255,255,255,.16); }
.lightbox-close { position: fixed; z-index: 2; top: max(.8rem, env(safe-area-inset-top)); right: max(.8rem, env(safe-area-inset-right)); width: 46px; height: 46px; }
.lightbox-nav { width: 48px; height: 48px; }
.lightbox-prev .icon { transform: rotate(180deg); }
.lightbox-nav[hidden] { visibility: hidden; display: grid; }

@media (max-width: 680px) {
  .guest-feed-grid > .post-card:first-child { grid-column: auto; }
  .guest-footer .footer-language { width: 100%; margin-left: 0; }
  .settings-language { align-items: flex-start; flex-direction: column; }
  .media-lightbox { padding: .55rem; }
  .media-lightbox[open] { grid-template-columns: 42px minmax(0, 1fr) 42px; gap: .2rem; }
  .lightbox-nav { width: 40px; height: 40px; }
  .lightbox-close { width: 42px; height: 42px; }
  .lightbox-figure { height: calc(100dvh - 1.1rem); }
  .lightbox-figure figcaption { padding-inline: .35rem; }
}

/* Visual QA pass 2.1 — resilient layouts, polished controls, no clipped copy */

/* Registration setup pages use a focused shell instead of the full signed-in navigation. */
.flow-header,
.flow-main,
.flow-footer {
  width: min(1120px, calc(100% - 2rem));
  margin-inline: auto;
}
.flow-header {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
}
.flow-header .brand-copy small { display: block; }
.flow-main { padding: clamp(1.25rem, 4vw, 3rem) 0 4rem; }
.flow-footer {
  padding: 1.35rem 0 2rem;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem 1.25rem;
  color: var(--muted);
  font-size: .88rem;
}
.flow-footer a { color: inherit; text-decoration: none; }
.flow-footer a:hover { color: var(--text); }
.flow-main .code-shell { width: min(680px, 100%); margin: 0 auto; }
.flow-main .onboarding-shell { width: 100%; padding-top: 0; }

/* Headings may wrap at spaces, never in the middle of ordinary words. */
.guest-hero h1,
.onboarding-copy h1,
.auth-card h1,
.topbar h1,
.admin-section h2,
.settings-content h2,
.error-copy h1 {
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}

/* The hero keeps its editorial presence without colliding with the artwork. */
.guest-hero {
  grid-template-columns: minmax(350px, .92fr) minmax(450px, 1.08fr);
}
.guest-hero-copy { min-width: 0; }
.guest-hero h1 {
  max-width: 100%;
  font-size: clamp(3.15rem, 4.9vw, 5.25rem);
  line-height: .95;
  text-wrap: balance;
}
.guest-hero-art { min-width: 0; }

/* Native file inputs are replaced by compact, keyboard-accessible product controls. */
.file-picker {
  min-width: 0;
  max-width: 100%;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .55rem .75rem;
}
.file-picker-input {
  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;
}
.file-picker-button {
  flex: 0 0 auto;
  gap: .45rem;
  cursor: pointer;
}
.file-picker-input:focus-visible + .file-picker-button {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.file-picker-name {
  min-width: 0;
  max-width: min(100%, 30rem);
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-picker-name.has-files { color: var(--text); }
.avatar-upload-field { flex: 1 1 260px; }
.editor-file-picker { margin-bottom: .8rem; }

/* Setup and recovery pages remain proportional all the way down to 320 px. */
.onboarding-shell,
.onboarding-copy,
.onboarding-form,
.onboarding-form .field,
.onboarding-form fieldset,
.code-shell,
.recovery-card { min-width: 0; max-width: 100%; }
.onboarding-form .profile-avatar-row {
  margin: 0;
  padding: 0;
  align-items: center;
  justify-content: flex-start;
}
.onboarding-form .tag-list { margin-top: 0; }
.onboarding-form .user-list { min-width: 0; }
.recovery-card { padding: clamp(1.25rem, 5vw, 2.6rem); }
.recovery-code {
  overflow-wrap: anywhere;
  word-break: normal;
  letter-spacing: .035em;
}
.recovery-actions { justify-content: center; }

/* Settings navigation and controls do not run outside the viewport. */
.settings-layout,
.settings-content,
.settings-content form,
.settings-avatar-row,
.settings-avatar-row .field { min-width: 0; max-width: 100%; }
.settings-nav a {
  min-width: 0;
  display: flex;
  align-items: center;
  overflow-wrap: normal;
  word-break: normal;
}
.theme-options { align-items: stretch; }
.theme-option {
  min-width: 0;
  min-height: 58px;
  padding: .7rem .75rem;
  display: flex;
  align-items: center;
  gap: .55rem;
  border: 1px solid var(--line);
  border-radius: .8rem;
  background: var(--surface-raised);
  cursor: pointer;
}
.theme-option:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.theme-option:has(input:checked) {
  border-color: color-mix(in srgb, var(--accent) 65%, var(--line));
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 720;
}
.theme-option input { width: 1.12rem; height: 1.12rem; margin: 0; accent-color: var(--accent); flex: 0 0 auto; }

/* Administration remains usable instead of turning into clipped horizontal strips. */
.admin-tabs { max-width: 100%; }
.admin-tabs a {
  min-width: 0;
  display: grid;
  place-items: center;
  text-align: center;
  line-height: 1.2;
  overflow-wrap: normal;
  word-break: normal;
}
.data-table td > *,
.data-table td a,
.data-table td strong,
.data-table td small { min-width: 0; max-width: 100%; }

@media (max-width: 1120px) {
  .guest-hero { grid-template-columns: minmax(320px, .9fr) minmax(420px, 1.1fr); }
  .guest-hero h1 { font-size: clamp(3rem, 5.3vw, 4.55rem); }
}

@media (max-width: 820px) {
  .guest-hero { grid-template-columns: 1fr; }
  .guest-hero h1 { max-width: 14ch; font-size: clamp(3.05rem, 9vw, 5rem); }
  .onboarding-shell { grid-template-columns: 1fr; }
  .onboarding-copy { min-width: 0; }
}

@media (max-width: 760px) {
  .settings-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .45rem;
    overflow: visible;
    padding: 0;
  }
  .settings-nav a {
    min-height: 44px;
    justify-content: center;
    padding: .6rem .45rem;
    border: 1px solid var(--line);
    background: var(--surface);
    text-align: center;
    line-height: 1.2;
  }
  .settings-nav a.active { background: var(--accent-soft); }
  .admin-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .4rem;
    overflow: visible;
    padding: .4rem;
  }
  .admin-tabs a { min-height: 44px; padding: .55rem .35rem; white-space: normal; }
}

@media (max-width: 680px) {
  .flow-header,
  .flow-main,
  .flow-footer { width: calc(100% - 1.5rem); }
  .flow-header { min-height: 72px; }
  .flow-header .brand-copy small { display: none; }
  .flow-main { padding-top: 1rem; }
  .onboarding-copy { display: block; }
  .onboarding-copy h1 { font-size: clamp(2.25rem, 10vw, 3rem); }
  .onboarding-copy p { margin-bottom: 1.25rem; }
  .onboarding-form { padding: 1rem; }
  .onboarding-form .profile-avatar-row { flex-wrap: wrap; }
  .theme-options { grid-template-columns: 1fr; }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td { width: 100%; }
  .data-table tr { padding: .75rem 0; }
  .data-table td {
    display: grid;
    grid-template-columns: minmax(82px, 34%) minmax(0, 1fr);
    align-items: start;
    gap: .75rem;
    min-height: 0;
    padding: .38rem 0;
    position: static;
    overflow-wrap: anywhere;
  }
  .data-table td::before {
    position: static;
    width: auto;
    padding: 0;
    overflow-wrap: normal;
    word-break: normal;
    line-height: 1.25;
  }
  .data-table td[colspan] { display: block; }
  .data-table td[colspan]::before { display: none; }
}

@media (max-width: 480px) {
  .guest-header .language-switch { display: inline-flex; }
  .guest-actions { display: none; }
  .guest-header-tools { margin-left: auto; }
  .guest-hero h1 {
    max-width: 100%;
    font-size: clamp(2.45rem, 12.4vw, 3.35rem);
    line-height: .98;
  }
  .guest-hero-copy > p { font-size: 1rem; }

  .flow-header,
  .flow-main,
  .flow-footer { width: calc(100% - 1rem); }
  .flow-header .brand-copy strong { font-size: 1.25rem; }
  .flow-header .brand-icon { width: 36px !important; height: 36px !important; }
  .flow-header .language-option { min-width: 34px; padding-inline: .38rem; }
  .flow-footer { align-items: flex-start; flex-direction: column; }

  .recovery-card { padding: 1.05rem; }
  .recovery-card h1 { font-size: clamp(2rem, 10vw, 2.55rem); }
  .recovery-actions { display: grid; grid-template-columns: 1fr; width: 100%; }
  .recovery-actions .button { width: 100%; }
  .recovery-code { padding: .85rem .65rem; font-size: .94rem; }

  .onboarding-form .profile-avatar-row {
    display: grid;
    grid-template-columns: 70px minmax(0, 1fr);
    align-items: start;
    gap: .8rem;
  }
  .onboarding-avatar { width: 70px; height: 70px; }
  .onboarding-form .file-picker { align-items: flex-start; }
  .onboarding-form .file-picker-name { flex-basis: 100%; white-space: normal; overflow-wrap: anywhere; }
  .compact-user-list .user-row { grid-template-columns: 40px minmax(0, 1fr) 22px; gap: .55rem; }
  .onboarding-form .form-actions { display: grid; grid-template-columns: 1fr; }
  .onboarding-form .form-actions .button { width: 100%; }

  .settings-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-avatar-row { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: .8rem; }
  .settings-avatar-row .avatar { width: 64px; height: 64px; }
  .settings-content .file-picker { align-items: flex-start; }
  .settings-content .file-picker-name { flex-basis: 100%; white-space: normal; overflow-wrap: anywhere; }

  .admin-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-tabs a { font-size: .82rem; }
  .topbar h1 {
    min-width: 0;
    max-width: 100%;
    font-size: 1.15rem;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .topbar { gap: .5rem; }
  .file-picker-name { flex: 1 1 100%; white-space: normal; overflow-wrap: anywhere; }
}

@media (max-width: 360px) {
  .flow-header .language-option { min-width: 31px; }
  .guest-hero h1 { font-size: 2.4rem; }
  .topbar h1 { font-size: 1.08rem; }
  .settings-nav a { font-size: .84rem; }
  .data-table td { grid-template-columns: minmax(76px, 33%) minmax(0, 1fr); gap: .55rem; }
}

/* Wide workspaces use the room that was previously reserved for an empty rail. */
.app-shell.app-shell-wide {
  grid-template-columns: 232px minmax(0, 1fr);
}
.app-shell-wide .main-column { width: 100%; max-width: none; }
.app-shell-wide .editor-shell { width: min(900px, 100%); margin-inline: auto; }

.settings-content fieldset.field {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.settings-content fieldset.field > legend {
  margin: 0 0 .55rem;
  padding: 0;
  font-weight: 720;
}

/* Administrative tables keep labels and controls readable on full-size screens. */
.table-wrap { max-width: 100%; }
.data-table { table-layout: auto; }
.data-table th,
.data-table td {
  overflow-wrap: normal;
  word-break: normal;
}
.data-table th { line-height: 1.25; }
.data-table td a,
.data-table td small { overflow-wrap: anywhere; }
.data-table .status,
.data-table .button,
.admin-actions .button { white-space: nowrap; }
.data-table .status { justify-content: center; }
.admin-actions { align-items: center; }

@media (max-width: 1050px) {
  .app-shell.app-shell-wide { grid-template-columns: 190px minmax(0, 1fr); max-width: 1000px; }
}

@media (max-width: 760px) {
  .app-shell.app-shell-wide { display: block; width: 100%; max-width: none; }
  .app-shell-wide .editor-shell { width: 100%; }
}

@media (max-width: 360px) {
  .data-table td {
    grid-template-columns: 1fr;
    gap: .12rem;
    padding: .46rem 0;
  }
  .data-table td::before {
    margin-bottom: .08rem;
    font-size: .68rem;
  }
  .data-table .status { justify-self: start; min-width: 7rem; }
}

/* --------------------------------------------------------------------------
   Final administration polish
   Tables stay tables on wide screens and become compact, readable records on
   phones. This block intentionally comes last so legacy responsive rules do
   not leak into the final layout.
   -------------------------------------------------------------------------- */
.admin-row-id {
  display: inline-flex;
  align-items: center;
  min-height: 1.7rem;
  padding: .18rem .48rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: .76rem;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.admin-person,
.admin-primary-cell > a {
  display: inline-flex;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
.admin-person:hover strong,
.admin-primary-cell > a:hover strong { color: var(--accent-strong); }
.admin-primary-cell strong {
  display: block;
  min-width: 0;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.admin-primary-cell small {
  display: block;
  margin-top: .12rem;
  line-height: 1.25;
}
.admin-time-cell time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.admin-details-cell { max-width: 34rem; }
.admin-metric-cell { font-variant-numeric: tabular-nums; }
.admin-table tbody tr { transition: background-color .16s ease; }
.admin-table tbody tr:not(.admin-empty-row):hover { background: color-mix(in srgb, var(--surface-2) 58%, transparent); }
.admin-table .button.small { min-height: 36px; padding-block: .42rem; }
.admin-decision-actions { gap: .4rem; }
.admin-empty-row .table-empty { padding: 1.4rem .75rem; text-align: center; color: var(--muted); }

@media (max-width: 900px) {
  .admin-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .4rem;
    overflow: visible;
    padding: .4rem;
  }
  .admin-tabs a { min-height: 44px; padding: .55rem .35rem; white-space: normal; }
  .admin-storage-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .admin-section {
    margin-top: .8rem;
    padding: .72rem;
    border-radius: 1rem;
  }
  .admin-section > h2,
  .section-title-row h2 {
    margin-bottom: .72rem;
    font-size: clamp(1.25rem, 6vw, 1.5rem);
    line-height: 1.05;
  }
  .section-title-row { align-items: baseline; gap: .6rem; }
  .section-title-row .text-link { flex: 0 0 auto; }
  .table-wrap { overflow: visible; }

  .admin-table,
  .admin-table tbody {
    display: block;
    width: 100%;
  }
  .admin-table thead { display: none; }
  .admin-table tbody {
    display: grid;
    gap: .62rem;
  }
  .admin-table tr:not(.admin-empty-row) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .58rem .7rem;
    width: 100%;
    padding: .78rem;
    border: 1px solid var(--line);
    border-radius: .88rem;
    background: var(--surface-raised);
    box-shadow: 0 1px 0 color-mix(in srgb, var(--text) 3%, transparent);
  }
  .admin-table tr:not(.admin-empty-row):hover { background: var(--surface-raised); }
  .admin-table td {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: .16rem;
    width: auto;
    min-width: 0;
    min-height: 0;
    padding: 0;
    border: 0;
    position: static;
    overflow-wrap: anywhere;
  }
  .admin-table td::before {
    content: attr(data-label);
    position: static;
    display: block;
    width: auto;
    padding: 0;
    color: var(--muted);
    font-size: .64rem;
    font-weight: 780;
    line-height: 1.15;
    letter-spacing: .055em;
    text-transform: uppercase;
    overflow-wrap: normal;
    word-break: normal;
  }
  .admin-table td[colspan] { display: block; grid-column: 1 / -1; }
  .admin-table td[colspan]::before { display: none; }
  .admin-table .admin-primary-cell,
  .admin-table .admin-details-cell,
  .admin-table .admin-action-cell {
    grid-column: 1 / -1;
  }
  .admin-table .admin-primary-cell { order: -4; }
  .admin-table .admin-status-cell { order: -3; }
  .admin-table .admin-id-cell { order: -2; }
  .admin-table .admin-details-cell { margin-top: .08rem; }
  .admin-table .admin-action-cell {
    margin-top: .14rem;
    padding-top: .62rem;
    border-top: 1px solid var(--line);
  }
  .admin-table .admin-primary-cell::before { display: none; }
  .admin-table .admin-primary-cell strong { font-size: .97rem; }
  .admin-table .admin-primary-cell small { font-size: .76rem; }
  .admin-table .admin-id-cell,
  .admin-table .admin-status-cell,
  .admin-table .admin-metric-cell {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .3rem;
  }
  .admin-table .admin-id-cell::before,
  .admin-table .admin-status-cell::before,
  .admin-table .admin-metric-cell::before { margin-right: auto; }
  .admin-table .status {
    min-width: 0;
    justify-self: auto;
    padding: .2rem .48rem;
    font-size: .7rem;
  }
  .admin-table .admin-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(7.2rem, 1fr));
    align-items: stretch;
    width: 100%;
    gap: .42rem;
  }
  .admin-table .admin-actions form { display: contents; }
  .admin-table .admin-actions .button {
    width: 100%;
    min-width: 0;
    min-height: 40px;
    justify-content: center;
  }
  .admin-users-table .admin-primary-cell,
  .admin-reports-table .admin-primary-cell,
  .admin-posts-table .admin-primary-cell,
  .admin-log-table .admin-primary-cell { grid-column: 1 / -1; }
  .admin-users-table .admin-status-cell,
  .admin-reports-table .admin-status-cell,
  .admin-posts-table .admin-status-cell { grid-column: 2; grid-row: 2; }
  .admin-users-table .admin-id-cell,
  .admin-reports-table .admin-id-cell,
  .admin-posts-table .admin-id-cell { grid-column: 1; grid-row: 2; }
  .admin-reports-table .admin-details-cell:empty { display: none; }

  .admin-log-table .admin-time-cell,
  .admin-log-table .admin-primary-cell,
  .admin-log-table .admin-details-cell { grid-column: 1 / -1; }
  .admin-log-table .admin-time-cell { order: -3; }
  .admin-log-table .admin-primary-cell { order: -2; }
  .admin-log-table .admin-time-cell time { white-space: normal; }

  .admin-empty-row {
    display: block;
    width: 100%;
    padding: 0;
    border: 1px dashed var(--line);
    border-radius: .88rem;
    background: color-mix(in srgb, var(--surface-2) 62%, transparent);
  }
  .admin-empty-row .table-empty { padding: 1.15rem .8rem; }
}

@media (max-width: 390px) {
  .admin-tabs { gap: .32rem; padding: .34rem; }
  .admin-tabs a { min-height: 42px; padding: .48rem .25rem; font-size: .78rem; }
  .stat-grid { gap: .42rem; }
  .stat-card { min-height: 78px; padding: .72rem; }
  .stat-card strong { font-size: 1.55rem; }
  .stat-card span { font-size: .74rem; line-height: 1.2; }
  .admin-table tr:not(.admin-empty-row) { padding: .72rem; gap: .5rem .62rem; }
  .admin-table td::before { font-size: .61rem; }
  .admin-table .admin-actions { grid-template-columns: 1fr; }
  .admin-decision-actions { grid-template-columns: 1fr 1fr !important; }
  .admin-decision-actions form:last-child { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  .admin-table tbody tr { transition: none; }
}

/* Keep names and handles visually separated in administrative records. */
.admin-person,
.admin-primary-cell > a { flex-direction: column; align-items: flex-start; }
.admin-person > span { min-width: 0; }
