:root {
  color-scheme: light;
  --bg: #faf9fa;
  --panel: #f3f1f3;
  --panel-2: #eae7eb;
  --panel-3: #e7e3e7;
  --line: #e1dce1;
  --line-strong: #c5bec6;
  --text: #29252c;
  --muted: #645c68;
  --subtle: #6f6773;
  --teal: #b72e68;
  --teal-dark: #922151;
  --amber: #93661c;
  --coral: #bb5147;
  --blue: #32719e;
  --danger: #b33130;
  --success: #277653;
  --border: var(--line);
  --shadow: 0 12px 28px rgba(46, 34, 48, 0.08);
  font-family: Inter, "Yu Gothic UI", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  font-size: 15px;
  line-height: 1.65;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
  text-decoration-skip-ink: auto;
}

:where(.server-rail, .channel-rail, .mobile-header, .operations-nav) a,
a:is(.primary-button, .secondary-button, .danger-button, .small-button,
     .icon-button, .line-action, .send-button, .approve-button,
     .server-icon, .channel-link, .sidebar-inbox, .brand, .mobile-brand, .auth-brand,
     .direct-row, .search-result) {
  text-decoration: none;
}

button,
input,
textarea,
select {
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

button,
select {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  outline: 0;
  background: var(--bg);
  padding: 11px 12px;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(183, 46, 104, 0.13);
}

textarea {
  resize: vertical;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: 27px;
  line-height: 1.3;
}

h2 {
  margin-bottom: 14px;
  font-size: 18px;
  line-height: 1.4;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.muted {
  color: var(--muted);
}

.eyebrow,
.channel-kicker,
.nav-label {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(520px, 1fr) 320px;
  min-height: 100dvh;
}

.channel-rail,
.insight-rail {
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
  background: var(--panel);
}

.channel-rail {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  min-height: 0;
  overflow: hidden;
}

.channel-rail > :not(.channel-nav) { flex-shrink: 0; }

.brand-block {
  padding: 24px 20px 18px;
  border-bottom: 1px solid var(--line);
}

.brand,
.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 850;
}

.brand-mark {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 7px;
  background: var(--teal);
  color: #ffffff;
  font-weight: 900;
}

.brand-block p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.sidebar-search {
  padding: 16px 16px 10px;
}

.sidebar-search input {
  height: 40px;
  border-color: transparent;
  background: var(--panel);
  font-size: 13px;
}

.channel-nav {
  flex: 1 1 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
  padding: 12px 10px 100px;
}

.nav-label {
  padding: 0 10px;
  color: var(--subtle);
}

.channel-link {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 8px;
  border-radius: 5px;
  padding: 7px 11px;
  color: var(--muted);
  font-weight: 650;
}

.channel-link:hover {
  background: var(--panel-3);
  color: var(--text);
}

.channel-link.is-active {
  background: var(--success-soft);
  color: var(--success);
}

.channel-link > span:first-child {
  color: var(--subtle);
  font-size: 19px;
  font-weight: 400;
}

.unread-indicator {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--coral);
  margin-left: auto;
}

.operator-tools {
  margin-top: 12px;
  border-left: 2px solid var(--amber);
  padding-left: 10px;
}

.operator-tools summary {
  color: var(--amber);
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
}

.operator-tools textarea {
  margin: 8px 0;
}

.account-strip {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--line);
  background: var(--panel);
  padding: 12px;
}

.avatar,
.post-avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--success-soft);
  color: var(--success);
  font-weight: 800;
}

.avatar {
  width: 38px;
  height: 38px;
}

.account-copy {
  min-width: 0;
}

.account-copy strong,
.account-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-copy strong {
  font-size: 12px;
}

.account-copy span,
.account-strip > a {
  color: var(--muted);
  font-size: 11px;
}

.timeline-column {
  min-width: 0;
  background: var(--panel);
}

.channel-header,
.page-header {
  display: flex;
  min-height: 96px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  padding: 19px 28px;
}

.channel-header h1,
.page-header h1 {
  margin: 0;
}

.channel-header h1 span {
  color: var(--subtle);
  font-weight: 450;
}

.channel-header p:last-child,
.page-header p:last-child {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.policy-pill,
.status-chip,
.reason-list span {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--panel-2);
  padding: 4px 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.status-chip.pending {
  border-color: var(--amber);
  background: var(--warning-soft);
  color: var(--amber);
}

.timeline {
  padding: 8px 0 180px;
}

.post {
  display: flex;
  gap: 13px;
  border-left: 3px solid transparent;
  padding: 18px 28px;
}

.post:hover {
  background: var(--surface);
}

.post.is-pinned {
  border-left-color: var(--amber);
  background: rgba(231, 182, 93, 0.035);
}

.post-avatar {
  width: 42px;
  height: 42px;
  margin-top: 2px;
}

.post-content {
  min-width: 0;
  flex: 1;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}

.author-name {
  font-weight: 800;
}

.post-meta time {
  color: var(--subtle);
  font-size: 12px;
}

.post-body,
.comment-body {
  overflow-wrap: anywhere;
  color: var(--text);
  line-height: 1.78;
}

.post-actions,
.compact-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}

.post-actions form,
.compact-actions form,
.rail-actions form {
  margin: 0;
}

.reaction-button,
.quick-reaction button,
.text-button,
.small-button,
.secondary-button,
.primary-button,
.approve-button,
.danger-button,
.send-button,
.icon-button {
  border: 0;
  border-radius: 6px;
  font-weight: 750;
  text-align: center;
}

.reaction-button,
.quick-reaction button {
  min-width: 34px;
  min-height: 30px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  padding: 3px 8px;
}

.reaction-button.is-selected {
  border-color: var(--teal-dark);
  background: var(--accent-soft);
}

.quick-reaction {
  opacity: 0.5;
}

.quick-reaction:hover {
  opacity: 1;
}

.text-button {
  display: inline-block;
  background: transparent;
  padding: 6px 8px;
  color: var(--muted);
}

.small-button,
.secondary-button,
.danger-button,
.approve-button,
.primary-button,
.send-button {
  display: inline-block;
  min-height: 38px;
  padding: 8px 14px;
}

.primary-button,
.send-button,
.approve-button {
  background: var(--teal);
  color: #ffffff;
}

.secondary-button,
.small-button {
  border: 1px solid var(--line-strong);
  background: var(--panel-3);
}

.danger-button {
  background: var(--danger-soft);
  color: var(--danger);
}

.icon-button {
  display: inline-grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--panel-2);
}

.report-menu {
  position: relative;
  color: var(--muted);
  font-size: 12px;
}

.report-menu summary {
  cursor: pointer;
  list-style: none;
  padding: 6px 8px;
}

.report-menu form {
  position: absolute;
  z-index: 4;
  top: 32px;
  right: 0;
  width: 250px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--panel-2);
  box-shadow: var(--shadow);
  padding: 12px;
}

.report-menu input,
.report-menu select {
  margin-bottom: 8px;
}

.comment-thread {
  margin-top: 14px;
}

.comment {
  position: relative;
  display: flex;
  gap: 12px;
  padding: 10px 0 8px 20px;
}

.comment-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 4px;
  width: 1px;
  background: var(--line);
}

.reply-form {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 8px;
  margin-top: 12px;
}

.reply-form[hidden] {
  display: none;
}

.poll {
  max-width: 560px;
  margin: 16px 0;
  border-left: 3px solid var(--blue);
  background: var(--panel);
  padding: 14px;
}

.poll > strong {
  display: block;
  margin-bottom: 10px;
}

.poll-option {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 9px;
  margin: 6px 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 8px 10px;
}

.poll-option input {
  width: auto;
}

.poll-option b {
  color: var(--muted);
  font-size: 12px;
}

.composer {
  position: sticky;
  z-index: 5;
  bottom: 0;
  border-top: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.97);
  padding: 12px 24px 18px;
  backdrop-filter: blur(12px);
}

.composer > form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.composer-main {
  position: relative;
}

.composer textarea {
  min-height: 54px;
  max-height: 180px;
  background: var(--panel-3);
  padding-right: 90px;
}

.character-count {
  position: absolute;
  right: 10px;
  bottom: 9px;
  color: var(--subtle);
  font-size: 11px;
}

.composer-options {
  grid-column: 1 / -1;
  order: 3;
  color: var(--muted);
  font-size: 12px;
}

.composer-options summary {
  cursor: pointer;
}

.option-grid {
  display: grid;
  grid-template-columns: 180px 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.option-grid label {
  display: block;
  margin-bottom: 4px;
}

.insight-rail {
  border-left: 1px solid var(--line);
  padding: 22px 18px;
}

.rail-section {
  border-bottom: 1px solid var(--line);
  padding: 4px 0 20px;
  margin-bottom: 20px;
}

.rail-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.rail-heading a,
.rail-actions a,
.rail-actions button {
  color: var(--muted);
  font-size: 11px;
}

.rail-lead {
  color: var(--muted);
  font-size: 13px;
}

.rail-post {
  display: block;
  border-left: 2px solid var(--line-strong);
  margin: 8px 0;
  padding: 5px 0 5px 11px;
}

.rail-post:hover {
  border-left-color: var(--teal);
}

.rail-post span,
.rail-post small,
.rail-post strong {
  display: block;
}

.rail-post span,
.rail-post small {
  color: var(--subtle);
  font-size: 10px;
}

.rail-post strong {
  margin: 3px 0;
  color: var(--text);
  font-size: 12px;
  line-height: 1.5;
}

.rail-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.mobile-header,
.drawer-scrim {
  display: none;
}

.flash-stack {
  position: fixed;
  z-index: 20;
  top: 18px;
  left: 50%;
  width: min(520px, calc(100% - 28px));
  transform: translateX(-50%);
}

.flash {
  margin-bottom: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 10px 14px;
}

.flash-success {
  border-color: var(--success);
}

.flash-error {
  border-color: var(--danger);
}

.flash-info {
  border-color: var(--amber);
}

.auth-shell {
  display: flex;
  min-height: 100dvh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 18px;
  background: var(--bg);
}

.auth-brand {
  margin-bottom: 26px;
}

.auth-panel {
  width: min(440px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 30px;
}

.auth-panel-wide,
.nickname-panel {
  width: min(560px, 100%);
}

.onboarding-panel {
  width: min(820px, 100%);
}

.auth-intro {
  margin-bottom: 24px;
  color: var(--muted);
}

.stack-form,
.choice-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.field-row label,
.stack-form > div > label,
.inline-form label,
.moderation-form label {
  display: block;
  margin-bottom: 5px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.errorlist {
  margin: 6px 0 0;
  padding: 0;
  color: var(--danger);
  font-size: 12px;
  list-style: none;
}

.auth-switch,
.auth-footer {
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.auth-switch a,
.auth-footer a,
.back-link {
  color: var(--teal);
}

.auth-footer {
  display: flex;
  gap: 18px;
}

.choice-group {
  border: 0;
  margin: 0;
  padding: 0;
}

.choice-group legend {
  margin-bottom: 8px;
  font-weight: 800;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.choice-card,
.nickname-card {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  padding: 10px 12px;
  cursor: pointer;
}

.choice-card:has(input:checked),
.nickname-card:has(input:checked) {
  border-color: var(--teal);
  background: var(--success-soft);
}

.choice-card input,
.nickname-card input {
  width: auto;
  accent-color: var(--teal);
}

.nickname-options {
  display: grid;
  gap: 9px;
}

.nickname-card {
  min-height: 58px;
  font-size: 16px;
  font-weight: 800;
}

.redraw-form {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 12px;
}

.page-header + .operations-nav {
  border-top: 0;
}

.operations-nav {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  padding: 10px 24px;
}

.operations-nav a {
  flex: 0 0 auto;
  border-radius: 5px;
  padding: 7px 10px;
  color: var(--muted);
  font-size: 12px;
}

.operations-nav a:hover {
  background: var(--panel-3);
  color: var(--text);
}

.metric-grid,
.aggregate-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
}

.metric-grid a,
.aggregate-block {
  min-height: 150px;
  background: var(--panel);
  padding: 24px;
}

.metric-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric-grid strong {
  display: block;
  margin-top: 18px;
  color: var(--amber);
  font-size: 38px;
}

.settings-section,
.moderation-list,
.legal-page,
.narrow-page {
  padding: 26px 28px;
}

.settings-section + .settings-section,
.moderation-list + .moderation-list {
  border-top: 1px solid var(--line);
}

.settings-section .stack-form {
  max-width: 650px;
}

.detail-list {
  max-width: 620px;
}

.detail-list div {
  display: grid;
  grid-template-columns: 180px 1fr;
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.detail-list dt {
  color: var(--muted);
}

.detail-list dd {
  margin: 0;
  font-weight: 700;
}

.danger-zone {
  border-left: 3px solid var(--danger);
}

.narrow-page {
  max-width: 740px;
  margin: 0 auto;
}

.one-time-secret {
  margin: 20px 28px;
  border: 1px solid var(--amber);
  border-radius: 7px;
  background: var(--warning-soft);
  padding: 18px;
}

.one-time-secret code {
  display: block;
  overflow-wrap: anywhere;
  margin: 12px 0;
  color: var(--amber);
  font-size: 16px;
}

.inline-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(130px, 1fr)) auto;
  align-items: end;
  gap: 12px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

td small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.moderation-item {
  border-bottom: 1px solid var(--line);
  padding: 18px 0 24px;
}

.moderation-item header {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

.moderation-item > p {
  margin: 12px 0;
  color: var(--text);
}

.reason-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 12px;
}

.moderation-form textarea {
  margin: 5px 0 8px;
}

.aggregate-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 8px 0;
}

.aggregate-row span {
  color: var(--muted);
}

.legal-page {
  max-width: 760px;
  margin: 0 auto;
  overflow-wrap: anywhere;
}

.legal-page h1 {
  font-size: 1.75rem;
  line-height: 1.5;
}

.legal-page h2 {
  margin-top: 40px;
  font-size: 1.25rem;
  line-height: 1.6;
}

.legal-page h3 {
  margin-top: 24px;
  font-size: 1.1rem;
  line-height: 1.6;
}

.legal-page p {
  color: var(--muted);
}

.search-page-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 18px 28px;
}

.result-count {
  margin: 0;
  border-top: 1px solid var(--line);
  padding: 12px 28px;
  color: var(--muted);
}

.search-result,
.notification-item {
  display: block;
  border-top: 1px solid var(--line);
  padding: 16px 28px;
}

.search-result:hover {
  background: var(--panel-2);
}

.search-result span,
.search-result strong {
  display: block;
}

.search-result span,
.notification-item p {
  color: var(--muted);
  font-size: 12px;
}

.notification-item {
  display: flex;
  gap: 12px;
}

.notification-mark {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--line-strong);
  margin-top: 8px;
}

.notification-item.is-unread .notification-mark {
  background: var(--coral);
}

.notification-item a {
  color: var(--teal);
  font-size: 12px;
}

.empty-state {
  padding: 70px 24px;
  color: var(--muted);
  text-align: center;
}

.empty-state > span {
  display: inline-grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  margin-bottom: 14px;
  color: var(--teal);
  font-size: 24px;
}

.page-empty {
  padding-top: 22vh;
}

.error-code {
  margin: 0;
  color: var(--coral);
  font-size: 52px;
  font-weight: 900;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 240px minmax(500px, 1fr) 280px;
  }

  .insight-rail {
    padding-inline: 14px;
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .insight-rail {
    display: none;
  }

  .metric-grid,
  .aggregate-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  body {
    padding-top: 54px;
  }

  .mobile-header {
    position: fixed;
    z-index: 30;
    top: 0;
    right: 0;
    left: 0;
    display: grid;
    height: 54px;
    grid-template-columns: 42px 1fr auto;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--line);
    background: var(--panel);
    padding: 6px 12px;
  }

  .mobile-brand {
    font-weight: 850;
  }

  .notification-link {
    position: relative;
    color: var(--muted);
    font-size: 12px;
  }

  .notification-dot {
    display: inline-grid;
    min-width: 18px;
    height: 18px;
    place-items: center;
    border-radius: 9px;
    background: var(--coral);
    color: #ffffff;
    font-size: 10px;
    font-weight: 900;
  }

  .app-shell {
    display: block;
    min-height: calc(100dvh - 54px);
  }

  .channel-rail {
    position: fixed;
    z-index: 40;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(310px, 86vw);
    height: 100dvh;
    transform: translateX(-102%);
    transition: transform 180ms ease;
  }

  .channel-rail.is-open {
    transform: translateX(0);
  }

  .drawer-scrim {
    position: fixed;
    z-index: 35;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: rgba(0, 0, 0, 0.65);
  }

  .drawer-scrim.is-open {
    display: block;
  }

  .channel-header,
  .page-header {
    min-height: 86px;
    align-items: flex-start;
    padding: 17px 18px;
  }

  .channel-header h1,
  .page-header h1 {
    font-size: 22px;
  }

  .policy-pill {
    max-width: 130px;
    white-space: normal;
  }

  .post {
    gap: 10px;
    padding: 15px 16px;
  }

  .post-avatar {
    width: 34px;
    height: 34px;
  }

  .timeline {
    padding-bottom: 190px;
  }

  .composer {
    padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
  }

  .composer > form {
    grid-template-columns: 1fr auto;
  }

  .send-button {
    min-width: 58px;
  }

  .option-grid,
  .choice-grid,
  .metric-grid,
  .aggregate-grid,
  .inline-form {
    grid-template-columns: 1fr;
  }

  .report-menu form {
    position: fixed;
    right: 12px;
    bottom: 72px;
    left: 12px;
    top: auto;
    width: auto;
  }

  .auth-shell {
    justify-content: flex-start;
    padding-top: 30px;
  }

  .auth-panel {
    padding: 22px 18px;
  }

  .settings-section,
  .moderation-list,
  .legal-page,
  .narrow-page,
  .search-page-form {
    padding-right: 18px;
    padding-left: 18px;
  }

  .detail-list div {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .operations-nav {
    padding-inline: 14px;
  }

  th,
  td {
    min-width: 120px;
  }
}

/* Compact community shell. Domain forms and moderation tables retain their layout. */
.ui-icon { display: block; width: 20px; height: 20px; flex: 0 0 auto; }
.icon-button { background: transparent; border: 0; }
.icon-button:hover { background: var(--panel-3); }
.icon-button:focus-visible, a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid #b72e68; outline-offset: 3px;
}
.app-shell { grid-template-columns: 68px 240px minmax(0, 1fr) 260px; height: 100dvh; min-height: 0; }
.server-rail { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 12px 8px; background: var(--bg); }
.server-icon { position: relative; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--panel-3); transition: border-radius 120ms, background 120ms; }
.server-icon:hover, .server-icon.is-current { border-radius: 15px; background: #b72e68; }
.server-icon.is-current::before { content: ''; position: absolute; width: 4px; height: 32px; left: -11px; border-radius: 0 3px 3px 0; background: white; }
.server-icon > span:not(.server-badge) { font-size: 24px; font-weight: 800; }
.server-divider { width: 30px; height: 2px; background: var(--panel-3); }
.server-bottom { margin-top: auto; }
.server-badge { position: absolute; right: -2px; bottom: -3px; min-width: 18px; padding: 0 4px; border: 2px solid var(--bg); background: var(--danger); border-radius: 9px; font-size: 10px; }
.brand-block { display: flex; align-items: center; justify-content: space-between; min-height: 52px; padding: 10px 16px; }
.brand { font-size: 16px; font-weight: 750; }
.brand-mark { background: #b72e68; color: white; }
.sidebar-search { padding: 12px 10px 6px; }
.sidebar-search input { height: 32px; background: var(--bg); }
.sidebar-inbox { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 6px 8px; color: var(--muted); }
.sidebar-inbox:hover { color: var(--text); background: var(--panel-3); border-radius: 4px; }
.channel-nav { padding: 4px 8px 20px; }
.nav-label { margin: 20px 0 6px; font-size: 11px; }
.channel-link { min-height: 34px; padding: 5px 8px; }
.channel-link > span:nth-child(2) { min-width: 0; overflow-wrap: anywhere; font-size: 14px; font-weight: 550; }
.channel-link.is-active { background: var(--accent-soft); color: var(--accent-text); }
.channel-link.has-unread { color: var(--text); }
.sidebar-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px; color: var(--subtle); font-size: 11px; }
.sidebar-footer a { display: flex; gap: 5px; align-items: center; }
.sidebar-footer .ui-icon { width: 14px; height: 14px; }
.sidebar-footer .text-button { font-size: 11px; padding: 0; }
.sidebar-footer form { margin: 0; }
.account-strip { padding: 9px 8px; background: var(--panel-2); }
.account-strip > a { width: 32px; height: 32px; }
.avatar, .post-avatar { background: var(--avatar-bg); color: var(--text); border: 0; }
.timeline-column { min-height: 0; height: 100dvh; overflow-y: auto; display: flex; flex-direction: column; background: var(--surface); }
.channel-header { position: sticky; top: 0; z-index: 8; min-height: 52px; flex-shrink: 0; padding: 8px 16px; background: var(--surface); box-shadow: 0 1px 3px #0003; gap: 10px; }
.channel-heading { display: flex; align-items: center; gap: 16px; min-width: 0; }
.channel-header h1 { font-size: 16px; white-space: nowrap; }
.channel-header h1 span { font-size: 24px; margin-right: 4px; vertical-align: -1px; }
.channel-heading p:last-child { border-left: 1px solid var(--line-strong); padding-left: 16px; margin: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12px; }
.channel-tools { display: flex; gap: 4px; flex: 0 0 auto; }
.timeline { flex: 1; padding: 0 0 24px; }
.channel-welcome { padding: 32px 24px 24px; margin-bottom: 10px; border-bottom: 1px solid var(--line-strong); }
.welcome-hash { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--accent-soft); font-size: 42px; font-weight: 500; margin-bottom: 12px; }
.channel-welcome h2 { font-size: 26px; margin-bottom: 8px; overflow-wrap: anywhere; }
.channel-welcome p { font-size: 14px; color: var(--muted); margin-bottom: 12px; }
.policy-pill { border-radius: 4px; }
.post { padding: 10px 20px; }
.post:hover { background: var(--surface-hover); }
.post-meta { margin-bottom: 2px; }
.post-body, .comment-body { color: var(--text); line-height: 1.6; }
.post-avatar { width: 40px; height: 40px; }
.post-avatar.avatar-teal { background: var(--success-soft); }
.post-avatar.avatar-coral { background: var(--danger-soft); }
.post-actions { margin-top: 6px; }
.reaction-button { min-height: 26px; padding: 1px 7px; font-size: 13px; border-radius: 7px; }
.reaction-button.is-selected { background: var(--accent-soft); }
.reply-action { padding: 3px 7px; }
.reply-action .ui-icon { width: 17px; height: 17px; }
.primary-button, .send-button, .approve-button { background: #b72e68; color: white; }
.primary-button:hover, .send-button:hover { background: #922151; }
.send-button { display: grid; place-items: center; height: 42px; width: 42px; min-width: 0; padding: 0; margin-bottom: 8px; }
.send-button .ui-icon { filter: brightness(0) invert(1); }
.composer { flex-shrink: 0; background: var(--surface); border: 0; padding: 10px 16px 18px; backdrop-filter: none; }
.composer textarea { min-height: 58px; border-color: transparent; padding: 10px 14px 26px; }
.composer-readonly { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 16px 20px; font-size: 13px; background: var(--surface); position: sticky; bottom: 0; }
.insight-rail { padding: 0 16px 18px; }
.insight-title { display: flex; align-items: center; height: 52px; border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 700; }
.rail-section { padding: 16px 0; margin-bottom: 0; }
.rail-heading { color: var(--subtle); font-size: 11px; }
.rail-section > .muted { font-size: 12px; margin: 0; }
.empty-state { padding: 20px 24px 40px; text-align: left; }
.app-shell.info-collapsed { grid-template-columns: 68px 240px minmax(0, 1fr); }
.app-shell.info-collapsed .insight-rail { display: none; }
.drawer-dismiss { display: none; }
.flash { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; }
.flash .icon-button { width: 28px; height: 28px; flex: 0 0 auto; }
.auth-shell { background: var(--bg); }
.auth-panel { background: var(--surface); }
.auth-panel h1 { font-size: 24px; }
.auth-brand { font-size: 20px; }
.auth-panel > .eyebrow { color: var(--subtle); }
.auth-panel > h1, .auth-panel > .auth-intro, .auth-panel > .eyebrow { text-align: center; }
.choice-card:has(input:checked), .nickname-card:has(input:checked) { background: var(--choice-selected); }
.poll { background: var(--panel); }
.timeline-column > :not(.timeline):not(.composer):not(.flash-stack) { flex-shrink: 0; }
.timeline-column, .channel-rail, .insight-rail { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 64px 224px minmax(0, 1fr) 240px; }
  .app-shell.info-collapsed { grid-template-columns: 64px 224px minmax(0, 1fr); }
}
@media (max-width: 980px) {
  .app-shell, .app-shell.info-collapsed { grid-template-columns: 64px 224px minmax(0, 1fr); }
  .info-toggle { display: none; }
}
@media (max-width: 760px) {
  body:not(.community-app) { padding-top: 0; }
  .server-rail { display: none; }
  .drawer-dismiss { display: inline-grid; }
  .app-shell { height: calc(100dvh - 54px); min-height: 0; }
  .timeline-column { height: calc(100dvh - 54px); }
  .mobile-header { background: var(--panel); }
  .channel-header { min-height: 48px; padding: 6px 12px; align-items: center; }
  .channel-header h1 { font-size: 15px; overflow: hidden; text-overflow: ellipsis; }
  .channel-heading { overflow: hidden; }
  .channel-heading p:last-child { display: none; }
  .channel-welcome { padding: 24px 18px 20px; }
  .channel-welcome h2 { font-size: 24px; }
  .timeline { padding-bottom: 16px; }
  .post { padding: 10px 14px; }
  .post-avatar { width: 34px; height: 34px; }
  .composer { padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); }
}
.is-operations .app-shell { grid-template-columns: 68px 240px minmax(0, 1fr); }
.is-operations .insight-rail { display: none; }
.stack-form input[type="checkbox"], .stack-form input[type="radio"], .table-wrap input[type="checkbox"] {
  width: 18px; height: 18px; flex: 0 0 18px; margin: 0 8px 0 0; vertical-align: middle; accent-color: var(--teal);
}
.stack-form fieldset { border: 1px solid var(--line-strong); border-radius: 6px; min-width: 0; padding: 12px; }
.stack-form fieldset label:has(input) { display: flex; align-items: center; gap: 6px; padding: 6px 0; }
.stack-form > div:has(> input[type="checkbox"]) { display: flex; align-items: flex-start; gap: 8px; }
.stack-form > div > input[type="checkbox"] { order: -1; margin-top: 4px; }
.member-search { display: grid; grid-template-columns: auto minmax(100px, 420px) auto; gap: 10px; align-items: center; justify-content: start; padding: 20px 28px; }
.member-table { min-width: 960px; }
.member-table th { white-space: nowrap; }
.member-table th:first-child { width: 56px; }
.member-table td:nth-child(2) { min-width: 150px; max-width: 220px; overflow-wrap: anywhere; }
.member-table td:nth-child(3), .member-table td:nth-child(4) { min-width: 90px; }
.member-table td:nth-child(5) { min-width: 340px; }
.member-table td:nth-child(6) { min-width: 160px; }
.is-operations .table-wrap { padding: 0 28px 24px; }
@media (max-width: 980px) { .is-operations .app-shell { grid-template-columns: 64px 224px minmax(0, 1fr); } }
@media (max-width: 760px) {
  .is-operations .app-shell { grid-template-columns: minmax(0, 1fr); }
  .member-search { padding: 16px 18px; grid-template-columns: minmax(0, 1fr) auto; }
  .member-search > label { grid-column: 1 / -1; }
  .is-operations .table-wrap { padding: 0 18px 20px; }
  .operations-nav { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
.consent-row,
.consent-row label,
.profile-preview {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.consent-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  margin: 3px 0 0;
}

.private-fields {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 18px;
  min-width: 0;
}

.private-fields .field-row {
  margin: 16px 0;
}
[hidden] { display: none !important; }
.community-mark { display: block; object-fit: cover; border-radius: inherit; }
.server-rail { background: #302a32; }
.server-rail .server-icon { background: #514651; color: #ffffff; }
.server-rail .server-icon.is-current { background: var(--accent-soft); }
.server-rail .server-divider { background: #675a65; }
.server-rail .server-icon:hover { background: #794e68; }
.server-badge { color: #ffffff; }
.server-icon .community-mark { width: 46px; height: 46px; border-radius: 13px; }
.brand { color: var(--accent-text); }
.ui-icon { filter: brightness(0) saturate(100%) opacity(.65); }
.server-rail .ui-icon { filter: brightness(0) invert(1) opacity(.85); }
.auth-brand .brand-mark { width: 46px; height: 46px; }
.channel-welcome h2 { font-size: 22px; }
.channel-welcome { padding-top: 24px; }
.welcome-hash { width: 48px; height: 48px; font-size: 30px; border-radius: 8px; color: var(--accent-text); }
.post-body, .comment-body { line-height: 1.8; }
.settings-sections { padding: 8px 24px 32px; width: 100%; max-width: 800px; }
.settings-sections > section { padding: 24px 0; border-bottom: 1px solid var(--line); }
.settings-sections .button-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.settings-sections .stack-form { max-width: 520px; }
.settings-sections h2 { font-size: 17px; }
.private-registration { display: grid; gap: 20px; max-width: 680px; margin: 24px 0 0; }
.private-registration dt { margin-bottom: 8px; }
.private-registration dd { margin: 0; padding: 14px 16px; border: 1px solid #999; border-radius: 6px; background: #ededed; color: #545454; overflow-wrap: anywhere; }
[data-theme="dark"] .private-registration dd { background: #292929; border-color: #646464; color: #bdbdbd; }
.line-browser-help { margin-top: 24px; padding: 18px; border: 2px solid #358858; border-radius: 6px; }
.line-browser-help h3 { margin: 0 0 14px; font-size: 17px; line-height: 1.5; }
.line-browser-help ol { margin: 0; padding-left: 24px; }
.line-browser-help li { margin-bottom: 12px; overflow-wrap: anywhere; }
.line-browser-help .secondary-button { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; }
[data-theme="dark"] .line-browser-help { border-color: #71bd8f; }
.notification-pagination { display: flex; justify-content: space-between; padding: 20px; }
.public-profile { position: relative; max-width: 100%; }
.public-profile summary { cursor: pointer; list-style: none; }
.public-profile summary::-webkit-details-marker { display: none; }
.public-profile-popover { position: absolute; left: 0; top: 100%; z-index: 6; width: min(260px, 62vw); border: 1px solid var(--line-strong); padding: 12px; background: var(--surface); box-shadow: var(--shadow); border-radius: 6px; white-space: normal; overflow-wrap: anywhere; }
.public-profile-popover p { color: var(--muted); margin: 8px 0 0; line-height: 1.6; }
@media (max-width: 760px) {
  .settings-sections { padding: 0 16px 24px; }
  .settings-sections .button-row > button { width: 100%; }
  .channel-welcome h2 { font-size: 21px; }
}
.is-direct .app-shell {
  grid-template-columns: 68px 248px minmax(0, 1fr);
}
.is-direct .insight-rail { display: none; }
.direct-timeline { flex: 1; overflow-y: auto; padding: 20px; }
.direct-message { padding: 16px 0; border-bottom: 1px solid var(--border); }
.direct-message.is-own { border-left: 3px solid var(--accent); padding-left: 14px; }
.direct-message .post-meta { flex-wrap: wrap; }
.direct-message .avatar { width: 28px; height: 28px; }
.direct-list { padding: 12px 20px; }
.direct-row { display: flex; align-items: center; gap: 12px; padding: 18px 0; border-bottom: 1px solid var(--border); }
.direct-row > div { min-width: 0; }
.direct-row p { margin: 6px 0 0; overflow-wrap: anywhere; }
.direct-composer form { display: flex; flex-direction: column; }
.direct-composer .primary-button { align-self: flex-end; }
@media (max-width: 760px) { .is-direct .app-shell { display: block; } }
.channel-page .app-shell { grid-template-columns: 68px 224px minmax(340px, 1fr) minmax(300px, 380px); }
.thread-rail { display: flex; flex-direction: column; min-width: 0; height: 100dvh; overflow: hidden; border-left: 1px solid var(--border); background: var(--panel); }
.thread-heading { display: flex; align-items: center; justify-content: space-between; min-height: 52px; padding: 8px 16px; border-bottom: 1px solid var(--border); }
.thread-heading h2 { font-size: 16px; margin: 0; }
.thread-scroll { overflow-y: auto; min-height: 0; padding: 0 16px 20px; }
.thread-root { padding: 18px 0; border-bottom: 1px solid var(--border); }
.thread-root .post-meta { flex-wrap: wrap; }
.thread-root .avatar { height: 28px; width: 28px; }
.thread-rail .comment-thread { margin: 0; }
.thread-rail .comment { margin-left: 0; padding-left: 0; }
.thread-rail .comment-line { display: none; }
.thread-rail .post-meta { flex-wrap: wrap; }
.thread-rail .reply-form { margin: 16px 0; padding: 10px 0; display: flex; flex-direction: column; }
.thread-link { display: inline-flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 12px; background: transparent; border: 0; color: var(--accent); cursor: pointer; }
.channel-rules { font-size: 13px; margin-top: 12px; }
@media (max-width: 1100px) {
  .channel-page .app-shell { grid-template-columns: 64px 224px minmax(0, 1fr); }
  .channel-page .thread-rail { display: none; }
  .channel-page.has-thread .timeline-column { display: none; }
  .channel-page.has-thread .thread-rail { display: flex; }
}
@media (max-width: 760px) {
  .channel-page .app-shell { grid-template-columns: minmax(0, 1fr); }
  .channel-page .thread-rail { height: calc(100dvh - 54px); }
}
.channel-page .app-shell.info-collapsed { grid-template-columns: 68px 224px minmax(0, 1fr); }
.channel-page .app-shell.info-collapsed .thread-rail { display: none; }
.is-direct .channel-heading p:last-child { display: block; white-space: normal; font-size: 12px; }
.direct-install-note { padding: 18px 24px; border-bottom: 1px solid var(--line); max-height: 45dvh; overflow-y: auto; }
.direct-install-note h2 { font-size: 17px; margin: 0 0 12px; }
.direct-install-note p { font-size: 14px; line-height: 1.75; overflow-wrap: anywhere; margin: 0 0 12px; }
.direct-install-note form { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.direct-install-note .primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.direct-install-note .primary-button .ui-icon { filter: brightness(0) invert(1); }
