/* Shared look for the review panel. Old panel.css stays for pages not redesigned yet. */

:root {
  --font: "Vazirmatn", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;

  --bg: #F4F6FA;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --border: #E3E8F0;
  --border-strong: #CBD5E1;

  --text: #1B2433;
  --text-muted: #5B6778;
  --text-faint: #8793A5;

  --brand-navy: #1F3A5C;
  --primary: #2457D6;
  --primary-hover: #1C46B0;
  --primary-50: #EAF0FF;
  --primary-100: #D6E2FF;

  --success: #0F7A50;
  --success-bg: #E6F6EE;
  --success-border: #BFE6D3;
  --warning: #8A5A00;
  --warning-bg: #FFF6E0;
  --warning-border: #F3DDA3;
  --danger: #B42336;
  --danger-bg: #FDECEF;
  --danger-border: #F5C2CB;
  --info: #1F5FA8;
  --info-bg: #E8F1FB;
  --info-border: #BBD6F0;
  --neutral-text: #4A5568;
  --neutral-bg: #EEF1F5;
  --neutral-border: #DDE3EB;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, .08);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  --topbar-h: 60px;
  --sidebar-w: 264px;
  --content-max: 1280px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.85;
  color: var(--text);
  background: var(--bg);
}

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

a {
  color: var(--primary);
}

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
}

.icon--log-out {
  transform: scaleX(-1);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  height: var(--topbar-h);
  padding: 0 var(--space-4);
  background: var(--surface);
  color: var(--text);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar__start,
.topbar__end,
.topbar__brand,
.userchip {
  display: flex;
  align-items: center;
}

.topbar__start,
.topbar__brand {
  gap: 10px;
  min-width: 0;
}

.topbar__end {
  gap: var(--space-3);
}

.topbar__menu {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

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

.topbar__name {
  font-size: 16px;
  font-weight: 700;
  color: var(--brand-navy);
  white-space: nowrap;
}

.topbar__divider {
  width: 1px;
  height: 18px;
  background: var(--border-strong);
}

.topbar__holding {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

.userchip {
  gap: var(--space-2);
}

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

.userchip__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary-50);
  color: var(--primary);
  font-weight: 700;
}

.userchip__name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}

.userchip__role {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.3;
}

.topbar__logout {
  margin: 0;
}

.shell {
  display: flex;
  align-items: stretch;
  min-height: calc(100vh - var(--topbar-h));
}

.sidebar {
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  background: var(--surface);
  border-inline-end: 1px solid var(--border);
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 16px 12px;
}

.sidebar__title {
  margin: 20px 12px 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-faint);
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 12px;
  border-radius: var(--radius);
  border-inline-start: 3px solid transparent;
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
}

.sidebar__link:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}

.sidebar__link.active {
  background: var(--primary-50);
  color: var(--primary);
  font-weight: 700;
  border-inline-start-color: var(--primary);
}

.sidebar__label {
  flex: 1;
  min-width: 0;
}

.sidebar .menu-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-border);
  font-size: 12px;
  font-weight: 600;
  min-width: 0;
}

.sidebar-overlay {
  display: none;
}

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

.content__inner {
  max-width: var(--content-max);
  margin-inline: auto;
  padding: 24px 32px 48px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.page-title {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.4;
}

.page-subtitle {
  margin: 4px 0 0;
  font-size: 15px;
  color: var(--text-muted);
}

.page-header__meta {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.page-header__aside {
  font-size: 14px;
  color: var(--text-muted);
  white-space: nowrap;
}

.card {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px 24px;
}

.card strong {
  display: inline;
  font-weight: 700;
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}

.card__title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.card__hint {
  font-size: 13px;
  color: var(--text-muted);
}

.card__body {
  min-width: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 40px;
  padding: 0 var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 120ms, border-color 120ms, color 120ms;
}

.btn:hover {
  text-decoration: none;
}

.btn--primary {
  background: var(--primary);
  color: #fff;
}

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

.btn--secondary {
  background: #fff;
  border-color: var(--border-strong);
  color: var(--text);
}

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

.btn--ghost {
  color: var(--text-muted);
}

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

.btn--danger {
  background: var(--danger);
  color: #fff;
}

.btn--sm {
  height: 32px;
  padding: 0 var(--space-3);
  font-size: 13px;
}

.btn--lg {
  height: 44px;
  padding: 0 18px;
  font-size: 15px;
}

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

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

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

.badge--success { color: var(--success); background: var(--success-bg); border-color: var(--success-border); }
.badge--warning { color: var(--warning); background: var(--warning-bg); border-color: var(--warning-border); }
.badge--danger { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-border); }
.badge--info { color: var(--info); background: var(--info-bg); border-color: var(--info-border); }
.badge--neutral { color: var(--neutral-text); background: var(--neutral-bg); border-color: var(--neutral-border); }

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
}

.alert .icon {
  margin-top: 3px;
}

.alert--info { background: var(--info-bg); border-color: var(--info-border); }
.alert--info .icon { color: var(--info); }
.alert--success { background: var(--success-bg); border-color: var(--success-border); }
.alert--success .icon { color: var(--success); }
.alert--warning { background: var(--warning-bg); border-color: var(--warning-border); }
.alert--warning .icon { color: var(--warning); }
.alert--danger { background: var(--danger-bg); border-color: var(--danger-border); }
.alert--danger .icon { color: var(--danger); }

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

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: start;
}

.table th {
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

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

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

.field__label {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.field__help {
  font-size: 13px;
  line-height: 1.8;
  color: var(--text-muted);
}

.field__req {
  color: var(--danger);
}

.field__error {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 0;
  font-size: 13px;
  color: var(--danger);
}

.field__error .icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin-top: 2px;
}

.input,
.select,
.textarea {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
}

.input-group {
  position: relative;
}

.input-group .input {
  padding-inline-end: 44px;
}

.input-group__toggle {
  position: absolute;
  inset-inline-end: 4px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

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

.textarea {
  height: auto;
  min-height: 96px;
  padding: 8px 12px;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--primary);
}

.kv {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.kv:last-child {
  border-bottom: 0;
}

.kv__title {
  font-size: 15px;
  font-weight: 600;
}

.kv__help {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.kv__value {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  text-align: end;
}

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

.kv .alert {
  margin-top: var(--space-2);
}

.pill {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--neutral-bg);
  color: var(--neutral-text);
  font-size: 13px;
}

.pill--on {
  background: var(--success-bg);
  color: var(--success);
}

.pill--off {
  background: var(--neutral-bg);
  color: var(--neutral-text);
}

.empty {
  padding: var(--space-6);
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.kpi {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 100%;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  color: inherit;
  text-decoration: none;
}

.kpi:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

.kpi__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.kpi__icon .icon {
  width: 22px;
  height: 22px;
}

.kpi--primary .kpi__icon { background: var(--primary-50); color: var(--primary); }
.kpi--warning .kpi__icon { background: var(--warning-bg); color: var(--warning); }
.kpi--info .kpi__icon { background: var(--info-bg); color: var(--info); }
.kpi--neutral .kpi__icon { background: var(--neutral-bg); color: var(--neutral-text); }

.kpi__labelrow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.kpi__label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

.kpi__value {
  font-size: 34px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
}

.kpi__help {
  min-height: 2.8em;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-muted);
}

.kpi__cta {
  margin-top: auto;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
}

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: var(--space-5);
  align-items: start;
}

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

.home-grid__side {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.status-block + .status-block {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.status-block__title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-faint);
}

.site-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.site-box + .site-box {
  margin-top: var(--space-3);
}

.site-box__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.site-box__name {
  font-size: 15px;
  font-weight: 700;
}

.site-box__sync {
  font-size: 13px;
  color: var(--text-muted);
  text-align: end;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.site-box__meta,
.guide-foot {
  margin: var(--space-3) 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stack .btn {
  width: 100%;
}

.card__rule {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 4px 0;
}

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.steps li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: 14px;
  line-height: 1.9;
}

.steps__n {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  margin-top: 2px;
  border-radius: 50%;
  background: var(--primary-50);
  color: var(--primary);
  font-weight: 700;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-3);
}

.stat__label {
  font-size: 13px;
  color: var(--text-muted);
}

.stat__value {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
}

@media (max-width: 1023px) {
  .topbar__menu {
    display: inline-flex;
  }

  .sidebar {
    position: fixed;
    z-index: 30;
    inset-inline-start: 0;
    top: var(--topbar-h);
    transform: translateX(100%);
  }

  body.sidebar-open .sidebar {
    transform: none;
  }

  body.sidebar-open .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(16, 24, 40, .28);
  }

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

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

@media (max-width: 639px) {
  .content__inner {
    padding: 16px;
  }
}

@media (max-width: 559px) {
  .kpi-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .page-header {
    flex-direction: column;
  }
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.login-stack {
  width: 100%;
  max-width: 420px;
}

.login-card {
  max-width: 420px;
  width: 100%;
  padding: 36px 32px;
  box-shadow: var(--shadow-md);
}

.login-card button {
  margin-top: 0;
}

.login-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  border-radius: 14px;
  background: var(--primary);
  color: #fff;
}

.login-mark .icon {
  width: 28px;
  height: 28px;
}

.login-title {
  margin: 0;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.login-subtitle {
  margin: 4px 0 24px;
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
  white-space: nowrap;
}

.login-card .alert {
  margin-bottom: 16px;
}

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

.login-card .input {
  height: 44px;
  font-size: 16px;
}

.login-caps {
  display: none;
  color: var(--warning);
}

.login-caps.is-on {
  display: block;
}

.login-submit {
  width: 100%;
  height: 44px;
  font-size: 15px;
}

.login-help {
  margin: 20px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

.login-foot {
  margin: 20px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--text-faint);
}

@media (max-width: 479px) {
  .login-card {
    padding: 28px 20px;
    box-shadow: none;
  }

  .login-subtitle {
    font-size: 13px;
    white-space: normal;
  }
}

/* Horizontal filter row. Later list pages reuse it. */
.filterbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px;
  padding: 16px 20px;
  margin-bottom: 16px;
}

.filterbar__note {
  flex: 1 0 100%;
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

/* Sources page: status chips and the problem checkbox stay on one line. */
.sources-page .filterbar {
  align-items: center;
}

.sources-page .filterbar .searchbox {
  flex: 1 1 200px;
  min-width: 160px;
}

.filterbar__choices {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.sources-page .filterbar .checkbox-box {
  align-items: center;
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 4px 12px;
}

.sources-page .filterbar .checkbox-box input {
  margin-top: 0;
}

/* Segmented tabs. The look applies only when a page uses .tabs__tab. */
.tabs:has(.tabs__tab) {
  display: inline-flex;
  align-items: stretch;
  gap: 0;
  padding: 0;
  border-bottom: 1px solid var(--border);
}

.tabs__tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 16px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.tabs__tab[aria-selected="true"],
a.tabs__tab[aria-current="page"] {
  background: #fff;
  color: var(--primary);
  border-bottom-color: var(--primary);
}

a.tabs__tab {
  text-decoration: none;
}

.tabs__count {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--neutral-bg);
  color: var(--neutral-text);
  font-size: 12.5px;
  font-weight: 600;
}

.tabs__count--main {
  background: var(--primary-50);
  color: var(--primary);
}

.tabs__count--warn {
  background: var(--warning-bg);
  color: var(--warning);
}

/* Two-choice switch, such as sort order. */
.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.segmented__item {
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.segmented__item.is-active {
  background: #fff;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Small source or category label. */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 12.5px;
  text-decoration: none;
}

.chip:hover {
  text-decoration: none;
  border-color: var(--border-strong);
}

a.chip--link {
  color: var(--primary);
  cursor: pointer;
}

a.chip--link:hover {
  text-decoration: underline;
}

.chip .icon {
  width: 12px;
  height: 12px;
}

/* One cluster in a list. */
.news-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  margin-bottom: 10px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.news-row:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.news-row--mine {
  background: var(--primary-50);
  border-color: var(--primary-100);
}

.news-row--other {
  background: var(--surface-2);
}

.news-row--other .news-row__title {
  color: var(--text-muted);
}

/* Queue row: title, then the take control, then source links in the tab order. */
.news-row:has(.news-row__rest) > .news-row__body {
  display: contents;
}

.news-row:has(.news-row__rest) > .score {
  grid-column: 1;
  grid-row: 1 / span 2;
  align-self: center;
}

.news-row:has(.news-row__rest) .news-row__title {
  grid-column: 2;
  grid-row: 1;
}

.news-row:has(.news-row__rest) .news-row__action {
  grid-column: 3;
  grid-row: 1 / span 2;
  align-self: center;
}

.news-row:has(.news-row__rest) .news-row__rest {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
}

.news-row--fresh {
  animation: queue-taken 600ms ease;
}

@keyframes queue-taken {
  from { background: var(--success-bg); }
  to { background: var(--primary-50); }
}

@media (prefers-reduced-motion: reduce) {
  .news-row--fresh {
    animation: none;
  }
}

.chip--more {
  display: none;
  cursor: pointer;
  font: inherit;
}

html.js .chip--more {
  display: inline-flex;
}

html.js .chip--more[hidden] {
  display: none;
}

html.js .chip-extra {
  display: none;
}

html.js .chip-extra.is-open {
  display: inline;
}

.toast--success {
  border-color: var(--success-border);
  background: var(--success-bg);
}

.toast--neutral {
  border-color: var(--border-strong);
  background: var(--surface);
}

/* Fade and collapse a row that is leaving the list. */
.row-leave {
  overflow: hidden;
  animation: row-leave 150ms ease forwards;
}

@keyframes row-leave {
  from { opacity: 1; max-height: 280px; }
  to { opacity: 0; max-height: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .row-leave { animation: none; }
}

.news-row__title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.7;
  color: var(--text);
  text-decoration: none;
}

.news-row__title:hover {
  color: var(--primary);
  text-decoration: underline;
}

.news-row__tags,
.news-row__meta,
.news-row__sources {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.news-row__tags {
  margin-top: 4px;
}

.news-row__meta {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-muted);
  gap: 0;
}

.meta-item + .meta-item {
  margin-inline-start: 10px;
  padding-inline-start: 10px;
  border-inline-start: 1px solid var(--border-strong);
}

.news-row__held {
  font-size: 13px;
  color: var(--text-muted);
}

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

.news-row__action form {
  margin: 0;
}

.news-row__action .btn {
  white-space: nowrap;
}

/* Priority score square. */
.score {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 12px;
}

.score__value {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.1;
}

.score__caption {
  font-size: 10.5px;
  line-height: 1.2;
}

.score--high {
  background: var(--primary);
  color: #fff;
}

.score--mid {
  background: var(--primary-50);
  color: var(--primary);
}

.score--low,
.score--none {
  background: var(--neutral-bg);
  color: var(--neutral-text);
}

.queue-refresh {
  font-size: 13px;
}

.queue-alert {
  margin-bottom: 16px;
}

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

.queue-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

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

.queue-sort__label {
  font-size: 13px;
  color: var(--text-muted);
}

.queue-hint {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--text-muted);
}

html.js .queue-panel {
  display: none;
}

html.js .queue-panel.is-active {
  display: block;
}

.queue-panel .empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.badge .icon,
.news-row__meta .badge .icon {
  width: 14px;
  height: 14px;
}

@media (max-width: 899px) {
  .news-row {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .news-row__action {
    grid-column: 1 / -1;
  }

  .news-row:has(.news-row__rest) .news-row__action {
    grid-column: 1 / -1;
    grid-row: 3;
  }

  .news-row__action .btn {
    width: 100%;
    height: 40px;
  }
}

@media (max-width: 639px) {
  .filterbar .field,
  .filterbar .select {
    width: 100%;
  }

  .queue-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .tabs:has(.tabs__tab) {
    width: 100%;
  }

  .tabs__tab {
    flex: 1;
  }
}

/* Green primary action, such as «منتشر شد». */
.btn--success {
  background: var(--success);
  color: #fff;
}

.btn--success:hover {
  background: #0c6844;
}

/* Danger action that stays on a white background. */
.btn--outline-danger {
  background: #fff;
  border-color: var(--danger);
  color: var(--danger);
}

.btn--outline-danger:hover {
  background: var(--danger-bg);
}

/* Sticky row of the main actions on a work page. */
.actionbar {
  position: sticky;
  top: var(--topbar-h);
  z-index: 15;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 16px 0;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

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

.actionbar form {
  margin: 0;
}

.actionbar__hint,
.actionbar__held {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

/* Collapsible block with a rotating chevron. */
.disclosure {
  margin-top: 8px;
  border-top: 1px solid var(--border);
}

.disclosure > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.disclosure > summary::-webkit-details-marker {
  display: none;
}

.disclosure__chevron {
  display: inline-flex;
  transition: transform 120ms;
}

.disclosure[open] > summary .disclosure__chevron {
  transform: rotate(180deg);
}

.disclosure--accent {
  margin-top: 0;
  margin-bottom: 16px;
  border: 1px solid var(--primary-100);
  border-radius: var(--radius);
  background: var(--primary-50);
  padding: 14px 18px;
}

.disclosure--accent:hover {
  background: color-mix(in srgb, var(--primary-50) 82%, var(--primary));
}

.disclosure--accent > summary {
  padding: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
}

.disclosure--accent > summary > .icon,
.disclosure--accent .disclosure__chevron .icon {
  width: 20px;
  height: 20px;
}

.disclosure--accent .disclosure__chevron {
  margin-inline-start: auto;
}

.disclosure__aside {
  margin-inline-start: auto;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.disclosure__intro,
.factor-quote__label {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.factor-quote__label {
  font-weight: 600;
}

.factor-quote {
  margin: 0;
  border-inline-start: 3px solid var(--border-strong);
  padding-inline-start: 12px;
  color: var(--text);
}

/* One editable field: label line, control, save line. */
.fieldrow {
  margin-bottom: 18px;
}

.fieldrow__head,
.fieldrow__foot {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.fieldrow__foot {
  align-items: center;
  margin-top: 8px;
}

.fieldrow__label {
  font-size: 15px;
  font-weight: 700;
}

.fieldrow__help,
.fieldrow__count {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

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

.fieldrow__dirty {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--warning);
}

.fieldrow.is-dirty .input,
.fieldrow.is-dirty .textarea,
.fieldrow.is-dirty .select {
  border-color: var(--warning);
}

.fieldrow__count.is-over {
  color: var(--danger);
  font-weight: 700;
}

.textarea--lead {
  min-height: 96px;
  line-height: 1.9;
}

.textarea--body {
  min-height: 220px;
  line-height: 1.9;
}

.textarea--meta {
  min-height: 80px;
  line-height: 1.9;
}

/* Smaller tabs, used inside a field. */
.tabs--sm .tabs__tab {
  height: 36px;
  font-size: 13px;
}

html.js .body-pane {
  display: none;
}

html.js .body-pane.is-active {
  display: block;
}

.body-preview {
  max-height: 520px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  line-height: 2;
}

/* One original source under the rewritten news. */
.source {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

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

.source__time,
.source__hint,
.source__kicker,
.source__extra {
  font-size: 13px;
  color: var(--text-muted);
}

.source__kicker {
  margin: 12px 0 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-faint);
}

.source__title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.source-body p {
  margin: 0 0 12px;
  font-size: 15px;
  line-height: 2;
}

.review-back {
  margin: 0 0 12px;
}

.review-eyebrow {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.review-title {
  margin: 0 0 12px;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.7;
}

.review-badges,
.review-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.review-meta {
  margin: 10px 0;
  font-size: 14px;
  color: var(--text-muted);
}

.review-header .alert {
  margin-top: 8px;
}

.review-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.review-column-title {
  margin: 0 0 12px;
  font-size: 17px;
  font-weight: 700;
}

.review-edit-note {
  margin-bottom: 16px;
}

.review-draft .card + .card,
.review-subhead {
  margin-top: 16px;
}

.review-sources {
  position: sticky;
  top: calc(var(--topbar-h) + 72px);
  max-height: calc(100vh - var(--topbar-h) - 96px);
  overflow-y: auto;
}

.draft-image {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.draft-image img {
  max-width: 240px;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.draft-image figcaption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.dialog__question {
  margin: 0;
  font-size: 15px;
  line-height: 1.9;
  color: var(--text);
}

.dialog .input,
.dialog .select,
.dialog .textarea {
  margin-top: 6px;
}

@media (max-width: 1099px) {
  .review-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .review-sources {
    position: static;
    max-height: 70vh;
  }
}

/* How many items this person may still take. */
.slots {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.slots__label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.slots__track {
  display: flex;
  gap: 4px;
}

.slots__seg {
  width: 28px;
  height: 8px;
  border-radius: 4px;
  background: var(--border);
}

.slots__seg.is-filled {
  background: var(--primary);
}

.slots.is-full .slots__seg {
  background: var(--warning);
}

.slots__bar {
  width: 160px;
  height: 8px;
  border-radius: 4px;
  background: var(--border);
  overflow: hidden;
}

.slots__bar > span {
  display: block;
  height: 100%;
  background: var(--primary);
}

.slots.is-full .slots__bar > span {
  background: var(--warning);
}

/* Own held rows stay white; the queue still tints its «در دست تو» rows. */
.mine-list .news-row--mine {
  background: var(--surface);
  border-color: var(--border);
}

.mine-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 6px 0 0;
  font-size: 13px;
}

.mine-note {
  margin: -4px 0 12px;
  font-size: 13px;
  color: var(--text-faint);
}

.empty__mark .icon {
  width: 40px;
  height: 40px;
  color: var(--text-muted);
}

.empty__title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

@media (max-width: 899px) {
  .mine-list .news-row__action > .btn,
  .mine-list .news-row__action > form {
    width: calc(50% - 4px);
  }

  .mine-list .news-row__action > form .btn {
    width: 100%;
  }
}

@media (max-width: 639px) {
  .mine-page {
    flex-direction: column;
  }

  .slots {
    align-items: flex-start;
  }
}

/* Confidence square on the irrelevant box. Queue scores keep their own colours. */
.news-row--irrelevant {
  align-items: start;
  container-type: inline-size;
}

.news-row--done {
  background: var(--surface-2);
}

.news-row--irrelevant .news-row__action {
  flex-direction: column;
  align-items: stretch;
  width: 190px;
  gap: 8px;
}

.news-row--irrelevant .news-row__action form,
.news-row--irrelevant .news-row__action .btn {
  width: 100%;
}

.news-row__decision-badge {
  margin: 0 0 6px;
}

.news-row__decision {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.news-row--irrelevant .score--low {
  background: var(--warning-bg);
  color: var(--warning);
}

.news-row--irrelevant .score--mid {
  background: var(--neutral-bg);
  color: var(--neutral-text);
}

.news-row--irrelevant .score--sure {
  background: var(--neutral-bg);
  color: var(--text-faint);
}

.news-row__title:not(a):hover {
  color: var(--text);
  text-decoration: none;
}

.reason {
  margin: 4px 0 0;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-muted);
}

.reason strong {
  color: var(--text);
}

html.js .reason {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

html.js .reason.is-open,
html.js .reason--empty {
  display: block;
  overflow: visible;
  -webkit-line-clamp: unset;
}

.reason--empty {
  font-style: italic;
}

.reason__more {
  margin-top: 2px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--primary);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.reason-keyword {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.fulltext > summary {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  list-style: none;
}

.fulltext > summary::-webkit-details-marker {
  display: none;
}

.fulltext__close {
  display: none;
}

.fulltext[open] .fulltext__open {
  display: none;
}

.fulltext[open] .fulltext__close {
  display: inline;
}

.fulltext[open] > summary .disclosure__chevron {
  transform: rotate(180deg);
}

.fulltext__body {
  flex: 1 0 100%;
  margin-top: 8px;
  padding: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 320px;
  overflow: auto;
  font-size: 15px;
  line-height: 2;
}

.news-row--irrelevant .fulltext__body {
  width: 100cqi;
  margin-inline-start: -80px;
}

.fulltext__body p {
  margin: 0 0 12px;
}

.rescue-hint {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

.box-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(130px, 1fr));
  gap: 12px;
  margin: 0;
  flex: none;
}

.badge--plain::before {
  content: none;
}

.disclosure__list {
  margin: 0 0 12px;
  padding-inline-start: 1.4em;
  font-size: 14px;
  line-height: 2;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

#irrelevant-filters .checkbox,
#duplicates-filters .checkbox {
  white-space: nowrap;
  flex: 0 0 auto;
  min-width: 220px;
}

#duplicates-filters .checkbox {
  min-width: 230px;
}

html.js .is-filtered-out {
  display: none;
}

@media (max-width: 899px) {
  .news-row--irrelevant .news-row__action {
    flex-direction: row;
    width: 100%;
  }

  .news-row--irrelevant .news-row__action form {
    flex: 1 1 50%;
    width: auto;
  }
}

@media (max-width: 639px) {
  .page-header:has(.box-stats) {
    flex-direction: column;
  }

  #irrelevant-filters {
    align-items: stretch;
  }

  #irrelevant-filters .field,
  #irrelevant-filters .queue-sort,
  #irrelevant-filters .checkbox {
    flex: 1 1 100%;
    min-width: 0;
    white-space: normal;
  }

  #irrelevant-filters .segmented {
    flex-wrap: wrap;
  }
}

@media (max-width: 639px) {
  .actionbar__buttons .btn,
  .actionbar__buttons form {
    width: calc(50% - 5px);
  }

  .actionbar__buttons .btn {
    width: 100%;
  }

  .draft-image {
    flex-direction: column;
  }
}

/* One duplicate: the new item beside the one it repeats. */
.dupcard {
  padding: 0;
  margin-bottom: 12px;
}

.compare {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
  padding: 16px 20px;
}

.compare__side {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.compare__side--existing {
  background: var(--surface);
}

.compare__center {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.compare__center::before {
  content: "";
  position: absolute;
  top: 50%;
  inset-inline: -16px;
  height: 1px;
  background: var(--border-strong);
}

.simcircle {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--primary-50);
  color: var(--primary);
}

.simcircle__value {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.1;
}

.simcircle__caption {
  font-size: 11px;
}

.simpill {
  display: none;
}

.dupcard__eyebrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-faint);
}

.dupcard__eyebrow .icon {
  width: 14px;
  height: 14px;
}

.dupcard__title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 6px 0 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.7;
  color: var(--text);
  text-decoration: none;
}

a.dupcard__title:hover {
  color: var(--primary);
}

.dupcard__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.dupcard__foot {
  border-top: 1px solid var(--border);
  padding: 14px 20px;
}

.dupcard .reason,
.dupcard .reason strong {
  font-size: 14px;
  line-height: 1.8;
}

.dupcard .reason strong {
  display: inline;
  font-weight: 700;
  color: var(--text);
}

.dupcard .chip .icon {
  width: 12px;
  height: 12px;
}

.dupcard--done {
  background: var(--surface-2);
}

.dupcard__badge {
  margin: 0;
  padding: 14px 20px 0;
}

.dupcard__line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-muted);
}

.dupcard__rescue {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin-inline-start: auto;
}

.dupcard__rescue form {
  margin: 0;
}

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

  .compare__center::before,
  .simcircle {
    display: none;
  }

  .simpill {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--primary-50);
    color: var(--primary);
    font-size: 14px;
    font-weight: 700;
  }

  .dupcard__line {
    flex-direction: column;
    align-items: stretch;
  }

  .dupcard__rescue {
    width: 100%;
    margin-inline-start: 0;
  }

  .dupcard__rescue form {
    flex: 1 1 50%;
  }

  .dupcard__rescue .btn {
    width: 100%;
    height: 40px;
  }
}

@media (max-width: 639px) {
  #duplicates-filters {
    align-items: stretch;
  }

  #duplicates-filters .field,
  #duplicates-filters .queue-sort,
  #duplicates-filters .checkbox {
    flex: 1 1 100%;
    min-width: 0;
    white-space: normal;
  }

  #duplicates-filters .segmented {
    flex-wrap: wrap;
  }
}

/* One suspected reportage, with the decision on the end side. */
.advcard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  gap: 20px;
  align-items: start;
  padding: 16px 20px;
  margin-bottom: 12px;
}

.advcard--done {
  background: var(--surface-2);
}

.advcard__badges,
.advcard__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.advcard__title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 8px 0 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.7;
}

.advcard__meta {
  gap: 0;
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.advcard__decision {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.advcard__more {
  font-size: 13px;
  color: var(--text-muted);
}

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

.advcard__actions form {
  margin: 0;
}

.advcard__actions .btn {
  width: 100%;
}

.fulltext mark {
  background: var(--warning-bg);
  color: inherit;
  padding: 0 2px;
  border-radius: 3px;
}

.empty__mark--ok .icon {
  color: var(--success);
}

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

  .advcard__actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .advcard__actions form {
    width: calc(50% - 4px);
  }

  .advcard__actions .btn {
    height: 40px;
  }
}

@media (max-width: 639px) {
  #advertorial-filters {
    align-items: stretch;
  }

  #advertorial-filters .segmented {
    flex-wrap: wrap;
  }
}

/* History filters, table and page numbers. */
.history-filters {
  align-items: flex-end;
}

.history-search {
  flex: 1 0 100%;
}

.searchbox {
  position: relative;
}

.searchbox > .icon {
  position: absolute;
  inset-inline-start: 10px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.searchbox .input {
  width: 100%;
  padding-inline-start: 34px;
}

.history-filters__row,
.history-dates,
.history-filters__actions,
.history-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

.history-dates {
  flex-direction: column;
  align-items: stretch;
}

.history-dates__help {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.history-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 12px;
}

.history-summary__total {
  font-size: 15px;
  font-weight: 700;
}

.history-summary__page {
  font-size: 14px;
  color: var(--text-muted);
}

.table--history {
  font-size: 14px;
}

.table--history th,
.table--history td {
  vertical-align: middle;
}

.table--history th:nth-child(1),
.table--history td:nth-child(1) { width: 110px; }
.table--history th:nth-child(2),
.table--history td:nth-child(2) { min-width: 280px; }
.table--history th:nth-child(3),
.table--history td:nth-child(3) { width: 200px; }
.table--history th:nth-child(4),
.table--history td:nth-child(4) { width: 130px; }
.table--history th:nth-child(5),
.table--history td:nth-child(5) { width: 130px; }
.table--history th:nth-child(6),
.table--history td:nth-child(6) { width: 120px; }
.table--history th:nth-child(7),
.table--history td:nth-child(7) { width: 90px; }
.table--history th:nth-child(8),
.table--history td:nth-child(8) { width: 110px; }

.history-info {
  display: inline-flex;
  vertical-align: middle;
}

.history-info .icon {
  width: 14px;
  height: 14px;
}

.history-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.7;
  color: var(--text);
  text-decoration: none;
}

.history-title:hover {
  color: var(--primary);
  text-decoration: underline;
}

.history-site,
.history-time,
.history-note,
.history-url {
  font-size: 13px;
  color: var(--text-muted);
}

.history-note {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 4px;
}

.history-note--warn {
  color: var(--warning);
}

.history-url {
  margin-top: 4px;
  font-size: 12px;
}

.history-who {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary-50);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.pagination__item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.pagination__item.is-current {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

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

@media (max-width: 1099px) {
  .table--history thead {
    display: none;
  }

  .table--history,
  .table--history tbody,
  .table--history tr,
  .table--history td {
    display: block;
    width: auto;
    min-width: 0;
  }

  .table--history tr {
    margin-bottom: 12px;
    padding: 8px 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
  }

  .table--history td {
    border-bottom: 0;
  }

  .table--history td[data-label]:not([data-label=""])::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
  }
}

/* Settings pages: content plus a sticky section index. */
.settings-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 232px;
  gap: 24px;
  align-items: start;
}

.settings-nav {
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
  max-height: calc(100vh - var(--topbar-h) - 32px);
  overflow-y: auto;
  padding: 8px;
}

.settings-nav__link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  text-decoration: none;
}

.settings-nav__link.is-current {
  background: var(--primary-50);
  color: var(--primary);
  font-weight: 700;
}

.settings-nav__count {
  margin-inline-start: auto;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--neutral-bg);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

.settings-nav__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warning);
}

.settings-section {
  scroll-margin-top: calc(var(--topbar-h) + 16px);
  margin-bottom: 28px;
}

.settings-section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.settings-section__head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.settings-section__head p,
.settings-help,
.settings-tools__count {
  margin: 0;
  font-size: 14px;
  line-height: 2;
  color: var(--text-muted);
}

.settings-section__head p {
  flex-basis: 100%;
  line-height: 1.8;
}

.settings-help p {
  margin: 0 0 8px;
}

.settings-tools {
  align-items: flex-end;
  margin-bottom: 8px;
  flex-wrap: nowrap;
}

.settings-page .settings-tools .param-search {
  flex: 1 1 auto;
  min-width: 240px;
  width: auto;
}

.settings-page .settings-tools .checkbox {
  flex: none;
  white-space: nowrap;
}

.settings-note {
  display: flex;
  align-items: center;
  gap: 6px;
}

.settings-note .icon {
  width: 16px;
  height: 16px;
}

.param-list.card {
  padding: 0;
}

.param {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  gap: 24px;
  align-items: start;
  padding: 16px 20px;
  scroll-margin-top: calc(var(--topbar-h) + 16px);
}

.param + .param {
  border-top: 1px solid var(--border);
}

.param__name {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.param__desc {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.9;
  color: var(--text-muted);
}

.param__scopes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.param__scopes .chip {
  font-size: 12px;
}

.param__label {
  margin-bottom: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.param__editor,
.override-add__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
}

.param__editor .input,
.param__editor .select,
.override-add .input,
.override-add .select {
  width: 160px;
  max-width: 100%;
}

.param__dirty {
  display: none;
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--warning);
}

.param__control:has(.is-dirty) .param__dirty {
  display: block;
}

.input.is-dirty,
.select.is-dirty,
.textarea.is-invalid {
  border-color: var(--warning);
}

.textarea.is-invalid {
  border-color: var(--danger);
}

.param__summary,
.param__more {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.param__summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.disclosure--inline {
  margin-top: 4px;
  border-top: 0;
}

.disclosure--inline > summary {
  padding: 6px 0;
  font-size: 13px;
  font-weight: 600;
}

.input-group--unit {
  display: inline-flex;
  align-items: stretch;
  max-width: 100%;
}

.input-group--unit .input {
  width: 160px;
  padding-inline-end: 12px;
  border-start-end-radius: 0;
  border-end-end-radius: 0;
}

.input-group__addon {
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-inline-start: 0;
  border-start-start-radius: 0;
  border-end-start-radius: 0;
  border-start-end-radius: var(--radius);
  border-end-end-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 13px;
  white-space: nowrap;
}

.override-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.override-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-height: 32px;
  margin: 0;
  padding: 4px 4px 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 13px;
}

.override-chip__name {
  font-weight: 700;
}

.override-chip__kind,
.override-chip__value {
  color: var(--text-muted);
}

.override-chip__flag {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.override-chip__x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.override-chip__x .icon {
  width: 14px;
  height: 14px;
}

.override-chip__x:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.override-chip.is-pending {
  opacity: 0.5;
  text-decoration: line-through;
}

.override-add {
  margin-top: 8px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--surface-2);
}

.override-add__title {
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
}

html.js .override-add__hint {
  display: none;
}

html.js .js-tabs .settings-panel {
  display: none;
}

html.js .js-tabs .settings-panel.is-active {
  display: block;
}

.settings-panel__title {
  margin: 12px 0;
  font-size: 15px;
}

.weights__extra,
.weights__legend,
.weights__total {
  font-size: 13px;
}

.weights__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.weights__bar {
  display: flex;
  height: 10px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 5px;
  background: var(--neutral-bg);
}

.weights__seg {
  display: block;
  height: 100%;
}

.weights__seg--primary { background: var(--primary); }
.weights__seg--info { background: var(--info); }
.weights__seg--success { background: var(--success); }
.weights__seg--warning { background: var(--warning); }

.weights__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
  color: var(--text-muted);
}

.weights__swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-inline-end: 4px;
  border-radius: 2px;
}

.weights__total {
  display: flex;
  align-items: center;
  gap: 6px;
}

.weights__total.is-ok { color: var(--success); }
.weights__total.is-bad { color: var(--danger); }
.weights__total.is-bad .weights__total-icon { display: none; }

.weights__total .icon {
  width: 16px;
  height: 16px;
}

.schedule {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0;
}

.schedule__row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 12px;
  align-items: center;
}

.schedule__day {
  font-size: 14px;
  font-weight: 700;
}

.schedule .textarea {
  min-height: 56px;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, monospace;
}

.schedule__invalid {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--danger);
}

.schedule__quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.timeline {
  direction: ltr;
}

.timeline__bar {
  position: relative;
  height: 14px;
  overflow: hidden;
  border-radius: 7px;
  background: var(--neutral-bg);
}

.timeline__bar span {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--primary);
}

.timeline__ticks {
  display: flex;
  justify-content: space-between;
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-muted);
}

.flash-highlight {
  animation: flash-highlight 2s ease;
}

.flash-highlight--danger {
  animation-name: flash-highlight-danger;
}

@keyframes flash-highlight {
  from { background: var(--success-bg); }
  to { background: transparent; }
}

@keyframes flash-highlight-danger {
  from { background: var(--danger-bg); }
  to { background: transparent; }
}

@media (max-width: 1099px) {
  .settings-layout {
    grid-template-columns: 1fr;
  }

  .settings-nav.settings-nav--chips {
    position: sticky;
    top: var(--topbar-h);
    z-index: 5;
    display: flex;
    max-height: none;
    overflow-x: auto;
    order: -1;
  }

  .settings-nav__link {
    flex: 0 0 auto;
  }

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

  .param__editor,
  .param__editor .input-group--unit,
  .param__editor .input,
  .param__editor .select {
    max-width: 100%;
  }
}

@media (max-width: 699px) {
  .weights__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .weights .tabs,
  .settings-section .tabs {
    max-width: 100%;
    overflow-x: auto;
  }
}

/* Breadcrumb above a settings form. */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.breadcrumb__root,
.breadcrumb__sep {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.breadcrumb__root .icon,
.breadcrumb__sep .icon {
  width: 14px;
  height: 14px;
}

.breadcrumb__here {
  max-width: 40ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--primary);
}

/* Card used as a grouped form section. */
.form-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 16px;
}

.form-card .input,
.form-card .select {
  height: 42px;
}

.form-card .card__header {
  margin-bottom: 0;
}

/* Bordered checkbox with a title and a help line. */
.checkbox-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface-2);
}

.checkbox-box > span {
  flex: 1;
  min-width: 0;
}

.checkbox-box input {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  margin: 5px 0 0;
  padding: 0;
}

.checkbox-box__title,
.checkbox-box__help {
  display: block;
}

.checkbox-box__title {
  font-size: 14px;
  font-weight: 700;
}

.checkbox-box__help {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.8;
  color: var(--text-muted);
}

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

.field-pair__help,
.field-pair > .field__help {
  grid-column: 1 / -1;
}

.input-group--secret .input {
  padding-inline-start: 36px;
}

.input-group__lock {
  position: absolute;
  inset-inline-start: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.input-group__lock .icon {
  width: 16px;
  height: 16px;
}

.site-create {
  display: grid;
  grid-template-columns: minmax(0, 720px) 280px;
  gap: 24px;
  align-items: start;
}

/* New source form uses the same layout, with a 640px form column. */
.site-create.source-create {
  grid-template-columns: minmax(0, 640px) 280px;
}

.credibility-picker {
  position: relative;
}

.credibility-picker .segmented {
  display: none;
}

html.js .credibility-picker .segmented {
  display: inline-flex;
  flex-wrap: wrap;
  max-width: 100%;
}

html.js .credibility-picker .credibility-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.site-create__help .card {
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
}

.site-create__help-mini {
  display: none;
}

.site-next {
  margin: 12px 0 0;
  padding-inline-start: 1.4em;
  font-size: 14px;
  line-height: 2;
}

.actionbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.actionbar__note {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.sites-table.card {
  padding: 0;
  overflow: hidden;
}

.table--sites th {
  font-weight: 600;
}

.table--sites td {
  min-height: 56px;
}

.table--sites th:nth-child(5),
.site-count {
  text-align: end;
  font-variant-numeric: tabular-nums;
}

.site-count.is-zero,
.site-sync-empty {
  color: var(--text-muted);
}

.site-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.site-name:hover {
  color: var(--primary);
}

.site-code {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-muted);
}

.empty .icon {
  width: 28px;
  height: 28px;
  color: var(--text-muted);
}

@media (max-width: 1099px) {
  .site-create {
    grid-template-columns: 1fr;
  }

  .site-create__help {
    order: -1;
  }

  .site-create__help .card {
    display: none;
  }

  .site-create__help-mini {
    display: block;
  }
}

@media (max-width: 899px) {
  .table--stack thead {
    display: none;
  }

  .table--stack,
  .table--stack tbody,
  .table--stack tr,
  .table--stack td {
    display: block;
    width: auto;
  }

  .table--stack tr {
    margin: 12px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
  }

  .table--stack td {
    border-bottom: 0;
    padding: 6px 0;
  }

  .table--stack td[data-label="وضعیت"],
  .table--stack td[data-label="اتصال"] {
    display: inline-block;
    width: auto;
    margin-inline-end: 8px;
  }

  .table--stack td[data-label]:not([data-label=""])::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
  }

  .table--stack td[data-label="وضعیت"]::before,
  .table--stack td[data-label="اتصال"]::before {
    content: none;
  }

  .table--stack .btn {
    width: 100%;
  }

  .site-count {
    text-align: start;
  }
}

@media (max-width: 640px) {
  .source-create .segmented {
    flex-wrap: wrap;
  }

  .source-create .actionbar .btn {
    width: 100%;
    height: 44px;
  }
}

@media (max-width: 639px) {
  .field-pair {
    grid-template-columns: 1fr;
  }

  .actionbar .btn {
    width: 100%;
  }
}

/* Site detail: shared header, setup stepper, profile, ticks. */

.site-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 880px;
}

.site-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

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

.site-header__title .page-title {
  margin: 0;
}

.site-header__meta {
  color: var(--text-muted);
  font-size: 13px;
}

.site-tabs {
  overflow-x: auto;
}

.site-cats__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

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

.tree__row,
.tree-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-height: 36px;
}

.tree__name.is-parent {
  font-weight: 700;
}

.tree__corner .icon {
  width: 16px;
  height: 16px;
  color: var(--text-faint);
}

.tree__row .chip,
.tree-row .chip {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree__id {
  color: var(--text-faint);
  font-size: 12px;
}

.tree-row {
  min-height: 44px;
  border-bottom: 1px solid var(--border);
}

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

.tree-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
}

.tree-row:has(input[name="tick"]:checked) label {
  font-weight: 600;
  color: var(--primary);
}

.tree-row:not(:has(input[name="tick"]:checked)) .select--sm {
  opacity: 0.45;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.status-sync .segmented {
  display: none;
}

html.js .status-sync .segmented {
  display: inline-flex;
}

html.js .status-sync > select {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.stepper__bar {
  height: 6px;
  margin-bottom: 12px;
  border-radius: 99px;
  background: var(--surface-2);
  overflow: hidden;
}

.stepper__bar span {
  display: block;
  height: 100%;
  background: var(--primary);
}

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

.stepper__item {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 14px 0;
  border-top: 1px solid var(--border);
}

.stepper__dot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  font-size: 13px;
  font-weight: 700;
}

.stepper__item.is-done .stepper__dot {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: var(--success);
}

.stepper__item.is-current .stepper__dot {
  background: var(--primary-50);
  border-color: var(--primary);
  color: var(--primary);
}

.stepper__item.is-locked {
  opacity: 0.6;
}

.stepper__item.is-locked .stepper__dot {
  background: var(--surface-2);
  color: var(--text-faint);
}

.stepper__item {
  position: relative;
}

.stepper__item:not(:last-child)::before {
  content: "";
  position: absolute;
  inset-inline-start: 15px;
  top: 46px;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.stepper__body h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.stepper__body p {
  margin: 0 0 8px;
  color: var(--text-muted);
}

.profile-layout {
  align-items: start;
}

.profile-tools {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.profile-field > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.profile-field__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary-50);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.profile-field__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
}

.profile-field__preview {
  flex: 1 1 160px;
  color: var(--text-faint);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.savebar {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin-top: 16px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.savebar__note {
  flex: 1 1 220px;
  margin: 0;
}

.savebar__count {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

.mono-block {
  margin: 0;
  padding: 12px;
  overflow: auto;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  white-space: pre-wrap;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 13px;
  line-height: 1.7;
}

.card--tinted {
  background: var(--primary-50);
}

.table--compact td,
.table--compact th {
  padding: 6px 8px;
  font-size: 13px;
}

.table--compact tr.is-zero td {
  color: var(--text-faint);
}

.select--sm {
  width: 120px;
  height: 32px;
  padding: 0 8px;
  font-size: 13px;
}

.profile-area {
  width: 100%;
  min-height: 140px;
  resize: vertical;
  font-size: 15px;
  line-height: 2;
}

.ticks-form > .ticks-toolbar {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
}

.source-card > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 700;
}

.ticks-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
}

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

/* Two panes: sources on the right, one source's sections on the left. */
.master-detail {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.tick-bar__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tick-live {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.tick-live.is-empty {
  color: var(--text-muted);
}

.tick-bar__list {
  margin-top: 0;
  border-top: 0;
  flex: 1 0 100%;
}

.tick-bar__list > summary {
  width: fit-content;
  padding: 4px 8px;
}

.tick-group {
  font-weight: 700;
}

.source-list {
  margin-top: 0;
  border-top: 0;
  padding: 12px;
}

.source-list__picker {
  display: none;
}

.source-list__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.source-list .segmented {
  flex-wrap: wrap;
}

.source-list__items {
  display: flex;
  flex-direction: column;
}

.source-list__item[hidden] {
  display: none;
}

.source-list__item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 10px;
  border: 0;
  border-inline-start: 3px solid transparent;
  background: transparent;
  color: var(--text);
  text-align: start;
  cursor: pointer;
}

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

.source-list__item.is-selected {
  background: var(--primary-50);
  border-inline-start-color: var(--primary);
}

.source-list__item.is-paused {
  color: var(--text-muted);
}

.source-list__name {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
}

.source-list__zero {
  color: var(--text-muted);
  font-size: 13px;
}

.source-list__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
}

html.js .source-pane:not(.is-selected) {
  display: none;
}

.source-pane__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.source-pane__title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.tick-help {
  position: relative;
  margin: 0 0 0 auto;
  border: 0;
}

.tick-help > summary {
  width: 32px;
  height: 32px;
  padding: 0;
  list-style: none;
}

.tick-help > summary::-webkit-details-marker {
  display: none;
}

.tick-help__body {
  position: absolute;
  z-index: 3;
  inset-inline-end: 0;
  top: 36px;
  width: min(360px, 70vw);
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  color: var(--text);
  font-size: 13px;
  font-weight: 400;
}

.tick-help__body p {
  margin: 0;
}

.ticks-form .tree-row {
  position: relative;
  min-height: 40px;
  flex-wrap: nowrap;
  padding-inline-start: calc(var(--depth) * 20px);
}

/* Author display:flex would otherwise ignore the hidden attribute. */
.ticks-form .tree-row[hidden],
.ticks-form .tree__more[hidden] {
  display: none;
}

.ticks-form .tree__guide {
  position: absolute;
  inset-inline-start: calc((var(--depth) - 0.5) * 20px);
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border);
}

.ticks-form .tree-row[style="--depth: 0"] .tree__guide {
  display: none;
}

.ticks-form .tree__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.ticks-form .tree__toggle--spacer {
  cursor: default;
}

.ticks-form .tree-row[data-open="1"] .tree__toggle .disclosure__chevron {
  transform: rotate(180deg);
}

.ticks-form .tree-row:not([data-open="1"]) .tree__toggle .disclosure__chevron {
  transform: rotate(-90deg);
}

.ticks-form .tree__label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.ticks-form .tree__name {
  font-size: 14px;
}

.ticks-form .tree__kids {
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}

.ticks-form .tree__more {
  margin-inline-start: calc(var(--depth, 1) * 20px);
}

@media (min-width: 900px) {
  .source-list {
    position: sticky;
    top: calc(var(--topbar-h) + 16px);
    max-height: calc(100vh - 140px);
    overflow: auto;
  }
}

@media (max-width: 899px) {
  .master-detail {
    grid-template-columns: 1fr;
  }

  .source-list:not(.is-open) .source-list__body {
    display: none;
  }

  .source-list__picker {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 8px 0;
    border: 0;
    background: transparent;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
  }

  .source-list.is-open .source-list__picker .disclosure__chevron {
    transform: rotate(180deg);
  }
}

@media (max-width: 1099px) {
  .profile-layout {
    grid-template-columns: 1fr;
  }

  .profile-layout .settings-nav--chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .profile-layout .settings-nav__link {
    width: auto;
    border: 1px solid var(--border);
    border-radius: 99px;
    padding: 4px 10px;
  }
}

@media (max-width: 899px) {
  .site-tabs {
    flex-wrap: nowrap;
  }

  .table--compact {
    display: block;
    overflow-x: auto;
  }
}

@media (max-width: 639px) {
  .stepper__item {
    grid-template-columns: 32px 1fr;
  }

  .stepper__item > .btn,
  .stepper__body .btn {
    grid-column: 1 / -1;
    width: 100%;
  }

  .savebar [data-profile-reset] {
    display: none;
  }
}

/* Sources list: summary tiles, health dot, problem rows. */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.stat-grid .stat {
  padding: 16px 20px;
}

.stat-grid .stat__value {
  font-size: 28px;
  font-weight: 700;
}

.box-stats.stat-grid {
  grid-template-columns: repeat(2, minmax(130px, 1fr));
  margin-bottom: 0;
}

.box-stats .stat {
  min-width: 130px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.box-stats .stat__value--open {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
}

.box-stats .stat__value--done {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.box-stats .stat__note {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--warning);
}

.box-stats .stat__note--muted {
  color: var(--text-muted);
}

.stat__value--success {
  color: var(--success);
}

.stat__value--danger {
  color: var(--danger);
}

.stat__value--warning {
  color: var(--warning);
}

.sources-table.card {
  padding: 0;
  overflow: hidden;
}

.table--sources td {
  min-height: 64px;
  vertical-align: middle;
}

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

.table--sources tr.is-paused {
  opacity: 0.7;
}

.table--sources tr.is-danger {
  background: color-mix(in srgb, var(--danger-bg) 40%, var(--surface));
}

.table--sources tr.is-danger td:first-child {
  box-shadow: inset -3px 0 0 var(--danger);
}

.table--sources tr.is-warning {
  background: color-mix(in srgb, var(--warning-bg) 40%, var(--surface));
}

.table--sources tr.is-warning td:first-child {
  box-shadow: inset -3px 0 0 var(--warning);
}

.source-link {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: inherit;
  text-decoration: none;
}

.source-link:hover {
  color: var(--primary);
}

.source-code {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
}

.crawl-interval {
  display: block;
  font-size: 14px;
}

.crawl-origin,
.crawl-when {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
}

.crawl-origin.is-own {
  color: var(--primary);
}

.yield-new,
.yield-failed {
  display: block;
}

.yield-new {
  font-size: 16px;
  font-weight: 700;
}

.yield-new.is-success {
  color: var(--success);
}

.yield-new.is-muted,
.yield-failed.is-muted,
.crawl-when.is-muted {
  color: var(--text-muted);
  font-weight: 400;
}

.yield-failed {
  font-size: 12.5px;
}

.yield-failed.is-warning {
  color: var(--warning);
}

.yield-failed.is-danger {
  color: var(--danger);
}

.health-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-inline-end: 4px;
  border-radius: 50%;
  background: var(--text-faint);
  vertical-align: middle;
}

.health-dot.is-fresh {
  background: var(--success);
}

.health-dot.is-late {
  background: var(--warning);
}

.health-note {
  display: -webkit-box;
  max-width: 180px;
  overflow: hidden;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  font-size: 12px;
  color: var(--text-muted);
}

.meter {
  display: inline-flex;
  gap: 3px;
}

.meter__step {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--border);
}

.meter__step.is-on {
  background: var(--primary);
}

.sources-note {
  margin-top: 12px;
  font-size: 13px;
}

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

  .table--sources.table--stack tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .table--sources.table--stack td.source-name,
  .table--sources.table--stack td.source-health,
  .table--sources.table--stack td.source-action {
    grid-column: 1 / -1;
  }

  .table--sources.table--stack td.source-status {
    display: inline-block;
    width: auto;
  }

  .table--sources.table--stack .btn {
    width: 100%;
  }

  .source-page .field-pair,
  .source-page .section-row__main {
    display: flex;
    flex-direction: column;
  }

  .section-row__actions .btn {
    width: 100%;
  }

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

/* Single source page. */

.source-column {
  max-width: 760px;
}

.source-stats .stat__value {
  font-size: 22px;
}

.mono-input {
  font-family: ui-monospace, Consolas, monospace;
  direction: ltr;
  text-align: left;
}

.input-group__suffix {
  position: absolute;
  inset-inline-end: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 13px;
}

.section-row {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.section-row.is-archived {
  opacity: 0.6;
}

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

.section-row__text {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 240px;
}

.section-row__url {
  display: block;
  flex-basis: 100%;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-row__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.field-pair .field--full {
  grid-column: 1 / -1;
}

html.js .section-edit__summary {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.source-page [data-edit] {
  display: none;
}

html.js .source-page [data-edit] {
  display: inline-flex;
}

#sections-more {
  display: none;
}

html.js #sections-more {
  display: inline-flex;
}

html.js .section-tree:not(.is-expanded) .section-row.is-extra {
  display: none;
}

.probe-controls {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.probe-controls .field {
  flex: 1 1 180px;
  margin: 0;
}

.probe-controls .btn {
  flex: 0 0 auto;
  height: 42px;
}

.probe-button__busy {
  display: none;
  align-items: center;
  gap: 8px;
}

#probe-button.htmx-request .probe-button__idle {
  display: none;
}

#probe-button.htmx-request .probe-button__busy {
  display: inline-flex;
}

#probe-wait.htmx-request {
  display: block;
}

.probe-button__busy .icon {
  animation: probe-spin 0.8s linear infinite;
}

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

.probe-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 16px;
  padding: 10px 0;
  border-block: 1px solid var(--border);
  font-size: 14px;
}

.probe-bar__muted {
  color: var(--text-muted);
}

.probe-links {
  max-height: 320px;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.probe-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.probe-link__text {
  flex: 1;
  min-width: 0;
}

.probe-link__title {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.probe-link__meta {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: var(--text-muted);
}

.probe-samples {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}

.probe-sample__head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.probe-sample__title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.probe-sample__open {
  font-size: 13px;
}

.probe-grid {
  margin-top: 8px;
}

.probe-kv {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px 12px;
  align-items: start;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.probe-kv__key {
  font-size: 13px;
  color: var(--text-muted);
}

.probe-kv__val {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.probe-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-top: 8px;
  border-radius: 999px;
  background: var(--text-muted);
}

.probe-dot--ok {
  background: var(--success);
}

.probe-dot--bad {
  background: var(--danger);
}

.probe-missing {
  color: var(--text-muted);
}

.probe-missing--bad {
  color: var(--danger);
}

.probe-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.probe-url {
  overflow-wrap: anywhere;
  font-size: 12px;
  color: var(--text-muted);
}

.probe-urls {
  margin: 0;
  padding: 0 0 8px;
  list-style: none;
  font-size: 12px;
  color: var(--text-muted);
}

.probe-urls li {
  overflow-wrap: anywhere;
  padding: 4px 0;
}

.probe-body {
  margin-top: 12px;
}

.probe-body__preview {
  display: -webkit-box;
  margin: 0 0 4px;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 2;
  font-size: 15px;
}

.probe-body__full {
  max-height: 420px;
  overflow: auto;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface-2);
  white-space: pre-wrap;
  line-height: 2;
  font-size: 15px;
}

.probe-quality,
.probe-removed {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 0;
}

.probe-quality__label {
  font-size: 13px;
  color: var(--text-muted);
}

@media (max-width: 640px) {
  .probe-controls {
    flex-direction: column;
    align-items: stretch;
  }

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

@media (max-width: 639px) {
  .source-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .source-page .savebar .btn--ghost {
    display: none;
  }
}

/* AI switches: pipeline strip, on/off toggle, per-site row. */

.pipeline__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pipeline__step {
  display: flex;
  align-items: center;
}

.pipeline__step a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 96px;
  color: inherit;
  text-decoration: none;
}

.pipeline__step:not(:last-child)::after {
  content: "";
  width: 18px;
  height: 1px;
  margin-inline: 6px;
  background: var(--border-strong);
}

.pipeline__dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-50);
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
}

.pipeline__name {
  font-size: 13.5px;
  font-weight: 600;
}

.pipeline__state {
  font-size: 12px;
}

.pipeline__state.is-on {
  color: var(--success);
}

.pipeline__state.is-off {
  color: var(--text-faint);
}

.switch-card {
  padding: 0;
  margin-top: 16px;
  scroll-margin-top: 88px;
}

.switch-card__head,
.switch-card__sites {
  padding: 20px 24px;
}

.switch-card__sites {
  border-top: 1px solid var(--border);
  padding-top: 8px;
  padding-bottom: 16px;
}

.content__inner--wide {
  max-width: none;
  width: 100%;
}

.switches-page {
  width: 100%;
}

.switch-card__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  gap: 32px;
  align-items: start;
}

.switch-card__title {
  display: flex;
  gap: 12px;
  min-width: 0;
}

.switch-card__title h2 {
  margin: 0;
  font-size: 17px;
}

.switch-card__global {
  flex: 0 0 auto;
}

.switch {
  display: none;
  align-items: center;
  width: 52px;
  height: 28px;
  padding: 3px;
  border: 0;
  border-radius: 99px;
  background: var(--neutral-bg);
  cursor: pointer;
}

html.js .switch {
  display: inline-flex;
}

.switch[aria-checked="true"] {
  background: var(--success);
}

.switch__knob {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  margin-inline-start: 0;
}

.switch[aria-checked="true"] .switch__knob {
  margin-inline-start: 24px;
}

.switch__text {
  margin-inline-start: 8px;
  font-size: 14px;
  font-weight: 700;
}

html.js .js-select {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.switch-sync,
.site-switch form {
  position: relative;
}

.segmented--sm {
  display: none;
}

html.js .segmented--sm {
  display: inline-flex;
}

.segmented--sm .segmented__item {
  height: 28px;
  padding: 0 8px;
  font-size: 12px;
}

.switch-sites__label {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 700;
}

.switch-sites__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.switch-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}

.switch-chip.is-override {
  border-color: var(--primary);
  background: var(--primary-50);
}

.switch-chip.is-open {
  box-shadow: 0 0 0 2px var(--primary-100);
}

.switch-chip__tag {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.switch-editor {
  display: none;
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.switch-editor.is-open {
  display: block;
}

.switch-editor__name {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 700;
}

.switch-editor .segmented {
  display: inline-flex;
  margin-top: 8px;
}

.switch-editor .segmented__item {
  position: relative;
}

.switch-editor .segmented__item input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}

.switch-editor .segmented__item:has(input:checked),
.switch-editor .segmented__item.is-active {
  background: var(--primary);
  color: #fff;
  box-shadow: none;
}

.switch-editor__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.site-switch {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  min-height: 56px;
  border-top: 1px solid var(--border);
}

.site-switch__name {
  font-size: 15px;
  font-weight: 600;
  color: inherit;
  text-decoration: none;
}

.site-switch__name:hover {
  color: var(--primary);
}

.site-switch__own {
  background: var(--primary-50);
}

.site-switch__hint {
  display: none;
}

html.js .site-switch__hint {
  display: block;
}

html.js .site-switch__hint[hidden] {
  display: none;
}

@media (max-width: 899px) {
  .pipeline__list {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .pipeline__step::after {
    display: none;
  }

  .switch-card__head {
    grid-template-columns: 1fr;
  }

  .switch-card__save {
    text-align: end;
  }

  .site-switch {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 639px) {
  .segmented--sm .segmented__item {
    flex: 1;
  }
}

/* Lists page: grouped keyword accordions, removable tags, version editor. */

.lists-page .list-panel {
  margin-top: 16px;
}

html.js .lists-page .list-panel {
  display: none;
}

html.js .lists-page .list-panel.is-active {
  display: block;
}

.lists-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin: 16px 0;
}

.lists-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 280px;
}

.lists-search .searchbox {
  flex: 1;
}

.lists-toolbar .field {
  flex: 0 1 220px;
  margin: 0;
}

.lists-count {
  margin: 0;
  color: var(--text-muted);
  font-size: 13.5px;
}

.lists-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
}

.kw-edit-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.lists-page--edit .kw-read-row {
  display: none;
}

html.js .lists-page--edit .kw-read-row:not([hidden]) {
  display: table-row;
}

html.js .lists-page--edit .kw-edit-row {
  display: none;
}

html.js .lists-page--edit .kw-read-row.is-editing {
  display: none;
}

html.js .lists-page--edit .kw-edit-row.is-editing:not([hidden]) {
  display: table-row;
}

html.js .lists-page .kw-extra,
html.js .lists-page--edit .kw-read-row.kw-extra {
  display: none;
}

html.js .lists-page .group.is-expanded .kw-extra:not([hidden]) {
  display: table-row;
}

.lists-page .kw-read-row td,
.lists-page .reason-row td {
  height: 44px;
}

.lists-page .reason-row td {
  height: 52px;
}

.lists-page .kw-word {
  font-size: 15px;
  font-weight: 600;
}

.lists-page .kw-note,
.lists-page .kw-zero {
  color: var(--text-muted);
  font-size: 13.5px;
}

.lists-page .kw-read-row.is-hit td {
  background: var(--warning-bg);
}

.kw-actions,
.kw-ask:not([hidden]),
.tag-ask:not([hidden]) {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

html.js .lists-page .confirm-legacy {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.group > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  cursor: pointer;
}

.group__name {
  font-size: 15px;
  font-weight: 700;
}

.group__more {
  display: none;
  margin: 8px 16px 16px;
}

html.js .group__more:not([hidden]) {
  display: inline-flex;
}

html.js .group.is-expanded .group__more {
  display: none;
}

.headline-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--neutral-bg);
  color: var(--text);
  font-size: 14px;
}

.tag__x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.tag__x:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.title-tags {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

html.js .title-tags,
.title-tags.is-static {
  display: flex;
}

html.js .title-legacy {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.order-nudge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.order-nudge .btn {
  display: none;
}

html.js .order-nudge .btn {
  display: inline-flex;
}

.sort-input {
  width: 72px;
  max-width: 72px;
}

.reason-row.is-inactive input[name="title"],
.reason-row.is-inactive .sort-input {
  opacity: 0.6;
}

.lists-page .criteria-body {
  min-height: 320px;
  height: auto;
  padding: 12px;
  font-size: 15px;
  line-height: 2;
  resize: vertical;
}

.lists-compare {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.lists-compare .select {
  width: auto;
  min-width: 96px;
}

.btn-trash:hover {
  color: var(--danger);
}

@media (max-width: 899px) {
  .lists-page .tabs:has(.tabs__tab) {
    display: flex;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
  }

  .lists-page .tabs__tab {
    flex: 0 0 auto;
  }

  .headline-grid,
  .lists-fields {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 639px) {
  .lists-toolbar .field,
  .lists-toolbar .select,
  .lists-toolbar .searchbox {
    width: 100%;
    flex-basis: 100%;
  }

  .lists-page .col-note {
    display: none;
  }
}

/* Profile template: numbered field rows and the stage matrix. */

.tpl-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 12px 16px;
  align-items: start;
  padding: 16px 20px;
  margin-bottom: 8px;
  scroll-margin-top: 88px;
}

.tpl-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-50);
  color: var(--primary);
  font-weight: 700;
}

.tpl-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.tpl-guide {
  display: -webkit-box;
  margin: 6px 0 0;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 13.5px;
  line-height: 1.7;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.tpl-guide.is-open {
  display: block;
  -webkit-line-clamp: unset;
}

.tpl-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.chip--muted {
  color: var(--warning);
  background: var(--warning-bg);
}

.tpl-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: end;
}

.btn--icon {
  width: 36px;
  height: 36px;
  padding: 0;
}

.tpl-pencil,
.tpl-ask {
  display: none;
}

html.js .tpl-pencil,
html.js .tpl-ask {
  display: inline-flex;
}

html.js .tpl-legacy {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

html.js .tpl-editor > summary {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.tpl-confirm,
.tpl-editor {
  grid-column: 1 / -1;
}

.tpl-confirm:not([hidden]) {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}

.tpl-stages {
  display: grid;
  gap: 8px;
  margin: 12px 0;
  padding: 0;
  border: 0;
}

.tpl-guide-edit {
  min-height: 140px;
  height: auto;
  padding: 12px;
  line-height: 2;
  resize: vertical;
}

.tpl-edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.matrix summary {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  cursor: pointer;
  list-style: none;
}

.matrix summary::-webkit-details-marker {
  display: none;
}

.matrix__num {
  display: inline-block;
  min-width: 1.5em;
  color: var(--primary);
  font-weight: 700;
}

.matrix__yes {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--success-bg);
  color: var(--success);
}

.matrix__yes .icon {
  width: 14px;
  height: 14px;
}

.matrix__no {
  color: var(--text-faint);
}

.matrix td,
.matrix th {
  text-align: center;
}

.matrix td:first-child,
.matrix th:first-child {
  text-align: start;
}

.tpl-archived {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
}

html.js .tpl-archived-legacy {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

#add {
  scroll-margin-top: 88px;
}

@media (max-width: 899px) {
  .tpl-row {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .tpl-actions {
    grid-column: 1 / -1;
  }

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

@media (max-width: 639px) {
  .tpl-num {
    width: 28px;
    height: 28px;
  }

  .tpl-editor .field,
  .tpl-editor .input,
  .tpl-editor .textarea {
    width: 100%;
  }
}

/* Users: one row per account, editor closed until asked. */

.users-stats,
.users-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.users-toolbar .searchbox {
  flex: 1 1 220px;
}

.users-count {
  margin: 0;
  color: var(--text-muted);
  font-size: 13.5px;
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-50);
  color: var(--primary);
  font-weight: 700;
}

.user-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1.4fr) 1fr 1.2fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 20px;
  margin-bottom: 8px;
  scroll-margin-top: 88px;
}

.user-row[hidden] {
  display: none;
}

.user-row.is-inactive {
  opacity: 0.6;
}

.user-row__name strong {
  font-size: 15px;
  font-weight: 700;
}

.user-row__login,
.user-row__seen {
  display: block;
  color: var(--text-muted);
  font-size: 12.5px;
}

.user-row__sites {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.user-row__status {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.user-row__editor {
  grid-column: 1 / -1;
}

.users-js {
  display: none;
}

html.js .users-js {
  display: inline-flex;
}

html.js .user-row__editor > summary,
html.js .users-page .confirm-toggle,
html.js .users-page .confirm-box,
html.js .users-page .all-sites-check {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.site-mode {
  display: none;
}

html.js .site-mode {
  display: inline-flex;
}

.site-picks {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.site-picks[hidden] {
  display: none;
}

.user-row__editor .card--tinted {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.user-active-box {
  padding: 12px;
  border-radius: var(--radius);
  background: var(--surface-2);
}

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

.locked-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

#add {
  scroll-margin-top: 88px;
}

@media (max-width: 999px) {
  .user-row {
    grid-template-columns: 48px minmax(0, 1fr) auto;
  }

  .user-row__sites,
  .user-row > div:nth-child(3) {
    grid-column: 1 / -1;
  }
}

@media (max-width: 639px) {
  .users-page .btn,
  .users-page .segmented {
    width: 100%;
  }

  .users-page .segmented {
    flex-wrap: wrap;
  }
}

/* Change history: readable diffs, grouped batches, cards on a phone. */
.audit-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
}

.audit-filters__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  grid-column: 1 / -1;
}

.audit-filters .history-dates__help,
.audit-filters .field-error,
.audit-filters .history-presets {
  grid-column: 1 / -1;
  margin: 0;
}

.audit-filters .input.is-invalid {
  border-color: var(--danger);
}

.audit-summary {
  margin: 0 0 8px;
  color: var(--text-muted);
  font-size: 14px;
}

.audit-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.audit-time {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.audit-time__clock,
.audit-person__user {
  color: var(--text-muted);
  font-size: 12px;
}

.audit-person {
  display: block;
  font-size: 14px;
  font-weight: 600;
}

.audit-subject {
  display: block;
  margin-top: 4px;
  font-size: 14px;
}

.chip--entity {
  gap: 4px;
}

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

.diff li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.diff__label {
  font-size: 13px;
  font-weight: 600;
}

.diff__old,
.diff__new,
.audit-fact {
  max-width: 280px;
  height: auto;
  min-height: 24px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.diff__old {
  background: color-mix(in srgb, var(--danger-bg) 60%, var(--surface));
  text-decoration: line-through;
  font-size: 13.5px;
}

.diff__new {
  background: color-mix(in srgb, var(--success-bg) 60%, var(--surface));
  font-size: 13.5px;
}

.table--audit .kv {
  gap: 8px;
  padding: 4px 0;
}

.group-row > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.group-row__title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.group-row__time {
  color: var(--text-muted);
  font-size: 12px;
}

.group-row__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 8px 0;
}

.audit-raw .mono-block {
  direction: ltr;
  text-align: left;
  font-size: 12.5px;
}

@media (max-width: 999px) {
  .audit-filters {
    grid-template-columns: 1fr 1fr;
  }

  .audit-page > .table-wrap > .table--audit > thead {
    display: none;
  }

  .audit-page > .table-wrap > .table--audit,
  .audit-page > .table-wrap > .table--audit > tbody,
  .audit-page > .table-wrap > .table--audit > tbody > tr,
  .audit-page > .table-wrap > .table--audit > tbody > tr > td {
    display: block;
    width: 100%;
  }

  .audit-page > .table-wrap > .table--audit > tbody > tr {
    margin-bottom: 12px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
  }

  .audit-page > .table-wrap > .table--audit > tbody > tr:not(.is-group) {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .audit-page > .table-wrap > .table--audit > tbody > tr:not(.is-group) > td:nth-child(n + 3) {
    grid-column: 1 / -1;
  }

  .group-row .table--audit tr,
  .group-row .table--audit td {
    display: block;
    width: 100%;
  }
}

@media (max-width: 639px) {
  .audit-filters {
    grid-template-columns: 1fr;
  }

  .audit-page > .table-wrap > .table--audit > tbody > tr:not(.is-group) {
    grid-template-columns: 1fr;
  }
}

/* AI models: comparison table, collapsible task cards, labelled prices. */
.models-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.models-overview .card__title,
.model-section__title,
.model-card__title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.models-overview .card__title {
  margin-bottom: 12px;
  font-size: 16px;
}

.models-stage,
.model-card__desc,
.model-card__cost span,
.model-card__spent {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 400;
}

.models-id {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 13px;
}

.models-money {
  display: inline-block;
  font-weight: 700;
}

.cost-bar {
  display: block;
  height: 6px;
  margin-top: 4px;
  border-radius: 999px;
  background: var(--surface-2);
}

.cost-bar__fill {
  display: block;
  height: 6px;
  border-radius: 999px;
  background: var(--primary);
}

.model-card {
  margin-bottom: 12px;
  padding: 0;
  scroll-margin-top: calc(var(--topbar-h) + 16px);
}

.model-card__summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  cursor: pointer;
  list-style: none;
}

.model-card__summary::-webkit-details-marker {
  display: none;
}

.model-card--fixed .model-card__summary {
  cursor: default;
}

.model-card__text {
  flex: 1 1 auto;
  min-width: 0;
}

.model-card__title {
  font-size: 16px;
  font-weight: 700;
}

.model-card__desc {
  margin: 2px 0 0;
  font-size: 13.5px;
}

.model-card__side {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.model-card__cost {
  font-size: 14px;
  font-weight: 700;
}

.model-card__chevron .icon {
  transition: transform 120ms ease;
}

.model-card[open] > .model-card__summary .model-card__chevron .icon {
  transform: rotate(180deg);
}

.model-card__body {
  padding: 0 20px 20px;
}

.model-split,
.model-run__fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.model-section__title {
  font-size: 15px;
  font-weight: 700;
}

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

.pricebox__label {
  font-size: 13px;
  font-weight: 600;
}

.pricebox__missing {
  flex: 1 0 100%;
  margin: 0;
}

.model-card__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.model-card__spent {
  margin-inline-start: auto;
}

@media (max-width: 899px) {
  .models-stats,
  .model-split,
  .model-run__fields {
    grid-template-columns: 1fr 1fr;
  }

  .model-split {
    grid-template-columns: 1fr;
  }

  .models-table thead {
    display: none;
  }

  .models-table,
  .models-table tbody,
  .models-table tr,
  .models-table td {
    display: block;
    width: 100%;
  }

  .models-table tr {
    margin-bottom: 12px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
  }

  .models-table td {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    padding: 4px 0;
  }

  .models-table td::before {
    content: attr(data-label);
    flex: 1 0 100%;
    color: var(--text-muted);
    font-size: 12px;
  }

  .models-table tfoot {
    display: block;
  }
}

@media (max-width: 639px) {
  .models-stats,
  .model-run__fields {
    grid-template-columns: 1fr;
  }

  .model-card__summary {
    flex-wrap: wrap;
  }

  .model-card__side,
  .model-card .btn {
    width: 100%;
  }
}

/* Reports: filters, six tiles, crawl tables, cost cards, quality flow. */
.reports-stats {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.reports-page .is-muted {
  color: var(--text-faint);
  font-weight: 500;
}

.reports-page .card__title {
  margin: 16px 0 8px;
  font-size: 16px;
}

.reports-page .clamp {
  display: inline-block;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

.reports-page tr.is-danger td:first-child {
  box-shadow: inset -3px 0 0 var(--danger);
}

.reports-page tr.is-warning td:first-child {
  box-shadow: inset -3px 0 0 var(--warning);
}

.reports-page .input.is-invalid {
  border-color: var(--danger);
}

.cost-groups,
.cost-breakdown {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.bar-chart {
  display: block;
  width: 100%;
  height: 120px;
}

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

.flow__stage {
  position: relative;
  margin: 0;
}

.flow__stage::after {
  content: "";
  position: absolute;
  inset-inline-start: 24px;
  top: 100%;
  width: 2px;
  height: 12px;
  background: var(--border);
}

.flow__stage:last-child::after {
  display: none;
}

.flow__tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.flow__tiles .stat__value {
  font-size: 24px;
  font-weight: 700;
}

.flow__tiles .stat__label {
  font-size: 13px;
}

.funnel {
  display: flex;
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}

.funnel__relevant { background: var(--success); }
.funnel__irrelevant { background: var(--text-faint); }
.funnel__advertorial { background: var(--warning); }
.funnel__duplicate { background: var(--danger); }

.funnel-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 8px 0 16px;
  color: var(--text-muted);
  font-size: 13px;
}

.funnel-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-inline-end: 4px;
  border-radius: 2px;
}

html.js .reports-page .report-panel {
  display: none;
}

html.js .reports-page .report-panel.is-active {
  display: block;
}

html.js .reports-page .report-extra {
  display: none;
}

html.js .reports-page.is-show-all .report-extra {
  display: table-row;
}

@media (max-width: 999px) {
  .reports-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 899px) {
  .cost-groups,
  .cost-breakdown {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 699px) {
  .reports-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .reports-page .tabs:has(.tabs__tab) {
    max-width: 100%;
    overflow-x: auto;
  }

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

  .reports-page .table th:first-child,
  .reports-page .table td:first-child {
    position: sticky;
    inset-inline-start: 0;
    background: var(--surface);
  }

  .reports-page .history-filters,
  .reports-page .history-dates,
  .reports-page .history-filters__actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}

/* Settings group in the sidebar. One open section, four labelled sub-lists. */
.nav-group__toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 42px;
  margin-top: 16px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  text-align: start;
  cursor: pointer;
}

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

.nav-group__toggle .icon {
  color: var(--text-faint);
}

.nav-group__title {
  min-width: 0;
}

.nav-group__dot {
  display: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  flex: none;
}

.nav-group:not(.is-open).has-active .nav-group__dot {
  display: block;
}

.nav-group:not(.is-open).has-active .nav-group__title {
  color: var(--primary);
}

.nav-group__chevron {
  display: inline-flex;
  margin-inline-start: auto;
  transition: transform 150ms;
}

.nav-group.is-open .nav-group__chevron {
  transform: rotate(180deg);
}

.nav-group__list {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 150ms, opacity 150ms;
}

.nav-group.is-open .nav-group__list {
  grid-template-rows: 1fr;
  opacity: 1;
}

.nav-group__inner {
  overflow: hidden;
}

.nav-sub + .nav-sub {
  margin-top: 8px;
  border-top: 1px solid var(--border);
}

.nav-sub__label {
  margin: 14px 16px 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-faint);
}

.nav-sub ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-sub .sidebar__link {
  padding-inline-start: 28px;
}

@media (max-width: 700px) {
  .settings-page .settings-tools {
    flex-wrap: wrap;
  }

  .settings-page .settings-tools .param-search,
  .settings-page .settings-tools .checkbox {
    flex: 1 0 100%;
    width: 100%;
    min-width: 0;
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nav-group__list,
  .nav-group__chevron {
    transition: none;
  }
}

/* Full-page failure inside the shell, or the same block on the standalone card. */
.error-page {
  max-width: 640px;
  margin: 48px auto 0;
  text-align: center;
}

.error-page__icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  border-radius: 50%;
}

.error-page__icon .icon {
  width: 32px;
  height: 32px;
}

.error-page__icon--info { background: var(--info-bg); color: var(--info); }
.error-page__icon--warning { background: var(--warning-bg); color: var(--warning); }
.error-page__icon--danger { background: var(--danger-bg); color: var(--danger); }
.error-page__icon--neutral { background: var(--neutral-bg); color: var(--neutral-text); }

.error-page__code,
.error-page__ref {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

.error-page__title {
  margin: 8px 0;
  font-size: 24px;
  font-weight: 700;
}

.error-page__msg {
  margin: 0;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 2;
}

.error-page__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
}

.error-page__tech {
  margin-top: 20px;
  text-align: start;
}

.error-standalone .error-page {
  max-width: none;
  margin-top: 16px;
}

.toast-region {
  position: fixed;
  z-index: 40;
  inset-inline-start: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.toast-region.toast-region--top {
  top: auto;
  bottom: auto;
  inset-block-start: 16px;
  inset-block-end: auto;
  inset-inline-start: auto;
  inset-inline-end: 16px;
  width: auto;
  max-width: min(420px, calc(100vw - 32px));
  height: auto;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--danger-border);
  border-radius: var(--radius);
  background: var(--danger-bg);
  color: var(--text);
  box-shadow: var(--shadow-md);
  pointer-events: auto;
}

.toast__close {
  margin-inline-start: auto;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
}

@media (max-width: 640px) {
  .error-page {
    margin-top: 24px;
  }

  .error-page__icon {
    width: 64px;
    height: 64px;
  }

  .error-page__actions {
    flex-direction: column;
  }

  .error-page__actions .btn {
    width: 100%;
    height: 44px;
  }
}

/* Numbered block on the review page. */
.review-sections {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Two cards. Nine shared rows so title lines up with title, and so on. */
.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: repeat(9, auto);
  column-gap: 24px;
}

.split__col {
  display: grid;
  grid-row: 1 / -1;
  grid-template-rows: subgrid;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.split__head {
  position: sticky;
  top: calc(var(--topbar-h) + var(--actionbar-h, 64px));
  z-index: 12;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 14px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
}

.split__title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

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

.split__intro,
.split__row {
  min-width: 0;
  padding: 16px;
  border-top: 1px solid var(--border);
}

.split__intro .section-card__header {
  padding: 0;
}

.section-card {
  padding: 0;
}

.section-card__header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 20px 20px 0;
}

.section-card__num {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-50);
  color: var(--primary);
  font-size: 14px;
  font-weight: 700;
}

.section-card__title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.section-card__desc {
  margin: 4px 0 0;
  font-size: 13.5px;
  color: var(--text-muted);
}

.section-card__body {
  padding: 20px;
}

.score-line {
  margin: 0 0 12px;
  font-size: 15px;
}

/* Comparison rows. Named rv-cmp so they are not the duplicates page .compare (3 columns). */
.rv-cmp {
  display: block;
}

.rv-cmp__head,
.rv-cmp__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  column-gap: 24px;
}

.rv-cmp__cell {
  display: block;
  min-width: 0;
}

.rv-cmp__head {
  position: sticky;
  top: calc(var(--topbar-h) + var(--actionbar-h, 64px));
  z-index: 10;
  align-items: start;
  padding-block: 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.rv-cmp__row {
  padding-block: 16px;
  border-top: 1px solid var(--border);
}

.rv-cmp__row:first-child,
.rv-cmp__head + .rv-cmp__row {
  border-top: 0;
}

.rv-cmp__title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.rv-cmp__aside,
.rv-cmp__note,
.section-card .srcwhen,
.section-card .src-count,
.section-card .srcswitch__time {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.rv-cmp__note {
  margin-top: 4px;
}

.rv-cmp__headcell,
.rv-cmp__tools,
.rv-cmp__rowhead,
.rv-cmp .fieldrow__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
}

.rv-cmp .fieldrow__tools,
.rv-cmp .imgactions .btn {
  flex: 0 0 auto;
}

.rv-cmp .fieldrow__tools {
  margin-inline-start: auto;
}

.rv-cmp .fieldrow__label {
  min-width: 0;
}

.rv-cmp__label {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 700;
}

.rv-cmp__label--source {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-faint);
}

.rv-cmp__cell .fieldrow:last-child {
  margin-bottom: 0;
}

.rv-cmp .input,
.rv-cmp .textarea,
.rv-cmp .select {
  display: block;
  width: 100%;
  max-width: none;
}

.rv-cmp .textarea--lead {
  height: auto;
  min-height: 96px;
  max-height: 320px;
  overflow-y: auto;
  resize: vertical;
}

/* Source picker. One shared choice for sections 1 and 2. */
.srcswitch {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  max-width: 100%;
  overflow-x: auto;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.srcswitch__item {
  flex: none;
  height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.srcswitch__item.is-active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.srcname {
  font-size: 15px;
  font-weight: 700;
}

.srcvariant__name {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 700;
}

html.js .srcvariant__name {
  display: none;
}

.src-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.8;
}

.src-text {
  margin: 0 0 12px;
  font-size: 15px;
  line-height: 2;
}

.src-muted {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

/* Equal-height scroll box for the two body texts. */
.rv-cmp__box {
  height: clamp(360px, 60vh, 560px);
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.section-card .body-preview.rv-cmp__box {
  max-height: none;
}

.section-card textarea.rv-cmp__box {
  display: block;
  width: 100%;
  height: clamp(360px, 60vh, 560px);
  min-height: 0;
  resize: vertical;
}

/* Source image placeholder. The file is not on our server, so it is not loaded. */
.imggrid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.imgthumb {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  max-width: 240px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 13px;
}

.imgthumb .icon {
  width: 28px;
  height: 28px;
}

.rv-cmp .draft-image {
  display: block;
  max-width: 100%;
}

.rv-cmp .draft-image img {
  display: block;
  max-width: 240px;
  height: auto;
}

.rv-cmp .imgname {
  display: block;
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--text-muted);
  direction: ltr;
  text-align: left;
  overflow-wrap: anywhere;
  word-break: normal;
}

/* Empty stand-in until our own picture exists. One element, two states. */
.imgslot {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 240px;
  aspect-ratio: 16 / 9;
  padding: 12px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text-muted);
  text-align: center;
}

.imgslot--inline {
  width: 120px;
  max-width: 120px;
  min-height: 80px;
  height: auto;
  aspect-ratio: auto;
}

.imgslot:has(img) {
  padding: 0;
  overflow: hidden;
}

.imgslot:has(img) .imgslot__empty {
  display: none;
}

.imgslot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.imgslot__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.imgslot .icon {
  width: 28px;
  height: 28px;
}

.srcshot {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  max-width: 240px;
}

.srcshot img {
  display: block;
  max-width: 240px;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.srcshot--inline img {
  max-width: 160px;
}

.rv-cmp .imgactions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.seo-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  column-gap: 32px;
}

.seo-grid__title {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 700;
}

.fieldrow.is-locked .input,
.fieldrow.is-locked .textarea,
.fieldrow.is-locked .select {
  background: var(--surface-2);
  cursor: not-allowed;
}

@media (max-width: 1099px) {
  .split {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
  }

  .split__col {
    display: flex;
    flex-direction: column;
    grid-row: auto;
    grid-template-rows: none;
  }

  .split__head {
    position: static;
  }

  .rv-cmp__head,
  .rv-cmp__row {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 12px;
  }

  .rv-cmp__head {
    position: static;
  }

  .rv-cmp__box,
  .section-card textarea.rv-cmp__box {
    height: clamp(300px, 55vh, 480px);
  }
}

@media (max-width: 899px) {
  .seo-grid {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 8px;
  }
}

@media (max-width: 639px) {
  .section-card .fieldrow__head,
  .section-card .fieldrow__foot,
  .rv-cmp__rowhead {
    flex-wrap: wrap;
  }
}
