/* ai-commentor admin: design tokens first, then layout, then components. */
:root {
  color-scheme: light dark;
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f0f1f6;
  --border: #e4e6ee;
  --text: #0f1222;
  --muted: #6b7085;
  --brand-1: #4f46e5;
  --brand-2: #9333ea;
  --brand-3: #ec4899;
  --brand: #6d28d9;
  --ring: rgb(109 40 217 / 0.28);
  --shadow: 0 1px 2px rgb(15 18 34 / 0.04), 0 8px 24px rgb(15 18 34 / 0.06);
  --radius: 16px;
  --radius-sm: 10px;
  --glass: rgb(255 255 255 / 0.78);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  --neutral-bg: #eef0f5;
  --neutral-fg: #4b5065;
  --info-bg: #e6f0ff;
  --info-fg: #1d4ed8;
  --warning-bg: #fff4dc;
  --warning-fg: #a15c00;
  --success-bg: #e3f8ec;
  --success-fg: #11793f;
  --danger-bg: #ffe8e8;
  --danger-fg: #c0262d;
  --accent-bg: #f1e8ff;
  --accent-fg: #6d28d9;
  /* Charts: validated diverging pair + neutral midpoint; sequential uses the cool pole. */
  --chart-pos: #2a78d6;
  --chart-neg: #e34948;
  --chart-neu: #b9bdca;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0d14;
    --surface: #151722;
    --surface-2: #1c1f2d;
    --border: #262a3b;
    --text: #eceef6;
    --muted: #9095ab;
    --brand: #a78bfa;
    --ring: rgb(167 139 250 / 0.35);
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 10px 30px rgb(0 0 0 / 0.35);
    --glass: rgb(21 23 34 / 0.78);

    --neutral-bg: #232636;
    --neutral-fg: #b7bbd0;
    --info-bg: #15264a;
    --info-fg: #8db4ff;
    --warning-bg: #3a2a0c;
    --warning-fg: #f5c26b;
    --success-bg: #0f3322;
    --success-fg: #6ee7a3;
    --danger-bg: #3d1417;
    --danger-fg: #ff8f94;
    --accent-bg: #2a1d4a;
    --accent-fg: #c4b1ff;
    --chart-pos: #3987e5;
    --chart-neg: #e66767;
    --chart-neu: #4a4f63;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font:
    15px/1.5 ui-sans-serif,
    system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
p {
  margin: 0;
}

.icon {
  flex: none;
}

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

.text-warning {
  color: var(--warning-fg);
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* ---------- Layout ---------- */

#app {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 22px 16px;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2) 55%, var(--brand-3));
  box-shadow: 0 6px 16px rgb(147 51 234 / 0.35);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--muted);
  font: inherit;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s;
}

.nav-link:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav-link.active {
  background: var(--accent-bg);
  color: var(--accent-fg);
}

.content {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 32px 28px 64px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.page-header h1 {
  font-size: 26px;
  letter-spacing: -0.02em;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
}

/* ---------- Cards ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card-title {
  font-weight: 650;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 12px;
}

/* ---------- Buttons & inputs ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform 0.08s,
    background 0.15s,
    border-color 0.15s,
    box-shadow 0.15s;
}

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

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  box-shadow: 0 6px 16px rgb(79 70 229 / 0.28);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4338ca, #7e22ce);
}

.btn-subtle {
  border-color: transparent;
  background: var(--surface-2);
}

.btn-danger {
  border-color: transparent;
  background: var(--danger-bg);
  color: var(--danger-fg);
}

button:focus-visible,
a:focus-visible,
.input:focus,
textarea:focus {
  outline: none;
  box-shadow: 0 0 0 4px var(--ring);
}

.input,
textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}

textarea {
  resize: vertical;
  min-height: 56px;
}

.input:focus,
textarea:focus {
  border-color: var(--brand);
  background: var(--surface);
}

.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

/* ---------- Badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.tone-neutral {
  --tone-bg: var(--neutral-bg);
  --tone-fg: var(--neutral-fg);
}
.tone-info {
  --tone-bg: var(--info-bg);
  --tone-fg: var(--info-fg);
}
.tone-warning {
  --tone-bg: var(--warning-bg);
  --tone-fg: var(--warning-fg);
}
.tone-success {
  --tone-bg: var(--success-bg);
  --tone-fg: var(--success-fg);
}
.tone-danger {
  --tone-bg: var(--danger-bg);
  --tone-fg: var(--danger-fg);
}
.tone-accent {
  --tone-bg: var(--accent-bg);
  --tone-fg: var(--accent-fg);
}

.badge[class*='tone-'] {
  background: var(--tone-bg);
  color: var(--tone-fg);
}

/* ---------- Avatars ---------- */

.avatar {
  --hue: 260;
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, hsl(var(--hue) 75% 58%), hsl(calc(var(--hue) + 40) 80% 52%));
}

.avatar-lg {
  width: 56px;
  height: 56px;
  font-size: 22px;
}

/* ---------- Overview ---------- */

.account {
  display: flex;
  gap: 14px;
  align-items: center;
}

.account-main {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.account-name {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.meta-line {
  font-size: 13.5px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.segments {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 5px;
  background: var(--surface-2);
  border-radius: 14px;
}

.segment {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  text-align: left;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s;
}

.segment strong {
  color: var(--text);
  font-size: 14px;
}

.segment span {
  font-size: 12px;
  line-height: 1.35;
}

.segment.active {
  background: var(--surface);
  box-shadow: var(--shadow);
}

.segment.active strong {
  color: var(--brand);
}

.kill-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.kill-row.on {
  border-color: transparent;
  background: var(--danger-bg);
}

.kill-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--danger-bg);
  color: var(--danger-fg);
}

.kill-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  font-size: 13px;
}

.kill-text strong {
  font-size: 14px;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  border-radius: 14px;
  background: var(--surface-2);
}

.tile-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-bottom: 6px;
  border-radius: 9px;
  background: var(--tone-bg);
  color: var(--tone-fg);
}

.tile-value {
  font-size: 24px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.tile-label {
  font-size: 13px;
  color: var(--muted);
}

.all-clear {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--success-bg);
  color: var(--success-fg);
  font-weight: 600;
}

.alert-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.alert-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--tone-bg);
  color: var(--tone-fg);
  font-size: 14px;
}

.queues {
  display: flex;
  flex-direction: column;
}

.queue-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.queue-name {
  font-weight: 600;
  min-width: 170px;
}

.queue-counts {
  display: flex;
  gap: 14px;
  flex: 1;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
}

.count b {
  color: var(--text);
}

.count.warn b {
  color: var(--danger-fg);
}

/* ---------- Switch ---------- */

.switch {
  position: relative;
  flex: none;
  width: 44px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--border);
  cursor: pointer;
  transition: background 0.2s;
}

.switch[aria-checked='true'] {
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
}

.switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.25);
  transition: transform 0.2s;
}

.switch[aria-checked='true'] .switch-thumb {
  transform: translateX(18px);
}

/* ---------- Comments ---------- */

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.chip:hover {
  color: var(--text);
}

.chip.active {
  border-color: transparent;
  background: var(--text);
  color: var(--surface);
}

.chip-count {
  min-width: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.chip.active .chip-count {
  background: rgb(255 255 255 / 0.18);
  color: inherit;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.comment-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.comment-who {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  font-size: 13px;
}

.comment-who strong {
  font-size: 14.5px;
}

.comment-text {
  font-size: 15.5px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.tags:empty {
  display: none;
}

.meter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.meter-bar {
  --value: 0;
  width: 64px;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.meter-fill {
  display: block;
  height: 100%;
  width: calc(var(--value) * 100%);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand-1), var(--brand-2));
}

.reply {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-left: 50px;
  padding: 12px 14px;
  border-radius: 4px 14px 14px 14px;
  background: var(--accent-bg);
}

.reply-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-fg);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.reply-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.reply-input {
  background: var(--surface);
}

.note {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13.5px;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.more {
  display: flex;
  justify-content: center;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 48px 16px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 6px;
  border-radius: 16px;
  background: var(--surface-2);
  color: var(--muted);
}

/* ---------- Posts ---------- */

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.post-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  color: var(--brand);
  font-weight: 600;
  text-decoration: none;
}

.caption {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.post-stats {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--muted);
}

.post-stats span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.facts-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-weight: 600;
}

/* ---------- Login ---------- */

.login {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 16px;
  background:
    radial-gradient(60% 50% at 20% 10%, rgb(79 70 229 / 0.18), transparent),
    radial-gradient(50% 50% at 90% 90%, rgb(236 72 153 / 0.16), transparent);
}

.login-card {
  width: min(400px, 100%);
  padding: 32px;
  gap: 16px;
}

.login-card h1 {
  font-size: 24px;
  letter-spacing: -0.02em;
}

/* ---------- Loading & toasts ---------- */

.skeleton-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.skeleton {
  height: 120px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2));
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite linear;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 10;
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 12px;
  transform: translateX(-50%);
  color: #fff;
  background: #16a34a;
  box-shadow: 0 12px 30px rgb(0 0 0 / 0.25);
  font-weight: 600;
  animation: rise 0.2s ease-out;
}

.toast-error {
  background: #dc2626;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- Form bits ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-error {
  min-height: 20px;
  color: var(--danger-fg);
  font-size: 13.5px;
  font-weight: 600;
}

.login-card .btn {
  justify-content: center;
  min-height: 46px;
}

/* App bar and tab bar exist only on phones. */
.appbar,
.tabbar {
  display: none;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.icon-btn span {
  display: none;
}

/* ---------- Tablets: icon rail ---------- */

@media (min-width: 761px) and (max-width: 1099px) {
  #app {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .sidebar {
    align-items: center;
    padding: 18px 10px;
  }

  .brand {
    padding: 0;
  }

  .brand-name,
  .nav-link span {
    display: none;
  }

  .nav-link {
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
  }

  .content {
    padding: 28px 24px 56px;
  }

  .tiles {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}

/* ---------- Phones: native-app feel ---------- */

@media (max-width: 760px) {
  body {
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: none;
  }

  #app {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .appbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: 40px 1fr 40px;
    align-items: center;
    gap: 8px;
    padding: calc(8px + var(--safe-top)) 12px 8px;
    background: var(--glass);
    backdrop-filter: saturate(180%) blur(18px);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
    border-bottom: 1px solid var(--border);
  }

  .appbar .brand-mark {
    width: 34px;
    height: 34px;
  }

  .appbar-title {
    text-align: center;
    font-size: 17px;
    font-weight: 700;
  }

  .tabbar {
    position: fixed;
    inset: auto 0 0;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(var(--tabs, 6), minmax(0, 1fr));
    padding: 6px 8px calc(6px + var(--safe-bottom));
    background: var(--glass);
    backdrop-filter: saturate(180%) blur(18px);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
    border-top: 1px solid var(--border);
  }

  .tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 0;
    border-radius: 12px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
  }

  .tab .icon {
    width: 24px;
    height: 24px;
  }

  .tab.active {
    color: var(--brand);
  }

  .tab:active,
  .btn:active,
  .chip:active,
  .segment:active {
    transform: scale(0.97);
  }

  .content {
    gap: 14px;
    padding: 16px 14px calc(96px + var(--safe-bottom));
  }

  .page-header {
    align-items: center;
  }

  .page-header h1 {
    font-size: 28px;
  }

  .page-header p {
    font-size: 14px;
  }

  .card {
    padding: 16px;
    border-radius: 20px;
    gap: 12px;
  }

  .grid-2 {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .segment {
    align-items: center;
    padding: 10px 6px;
    text-align: center;
  }

  .segment span {
    display: none;
  }

  .tiles {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .tile {
    padding: 12px;
  }

  .tile-value {
    font-size: 22px;
  }

  .queue-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .chips {
    margin: 0 -14px;
    padding: 0 14px 2px;
  }

  .chip {
    padding: 8px 14px;
  }

  .reply {
    margin-left: 0;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .actions .btn {
    justify-content: center;
    min-height: 46px;
  }

  .actions .btn-primary {
    grid-column: 1 / -1;
  }

  .btn {
    min-height: 44px;
  }

  .post-grid {
    grid-template-columns: 1fr;
  }

  .toast {
    bottom: calc(84px + var(--safe-bottom));
    width: calc(100% - 28px);
    text-align: center;
  }

  .login {
    align-items: center;
    padding: calc(16px + var(--safe-top)) 14px calc(16px + var(--safe-bottom));
  }

  .login-card {
    border-radius: 24px;
  }
}

/* ---------- Account switcher ---------- */

.view {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.account-switcher {
  align-self: flex-start;
}

.account-select {
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
}

/* ---------- Forms (settings) ---------- */

.form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field-hint {
  font-size: 12.5px;
  color: var(--muted);
}

select.input {
  appearance: auto;
  cursor: pointer;
}

.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px 16px;
}

.form-actions {
  justify-content: flex-end;
  padding-top: 4px;
}

@media (max-width: 760px) {
  .form-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ---------- Rules ---------- */

.rule.disabled {
  opacity: 0.6;
}

.rule .comment-head .switch {
  margin-left: auto;
}

.rule-name {
  font-size: 15.5px;
}

.rule-replies {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rule-foot .muted {
  flex: 1;
  font-size: 13px;
}

.tester-result:empty {
  display: none;
}

@media (max-width: 760px) {
  .tab {
    font-size: 10px;
  }
}

/* ---------- Post picker ---------- */

.post-picker {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.post-picker summary {
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 600;
}

.post-options {
  display: flex;
  flex-direction: column;
  max-height: 300px;
  overflow-y: auto;
  border-top: 1px solid var(--border);
}

.post-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.post-option:last-child {
  border-bottom: 0;
}

.post-option input {
  margin-top: 3px;
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.post-option-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.post-option-text .muted {
  font-size: 12.5px;
}

/* ---------- Feedback & style examples ---------- */

.reply-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.thumbs {
  display: inline-flex;
  gap: 4px;
}

.thumb {
  width: 34px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  font-size: 15px;
  cursor: pointer;
  filter: grayscale(1);
  opacity: 0.6;
  transition:
    filter 0.15s,
    opacity 0.15s,
    background 0.15s;
}

.thumb:hover,
.thumb.active {
  filter: none;
  opacity: 1;
}

.thumb.active {
  background: var(--surface);
  border-color: var(--border);
}

.examples {
  display: flex;
  flex-direction: column;
}

.example {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.example .row .btn {
  margin-left: auto;
}

.example-comment,
.example-reply {
  overflow-wrap: anywhere;
}

.example-reply {
  font-weight: 600;
}

/* ---------- Insights charts ---------- */

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 13px;
  color: var(--muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.mood-pos {
  background: var(--chart-pos);
}

.mood-neu {
  background: var(--chart-neu);
}

.mood-neg {
  background: var(--chart-neg);
}

.seq {
  background: var(--chart-pos);
}

.chart {
  display: grid;
  gap: 8px;
}

.chart-readout {
  min-height: 1.4em;
  margin: 0;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.bar-plot {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: 2px;
  align-items: end;
  height: 180px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.bar-col {
  position: relative;
  display: flex;
  justify-content: center;
  height: 100%;
  border-radius: 4px;
  outline: none;
  cursor: default;
}

.bar-col:hover,
.bar-col:focus-visible {
  background: var(--surface-2);
}

.bar-stack {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-start;
  gap: 2px;
  width: min(100%, 24px);
  height: 100%;
}

.bar-seg {
  flex: 0 0 calc(var(--v) * (100% - 6px));
  min-height: 2px;
}

.bar-stack .bar-seg:last-child {
  border-radius: 4px 4px 0 0;
}

.bar-tick {
  position: absolute;
  top: 100%;
  left: 50%;
  padding-top: 4px;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.chart-table summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th,
.table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 12.5px;
}

.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.faq {
  display: grid;
  gap: 12px;
  margin: 0;
  padding-left: 20px;
}

.faq-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.faq-example {
  margin: 4px 0 0;
  font-size: 13px;
}

.people {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.people li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
}

@media (forced-colors: active) {
  .bar-seg,
  .swatch {
    forced-color-adjust: none;
  }
}

/* ---------- Fact suggestions ---------- */

.suggestions {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px dashed var(--brand);
  border-radius: var(--radius-sm);
  background: var(--accent-bg);
}

.suggestions .field-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-fg);
}

.suggestion-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.suggestion {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}

.suggestion > span {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.toggle-row .hint {
  display: block;
  margin-top: 2px;
  font-size: 12.5px;
  line-height: 1.35;
}

/* ---------- Team & platform ---------- */

.members {
  display: grid;
  gap: 10px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.member {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.member-who {
  display: grid;
  flex: 1;
  min-width: 180px;
  gap: 2px;
}

.member-who .muted {
  font-size: 12.5px;
}

.invite-box {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.invite-box .row {
  flex-wrap: nowrap;
}

.invite-box .input {
  flex: 1;
  min-width: 0;
}

.mono {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 12.5px;
}

.ws-list {
  display: grid;
  gap: 16px;
}

.ws-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.member-actions {
  display: grid;
  gap: 6px;
}

.member-link {
  flex-basis: 100%;
}

.legal-links {
  margin: 4px 0 0;
  font-size: 12.5px;
  text-align: center;
}
