/* Elfbot triage cockpit — minimal, slick design system */

:root {
  color-scheme: dark;

  --bg: #0a0c10;
  --surface: #14181f;
  --surface-2: #1a1f28;
  --border: #252b34;
  --border-strong: #343b46;

  --text: #f3f5f7;
  --text-2: #c5cbd3;
  --muted: #9ba3ae;

  --accent: #4ade80;
  --accent-strong: #6ee7a0;
  --accent-weak: rgba(74, 222, 128, 0.14);
  --accent-contrast: #0a0c10;
  --hero: #12271e;

  --crit: #ff6b6b;
  --crit-weak: rgba(255, 107, 107, 0.14);
  --warn: #e8b86d;
  --warn-weak: rgba(232, 184, 109, 0.12);
  --info: #7eb6ff;
  --info-weak: rgba(126, 182, 255, 0.12);
  --ok: #4ade80;
  --ok-weak: rgba(74, 222, 128, 0.14);

  --primary: var(--accent);
  --primary-contrast: var(--accent-contrast);
  --success: var(--ok);
  --panel: var(--surface);
  --surface-muted: #10141a;
  --text-muted: var(--muted);

  --radius: 8px;
  --radius-sm: 7px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.28), 0 1px 3px rgba(0, 0, 0, 0.22);
  --shadow-md: 0 10px 32px rgba(0, 0, 0, 0.45);

  font-family:
    "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-feature-settings: "cv02", "cv03", "cv04", "ss01";
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

::placeholder {
  color: var(--muted);
  opacity: 0.85;
}

::selection {
  background: rgba(74, 222, 128, 0.28);
  color: var(--text);
}

input:-webkit-autofill,
select:-webkit-autofill,
textarea:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  box-shadow: 0 0 0 1000px var(--surface) inset;
  transition: background-color 9999s ease-out;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

h1,
h2,
h3 {
  margin: 0;
  font-weight: 650;
  letter-spacing: 0;
}

/* ---------- shell ---------- */

.app-shell {
  height: 100vh;
  display: flex;
  overflow: hidden;
  overscroll-behavior: contain;
}

/* ---------- nav rail ---------- */

.navrail {
  flex: 0 0 212px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 12px;
  border-right: 1px solid var(--border);
  background: var(--surface-2);
}

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

.navrail .brand-mark {
  margin: 4px 0 0 6px;
}

.nav-items {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 11px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  transition: background 0.12s ease, color 0.12s ease;
}

.nav-item svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.85;
}

.nav-item:hover {
  background: rgba(74, 222, 128, 0.08);
  color: var(--text);
}

.nav-item.active {
  background: var(--accent-weak);
  color: var(--accent-strong);
}

.nav-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 11px;
  font-weight: 650;
  line-height: 18px;
  text-align: center;
}

.nav-badge.hidden {
  display: none;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
}

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

.nav-avatar {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-weak);
  color: var(--accent-strong);
  font-weight: 600;
  font-size: 13px;
}

.nav-user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}

.nav-user-meta strong {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-user-meta span {
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- main area + views ---------- */

.main-area {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.views {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.view {
  height: 100%;
  min-height: 0;
}

.view.hidden {
  display: none !important;
}

#viewTriage {
  display: flex;
  flex-direction: column;
}

#viewConnections,
#viewPosts,
#viewComments,
#viewMetrics,
#viewGuidelines,
#viewTeam {
  overflow: auto;
}

.topbar {
  flex: 0 0 auto;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.topbar h1 {
  font-size: 17px;
  font-weight: 600;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--accent-contrast);
  font-weight: 800;
  font-size: 15px;
  flex-shrink: 0;
}

.brand-mark img { display: block; width: 100%; height: 100%; object-fit: contain; }

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-text strong {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0;
}

.brand-text span {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.api-base {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.api-base input {
  width: 170px;
  min-width: 0;
  height: 32px;
  padding: 0 9px;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0;
}

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

/* ---------- triage layout ---------- */

.triage-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 12px;
  padding: 12px 14px 14px;
}

.triage-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

/* One uniform row: Client · Page · Post · Status · Visibility · actions. */
.triage-bar-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.triage-context-summary {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
}

.triage-filter-post {
  flex: 1 1 240px;
  min-width: min(100%, 240px);
  max-width: 460px;
}

.triage-post-pick {
  width: 100%;
  height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.triage-post-pick:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-weak);
}

.triage-post-pick-value {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 620;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.triage-post-pick svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  flex: 0 0 auto;
}

.triage-filter {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 132px;
  font-size: 11px;
  font-weight: 650;
  color: var(--muted);
}

.triage-filter > span {
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.triage-filter select {
  height: 36px;
  min-width: 132px;
}

.triage-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
  /* Align buttons with the bottom edge of the labeled controls. */
  align-self: flex-end;
}

.triage-bar-actions .compact {
  height: 36px;
}

/* In-app confirmation dialog. */
.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(16, 18, 24, 0.45);
  backdrop-filter: blur(2px);
}

.confirm-overlay.hidden {
  display: none;
}

.confirm-card {
  width: min(440px, 100%);
  padding: 20px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.confirm-card h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.confirm-card p {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.5;
}

.confirm-quote {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-left: 3px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 13px;
  color: var(--text-2);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.confirm-actions button,
.confirm-actions .primary-button {
  width: auto;
}

.confirm-actions .primary-button.danger {
  background: var(--crit);
}

.confirm-actions .primary-button.danger:hover:not(:disabled) {
  background: #e55555;
}

/* Button loading spinner. */
.btn-spinner {
  width: 13px;
  height: 13px;
  margin-right: 7px;
  display: inline-block;
  vertical-align: -2px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
  opacity: 0.8;
}

@keyframes btn-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Criteria stands out once keywords are configured. */
.criteria-button.has-criteria {
  border-color: var(--accent);
  color: var(--accent-strong);
  background: var(--accent-weak);
  font-weight: 650;
}

.triage-context-summary {
  margin: 0;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.triage-workspace {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(300px, 420px) minmax(340px, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
}

.triage-help-list {
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  text-align: left;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.triage-help-list li + li {
  margin-top: 14px;
}

.triage-help-list strong {
  display: block;
  color: var(--text-2);
}

.triage-help-list span {
  display: block;
}

.triage-help-sublist {
  margin: 4px 0 0;
  padding-left: 18px;
  list-style: disc;
  color: var(--muted);
}

.triage-help-sublist li + li {
  margin-top: 4px;
}

.detail-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 0 0;
}

.detail-toolbar h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
}

.severity-thresholds {
  margin: 0;
  padding: 0;
  border: none;
  background: none;
}

.severity-thresholds legend {
  font-size: 13px;
  font-weight: 650;
  padding: 0;
  margin-bottom: 6px;
  color: var(--text);
}

.severity-thresholds .criteria-note {
  margin: 0 0 12px;
}

.severity-threshold-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(80px, 1fr));
  gap: 8px;
}

.severity-threshold-cell {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.severity-threshold-grid .inline-field select {
  min-width: 0;
  width: 100%;
}

.field-hint {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.field-hint code {
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.criteria-drawer-body {
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.criteria-examples {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.criteria-examples legend {
  font-weight: 600;
  padding: 0 4px;
}

.criteria-example {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.criteria-example-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.criteria-example textarea,
.criteria-example input,
.criteria-example select {
  width: 100%;
}

.triage-advanced {
  margin-top: auto;
  font-size: 12px;
  color: var(--muted);
}

.triage-advanced-body {
  padding: 12px 0 0;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.triage-advanced.hidden {
  display: none;
}

/* ---------- workspace (legacy / shared) ---------- */

.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 256px minmax(330px, 410px) minmax(380px, 1fr);
  gap: 14px;
  padding: 14px;
  min-height: 0;
}

.sidebar,
.queue-column,
.detail-column {
  min-height: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel,
.queue-column,
.detail-column {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.panel {
  padding: 14px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.section-heading h2 {
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0;
  color: var(--muted);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 11px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 550;
}

.field:last-child {
  margin-bottom: 0;
}

input,
select,
textarea {
  width: 100%;
  height: 36px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  padding: 0 11px;
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%239BA3AE' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5 6 7.5 9 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

textarea {
  height: auto;
  min-height: 78px;
  padding: 9px 11px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-weak);
}

/* ---------- buttons ---------- */

.primary-button,
.secondary-button,
.toolbar-button,
.action-button {
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-weight: 550;
  font-size: 13px;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.06s ease;
}

.primary-button:hover:not(:disabled),
.secondary-button:hover:not(:disabled),
.toolbar-button:hover:not(:disabled),
.action-button:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.primary-button:active:not(:disabled),
.action-button:active:not(:disabled) {
  transform: translateY(1px);
}

.primary-button {
  width: 100%;
  margin-top: 2px;
  border-color: transparent;
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
}

.primary-button:hover:not(:disabled) {
  background: var(--accent-strong);
  border-color: transparent;
  color: var(--accent-contrast);
}

.secondary-button {
  width: 100%;
}

.toolbar-button {
  height: 32px;
  padding: 0 12px;
}

.icon-button {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
}

.icon-button:hover {
  background: var(--surface-2);
  color: var(--text);
}

/* ---------- segmented control ---------- */

.segmented {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.segment {
  height: 30px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
  transition: background 0.12s ease, color 0.12s ease;
}

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

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

/* ---------- status pill / chips / badges ---------- */

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px 0 8px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
}

.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-pill.live {
  background: var(--ok-weak);
  color: var(--ok);
}

.status-pill.error {
  background: var(--crit-weak);
  color: var(--crit);
}

.status-pill.warn {
  background: var(--warn-weak);
  color: var(--warn);
}

.classifier-pill {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-chip,
.badge {
  display: inline-flex;
  align-items: center;
  height: 21px;
  padding: 0 8px;
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 550;
  white-space: nowrap;
  letter-spacing: 0;
}

.queue-chip.danger,
.badge.danger {
  background: var(--crit-weak);
  color: var(--crit);
}

.queue-chip.warn,
.badge.warn {
  background: var(--warn-weak);
  color: var(--warn);
}

.queue-chip.info,
.badge.info {
  background: var(--info-weak);
  color: var(--info);
}

.queue-chip.success,
.badge.success {
  background: var(--ok-weak);
  color: var(--ok);
}

.queue-chip.muted,
.badge.muted {
  background: var(--surface-2);
  color: var(--muted);
}

/* ---------- queue column ---------- */

.queue-column {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.queue-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.queue-column.queue-bulk-active .queue-scroll {
  padding-bottom: 96px;
}

.queue-floating-bar {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 12;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-md);
}

.queue-bulk-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.queue-bulk-head .bulk-count {
  margin: 0;
  font-size: 12px;
  font-weight: 620;
  color: var(--text);
  white-space: nowrap;
}

.queue-bulk-clear {
  margin-left: 0;
  flex-shrink: 0;
  padding: 0;
  font-size: 12px;
  font-weight: 560;
}

.queue-floating-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
}

.queue-floating-bar.hidden {
  display: none;
}

.queue-floating-bar .primary-button.compact,
.queue-floating-bar .secondary-button.compact {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  padding: 0 8px;
  font-size: 12px;
  white-space: nowrap;
}

.queue-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.queue-toolbar h2 {
  font-size: 15px;
}

.queue-toolbar p {
  margin: 1px 0 0;
  font-size: 12px;
}

.queue-list {
  overflow: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.queue-item {
  position: relative;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  column-gap: 10px;
  align-items: start;
  width: 100%;
  min-height: 84px;
  text-align: left;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 10px 12px 10px 14px;
  overflow: hidden;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.queue-item.queue-item-checked {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  background: color-mix(in srgb, var(--accent) 5%, var(--surface));
}

.queue-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--border-strong);
}

.queue-item.sev-danger::before {
  background: var(--crit);
}

.queue-item.sev-warn::before {
  background: var(--warn);
}

.queue-item.sev-info::before {
  background: var(--border-strong);
}

.queue-item:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}

.queue-item.active {
  border-color: var(--accent);
  background: var(--accent-weak);
}

.queue-row-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  min-width: 0;
}

.queue-tag-row {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  max-width: 62%;
}

.queue-label-muted {
  font-size: 11.5px;
  font-weight: 550;
  color: var(--muted);
  white-space: nowrap;
}

.queue-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}

.queue-author {
  min-width: 0;
  font-weight: 600;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-text {
  margin: 0;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.45;
  min-height: 2.9em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.queue-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

/* ---------- detail column ---------- */

.detail-column {
  overflow: auto;
  overscroll-behavior: contain;
  overflow-anchor: none;
  padding: 20px 20px 66px;
}

.empty-state {
  min-height: 300px;
  max-width: 420px;
  margin: 0 auto;
  display: grid;
  justify-items: center;
  align-content: center;
  text-align: center;
  gap: 6px;
  color: var(--muted);
}

.empty-state-icon {
  font-size: 32px;
  margin-bottom: 4px;
  opacity: 0.7;
}

.empty-state h2 {
  color: var(--text-2);
  font-size: 16px;
}

.empty-state p {
  margin: 0;
  font-size: 13px;
  max-width: 280px;
}

.empty-state-divider {
  width: 100%;
  border: 0;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

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

.hidden {
  display: none !important;
}

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.detail-header h2 {
  font-size: 18px;
}

.badge-row {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 5px;
}

.comment-text {
  margin: 0;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  overflow-wrap: anywhere;
}

.classification-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.classification-correction {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
  padding-top: 4px;
}

.classification-correction .field {
  min-width: 180px;
  flex: 1;
  margin-bottom: 0;
}

.criteria-example-source {
  margin: 0;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--accent, #5b4dc9);
}

/* The post the selected comment belongs to, pinned above the detail header. */
.detail-post-context {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.detail-post-context.hidden {
  display: none;
}

.detail-post-eyebrow {
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  color: var(--muted);
}

.detail-post-excerpt {
  flex: 1 1 240px;
  margin: 0;
  font-size: 13px;
  color: var(--text-2);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Compact chip row: label + scores + only the flags that are actually set. */
.classification-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.classification-detail-meta {
  font-size: 11.5px;
  font-weight: 550;
  color: var(--muted);
}

.metric {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 11px;
  background: var(--surface);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0;
  margin-bottom: 4px;
}

.metric strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.metrics-grid {
  padding: 0 0 24px;
}

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

.metrics-card strong {
  font-size: 22px;
  line-height: 1.2;
}

.metrics-card-note {
  margin: 6px 0 0;
  font-size: 11px;
  line-height: 1.35;
}

.metrics-period-label {
  margin: 4px 0 0;
  font-size: 12px;
}

.metrics-empty {
  margin-top: 8px;
}

.action-bar {
  /* Flex so a hidden button (e.g. Hide when already hidden) leaves no gap. */
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  position: relative;
}

.comment-detail.detail-actions-busy .action-bar {
  opacity: 0.62;
  pointer-events: none;
}

.comment-detail.detail-actions-busy .action-bar::after {
  content: "";
  position: absolute;
  right: 6px;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
}

.action-button {
  flex: 1 1 0;
  min-width: 72px;
  padding: 0 8px;
  font-size: 12.5px;
}

.action-bar .hidden {
  display: none;
}

.action-button.recommended {
  flex: 1.4 1 0;
  font-weight: 650;
  color: var(--primary-contrast, var(--accent-contrast));
  background: var(--primary, var(--accent));
  border-color: var(--primary, var(--accent));
}

.action-button.recommended:hover:not(:disabled) {
  filter: brightness(1.05);
}

.action-more {
  position: relative;
  flex: 0 0 auto;
}

.action-more-toggle {
  list-style: none;
  cursor: pointer;
  flex: 0 0 auto;
  min-width: 56px;
}

.action-more-toggle::-webkit-details-marker {
  display: none;
}

.action-more-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 5;
  min-width: 180px;
  padding: 6px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.action-more-menu .action-button {
  width: 100%;
  flex: none;
}

.action-more:not([open]) .action-more-menu {
  display: none;
}

.action-button.warn {
  color: var(--warn);
}

.action-button.warn:hover:not(:disabled) {
  border-color: var(--warn);
  background: var(--warn-weak);
}

.action-button.danger {
  color: var(--crit);
}

.action-button.danger:hover:not(:disabled) {
  border-color: var(--crit);
  background: var(--crit-weak);
}

#hideButton:hover:not(:disabled),
#unhideButton:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.reply-box {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px;
  background: var(--surface-2);
}

.reply-box .field {
  margin-bottom: 9px;
}

.reply-box .secondary-button {
  width: auto;
  float: right;
  padding: 0 16px;
}

.reply-box::after {
  content: "";
  display: block;
  clear: both;
}

/* ---------- tabs / history ---------- */

.tabs {
  display: flex;
  gap: 2px;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--border);
}

.tab {
  height: 32px;
  padding: 0 13px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 7px 7px 0 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 550;
  margin-bottom: -3px;
}

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

.tab.active {
  color: var(--accent-strong);
  border-bottom-color: var(--accent);
}

.history-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: var(--surface);
}

.history-item h3 {
  margin: 0 0 4px;
  font-size: 13.5px;
  font-weight: 600;
}

.history-item p {
  margin: 0;
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: min(380px, calc(100vw - 36px));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #1c222b;
  color: var(--text);
  box-shadow: var(--shadow-md);
  padding: 12px 14px;
  font-size: 13px;
  z-index: 40;
  animation: toast-in 0.16s ease;
}

.toast.error {
  background: var(--crit);
  border-color: var(--crit);
  color: var(--accent-contrast);
}

.toast.success {
  background: var(--ok);
  border-color: var(--ok);
  color: var(--accent-contrast);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ---------- login gate ---------- */

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 90% 70% at 50% 0%, var(--hero) 0%, var(--bg) 62%);
}

.login-card {
  width: min(380px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.login-mark {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  font-size: 21px;
}

.login-card h1 {
  font-size: 22px;
}

.login-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.login-card .primary-button {
  width: 100%;
  margin-top: 8px;
}

.login-foot {
  font-size: 12px;
}

.login-trust-link {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.login-trust-link:hover {
  color: var(--text-2);
}

/* ---------- onboarding wizard (B4) ---------- */

.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 44;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}

.onboarding-overlay.hidden {
  display: none !important;
}

.onboarding-card {
  width: min(560px, 100%);
  max-height: min(90vh, 720px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.onboarding-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.onboarding-header h1 {
  margin: 0 0 4px;
  font-size: 22px;
}

.onboarding-header p {
  margin: 0;
  font-size: 14px;
}

.onboarding-mark {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  font-size: 20px;
}

.onboarding-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.onboarding-step {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
}

.onboarding-step-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg));
}

.onboarding-step-done {
  opacity: 0.85;
}

.onboarding-step-marker {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.onboarding-step-active .onboarding-step-marker {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

.onboarding-step-done .onboarding-step-marker {
  background: color-mix(in srgb, var(--success) 18%, var(--surface));
  border-color: color-mix(in srgb, var(--success) 40%, var(--border));
  color: var(--success);
}

.onboarding-step-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.onboarding-step-copy strong {
  font-size: 13px;
}

.onboarding-step-copy span {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.3;
}

.onboarding-panel h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.onboarding-panel p {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.5;
}

.onboarding-checklist {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.onboarding-connect-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
}

.onboarding-connect-preview p {
  margin: 4px 0 0;
  font-size: 13px;
}

.onboarding-success-note {
  margin-top: 12px !important;
  padding: 10px 12px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--success) 12%, var(--bg));
  color: var(--success);
  font-size: 13px;
}

.onboarding-footer {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: auto;
}

.onboarding-footnote {
  margin: 0;
  font-size: 12px;
}

.onboarding-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

/* ---------- responsive ---------- */

/* ---------- management views ---------- */

.management-page {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 24px 28px 36px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.page-header h2 {
  font-size: 22px;
  font-weight: 680;
}

.page-header p {
  margin: 2px 0 0;
  font-size: 13px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.team-invite-form {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) minmax(140px, 0.8fr) auto;
  gap: 12px 14px;
  align-items: end;
  margin: 0 0 18px;
  padding: 16px 16px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.team-invite-form .field {
  margin-bottom: 0;
}

.team-invite-form .field-hint {
  grid-column: 1 / -1;
  margin: 0;
}

.team-invite-form .primary-button {
  height: 36px;
  width: auto;
  padding: 0 16px;
}

.team-invite-locked {
  margin: 0 0 16px;
}

.team-table-shell {
  min-height: 80px;
}

.team-table {
  width: 100%;
  border-collapse: collapse;
}

.team-table th,
.team-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.team-table th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 680;
}

.team-table tr:last-child td {
  border-bottom: 0;
}

.team-table select {
  width: auto;
  min-width: 140px;
}

.primary-inline-button {
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 650;
  font-size: 13px;
}

.primary-inline-button:hover:not(:disabled) {
  background: var(--accent-strong);
  color: var(--accent-contrast);
}

.secondary-button.compact {
  width: auto;
  min-width: 0;
  padding: 0 13px;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.comments-toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}

.comments-toolbar-row {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.comments-search-field {
  flex: 1 1 240px;
  min-width: 200px;
}

.comments-search-field input {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.comments-search-field input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-color: var(--accent);
}

.inline-field.compact-field {
  min-width: 0;
}

.comments-filter-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  width: fit-content;
  max-width: 100%;
}

.filter-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 560;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}

.filter-tab:hover {
  color: var(--text);
  background: var(--surface-2);
}

.filter-tab.active {
  color: var(--accent-strong);
  background: var(--accent-weak);
}

.comments-post-scope {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.comments-post-scope.hidden {
  display: none;
}

.comments-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.comments-pagination.hidden {
  display: none;
}

.comments-page-summary {
  font-size: 13px;
  color: var(--muted);
}

.comments-page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.bulk-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 6%, var(--panel));
}

.bulk-bar.hidden {
  display: none;
}

.bulk-count {
  font-size: 12px;
  font-weight: 620;
  color: var(--muted);
  margin-right: 4px;
}

.queue-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.queue-sort-select {
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 560;
  cursor: pointer;
}

.queue-sort-select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.queue-item-body {
  grid-column: 2;
  min-width: 0;
}

.queue-row-checkbox {
  grid-column: 1;
  grid-row: 1;
  width: 14px;
  height: 14px;
  margin: 2px 0 0;
  flex: 0 0 14px;
}

.queue-item-select {
  display: contents;
}

.queue-item-select input[type="checkbox"],
.comment-row-checkbox,
.comments-table .select-col input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin-top: 4px;
  flex: 0 0 14px;
}

.queue-chip.hidden-state {
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border-strong);
  font-weight: 600;
}

.queue-disclaimer {
  margin: 0 12px 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--warn) 35%, var(--border));
  background: var(--warn-weak);
  color: var(--warn);
  font-size: 12px;
  line-height: 1.5;
}

.queue-disclaimer.hidden {
  display: none;
}

.queue-item-deleted {
  opacity: 0.82;
  background: var(--surface-muted);
}

.deleted-comment-note {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--warn-weak);
  color: var(--warn);
  font-size: 12px;
  line-height: 1.5;
}

.deleted-comment-note.hidden {
  display: none;
}

.hidden-pending-note {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--info-weak);
  color: var(--info);
  font-size: 12px;
  line-height: 1.5;
}

.hidden-pending-note.hidden {
  display: none;
}

.dismissed-resolved-note {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--accent-weak);
  color: var(--accent-strong);
  font-size: 12px;
  line-height: 1.5;
}

.dismissed-resolved-note.hidden {
  display: none;
}

.comment-status-chips {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin-top: 2px;
}

.comment-status-chips .queue-chip {
  font-size: 11px;
}

.classification-source {
  margin: 0 0 8px;
  font-size: 12px;
}

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

.secondary-button.has-criteria {
  border-color: var(--accent);
  color: var(--accent-strong);
  background: var(--accent-weak);
}

.queue-flag-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  min-height: 22px;
  min-width: 0;
}

.queue-flag-left {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}

.queue-flag-right {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 4px;
  flex-shrink: 0;
  max-width: 58%;
}

.queue-flag-row .queue-label-muted {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-flag-row .queue-chip {
  flex-shrink: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.field-button {
  width: 100%;
  justify-content: space-between;
}

.criteria-panel textarea {
  min-height: 72px;
  resize: vertical;
}

.status-note,
.criteria-empty {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.45;
}

.keyword-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 10px;
}

.keyword-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-weak);
  border: 1px solid rgba(74, 222, 128, 0.22);
  color: var(--text);
  font-size: 12px;
  font-weight: 560;
}

.criteria-note {
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.45;
}

.auto-hide-warning {
  margin: 8px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--warn) 35%, var(--border));
  background: var(--warn-weak);
  font-size: 12px;
  line-height: 1.45;
  color: var(--text);
}

.auto-hide-panel.compact {
  padding: 12px 14px;
}

.auto-hide-panel .section-heading h2 {
  font-size: 1rem;
}

.toggle-field {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  font-size: 13px;
  color: var(--text);
  line-height: 1.45;
}

.toggle-field.compact {
  align-items: center;
}

.toggle-field input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  flex: 0 0 16px;
  accent-color: var(--accent);
}

.connection-meta {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.connection-card-top .queue-chip {
  flex-shrink: 0;
  align-self: flex-start;
}

.connection-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.drawer-search {
  padding: 0 16px 12px;
}

.triage-post-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  background: var(--surface);
}

.triage-post-item.active {
  border-color: var(--accent);
  background: var(--accent-weak);
}

.escalation-panel {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.escalation-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.escalation-header h3 {
  margin: 0;
  font-size: 15px;
}

.escalation-options {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.escalation-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  text-align: left;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
}

.escalation-option:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.escalation-option strong {
  font-size: 13px;
}

.escalation-option span {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.queue-item-select input {
  margin-top: 4px;
}

.inline-field {
  min-width: 160px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 620;
}

.inline-field select {
  min-width: 160px;
}

.connection-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

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

.connection-card,
.conn-card,
.post-summary-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.connection-card {
  display: flex;
  flex-direction: column;
  min-height: 168px;
}

.connection-card-top,
.conn-head,
.post-card-head,
.page-switch-item {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 11px;
}

.page-switch-item > button {
  flex-shrink: 0;
}

.platform-icon,
.conn-logo {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--info-weak);
  color: var(--info);
  font-weight: 760;
  font-size: 14px;
}

.platform-icon.instagram {
  background: var(--warn-weak);
  color: var(--warn);
}

.platform-icon.facebook.brand-icon {
  background: #1877f2;
  color: #fff;
}

.platform-icon.brand-icon svg {
  width: 20px;
  height: 20px;
  display: block;
}

.connection-main,
.conn-title,
.post-title-block,
.page-switch-main {
  min-width: 0;
  flex: 1;
}

.connection-platform-row,
.post-provider-row,
.page-switch-main > div {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.connection-platform-row strong,
.conn-title strong,
.post-provider-row strong,
.page-switch-main strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 650;
}

.connection-main h3 {
  margin-top: 8px;
  font-size: 16px;
  font-weight: 680;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connection-main p,
.conn-title span,
.post-title-block p,
.post-provider-row span,
.page-switch-main p {
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connection-facts,
.connection-actions,
.summary-strip,
.comment-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.connection-actions {
  padding-top: 2px;
  margin-top: auto;
}

.integration-panel {
  margin-top: 22px;
}

.integration-panel .section-note {
  margin: 4px 0 0;
  font-size: 13px;
}

.connect-platforms-panel {
  margin-bottom: 8px;
}

.connect-platform-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.connect-platform-button {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-width: min(360px, 100%);
  padding: 14px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.connect-platform-button:hover:not(:disabled) {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}

.connect-platform-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.connect-platform-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.connect-platform-copy strong {
  font-size: 15px;
}

.connect-platform-notice {
  margin: 6px 0 0;
  font-size: 13px;
}

.operator-panel {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
}

.operator-tools-link-wrap {
  margin: 16px 0 8px;
  text-align: center;
}

.zernio-config-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
  margin-top: 12px;
}

.zernio-config-grid .full-width {
  grid-column: 1 / -1;
}

.stack-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}

.stack-field input {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}

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

.copy-field-row input {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 12px;
}

.zernio-config-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

@media (max-width: 720px) {
  .zernio-config-grid {
    grid-template-columns: 1fr;
  }

  .severity-threshold-grid {
    grid-template-columns: 1fr;
  }
}

.source-button {
  height: 36px;
  max-width: min(360px, 100%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
}

.source-button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-button svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.post-summary-card {
  padding: 16px;
}

.post-actions {
  display: flex;
  gap: 7px;
  margin-left: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.post-excerpt {
  margin: 10px 0 0;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.post-body {
  margin-top: 14px;
}

.post-media-link {
  display: block;
  width: fit-content;
  max-width: 100%;
}

.post-media-thumb {
  display: block;
  width: min(320px, 100%);
  max-height: 220px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.mono-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.post-insight {
  margin-top: 12px;
}

.summary-body {
  margin: 0 0 8px;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.insight-empty {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

.insight-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.insight-meta {
  margin: 6px 0 0;
  font-size: 12px;
}

.text-button {
  margin-left: auto;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.text-button:hover {
  text-decoration: underline;
}

.muted-chip {
  opacity: 0.75;
}

.engagement-chip {
  cursor: pointer;
  border: 0;
  font: inherit;
}

.engagement-chip:hover {
  filter: brightness(1.08);
}

.engagement-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 18px;
}

.engagement-actor {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.engagement-actor strong {
  display: block;
  font-size: 14px;
}

.engagement-actor .muted {
  font-size: 12px;
}

.engagement-actor-avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
}

.empty-state.compact {
  padding: 12px 0;
}

.empty-state.compact p {
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 1.5;
}

.post-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.table-shell {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.moderation-table {
  width: 100%;
  min-width: 1060px;
  border-collapse: collapse;
}

.moderation-table th,
.moderation-table td {
  padding: 12px 13px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.moderation-table th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 680;
}

.moderation-table tr:last-child td {
  border-bottom: 0;
}

.moderation-table tbody tr:hover {
  background: var(--surface-2);
}

.select-col {
  width: 40px;
}

.select-col input {
  width: 16px;
  height: 16px;
  padding: 0;
}

.created-cell,
.social-cell,
.comment-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.created-cell strong,
.social-cell strong {
  font-size: 13px;
  font-weight: 660;
}

.created-cell span,
.social-cell span,
.id-line {
  color: var(--muted);
  font-size: 12px;
}

.comment-cell p {
  width: min(560px, 100%);
  margin: 0;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.comment-thread {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.thread-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-2);
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.thread-toggle:hover {
  background: var(--surface);
  border-color: var(--border-strong);
}

.thread-toggle.expanded {
  border-color: color-mix(in srgb, var(--accent) 30%, var(--border));
  background: color-mix(in srgb, var(--accent) 5%, var(--surface));
}

.thread-toggle-preview {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.thread-toggle-chevron {
  color: var(--muted);
  font-size: 11px;
}

.thread-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-left: 14px;
  border-left: 2px solid color-mix(in srgb, var(--accent) 25%, var(--border));
  /* Long threads scroll instead of pushing the table row off screen. */
  max-height: 320px;
  overflow-y: auto;
  padding-right: 6px;
  overscroll-behavior: contain;
}

.thread-panel.hidden {
  display: none;
}

.thread-bubble {
  max-width: min(520px, 100%);
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.thread-bubble.page-reply {
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 22%, var(--border));
}

.thread-bubble-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.thread-bubble-head strong {
  font-size: 12px;
  font-weight: 650;
}

.thread-bubble-head span {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.thread-bubble p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-2);
}

.classification-note {
  color: var(--muted) !important;
  font-size: 12px !important;
}

.table-link {
  display: inline-flex;
  align-items: center;
  height: 21px;
  padding: 0 8px;
  border-radius: 7px;
  background: var(--info-weak);
  color: var(--info);
  font-size: 11.5px;
  font-weight: 550;
  text-decoration: none;
  white-space: nowrap;
}

.table-link:hover {
  text-decoration: underline;
}

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

.table-action {
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
}

.table-action:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--text);
}

.table-action.active {
  border-color: var(--accent);
  background: var(--accent-weak);
  color: var(--accent-strong);
}

.table-action.danger {
  color: var(--crit);
  border-color: color-mix(in srgb, var(--crit) 35%, var(--border-strong));
}

.table-action.danger:hover:not(:disabled) {
  background: var(--crit-weak);
  color: var(--crit);
}

.row-actions-note {
  font-size: 12px;
}

.comment-reply-row td {
  padding-top: 0;
  background: color-mix(in srgb, var(--accent) 4%, var(--surface));
  border-bottom: 1px solid var(--border);
}

.inline-reply-composer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border));
  border-radius: 12px;
  background: var(--surface);
}

.inline-reply-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
}

.inline-reply-header strong {
  color: var(--text);
}

.inline-reply-mention {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--accent-weak);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 600;
}

.inline-reply-composer textarea {
  width: 100%;
  min-height: 84px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
}

.inline-reply-composer textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-color: var(--accent);
}

.inline-reply-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.loading-row,
.loading-cell {
  padding: 28px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: flex;
  justify-content: flex-end;
  pointer-events: auto;
}

.drawer-overlay.hidden {
  display: none !important;
  pointer-events: none;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
}

.drawer-panel {
  position: relative;
  width: min(520px, 100%);
  height: 100%;
  padding: 24px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  overflow: auto;
}

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.drawer-header h2 {
  font-size: 18px;
}

.drawer-header p {
  margin: 2px 0 0;
  font-size: 13px;
}

.page-switch-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 18px;
}

.page-switch-loading {
  padding: 12px;
  font-size: 13px;
}

.page-switch-item {
  align-items: center;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.page-switch-item-connected {
  opacity: 0.82;
  background: var(--surface-muted);
}

.page-switch-title-row {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.page-switch-title-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-switch-action {
  flex: 0 0 auto;
  min-width: 96px;
  max-width: 110px;
}

.platform-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.platform-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
}

.platform-chip.connected {
  border-color: var(--ok);
  color: var(--ok);
  background: var(--ok-weak);
}

body * {
  letter-spacing: 0;
}

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

  .triage-workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .detail-column {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  html,
  body {
    width: 100%;
    overflow-x: hidden;
  }

  .app-shell {
    flex-direction: column;
    height: auto;
    overflow: visible;
  }

  .navrail {
    width: 100%;
    flex: 0 0 auto;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
  }

  .navrail-top {
    flex-direction: row;
    align-items: center;
    gap: 10px;
  }

  .nav-items {
    flex-direction: row;
    max-width: calc(100vw - 74px);
    overflow-x: auto;
  }

  .nav-item {
    flex: 0 0 auto;
  }

  .views {
    overflow: visible;
  }
}

@media (max-width: 760px) {
  .topbar {
    height: auto;
    padding: 12px 14px;
    flex-wrap: wrap;
    gap: 12px;
  }

  .topbar-actions,
  .header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .team-invite-form {
    grid-template-columns: 1fr;
  }

  .management-page {
    padding: 20px 14px 28px;
  }

  .filter-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .comments-toolbar-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .comments-filter-tabs {
    width: 100%;
    overflow-x: auto;
  }

  .inline-field,
  .inline-field select {
    min-width: 0;
  }

  .api-base input {
    width: 130px;
  }

  .workspace {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .triage-shell {
    padding: 10px;
  }

  .triage-bar-row {
    flex-direction: column;
    align-items: stretch;
  }

  .triage-bar-actions {
    margin-left: 0;
    width: 100%;
  }

  .triage-filter,
  .triage-filter-post,
  .triage-post-pick {
    flex: 1 1 100%;
    max-width: none;
  }

  .triage-filter select {
    width: 100%;
  }

}

@media (max-width: 460px) {
  .segmented {
    grid-template-columns: 1fr 1fr;
  }
}

/* Guidelines: a revisitable policy editor, alongside Team. */
#viewGuidelines:not(.hidden) { display: flex; flex-direction: column; }
#viewGuidelines .guidelines-page {
  min-height: 100%;
  padding: 16px 28px 22px;
  display: flex;
  flex-direction: column;
}
#viewGuidelines .guidelines-page > .page-header { margin-bottom: 10px; }
#viewGuidelines .guidelines-page > .page-header p + p { display: none; }

.operator-usage-table-header { margin-top: 28px; }
#guidelinesContent,
.guidelines-shell,
.guidelines-panel,
.guidelines-summary {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 100%;
}
.guidelines-meta { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--muted); margin-bottom: 12px; font-size: 12px; }
.guidelines-steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.guidelines-steps button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 64px;
  padding: 16px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-2);
  background: var(--surface);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.guidelines-steps button span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 50%;
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 700;
}
.guidelines-steps button[aria-current="step"] { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-weak); }
.guidelines-panel {
  padding: 18px 22px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.guidelines-step-heading p { margin: 0 0 4px; font-size: 12px; }
.guidelines-step-heading h2 { margin: 0 0 10px; }
.guidelines-fields { display: grid; gap: 12px; border: 0; padding: 0; margin: 0; min-width: 0; align-content: start; }
.guidelines-fields p { margin: 0; }
.guidelines-fields textarea, .guidelines-fields input, .guidelines-fields select { width: 100%; min-width: 0; }
.guidelines-fields input[type="checkbox"] { width: auto; }
.guidelines-fields textarea { resize: vertical; }
#guidelinesPolicyText { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; line-height: 1.65; min-height: 280px; }
.guidelines-language-options, .guidelines-inline-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.guidelines-language-options .toggle-field { padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius); }
.guidelines-add-row { display: flex; align-items: end; gap: 12px; }
.guidelines-add-row .field { flex: 1; }
.guidelines-add-row button { flex: 0 0 auto; }
.guidelines-fields .keyword-chip { cursor: pointer; overflow-wrap: anywhere; max-width: 100%; white-space: normal; }
.guidelines-draft-helper, .guidelines-policy-preview { border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.guidelines-draft-helper summary, .guidelines-policy-preview summary { cursor: pointer; font-weight: 600; }
.guidelines-draft-helper[open] > :not(summary) { margin-top: 14px; }
.guidelines-policy-preview pre { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; }
.guidelines-subheading { margin: 8px 0 0; font-size: 1rem; }
.guidelines-reply-examples { display: grid; gap: 12px; }
.guidelines-reply-examples > .muted { margin: 0; }
.guidelines-reply-example { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.guidelines-reply-example textarea, .guidelines-reply-preview textarea { resize: vertical; font: inherit; }
.guidelines-reply-preview { display: grid; gap: 10px; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.guidelines-reply-preview > * { margin: 0; }
.guidelines-preview-draft { margin: 0; padding: 12px; border-radius: var(--radius); background: var(--surface-2); white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 720px) { .guidelines-reply-example { grid-template-columns: 1fr; } }
.guidelines-examples { overflow: auto; max-width: 100%; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.guidelines-examples > .muted { margin: 0; padding: 16px; }
.guidelines-example-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.guidelines-example-table th,
.guidelines-example-table td { padding: 6px 8px; vertical-align: top; text-align: left; border-bottom: 1px solid var(--border); }
.guidelines-example-table tbody tr:last-child td { border-bottom: 0; }
.guidelines-example-table th { font-size: 12px; font-weight: 650; color: var(--muted); background: var(--surface); }
.guidelines-example-table th:nth-child(1) { width: 44%; }
.guidelines-example-table th:nth-child(2) { width: 18%; }
.guidelines-example-table th:nth-child(3) { width: 30%; }
.guidelines-example-table th:nth-child(4) { width: 8%; }
.guidelines-example-table textarea { height: auto; min-height: 42px; max-height: 96px; padding: 6px 8px; line-height: 1.35; overflow: auto; }
.guidelines-example-table select { height: 34px; }
.guidelines-example-table .criteria-example-source { display: inline-block; margin-bottom: 6px; }
.guidelines-example-table td:last-child { text-align: right; white-space: nowrap; }
.guidelines-summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.guidelines-summary-card { text-align: left; display: grid; gap: 10px; padding: 20px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); font: inherit; cursor: pointer; }
.guidelines-summary-card span { color: var(--muted); }
.guidelines-summary-card small { color: var(--accent); }
.guidelines-summary-card:hover, .guidelines-steps button:hover { border-color: var(--border-strong); }
.guidelines-save-summary { padding: 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); display: grid; gap: 10px; }
.guidelines-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px; border-top: 1px solid var(--border); padding-top: 20px; margin-top: auto; }
.guidelines-footer > div { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.guidelines-footer .muted { font-size: 12px; }
.guidelines-safety { font-size: 12px; padding-top: 18px; margin-top: 18px; }
.guidelines-page button:focus-visible, .guidelines-page summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.guidelines-page button:disabled { cursor: default; opacity: .5; }
@media (max-width: 700px) {
  #viewGuidelines .guidelines-page { padding: 20px 14px 28px; }
  .guidelines-panel { padding: 18px 14px 16px; }
  .guidelines-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .guidelines-steps button { flex-direction: column; gap: 6px; min-height: 56px; font-size: 12px; padding: 12px 8px; }
  .guidelines-summary-grid { grid-template-columns: 1fr; }
  .guidelines-add-row { flex-direction: column; align-items: stretch; }
  .guidelines-example-table { table-layout: auto; }
  .guidelines-example-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .guidelines-example-table,
  .guidelines-example-table tbody,
  .guidelines-example-table tr,
  .guidelines-example-table th,
  .guidelines-example-table td { display: block; width: 100%; }
  .guidelines-example-table tr { padding: 12px; border-bottom: 1px solid var(--border); }
  .guidelines-example-table td { padding: 8px 0; border-bottom: 0; }
  .guidelines-example-table td::before { content: attr(data-label); display: block; margin-bottom: 4px; font-size: 11px; font-weight: 650; color: var(--muted); }
  .guidelines-example-table td:last-child { text-align: left; white-space: normal; }
  .guidelines-example-table td:last-child::before { content: none; }
  .guidelines-footer { flex-direction: column; }
}
.guidelines-footer .primary-button { width: auto; }

/* Shared draft-only reply assistance. Sending stays in the existing editor. */
.reply-draft-tools { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; background: var(--surface); min-width: 0; }
.reply-draft-tools summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.reply-draft-tools p { margin: 10px 0; font-size: 12px; }
.reply-draft-fields { border: 0; padding: 0; margin: 12px 0; min-width: 0; display: grid; gap: 10px; }
.reply-style-row { display: flex; flex-wrap: wrap; gap: 8px; }
.reply-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 4px 6px 4px 12px; border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--surface-2); font-size: 13px; cursor: pointer; }
.reply-chip > span { color: var(--muted); font-weight: 600; white-space: nowrap; }
.reply-chip.is-on { border-color: var(--accent); background: var(--accent-weak); }
.reply-chip.is-on > span { color: var(--accent); }
.reply-draft-tools .reply-chip select { width: auto; height: 26px; min-height: 0; padding: 0 4px; border: 0; background: transparent; color: inherit; font: inherit; box-shadow: none; }
.reply-tone-chip { padding-inline: 10px 12px; }
.reply-draft-tools .reply-tone-chip input { flex: none; width: 16px; height: 16px; min-height: 0; margin: 0; padding: 0; accent-color: var(--accent); }
.reply-draft-tools .reply-style-summary { margin: 0; color: var(--muted); }
.reply-style-summary a { color: var(--accent); }
.reply-draft-blocked { margin: 0; font-size: 12px; }
.reply-draft-tools .link-button { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }
.reply-draft-tools .reply-instructions-toggle { font-size: 12px; }
.reply-draft-tools input, .reply-draft-tools select, .reply-draft-tools textarea { width: 100%; min-width: 0; }
.reply-draft-tools button { justify-self: start; width: auto; }
.reply-draft-result:not(:empty) { border-top: 1px solid var(--border); margin-top: 12px; padding-top: 12px; }
.reply-draft-note { color: var(--text-2); }
.reply-draft-error { color: var(--crit); }
.reply-draft-tools [data-draft-preview] { resize: vertical; font: inherit; line-height: 1.5; }
@media (max-width: 480px) { .reply-chip { flex: 1 1 100%; } .reply-chip select { margin-inline-start: auto; } }

/* Fact checks sit on their own action row; evidence opens in a shared dialog. */
.fact-check-row { display:flex; flex-wrap:wrap; gap:.5rem; align-items:center; margin:.65rem 0; }
.fact-check-dialog { width:min(680px, calc(100vw - 32px)); max-height:85vh; box-sizing:border-box; overflow:auto; padding:24px; border:1px solid var(--border-strong); border-radius:14px; color:var(--text); background:var(--surface); box-shadow:0 20px 70px #0003; }
.fact-check-dialog::backdrop { background:#17203088; }
.fact-check-header { display:flex; justify-content:space-between; align-items:center; gap:1rem; }
.fact-check-header h2 { margin:0; }
.fact-check-dialog blockquote { margin:16px 0; padding:12px; background:var(--surface-2); border-radius:8px; overflow-wrap:anywhere; }
.fact-check-source { border-top:1px solid var(--border); padding:10px 0; overflow-wrap:anywhere; }
.fact-check-dialog textarea, .fact-check-dialog input { width:100%; box-sizing:border-box; }
.fact-check-dialog details { padding:12px 0; }
.fact-check-dispute-followup { padding:12px 0; border-top:1px solid #e5e8ec; }
.fact-check-history { padding:12px 0; border-top:1px solid #e5e8ec; }
.fact-check-manual { border:1px solid var(--border); border-radius:8px; padding:14px; }
.fact-check-other-claims { padding:8px 0; border-top:1px solid var(--border); }
.fact-check-dialog button:disabled { opacity:.55; cursor:not-allowed; }
@media(max-width:600px) { .fact-check-dialog {padding:16px;} .fact-check-row {align-items:flex-start;} }

.reply-box #replyFactCheckButton { float:none; display:inline-flex; margin:0 0 10px; }
.fact-check-dialog a { color:var(--info); }

.fact-check-badges { display:flex; flex-wrap:wrap; gap:5px; margin:6px 0 !important; }
.fact-check-badges:empty { display:none; }

/* First usability pass: clear hierarchy and responsive review navigation. */
:root {
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.app-shell { height: 100dvh; }
.skip-link { position: fixed; transform: translateY(-200%); top: 0; left: 16px; z-index: 100; padding: 12px; background: var(--surface); color: var(--accent); }
.skip-link:focus { transform: none; top: 12px; }
a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.navrail { padding-top: 24px; }
.navrail .brand { margin-bottom: 16px; }
.nav-item { min-height: 46px; }
.nav-user { width: 100%; text-align: left; }
.topbar { min-height: 88px; height: auto; padding: 18px 24px; }
.topbar h1 { font-size: 24px; font-weight: 700; }
.view-description { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.technical-settings { position: relative; font-size: 13px; }
.technical-settings > summary { cursor: pointer; padding: 12px 0; color: var(--muted); }
.technical-settings-panel { position: absolute; top: 48px; right: 0; z-index: 20; width: 280px; padding: 16px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow-md); }
.technical-settings .api-base { margin-top: 12px; flex-direction: column; align-items: stretch; }
.technical-settings input { width: 100%; }
.triage-shell { gap: 16px; padding: 20px; }
.triage-bar { padding: 16px; }
.triage-bar-row { gap: 12px; }
.triage-bar-actions { flex-wrap: wrap; }
.triage-filter > span { font-size: 12px; }
.triage-filter select, .triage-post-pick, .triage-bar-actions button, .toolbar-button { min-height: 44px; }
.triage-workspace { gap: 16px; }
.queue-column, .detail-column { min-width: 0; }
.queue-author, .queue-text { font-size: 14px; }
.queue-item { padding-top: 16px; padding-bottom: 16px; flex-shrink: 0; }
.queue-toolbar { flex-wrap: wrap; gap: 12px; }
.queue-toolbar h2 { font-size: 17px; }
.comment-text { font-size: 18px; line-height: 1.65; overflow-wrap: anywhere; }
.action-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.action-bar > button, .action-more-toggle { min-height: 44px; height: auto; padding: 10px 14px; }
.action-bar > button { flex: 1 1 140px; }
.detail-back-label { display: none; }
@media (max-width: 1180px) {
  #viewTriage:not(.has-selection) .detail-column { display: none; }
  #viewTriage.has-selection .queue-column { display: none; }
  #viewTriage.has-selection .triage-bar { display: none; }
  #viewTriage .detail-back-label { display: inline; }
  #viewTriage .detail-close-icon { display: none; }
  #clearSelectionButton { flex: 0 0 auto; width: auto; height: auto; white-space: nowrap; min-height: 44px; padding: 8px 12px; font-size: 14px; }
}
@media (max-width: 760px) {
  .app-shell { height: auto; min-height: 100dvh; }
  .navrail { display: flex; flex-direction: column; align-items: stretch; padding: 12px; overflow: visible; }
  .navrail-top { flex-direction: column; align-items: stretch; gap: 12px; }
  .navrail .brand { margin: 0; }
  .nav-items { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: none; gap: 4px; overflow: visible; }
  .nav-item { flex-direction: column; justify-content: center; gap: 3px; height: auto; min-height: 62px; padding: 8px 4px; font-size: 12px; text-align: center; }
  .nav-user { width: auto; align-self: flex-start; padding: 6px 10px; }
  .nav-user-meta { flex-direction: row; gap: 8px; align-items: center; }
  .nav-user-meta span { max-width: 180px; }
  .topbar { padding: 16px; gap: 12px; }
  .topbar h1 { font-size: 22px; }
  .topbar-actions { flex-wrap: wrap; }
  .technical-settings-panel { left: -90px; right: auto; max-width: calc(100vw - 32px); }
  .triage-shell { padding: 12px; }
  .triage-bar-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; }
  .triage-filter { min-width: 0; }
  .triage-filter-post, .triage-bar-actions { grid-column: 1 / -1; }
  .triage-filter select { font-size: 16px; }
  .triage-bar-actions { justify-content: flex-start; }
  .triage-workspace { overflow: visible; }
  .queue-toolbar-actions { flex-wrap: wrap; }
  .header-actions, .page-header { flex-wrap: wrap; }
  .detail-column { padding: 16px 16px 32px; }
  .detail-header { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Comments: conversation first, with a stacked layout on smaller screens. */
.comments-results-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 16px; }
.comments-results-bar p { margin: 0; font-size: 13px; }
#viewComments .comments-table { min-width: 0; table-layout: fixed; }
.comments-table th:first-child { width: 44px; }
.comments-table th:last-child { width: 260px; }
.comments-table .comment-cell { gap: 12px; }
.comments-table .comment-cell > p { width: 100%; font-size: 15px; line-height: 1.65; color: var(--text); }
.conversation-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 16px; }
.conversation-heading strong { font-size: 15px; }
.conversation-heading span, .conversation-page { font-size: 12px; color: var(--muted); }
.conversation-page { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; overflow-wrap: anywhere; }
.comment-extra summary, .comment-more summary { cursor: pointer; color: var(--muted); font-size: 13px; padding: 10px 0; }
.comment-extra[open] summary { margin-bottom: 6px; }
.comment-more { flex-basis: 100%; }
#viewComments .table-action { height: auto; min-height: 40px; padding: 8px 12px; }
#viewComments .comments-toolbar { padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
#viewComments .comments-toolbar input, #viewComments .comments-toolbar select { min-height: 44px; }
#viewComments .filter-tab { min-height: 44px; }
#viewComments .bulk-bar { flex-wrap: wrap; }
#viewComments .loading-cell { padding: 32px; white-space: normal; }
#viewComments .loading-cell p { max-width: 580px; margin: 10px auto; }
.connect-intro h2 { font-size: 21px; margin: 6px 0; }
.connect-intro > p:not(.eyebrow), .connect-intro ol { color: var(--muted); }
.connect-intro ol { padding-left: 22px; line-height: 1.9; margin-bottom: 20px; }
@media (max-width: 1100px) {
  #viewComments .comments-table, #viewComments .comments-table tbody { display: block; width: 100%; }
  #viewComments .comments-table thead { display: block; }
  #viewComments .comments-table thead tr { display: flex; align-items: center; }
  #viewComments .comments-table th { border: 0; }
  #viewComments .comments-table th:nth-child(2) { flex: 1; }
  #viewComments .comments-table th:last-child { display: none; }
  #viewComments .comments-table tbody > tr { display: grid; grid-template-columns: 44px minmax(0, 1fr); border-bottom: 1px solid var(--border-strong); padding: 8px 0; }
  #viewComments .comments-table td { display: block; border: 0; width: auto; min-width: 0; }
  #viewComments .comment-actions-cell { grid-column: 2; }
  #viewComments .comment-reply-row > td, #viewComments .loading-cell { grid-column: 1 / -1; }
  #viewComments .comment-reply-row .inline-reply-composer { margin: 0; }
  #viewComments .comments-table .row-actions { gap: 8px; }
  #viewComments .comments-table .comment-more { flex-basis: auto; }
  #viewComments .comments-table .comment-more[open] { flex-basis: 100%; }
}
@media (max-width: 760px) {
  .comments-results-bar, .comments-pagination { flex-wrap: wrap; }
  #viewComments .comments-toolbar-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #viewComments .comments-search-field { grid-column: 1 / -1; min-width: 0; }
  #viewComments .comments-toolbar-row select { width: 100%; font-size: 16px; }
  #viewComments .comments-search-field input { font-size: 16px; }
  #viewComments .comments-filter-tabs { overflow: visible; }
  #viewComments .filter-tab { flex: 1; padding: 8px; font-size: 12px; }
  #viewComments .inline-reply-composer { padding: 12px; }
  #viewComments .inline-reply-header { flex-wrap: wrap; }
  #viewComments textarea { font-size: 16px; }
}

#viewComments .comment-tags:empty { display: none; }

/* Shared page scope stays usable on narrow screens. */
.page-scope-bar { width: min(1120px, 100%); margin: 0 auto 40px; padding: 22px 28px 0; flex-wrap: wrap; }
.profile-summary { grid-column: 1 / -1; width: 100%; margin: 12px 0 4px; }
.profile-summary h3 { margin: 0 0 4px; font-size: 15px; }
.connection-card.is-active { outline: 2px solid var(--accent, #446b50); outline-offset: 2px; }
.page-scope-bar select { max-width: min(100%, 440px); }
@media (max-width: 640px) { .page-scope-bar .inline-field { width: 100%; } }


/* The scope header and active view share the available height. */
.views { display: flex; flex-direction: column; }
.views > .view { flex: 1; height: auto; min-height: 0; }
.page-scope-bar { flex: 0 0 auto; margin-bottom: 16px; align-items: flex-start; }
.scope-page-status { color: var(--muted); font-size: 12px; line-height: 1.5; }
.scope-page-status:empty { display: none; }
.connection-main h3, .page-switch-main strong { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
.connection-main .connection-status { margin: 6px 0 0; font-size: 12px; color: var(--muted); white-space: normal; }
.page-switch-main p { white-space: normal; overflow-wrap: anywhere; }
.page-switch-main .page-current-label { color: var(--accent); font-size: 12px; }
.detail-column { overscroll-behavior: contain; scrollbar-gutter: stable; }
@media (max-width: 760px) {
  .views { overflow: visible; }
  .views > .view { flex: 0 0 auto; }
}


/* Shared side-aligned connection control, separate from active-page selection. */
.connection-switch { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; width: auto; min-height: 44px; margin-left: auto; padding: 6px 8px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer; }
.connection-switch-track { width: 36px; height: 22px; padding: 3px; border-radius: 20px; background: var(--border-strong); display: flex; align-items: center; }
.connection-switch-track > span { width: 16px; height: 16px; border-radius: 50%; background: var(--text-2); color: var(--accent-contrast); display: grid; place-items: center; font-size: 12px; }
.connection-switch[aria-checked="true"] { color: var(--ok); }
.connection-switch[aria-checked="true"] .connection-switch-track { background: var(--ok); }
.connection-switch[aria-checked="true"] .connection-switch-track > span { margin-left: auto; background: var(--surface); color: var(--ok); }
.connection-switch:disabled { cursor: default; opacity: .8; }
.connection-card-top, .conn-head { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: start; }
.page-switch-item { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: start; }
.page-switch-item > .connection-switch { grid-column: 3; grid-row: 1; }
.page-switch-item > button:not(.connection-switch) { grid-column: 2; width: fit-content; }
@media (max-width: 460px) {
  .connection-card-top, .conn-head, .page-switch-item { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .connection-card-top > .platform-icon, .conn-head > .conn-logo, .page-switch-item > .platform-icon { display: none; }
  .connection-main, .conn-title, .page-switch-main { grid-column: 1; }
  .page-switch-item > .connection-switch { grid-column: 2; }
  .page-switch-item > button:not(.connection-switch) { grid-column: 1; }
  .connection-switch { padding: 6px; gap: 5px; font-size: 11px; }
}


/* Interface language controls and Arabic reading direction. */
.ui-language-field { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); }
.ui-language-field select { min-height: 36px; width: 130px; }
.topbar-actions { flex-wrap: wrap; }
html[dir="rtl"] .navrail { border-right: 0; border-left: 1px solid var(--border); }
html[dir="rtl"] .nav-item, html[dir="rtl"] .nav-user, html[dir="rtl"] .queue-item,
html[dir="rtl"] .moderation-table th, html[dir="rtl"] .moderation-table td { text-align: right; }
html[dir="rtl"] .connection-switch { margin-left: 0; margin-right: auto; }
html[dir="rtl"] .drawer-panel { left: 0; right: auto; }
html[dir="rtl"] .triage-bar-actions { margin-left: 0; margin-right: auto; }
html[dir="rtl"] .guidelines-example-table th, html[dir="rtl"] .guidelines-example-table td { text-align: right; }
.comment-text, .queue-text, .comment-cell > p, .thread-bubble p { unicode-bidi: plaintext; text-align: start; }
@media (max-width: 760px) { .ui-language-field select { font-size: 16px; } }

/* Compact connection switch beside the Active page selector, on every view. */
.page-scope-bar .scope-page-status { align-self: flex-end; display: flex; }
.connection-switch.compact { min-height: 32px; margin-left: 0; padding: 4px 8px; gap: 6px; font-size: 11px; }
.connection-switch.compact .connection-switch-track { width: 28px; height: 16px; padding: 2px; }
.connection-switch.compact .connection-switch-track > span { width: 12px; height: 12px; font-size: 9px; }
@media (max-width: 640px) { .page-scope-bar .scope-page-status { align-self: flex-start; } }

/* Simplified Your pages view: cards hold only name, switch, and active state. */
#viewConnections .connection-card { min-height: 0; gap: 14px; }
#viewConnections .pages-header { align-items: center; }
#viewConnections .pages-header .connect-platform-notice { margin: 0; }
#viewConnections #autoHidePanel { margin-bottom: 20px; }

/* Shared content edges and compact appearance controls. */
.triage-shell { width: min(1120px, 100%); margin-inline: auto; padding: 24px 28px 36px; }
.topbar > :first-child { min-width: 0; }
.topbar-actions { flex-shrink: 0; flex-wrap: nowrap; gap: 8px; }
.header-preference { display: inline-flex; flex-direction: row; align-items: center; gap: 5px; flex: 0 0 auto; height: 34px; color: var(--text-2); }
.header-preference svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; flex-shrink: 0; }
.header-preference select { width: auto; max-width: 112px; height: 34px; min-height: 34px; padding-block: 4px; padding-inline-start: 8px; font-size: 12px; }
.topbar .toolbar-button { height: 34px; min-height: 34px; padding: 4px 12px; font-size: 12px; }
.topbar .technical-settings > summary { padding-block: 7px; font-size: 12px; white-space: nowrap; }
.topbar .status-pill { white-space: nowrap; }
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f7f5; --surface: #ffffff; --surface-2: #edf2ef; --surface-muted: #e6ede8;
  --border: #d3ddd6; --border-strong: #a8b9ae;
  --text: #18271e; --text-2: #354c3e; --muted: #566c5e;
  --accent: #16723c; --accent-strong: #105d30; --accent-weak: rgba(22,114,60,.10); --accent-contrast: #ffffff;
  --hero: #e4f2e9;
  --crit: #b42332; --crit-weak: rgba(180,35,50,.09);
  --warn: #855600; --warn-weak: rgba(133,86,0,.09);
  --info: #245faa; --info-weak: rgba(36,95,170,.09);
  --ok: #16723c; --ok-weak: rgba(22,114,60,.10);
  --shadow-sm: 0 1px 3px rgba(25,50,35,.08); --shadow-md: 0 10px 32px rgba(25,50,35,.14);
}
:root[data-theme="light"] .toast { background: var(--surface); }
:root[data-theme="light"] .fact-check-history,
:root[data-theme="light"] .fact-check-dispute-followup { border-color: var(--border); }
@media (max-width: 1100px) {
  .topbar { flex-wrap: wrap; }
  .topbar-actions { flex-wrap: wrap; }
}
@media (max-width: 760px) {
  .triage-shell { padding: 12px 16px 24px; }
  .header-preference select { font-size: 16px; max-width: 120px; }
}

/* Post choices have text only, unlike page rows with an icon and connection switch. */
.page-switch-item.triage-post-item { display: block; text-align: start; }
.triage-post-item .page-switch-main > div { flex-wrap: wrap; }
.triage-post-item .page-switch-main strong { flex: 1 1 160px; }
.triage-post-item .queue-chip { flex-shrink: 0; }

.reply-policy-preview pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 220px; overflow: auto; font: inherit; padding: 10px; background: var(--surface); border-radius: var(--radius-sm); }

/* Review shares one scroll surface with its filters, queue and detail. */
#viewTriage { overflow-y: auto; }
#viewTriage .triage-shell { flex: 0 0 auto; min-height: 100%; }
#viewTriage .triage-workspace { flex: 0 0 auto; grid-template-rows: auto; align-items: start; }
#viewTriage .queue-column, #viewTriage .queue-scroll, #viewTriage .detail-column {
  overflow: visible;
  overscroll-behavior: auto;
}
#viewTriage .queue-scroll { flex: 0 0 auto; }
#viewTriage .queue-column.queue-bulk-active .queue-scroll { padding-bottom: 0; }
#viewTriage .queue-floating-bar { position: sticky; bottom: 12px; margin: 10px; }
#viewTriage .detail-back-label { display: inline; }
#viewTriage .detail-close-icon { display: none; }
#viewTriage #clearSelectionButton { width: auto; height: auto; min-height: 44px; padding: 8px 12px; font-size: 14px; white-space: nowrap; }
@media (max-width: 760px) {
  #viewTriage { height: auto; overflow: visible; }
  #viewTriage .triage-shell { min-height: 0; }
}

/* Keep everyday review controls prominent; disclose secondary controls on demand. */
#viewTriage .review-disclosure { border-top: 1px solid var(--border); margin-block: 12px; padding-top: 8px; }
#viewTriage .review-disclosure > summary { cursor: pointer; color: var(--muted); font-size: 13px; padding-block: 10px; }
#viewTriage .review-disclosure[open] > summary { color: var(--text); margin-bottom: 8px; }
#viewTriage .review-disclosure > .triage-bar-row { flex-wrap: wrap; }
#viewTriage .review-disclosure .triage-filter { flex: 1 1 180px; min-width: 0; }
/* "Why this result": AI explanation first, then Elfbot's rule-based automatic decision. */
#viewTriage .why-panel { font-size: 13px; overflow-wrap: anywhere; }
#viewTriage .why-panel p { margin: 0 0 4px; }
#viewTriage .why-panel .why-note { font-size: 12px; }
#viewTriage .why-auto { margin-top: 10px; padding: 8px 12px; border-left: 3px solid var(--border); background: var(--surface-2); border-radius: 6px; }
#viewTriage .why-auto ul { margin: 4px 0; padding-inline-start: 18px; }

/* Simple fact-check: one verdict card per claim (label colour = CORRECTIV-style scale). */
.verdict-card { --verdict: var(--muted); --verdict-weak: var(--surface-2); margin:12px 0; padding:14px 16px; border:1px solid var(--border); border-left:4px solid var(--verdict); border-radius:10px; background:var(--surface); overflow-wrap:anywhere; }
.verdict-card p { margin:6px 0; }
.verdict-false { --verdict: var(--crit); --verdict-weak: var(--crit-weak); }
.verdict-true { --verdict: var(--ok); --verdict-weak: var(--ok-weak); }
.verdict-missing_context { --verdict: var(--warn); --verdict-weak: var(--warn-weak); }
.verdict-unproven, .verdict-needs_details { --verdict: var(--muted); --verdict-weak: var(--surface-2); }
.verdict-opinion { --verdict: var(--info); --verdict-weak: var(--info-weak); }
.verdict-claim { font-weight:600; }
.verdict-badge { display:inline-flex; align-items:center; gap:6px; padding:3px 10px; border-radius:var(--radius-pill); font-weight:700; font-size:.9rem; color:var(--verdict, var(--info)); background:var(--verdict-weak, var(--info-weak)); }
.verdict-origin { font-size:.85rem; margin-left:6px; }
.verdict-reason { font-size:1.02rem; }
.verdict-sources { margin:10px 0 0; padding-left:20px; }
.verdict-sources li { margin:8px 0; }
.verdict-sources blockquote { margin:4px 0 0 !important; padding:6px 10px !important; font-size:.9rem; }
.verdict-says { display:inline-block; margin-left:6px; font-size:.8rem; color:var(--text-muted); }
.verdict-says-contradicts { color:var(--crit); }
.verdict-says-supports { color:var(--ok); }
.verdict-says-context { color:var(--warn); }
.verdict-opinion-note { color:var(--text-muted); }
.fact-check-footnote { font-size:.85rem; color:var(--text-muted); }
.fact-check-banner { padding:8px 12px; border-radius:8px; background:var(--warn-weak); }
.fact-check-more > summary { cursor:pointer; color:var(--text-muted); }
@media (max-width:600px) { .verdict-card { padding:12px; } .verdict-origin { display:block; margin:4px 0 0; } }
#viewTriage .why-quote { font-style: italic; }
#viewTriage .why-found p + p { margin-top: 4px; }
