:root {
  /* ── Green palette (key color, hsl ~175°) ── */
  --green-50:  #f0fafa;
  --green-100: #cde8e6;
  --green-200: #9dd1ce;
  --green-300: #5cb5b0;
  --green-400: #2b9e97;
  --green-500: #1a807a;
  --green-600: #126660;
  --green-700: #0e5a54;
  --green-800: #083a36;
  --green-900: #052523;

  /* ── Neutral palette (hsl ~200°, slightly cool) ── */
  --gray-50:  #f8fafc;
  --gray-100: #f0f4f5;
  --gray-200: #e2e8ea;
  --gray-300: #c2cdd1;
  --gray-400: #8fa3a8;
  --gray-500: #5f7880;
  --gray-600: #445d65;
  --gray-700: #2d4249;
  --gray-800: #182830;
  --gray-900: #0d1b20;

  /* ── Semantic tokens ── */
  --bg:            var(--gray-50);
  --bg-strong:     var(--gray-100);
  --panel:         #ffffff;
  --panel-strong:  var(--gray-100);
  --ink:           var(--gray-900);
  --muted:         var(--gray-600);
  --accent:        var(--green-700);
  --accent-strong: var(--green-800);
  --accent-soft:   var(--green-100);
  --warn:          #ad3f2f;
  --line:          var(--gray-200);
  --shadow:        0 18px 40px rgba(13, 27, 32, 0.08);
  font-family: "IBM Plex Sans", "Avenir Next", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

html[data-env="test"] {
  --bg: #fdf6e8;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
}

a {
  color: var(--accent-strong);
  text-decoration: none;
}

button,
input {
  font: inherit;
}

select {
  font: inherit;
  background: var(--panel);
  color: var(--ink);
}

select option {
  background: var(--panel);
  color: var(--ink);
}

#app {
  min-height: 100vh;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-panel {
  width: min(460px, 100%);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(226, 232, 234, 0.8);
  border-radius: 24px;
  padding: 32px;
  box-shadow: var(--shadow);
}

.auth-brand {
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.auth-panel h1 {
  margin: 0;
  font-size: 2rem;
  line-height: 1.05;
}

.auth-subtitle {
  margin: 10px 0 0;
  color: var(--muted);
}

.auth-form {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.auth-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.95rem;
}

.auth-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  background: #ffffff;
  color: var(--ink);
}

.primary-button,
.secondary-button,
.ghost-button,
.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 12px 18px;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.nav-link-button {
  text-decoration: none;
}

.primary-button {
  background: var(--accent);
  color: #f5fbfa;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.link-button:hover {
  transform: translateY(-1px);
}

.secondary-button,
.link-button {
  background: var(--panel-strong);
  color: var(--ink);
  border-color: var(--line);
}

.admin-button {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-color: var(--accent-strong);
}

.primary-button:disabled,
.ghost-button:disabled {
  opacity: 0.55;
  cursor: default;
  pointer-events: none;
}

.ghost-button {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.auth-footer {
  margin-top: 18px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  color: var(--muted);
}

.flash {
  margin-top: 18px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  padding: 12px 14px;
}

.flash.error,
.reader-status.error {
  background: #f8d8d2;
  color: #6f2016;
}

.toast {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%) translateY(-100%);
  z-index: 9999;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  pointer-events: none;
}

.toast-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.toast-success {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.toast-error {
  background: #f8d8d2;
  color: #6f2016;
}

.reader-shell {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pane-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
}

.pane-eyebrow {
  color: var(--accent);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
}

.admin-badge,
.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  font-size: 0.76rem;
}

.admin-badge,
.pill.flagged {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.pill.stage-raw {
  background: var(--panel-strong);
  color: var(--muted);
  border-color: var(--line);
}

.pill.stage-fetched {
  background: #e8f0fe;
  color: #1a56db;
  border-color: #b6d0f7;
}

.pill.stage-enriched {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-color: var(--accent);
}

.unread-pill {
  background: #f4e6b6;
}

.archived-pill {
  background: var(--bg-strong);
  color: var(--muted);
}

.reader-navbar {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 24px;
  height: 48px;
  background: #1e3a45;
  color: #f5fbfa;
  flex-shrink: 0;
  overflow: visible;
}

.reader-navbar-brand {
  background: transparent;
  border: none;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  margin-right: 20px;
  padding: 0;
  flex-shrink: 0;
  cursor: pointer;
  font-family: inherit;
  line-height: 1;
  transition: color 120ms ease;
}

.reader-navbar-brand:hover,
.reader-navbar-brand:focus-visible {
  color: rgba(255, 255, 255, 0.85);
}

.reader-navbar-prompt-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  padding: 4px;
  margin-right: 16px;
  margin-left: -12px;
  border-radius: 6px;
  flex-shrink: 0;
  transition: color 120ms ease, background 120ms ease;
}

.reader-navbar-prompt-edit:hover,
.reader-navbar-prompt-edit:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.reader-newsletter-selector {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0;
}

.reader-newsletter-name {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 6px 6px 12px;
  border-radius: 6px 0 0 6px;
  transition: background 120ms ease;
  line-height: 1.2;
}

.reader-newsletter-name:hover {
  background: rgba(255, 255, 255, 0.12);
}

.reader-newsletter-chevron {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 0 6px 6px 0;
  transition: background 120ms ease, color 120ms ease;
  display: flex;
  align-items: center;
  line-height: 1;
}

.reader-newsletter-chevron:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.reader-newsletter-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: #1a3352;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  padding: 4px;
  min-width: 160px;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.reader-newsletter-dropdown-item {
  display: block;
  width: 100%;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  text-align: left;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.875rem;
  transition: background 120ms ease, color 120ms ease;
}

.reader-newsletter-dropdown-item:hover,
.reader-newsletter-dropdown-item.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.reader-special-channel-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 5px;
  font-size: 0.875rem;
  margin-left: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 120ms ease, color 120ms ease;
}

.reader-special-channel-btn:hover,
.reader-special-channel-btn.active {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.reader-navbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

.reader-navbar-user {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
}

.reader-navbar-user-link {
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s;
}

.reader-navbar-user-link:hover {
  color: rgba(255, 255, 255, 0.9);
}

.reader-navbar-signout {
  color: rgba(255, 255, 255, 0.7);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 4px 12px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 120ms ease, color 120ms ease;
}

.reader-navbar-signout:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.reader-navbar-gear-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  font-size: 1rem;
  padding: 2px 6px;
  line-height: 1;
  border-radius: 4px;
  transition: color 120ms ease;
}

.reader-navbar-gear-btn:hover {
  color: #fff;
}

.reader-navbar-search-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  border-radius: 5px;
  transition: color 120ms ease, background 120ms ease;
}

.reader-navbar-search-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.reader-main {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(320px, 440px) minmax(0, 1fr);
  min-width: 0;
  overflow: hidden;
}

.story-list-pane,
.story-detail-pane {
  padding: 28px 24px;
  min-width: 0;
  overflow-y: auto;
}

.story-list-pane {
  border-right: 1px solid rgba(226, 232, 234, 0.9);
  background: var(--bg);
}

.story-detail-pane {
  background: var(--panel);
  outline: none;
}

.story-detail-pane--focused {
  box-shadow: inset 2px 0 0 var(--accent);
}

.pane-header h1,
.story-detail h2 {
  margin: 4px 0 0;
  font-size: 2rem;
  font-weight: 500;
  line-height: 1.05;
}

.reader-status {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.detail-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
}

.feed-source {
  font-weight: 500;
  color: var(--ink);
}

/* ── Full-width reader layout ── */

.reader-main-full {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
}

.feed-list-pane {
  max-width: 1080px;
  margin: 0 auto;
  padding: 8px 32px 48px;
}

.feed-list-header {
  margin-bottom: 16px;
}

.feed-list {
  display: flex;
  flex-direction: column;
}

/* Composer plus the compact controls that sit to its right once a search has
   run; the min-width on the box makes the controls wrap below it when narrow. */
.search-composer-row {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px;
}

.search-composer-box {
  position: relative;
  flex: 1 1 auto;
  min-width: min(100%, 380px);
}

.search-composer-side {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding-top: 9px;
}

.search-composer-input {
  width: 100%;
  box-sizing: border-box;
  display: block;
  max-height: 168px;
  overflow-y: auto;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 60px 12px 16px;
  font: inherit;
  font-size: 1rem;
  line-height: 1.45;
  color: var(--ink);
  background: #ffffff;
}

.search-composer-input::placeholder {
  color: var(--muted);
  opacity: 0.78;
}

.search-composer-input:focus {
  outline: none;
  border-color: var(--green-300);
  box-shadow: 0 0 0 3px rgba(43, 158, 151, 0.12);
}

.search-composer-submit {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0;
  background: #f5f9f8;
  color: #496667;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.search-composer-submit:hover:not(:disabled),
.search-composer-submit:focus-visible:not(:disabled) {
  background: #eaf2f1;
  border-color: #5f7e80;
  color: #314d4f;
}

.search-composer-submit:disabled {
  cursor: default;
  opacity: 0.48;
}

.search-composer-submit.search-dirty {
  background: #314d4f;
  border-color: #314d4f;
  color: #ffffff;
}

.search-composer-submit.search-dirty:hover:not(:disabled) {
  background: #243b3d;
  border-color: #243b3d;
}

.saved-search-pills-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.saved-search-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 240px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 7px 13px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.saved-search-pill:hover,
.saved-search-pill:focus-visible {
  border-color: #b8c9cd;
  background: #f8fbfb;
}

.saved-search-dropdown-wrap {
  position: relative;
}

.saved-search-dropdown-toggle svg {
  flex: 0 0 auto;
}

.saved-search-dropdown {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  width: min(320px, calc(100vw - 48px));
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(24, 39, 47, 0.14);
  background: #ffffff;
  padding: 6px;
}

.saved-search-dropdown-item {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 6px;
  padding: 9px 10px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
}

.saved-search-dropdown-item:hover,
.saved-search-dropdown-item:focus-visible {
  background: #f2f6f6;
}

.saved-search-dropdown-item.is-muted {
  color: var(--muted);
  cursor: default;
}

.search-options-summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  list-style: none;
}

.search-options-summary::-webkit-details-marker {
  display: none;
}

.search-options-summary svg {
  color: var(--muted);
  flex: 0 0 auto;
}

.feed-list-editor {
  margin-bottom: 20px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
}

.feed-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 16px 6px 14px;
  border-bottom: 1px solid var(--line);
  /* Unread signal lives on this edge (teal when unread) — no bullet dot. */
  border-left: 2px solid transparent;
  cursor: pointer;
  transition: background 100ms ease;
}

.feed-item.unread {
  border-left-color: var(--green-300);
}

.feed-item:first-child {
  border-top: 1px solid var(--line);
}

.feed-item:hover {
  background: var(--panel);
}

.feed-item.keyboard-focused {
  box-shadow: inset 0 0 0 1px var(--gray-300);
}

.feed-item.read {
  opacity: 0.6;
}

.feed-item.read:hover {
  opacity: 0.85;
}

.feed-item-line1 {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

/* Only acts as a flex line-break in the mobile media query; inert otherwise. */
.feed-item-row-break {
  display: none;
}

.feed-item-title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--ink);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feed-item.unread .feed-item-title {
  font-weight: 600;
}

.feed-item-title a {
  color: inherit;
  text-decoration: none;
}

.feed-item-title a:hover {
  text-decoration: underline;
}

.feed-item-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.feed-item-external-link {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.15s;
  text-decoration: none;
}

.feed-item-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: none;
  border: none;
  width: 20px;
  height: 20px;
  padding: 0;
  cursor: pointer;
  color: var(--muted);
  opacity: 1;
  transition: opacity 0.15s;
}

.feed-item:hover .feed-item-external-link,
.feed-item.keyboard-focused .feed-item-external-link {
  opacity: 1;
}

.feed-item-action-btn.flagged,
.feed-item-action-btn.archived,
.feed-item-action-btn.active {
  opacity: 1;
}

.feed-item-external-link:hover {
  color: var(--accent);
}

.feed-item-action-btn:hover {
  color: var(--accent);
}

.feed-item-action-btn.flagged {
  color: var(--warn, #d97706);
}

.feed-item-action-btn.active {
  color: var(--accent);
}

.feed-item-action-btn:disabled {
  cursor: default;
  opacity: 0.35;
}

.feed-item-action-btn:disabled:hover {
  color: var(--muted);
}

.feed-item-line2 {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-start;
  flex-wrap: nowrap;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
  min-width: 0;
  overflow: hidden;
}

.feed-item-domain {
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.01em;
  min-width: 0;
  max-width: min(36ch, 100%);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.feed-item-via {
  font-weight: 400;
  color: var(--muted);
}
.feed-item-domain-link {
  color: inherit;
  text-decoration: none;
}
.feed-item-domain-link:hover {
  text-decoration: underline;
}

.feed-item-source {
  color: var(--muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feed-item-source::before {
  content: "via ";
  opacity: 0.6;
}

.feed-item-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 3px;
  background: var(--panel-strong);
  font-size: 0.72rem;
  color: var(--muted);
  max-width: 18ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feed-item-age {
  color: var(--muted);
  opacity: 0.7;
  font-family: var(--font-mono, 'SF Mono', 'Menlo', monospace);
  font-size: 0.72rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feed-item-reading-time {
  color: var(--muted);
  opacity: 0.55;
  font-family: var(--font-mono, 'SF Mono', 'Menlo', monospace);
  font-size: 0.72rem;
  white-space: nowrap;
}

.detail-reading-time {
  opacity: 0.7;
}

.detail-gated {
  color: var(--warning, #b45309);
  opacity: 0.8;
  font-weight: 500;
}

/* Newsletter relevance badges */
.nl-badges {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.nl-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: none;
  cursor: pointer;
  line-height: 1.4;
  transition: opacity 0.15s;
}

.nl-badge:hover {
  opacity: 0.8;
}

.nl-badge-4 {
  background: rgba(76, 175, 80, 0.18);
  color: #4caf50;
}

.nl-badge-5 {
  background: rgba(46, 125, 50, 0.22);
  color: #2e7d32;
}

.nl-badge-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border-radius: 3px;
  border: 1px dashed var(--line);
  background: none;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  line-height: 1;
  transition: border-color 0.15s, color 0.15s;
}

.nl-badge-add:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.feed-item-stats {
  display: flex;
  gap: 8px;
  font-size: 0.72rem;
  font-weight: 500;
  flex-shrink: 0;
  margin-left: auto;
  color: var(--muted);
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
  align-items: center;
}

.feed-item-score-btn {
  background: none;
  border: none;
  padding: 1px 4px;
  font-size: inherit;
  font-weight: inherit;
  font-variant-numeric: tabular-nums;
  color: inherit;
  cursor: pointer;
  border-radius: 3px;
  line-height: 1;
  border-bottom: 1px dashed transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.feed-item-score-btn:hover {
  background: rgba(100, 149, 237, 0.15);
  color: cornflowerblue;
  border-bottom-color: cornflowerblue;
}

/* Admin score breakdown — inline with meta */
.feed-item-score-components {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  font-size: 0.72rem;
  opacity: 0.75;
}

.score-total {
  font-weight: 600;
}

.score-sep {
  opacity: 0.4;
}

.feed-item-base-score {
  all: unset;
  font-family: var(--font-mono, 'SF Mono', 'Menlo', monospace);
  font-variant-numeric: tabular-nums;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gray-500, #6b7280);
  background: var(--gray-100, #f3f4f6);
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 4px;
  padding: 0 5px;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1.5;
}

.feed-item-title-score {
  flex: 0 0 auto;
}
.feed-item-base-score:hover {
  background: var(--gray-200, #e5e7eb);
  color: var(--gray-700, #374151);
}

/* Graded score chips: strong judgments read teal, weak ones fade. */
.feed-item-base-score.score-high {
  background: #e3f2f0;
  border-color: #c3e2df;
  color: var(--green-700);
}
.feed-item-base-score.score-high:hover {
  background: #d2ebe8;
  color: var(--green-800);
}
.feed-item-base-score.score-low {
  background: transparent;
  border-color: transparent;
  color: var(--gray-400, #adb5bd);
}
.feed-item-base-score.score-low:hover {
  background: var(--gray-100, #f3f4f6);
  color: var(--gray-600, #4b5563);
}

.judgment-run-tag {
  font-family: var(--font-mono, 'SF Mono', 'Menlo', monospace);
  font-size: 0.68rem;
  background: var(--gray-800, #1f2937);
  color: var(--gray-400, #9ca3af);
  padding: 0 4px;
  border-radius: 3px;
  border: 1px solid var(--gray-700, #374151);
  letter-spacing: 0.02em;
}
.judgment-run-tag:hover {
  color: var(--gray-200, #e5e7eb);
  border-color: var(--gray-600, #4b5563);
}

.feed-item-score-rules {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: flex-end;
}

.score-rule-chip {
  opacity: 0.35;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.score-rule-chip.matched {
  opacity: 0.8;
}

.score-rule-field {
  font-weight: 500;
}

/* Curator override edit button — tiny pencil icon inline */
.curator-override-btn {
  background: none;
  border: none;
  padding: 0 2px;
  margin-left: 3px;
  cursor: pointer;
  color: var(--gray-400, #9ca3af);
  opacity: 0.5;
  transition: opacity 0.15s, color 0.15s;
  vertical-align: middle;
  line-height: 1;
}
.curator-override-btn:hover {
  opacity: 1;
  color: cornflowerblue;
}

/* Score feedback modal */
.score-feedback-modal {
  max-width: 380px;
  width: 100%;
  padding: 20px 24px;
}

.admin-score-modal {
  max-width: 440px;
}

.admin-score-modal-copy {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
  margin-bottom: 14px;
}

.admin-score-picker {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.admin-score-picker-btn {
  height: 40px;
  border: 2px solid transparent;
  border-radius: 10px;
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.admin-score-picker-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.16);
}

.admin-score-picker-btn.selected {
  border-color: #0f172a;
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.12);
}

.admin-score-picker-btn:disabled {
  cursor: wait;
  opacity: 0.65;
  transform: none;
  box-shadow: none;
}

.admin-score-modal-status {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 12px;
}

.admin-score-comment {
  min-height: 96px;
}

.score-feedback-modal-title {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.score-feedback-modal-article {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-feedback-modal-row {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 12px;
}

.score-feedback-modal-label {
  font-size: 0.82rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.score-feedback-select {
  font-size: 0.85rem;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
  color: var(--ink);
}

.score-feedback-justification {
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--bg-strong);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 10px;
  line-height: 1.45;
}

.score-feedback-comment {
  width: 100%;
  box-sizing: border-box;
  font-size: 0.82rem;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
  color: var(--ink);
  resize: vertical;
  margin-bottom: 14px;
}

.score-feedback-modal-actions {
  display: flex;
  gap: 8px;
}

.score-feedback-modal-done {
  font-size: 0.85rem;
  color: var(--accent);
  padding: 8px 0;
}

/* ── Feed membership feedback button ──────────────────────────────────── */
.feed-membership-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid var(--gray-300);
  background: var(--gray-100);
  color: var(--gray-500);
  cursor: pointer;
  padding: 0;
  margin-left: 4px;
  transition: color 0.15s, border-color 0.15s;
}
.feed-membership-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.feed-item-introspect-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid var(--gray-300);
  background: var(--gray-100);
  color: var(--gray-500);
  cursor: pointer;
  padding: 0;
  transition: color 0.15s, border-color 0.15s;
}

.feed-item-introspect-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.modal-content.smart-feed-events-modal {
  max-width: 760px;
  width: 100%;
  padding: 20px 24px;
}

.smart-feed-events-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.smart-feed-events-title {
  margin: 0 0 4px;
  font-size: 1rem;
  color: #111827;
}

.smart-feed-events-subtitle {
  font-size: 0.82rem;
  color: #6b7280;
  line-height: 1.4;
}

.smart-feed-events-empty {
  font-size: 0.84rem;
  color: #6b7280;
}

.smart-feed-events-error {
  color: #b91c1c;
}

.smart-feed-events-list {
  display: grid;
  gap: 12px;
}

.smart-feed-event-card {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px 16px;
  background: #ffffff;
}

.smart-feed-event-topline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.smart-feed-event-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.smart-feed-event-badge.is-in {
  background: #dcfce7;
  color: #166534;
}

.smart-feed-event-badge.is-out {
  background: #fee2e2;
  color: #991b1b;
}

.smart-feed-event-current {
  font-size: 0.72rem;
  font-weight: 600;
  color: #1d4ed8;
  background: #dbeafe;
  border-radius: 999px;
  padding: 2px 8px;
}

.smart-feed-event-time {
  font-size: 0.78rem;
  color: #6b7280;
  margin-left: auto;
}

.smart-feed-event-meta {
  display: grid;
  gap: 6px;
  font-size: 0.8rem;
  color: #374151;
  line-height: 1.4;
}

.smart-feed-event-mono {
  font-family: var(--font-mono, 'SF Mono', 'Menlo', monospace);
}

.smart-feed-event-justification {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  font-size: 0.8rem;
  color: #374151;
  line-height: 1.45;
}

/* ── Feed membership modal ───────────────────────────────────────────── */
.feed-membership-modal {
  max-width: 520px;
  width: 100%;
  padding: 20px 24px;
}

.feed-membership-article-title {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feed-membership-loading,
.feed-membership-error {
  font-size: 0.85rem;
  color: var(--muted);
  padding: 12px 0;
}

.feed-membership-error {
  color: var(--warn, #ef4444);
}

.feed-membership-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 50vh;
  overflow-y: auto;
}

.feed-membership-row {
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
}
.feed-membership-row:last-child {
  border-bottom: none;
}

.feed-membership-row-main {
  display: flex;
  align-items: center;
  gap: 10px;
}

.feed-membership-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  flex-shrink: 0;
}
.feed-membership-indicator.in-feed {
  background: var(--green-100, #dcfce7);
  color: var(--green-700, #15803d);
}
.feed-membership-indicator.not-in-feed {
  background: var(--gray-100, #f3f4f6);
  color: var(--gray-400, #9ca3af);
}

.feed-membership-name {
  flex: 1;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feed-membership-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.feed-membership-prior {
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 500;
}
.feed-membership-prior.prior-should {
  background: var(--green-100, #dcfce7);
  color: var(--green-700, #15803d);
}
.feed-membership-prior.prior-shouldnt {
  background: #fef2f2;
  color: #b91c1c;
}

.feed-membership-saved {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 500;
}

.feed-membership-action-btn {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s;
}
.feed-membership-action-btn:hover {
  background: var(--gray-100, #f3f4f6);
  border-color: var(--accent);
}

.feed-membership-cancel-btn {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--muted);
  cursor: pointer;
}

.feed-membership-expand {
  margin-top: 8px;
  margin-left: 32px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.feed-membership-justification {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 0.82rem;
  font-family: inherit;
  resize: vertical;
  background: #ffffff;
  color: var(--ink);
}
.feed-membership-justification:focus {
  outline: none;
  border-color: var(--accent);
}

.feed-membership-expand .primary-button {
  align-self: flex-start;
  font-size: 0.78rem;
  padding: 5px 14px;
}

.feed-membership-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

/* Curation data table */
.curation-data-table-wrap {
  overflow-x: auto;
}

.curation-data-table {
  width: 100%;
  min-width: 1080px;
  table-layout: auto;
}

.curation-data-table td,
.curation-data-table th {
  padding: 14px 12px;
  vertical-align: top;
}

.curation-data-table th {
  background: #ffffff;
}

.curation-data-row:hover {
  background: rgba(197, 232, 255, 0.14);
}

.curation-data-title {
  min-width: 320px;
  width: 34%;
}

.curation-data-title-link {
  display: inline-block;
  font-size: 0.98rem;
  line-height: 1.45;
  color: var(--ink);
  text-wrap: balance;
}

.curation-data-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.curation-data-pill-quality {
  background: #edf6ec;
  color: #2e6b39;
}

.curation-data-pill-topic {
  background: #fff1e7;
  color: #b25917;
}

.curation-data-pill-duplicate {
  background: #eef2ff;
  color: #4456c6;
}

.curation-data-pill-neutral {
  background: #f4f6f8;
  color: #52606d;
}

.curation-data-detail-cell {
  min-width: 180px;
  font-size: 0.86rem;
  line-height: 1.4;
}

.curation-data-detail-change {
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.curation-data-detail-link,
.curation-data-detail-topic {
  color: var(--ink);
}

.curation-data-score {
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
}

.curation-data-score-new {
  font-weight: 600;
  color: var(--accent);
}

.curation-data-comment {
  min-width: 220px;
  max-width: 280px;
  font-size: 0.84rem;
  line-height: 1.45;
}

.curation-data-curator {
  white-space: nowrap;
}

.curation-data-curator-name {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: #f7f8fa;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 600;
}

.curation-data-empty-value {
  color: var(--muted);
  font-style: italic;
}

.curation-data-when {
  min-width: 170px;
}

.curation-data-when-relative {
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 600;
}

.curation-data-when-absolute {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.77rem;
  line-height: 1.35;
}

.curation-data-actions {
  width: 120px;
  white-space: nowrap;
}

.curation-data-open-btn,
.curation-data-delete-btn {
  font-size: 0.76rem;
  padding: 5px 9px;
}

.curation-data-open-btn {
  margin-right: 8px;
}

.curation-data-delete-btn {
  color: #b83232;
}

.comment-expand-btn {
  background: none;
  border: none;
  padding: 0 2px;
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  font-size: inherit;
}

.comment-expand-btn:hover {
  text-decoration: underline;
}

/* Filter dropdowns */
.filter-header {
  display: inline-block;
}

.filter-header-btn {
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  text-transform: uppercase;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.filter-header-btn:hover {
  color: var(--accent);
}

.filter-chevron {
  font-size: 0.65rem;
  opacity: 0.6;
}

.filter-active-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  margin-left: 2px;
}

.filter-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9;
}

.filter-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.10);
  z-index: 10;
  min-width: 140px;
  max-height: 240px;
  overflow-y: auto;
  padding: 4px 0;
}

.filter-dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 5px 12px;
  font-size: 0.8rem;
  color: var(--ink);
  white-space: nowrap;
}

.filter-dropdown-item:hover {
  background: var(--bg-hover, #f5f5f5);
}

.filter-dropdown-item-active {
  font-weight: 600;
  color: var(--accent);
}

.filter-dropdown-clear {
  color: var(--muted);
  font-style: italic;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2px;
  padding-bottom: 6px;
}

/* Sortable headers */
.sortable-th {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.sortable-th:hover {
  color: var(--accent);
}

.sort-chevron {
  font-size: 0.55rem;
  margin-left: 3px;
  opacity: 0.25;
  vertical-align: middle;
}

.sort-chevron-active {
  opacity: 0.8;
  color: var(--accent);
}

.feed-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.feed-item-meta > * {
  flex: 0 0 auto;
}

.feed-item-meta .feed-item-domain,
.feed-item-meta .feed-item-source {
  flex: 0 0 auto;
}

.feed-item-meta .feed-item-tag,
.feed-item-meta .feed-item-age {
  flex: 0 1 auto;
}

.feed-item-topic-wrap {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
  flex: 0 1 auto;
}

.feed-item-topic {
  all: unset;
  color: var(--muted);
  cursor: pointer;
  opacity: 0.72;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.feed-item-topic:hover {
  color: var(--ink);
  opacity: 1;
}

.feed-item-topic-count {
  white-space: nowrap;
}

.feed-item-summary-toggle {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  padding: 0;
  font-size: 0.75rem;
  color: var(--muted);
  opacity: 0.6;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  font-family: inherit;
}

.feed-item-summary-toggle:hover {
  opacity: 1;
}

.feed-item-summary-toggle svg {
  transition: transform 120ms ease;
}

.feed-item-summary-toggle.expanded svg {
  transform: rotate(90deg);
}

.feed-item-expanded {
  margin: 6px 0 2px 0;
  padding: 10px 14px;
  background: #f8f9fa;
  border-radius: 6px;
  font-size: 0.8rem;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
}

/* Divider between every section in the expanded panel */
.feed-item-expanded > * + * {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.feed-item-expanded-summary {
  position: relative;
}

.feed-item-section-header {
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--gray-500, #6c757d);
  margin-bottom: 4px;
}

.feed-item-summary-actions {
  position: absolute;
  bottom: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

.feed-item-summary {
  font-size: 0.8rem;
  color: var(--ink);
  line-height: 1.5;
}

.feed-item-summary-edit-btn {
  background: none;
  border: none;
  padding: 1px 2px;
  cursor: pointer;
  color: var(--muted);
  opacity: 0.4;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  line-height: 1;
  transition: opacity 0.15s;
}

.feed-item-summary-edit-btn:hover {
  opacity: 1;
}

.feed-item-summary-edit {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.feed-item-summary-textarea {
  width: 100%;
  font-size: 0.82rem;
  font-family: inherit;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg);
  color: var(--ink);
  resize: vertical;
  box-sizing: border-box;
}

.feed-item-summary-edit-actions {
  display: flex;
  gap: 6px;
}

.summary-save-btn,
.summary-cancel-btn {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 3px;
  cursor: pointer;
  border: 1px solid var(--line);
}

.summary-save-btn {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.summary-save-btn:disabled,
.summary-cancel-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.summary-cancel-btn {
  background: none;
  color: var(--muted);
}

/* ── Topic alternates ── */

.feed-item-alternates-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.78rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.feed-item-alternates-list a {
  color: var(--link);
  text-decoration: none;
}

.feed-item-alternates-list a:hover {
  text-decoration: underline;
}

.feed-item-alternates-meta {
  display: inline;
  font-size: 0.72rem;
  color: var(--muted);
  margin-left: 6px;
}

.feed-item-alternates-meta > span + span::before {
  content: " · ";
}

.feed-item-alternates-domain {
  color: var(--muted);
  font-size: 0.72rem;
}

.feed-item-alternates-age {
  color: var(--muted);
  font-size: 0.72rem;
}

.feed-item-alternates-reading {
  color: var(--muted);
  font-size: 0.72rem;
}

.feed-item-context-fact {
  margin: 2px 0;
  color: var(--ink);
}

.feed-item-context-sources {
  font-size: 0.68rem;
  color: var(--muted);
  margin-left: 4px;
}

.feed-item-discussion-picks {
  list-style: none;
  margin: 6px 0 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.feed-item-discussion-pick-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.feed-item-discussion-pick-meta {
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-right: 6px;
}

.feed-item-discussion-pick-summary {
  color: var(--ink);
}

.feed-item-discussion-pick-link:hover .feed-item-discussion-pick-summary {
  text-decoration: underline;
}

/* ── Summary edit in article detail view ── */

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

.summary-edit-textarea {
  width: 100%;
  font-size: 0.9rem;
  font-family: inherit;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg);
  color: var(--ink);
  resize: vertical;
  box-sizing: border-box;
  line-height: 1.5;
}

.summary-edit-actions {
  display: flex;
  gap: 8px;
}

/* ── Article read page ── */

.article-read-navbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  height: 44px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.article-read-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 8px 4px 2px;
  border-radius: 6px;
  transition: background 100ms ease;
}

.article-read-back:hover {
  background: var(--accent-soft);
}

.article-read-domain {
  font-size: 0.78rem;
  color: var(--muted);
}

.article-read-main {
  flex: 1;
  overflow-y: auto;
  background: var(--panel);
}

.article-read-main .story-detail-pane {
  max-width: 820px;
  margin: 0 auto;
  padding: 32px 32px 64px;
  background: var(--panel);
  border: none;
}

@media (max-width: 720px) {
  .feed-list-pane {
    padding: 20px 16px 40px;
  }
  .article-read-main .story-detail-pane {
    padding: 20px 16px 48px;
  }
}

.story-detail {
  max-width: 820px;
}

.story-detail-header {
  display: grid;
  gap: 8px;
}

.story-detail-header h2 {
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.title-external-link {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  color: var(--muted);
  opacity: 0.55;
  transition: opacity 120ms ease, color 120ms ease;
  vertical-align: middle;
}

.title-external-link:hover {
  opacity: 1;
  color: var(--accent-strong);
}

.detail-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
}

.detail-author {
  font-size: 0.82rem;
  color: var(--ink);
  font-weight: 500;
}

.detail-score-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  opacity: 0.7;
  margin-left: 4px;
}

.detail-score-item {
  font-size: inherit;
}

.detail-score-btn {
  background: none;
  border: none;
  padding: 0 2px;
  font-size: inherit;
  font-weight: inherit;
  font-variant-numeric: tabular-nums;
  color: inherit;
  cursor: pointer;
  border-radius: 3px;
  line-height: 1;
  transition: background 0.1s, color 0.1s;
}

.detail-score-btn:hover {
  background: var(--panel-strong);
  color: var(--fg);
  opacity: 1;
}

.detail-status-icons {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.status-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: 4px;
  opacity: 0.55;
  transition: opacity 120ms ease, color 120ms ease;
}

.status-icon-btn:hover {
  opacity: 1;
  color: var(--ink);
}

.status-icon-btn.read {
  opacity: 1;
  color: var(--accent);
}

.status-icon-btn.flagged {
  opacity: 1;
  color: var(--accent-strong);
}

.status-icon-btn.note-open {
  opacity: 1;
  color: var(--accent);
}

.status-icon-btn.note-has-content {
  opacity: 0.8;
  color: var(--accent);
}

.article-note-panel {
  margin-top: 10px;
  padding: 10px 12px 8px;
  background: var(--bg-strong);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.article-note-textarea {
  display: block;
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px 10px;
  font-family: "IBM Plex Mono", "Fira Code", monospace;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--panel);
  outline: none;
  transition: border-color 120ms ease;
}

.article-note-textarea:focus {
  border-color: var(--accent);
}

.article-note-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 5px;
  min-height: 15px;
}

.article-note-status {
  font-size: 11px;
  color: var(--muted);
}

.article-note-delete-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  opacity: 0.6;
}

.article-note-delete-btn:hover {
  color: var(--danger, #c0392b);
  opacity: 1;
}

.article-note-loading {
  font-size: 12px;
  color: var(--muted);
  padding: 6px 0;
}

.admin-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 5px 10px;
  background: var(--accent-soft);
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
}

.admin-topic-badge {
  font-size: 0.78rem;
  padding: 1px 8px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
  margin-left: auto;
}

.admin-topic-badge--empty {
  background: none;
  color: var(--muted);
  font-style: italic;
  opacity: 0.6;
  border: 1px dashed var(--muted);
}

.admin-topic-badge:hover {
  opacity: 0.8;
  filter: brightness(0.95);
}

.admin-topic-badge--empty:hover {
  opacity: 1;
  border-color: var(--accent);
  color: var(--accent-strong);
}

.admin-icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  color: var(--accent-strong);
  border-radius: 4px;
  opacity: 0.65;
  transition: opacity 120ms ease, background 120ms ease;
}

.admin-icon-link:hover {
  opacity: 1;
  background: color-mix(in srgb, var(--accent) 15%, transparent);
}

.lifecycle-stepper {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
}

.lifecycle-arrow {
  color: var(--line);
  font-size: 0.75rem;
  line-height: 1;
  padding: 0 2px;
}

.lifecycle-step {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
  border: none;
  background: transparent;
  cursor: default;
  line-height: 1.4;
}

.lifecycle-step.step-done {
  color: var(--muted);
}

.lifecycle-step.step-current {
  background: var(--bg-strong);
  color: var(--ink);
}

.lifecycle-step.step-available {
  background: var(--accent-soft);
  color: var(--accent-strong);
  cursor: pointer;
  transition: transform 100ms ease, background 100ms ease;
}

.lifecycle-step.step-available:hover {
  transform: translateY(-1px);
  background: var(--accent);
  color: #fff;
}

.lifecycle-step.step-locked {
  color: var(--muted);
  opacity: 0.45;
}

.lifecycle-step.step-queued {
  background: var(--warning-soft, #fef3c7);
  color: var(--warning-strong, #92400e);
  cursor: default;
}

.lifecycle-dropdown {
  position: relative;
  display: inline-flex;
}

.lifecycle-step-dropdown {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.lifecycle-step-dropdown:hover {
  color: var(--ink);
}

.lifecycle-dropdown-caret {
  font-size: 0.6rem;
  opacity: 0.5;
  line-height: 1;
}

.lifecycle-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px;
  z-index: 100;
  min-width: 100%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.lifecycle-dropdown-item {
  display: block;
  width: 100%;
  padding: 3px 8px;
  font-size: 0.75rem;
  font-weight: 500;
  text-align: left;
  background: none;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  color: var(--ink);
  white-space: nowrap;
}

.lifecycle-dropdown-item:hover {
  background: var(--bg-strong);
}

.linked-url-row {
  margin-top: 14px;
}

.linked-url-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 8px;
  transition: color 120ms ease, border-color 120ms ease;
}

.linked-url-link:hover {
  color: var(--accent-strong);
  border-color: var(--accent-strong);
}

.content-updated-notice {
  margin-top: 16px;
  padding: 6px 10px;
  font-size: 0.82rem;
  color: var(--text-secondary, #6b7280);
  background: rgba(59, 130, 246, 0.06);
  border-left: 3px solid rgba(59, 130, 246, 0.4);
  border-radius: 2px;
}

.detail-section {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid rgba(226, 232, 234, 0.8);
}


.detail-section h3 {
  margin: 0 0 10px;
  font-size: 0.92rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.detail-section p {
  margin: 0;
  color: var(--ink);
  white-space: pre-wrap;
  line-height: 1.7;
}

.detail-content {
  margin: 0;
  color: var(--ink);
  line-height: 1.7;
}

.detail-content p,
.detail-content blockquote,
.detail-content h1,
.detail-content h2,
.detail-content h3,
.detail-content h4,
.detail-content h5,
.detail-content h6,
.detail-content ul,
.detail-content ol,
.detail-content pre,
.detail-content hr,
.detail-content figure {
  margin-bottom: 12px;
}

.detail-content h1,
.detail-content h2,
.detail-content h3,
.detail-content h4,
.detail-content h5,
.detail-content h6 {
  margin-top: 24px;
}

.detail-content a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.detail-content blockquote {
  border-left: 4px solid var(--accent);
  padding-left: 16px;
  margin-left: 0;
  color: var(--muted);
}

.detail-content img {
  max-width: 100%;
  height: auto;
}

.empty-panel {
  min-height: 240px;
  display: grid;
  place-items: center;
  padding: 24px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px dashed var(--line);
  color: var(--muted);
  text-align: center;
}

.detail-empty {
  min-height: 60vh;
}

.admin-shell {
  min-height: 100vh;
  padding: 0 24px 40px;
}

.admin-shell .reader-navbar {
  margin: 0 -24px 28px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.admin-crumb {
  display: inline-block;
  font-size: 0.8rem;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 10px;
}

.admin-crumb:hover {
  color: var(--accent);
}

.segmented-control {
  display: inline-flex;
  background: var(--gray-100);
  padding: 4px;
  border-radius: 12px;
  gap: 4px;
  margin-bottom: 24px;
}

.segmented-control-item {
  padding: 8px 16px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.segmented-control-item:hover {
  background: var(--gray-200);
  color: var(--ink);
}

.segmented-control-item.active {
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.admin-page-title {
  margin-bottom: 20px;
}

.admin-page-title h1 {
  margin: 0;
}

.change-detail-source-card {
  margin-bottom: 24px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
}

.change-detail-source-label {
  margin-bottom: 12px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.change-detail-source-grid {
  display: grid;
  gap: 12px;
}

.change-detail-source-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.change-detail-source-key {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
}

.change-detail-source-value {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.45;
}

.change-detail-source-meta {
  color: var(--muted);
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.change-detail-source-empty {
  color: var(--muted);
  font-size: 0.9rem;
}

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

.admin-header h1,
.site-card h3 {
  margin: 0;
}

.admin-panel h2 {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
}

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

.admin-header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-grid,
.tuning-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.admin-panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(226, 232, 234, 0.9);
  border-radius: 24px;
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 28px;
  overflow-x: auto;
}

.admin-panel.tuning-form {
  max-width: 800px;
  margin: 0 auto;
}

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

.score-settings-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #ffffff;
}

.score-settings-group h2 {
  margin: 0 0 12px;
  font-size: 0.9rem;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--muted);
}

.score-setting-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.score-setting-row:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.score-setting-copy {
  min-width: 0;
}

.score-setting-key {
  font-size: 0.86rem;
  font-weight: 650;
  color: var(--ink);
  font-family: var(--font-mono, 'SF Mono', 'Menlo', monospace);
}

.score-setting-description,
.score-setting-meta {
  margin-top: 3px;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
}

.score-setting-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.score-setting-control input {
  width: 92px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font-family: var(--font-mono, 'SF Mono', 'Menlo', monospace);
  font-size: 0.9rem;
}

.relevance-multiplier-slider {
  display: flex;
  align-items: center;
  gap: 8px;
}

.relevance-multiplier-slider input[type='range'] {
  width: 160px;
  padding: 0;
  border: 0;
  background: transparent;
}

.relevance-multiplier-readout {
  font-family: var(--font-mono, 'SF Mono', 'Menlo', monospace);
  font-size: 0.85rem;
  color: var(--muted);
  min-width: 44px;
  text-align: right;
}

.score-setting-error {
  grid-column: 1 / -1;
  color: var(--error, #dc2626);
  font-size: 0.85rem;
}

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

  .score-setting-row {
    grid-template-columns: 1fr;
  }

  .score-setting-control {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

.tuning-prompt-textarea {
  font-size: 1rem;
  line-height: 1.6;
  font-family: inherit;
  min-height: 320px;
  resize: vertical;
}

.site-card-actions.panel-footer {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.site-form,
.site-form-grid {
  display: grid;
  gap: 14px;
}

.site-form label,
.site-form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.95rem;
}

.form-field-group {
  display: grid;
  gap: 18px;
}

.field-help {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.5;
}

.site-form input,
.site-form textarea,
.site-form-grid input,
.site-form-grid textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: #ffffff;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.site-form input:focus,
.site-form textarea:focus,
.site-form-grid input:focus,
.site-form-grid textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.checkbox-row {
  display: flex !important;
  align-items: center;
  gap: 10px;
}

.checkbox-row input {
  width: auto;
}

.sites-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.sites-filter-input {
  flex: 1;
  min-width: 180px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 14px;
  background: #ffffff;
  color: var(--ink);
}

.sites-sort-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.sites-sort-controls select {
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: #ffffff;
  color: var(--ink);
}

.sites-sort-dir-button {
  padding: 8px 12px !important;
  font-size: 0.85rem;
}

.site-list,
.tuning-list {
  display: grid;
  gap: 14px;
}

.site-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  padding: 18px;
}

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

.site-domain,
.site-meta {
  color: var(--muted);
}

.site-meta {
  margin-top: 8px;
  font-size: 0.9rem;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.site-fetch-status {
  color: var(--ink);
  opacity: 0.7;
}

.site-fetch-error {
  color: var(--error);
  font-size: 0.85rem;
  margin: 12px 0;
  background: var(--error-soft);
  padding: 8px 12px;
  border-radius: 10px;
  word-break: break-all;
}

.site-form-grid {
  margin-top: 14px;
}

.site-notes-row {
  grid-column: 1 / -1;
}

.site-card-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.danger-button {
  color: #7c2d20;
  border-color: #d7a193;
}

.inactive-pill {
  background: var(--gray-200);
  color: var(--gray-600);
}

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

.site-domain-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.score-pill {
  font-size: 0.75rem;
  padding: 2px 7px;
  font-weight: 600;
}

.score-1 { background: #fdd; color: #9b1c1c; }
.score-2 { background: #fde6cc; color: #8a4b08; }
.score-3 { background: #fef3c7; color: #78600d; }
.score-4 { background: #d1fae5; color: #065f46; }
.score-5 { background: #a7f3d0; color: #064e3b; }

/* ── Inline score editor popover (Sites table) ──────────────────── */
.score-cell {
  position: relative;
  display: inline-block;
}

.score-pill.score-empty {
  opacity: 0.5;
  color: var(--muted);
}

.score-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

.score-popover-options {
  display: flex;
  gap: 6px;
}

.score-popover-option {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid transparent;
  border-radius: 9px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.score-popover-option:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.score-popover-option.is-current {
  border-color: var(--accent-strong);
}

.score-popover-option:disabled {
  cursor: default;
  opacity: 0.6;
}

.score-popover-error {
  font-size: 0.75rem;
  color: var(--warn);
}

.score-popover-suggest {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.72rem;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  text-decoration: underline;
}

.score-popover-suggest:hover {
  color: var(--ink);
}

.stories-search-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}

.stories-search-bar .sites-filter-input {
  flex: 1;
}

.fetch-recent-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.fetch-hours-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  color: var(--muted);
}

.fetch-hours-input {
  width: 64px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  font: inherit;
  font-size: 0.875rem;
  text-align: center;
  color: var(--ink);
}

.fetch-hours-input:disabled {
  opacity: 0.5;
}

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

.spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

.story-domain-link {
  color: var(--accent);
  text-decoration: none;
}

.story-domain-link:hover {
  text-decoration: underline;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

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

.users-table th {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

.users-table td {
  color: var(--ink);
}

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

.add-article-btn {
  background: none;
  border: none;
  padding: 0 4px;
  margin-left: 6px;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  vertical-align: middle;
  transition: color 0.1s;
}

.add-article-btn:hover {
  color: var(--accent);
}

/* Articles table */
.articles-table-wrap {
  overflow-x: auto;
  margin-top: 8px;
}

.articles-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.articles-table th,
.articles-table td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.articles-table th {
  font-size: 0.72rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 1;
}

.articles-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color 0.1s;
}

.articles-table th.sortable:hover {
  color: var(--accent-strong);
}

.articles-table th .th-inner {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.articles-table th .sort-icon {
  opacity: 0;
  font-size: 0.85em;
  transition: opacity 0.1s;
  letter-spacing: 0;
}

.articles-table th.sortable:hover .sort-icon {
  opacity: 0.3;
}

.articles-table th.sorted .sort-icon {
  opacity: 0.7;
}

.articles-table tbody tr:hover td {
  background: var(--bg-strong);
}

.articles-table tbody tr:last-child td {
  border-bottom: none;
}

.articles-table .col-title {
  min-width: 320px;
  max-width: 560px;
  width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.articles-table .col-title a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}

.articles-table .col-title a:hover {
  text-decoration: underline;
}

.articles-table .col-topic {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8rem;
  color: var(--muted);
  cursor: pointer;
}
.articles-table .col-topic.expanded {
  white-space: normal;
  overflow: visible;
  max-width: 240px;
}

.col-title-topic {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 400;
}

.col-title-topic--empty {
  opacity: 0.45;
  font-style: italic;
}

.articles-table .col-site {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
  font-size: 0.82rem;
}

.articles-table .col-rank {
  width: 52px;
  text-align: center;
  color: var(--muted);
}

.articles-table .col-uuid {
  width: 72px;
  text-align: center;
  white-space: nowrap;
}

.uuid-copy-btn {
  background: none;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 6px;
  cursor: pointer;
  font-family: monospace;
  font-size: 0.78rem;
  color: var(--gray-500);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: border-color 0.15s, color 0.15s;
}

.uuid-copy-btn:hover {
  border-color: var(--accent);
  color: var(--fg);
}

.uuid-copy-btn.uuid-copied {
  border-color: var(--green-600, #16a34a);
  color: var(--green-600, #16a34a);
}

.uuid-copy-icon {
  font-size: 0.72rem;
}

.score-high { color: var(--accent); }
.score-mid  { color: var(--warn-amber, #b45309); }
.score-low  { color: var(--warn); }
.score-null { color: var(--muted); }

.scores-expand-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.6rem;
  padding: 0 2px;
  line-height: 1;
  vertical-align: middle;
}

.scores-expand-btn:hover {
  color: var(--ink);
}

.newsletter-scores-row td {
  padding: 6px 16px 10px;
  background: var(--bg-strong);
}

.newsletter-scores-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.ns-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
}

.ns-badge .ns-score {
  font-weight: 700;
}

.score-high .ns-score { color: var(--accent); }
.score-mid  .ns-score { color: var(--warn-amber, #b45309); }
.score-low  .ns-score { color: var(--warn); }
.score-null .ns-score { color: var(--muted); }

.ns-empty {
  font-size: 0.8rem;
  color: var(--muted);
}

.articles-table .col-score {
  width: 46px;
  text-align: right;
  padding-left: 2px;
  padding-right: 6px;
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
  color: var(--muted);
}

.articles-table .col-tier {
  width: 30px;
  text-align: center;
  padding-left: 2px;
  padding-right: 2px;
  color: var(--muted);
}

.articles-table .col-date {
  color: var(--muted);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.articles-table .col-fetched,
.articles-table .col-bool {
  width: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 0.75rem;
  padding-left: 2px;
  padding-right: 2px;
}

.articles-table th.col-bool-header {
  width: 28px;
  padding: 0 2px;
  text-align: center;
}

.articles-table th.col-bool-header .th-inner {
  white-space: nowrap;
  font-size: 0.7rem;
  line-height: 1;
}

.articles-table .col-links {
  width: 132px;
}

.article-links {
  display: flex;
  align-items: center;
  gap: 10px;
}

.score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 20px;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel, #f6f6f4);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.score-badge-load {
  cursor: pointer;
  color: var(--muted);
  transition: color 0.1s, border-color 0.1s;
}

.score-badge-load:hover:not(:disabled) {
  color: var(--accent);
  border-color: var(--accent);
}

.score-badge-load:disabled {
  cursor: default;
  opacity: 0.6;
}

.article-links a,
.article-link-copy {
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: none;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  line-height: 1;
  transition: color 0.1s;
}

.article-links a:hover,
.article-link-copy:hover:not(:disabled) {
  color: var(--accent);
}

.article-link-disabled {
  color: var(--line);
  font-size: 0.85rem;
  cursor: default;
}

.article-link-copy:disabled {
  opacity: 0.5;
  cursor: default;
}

.curation-notes-table .curation-notes-id {
  font-family: monospace;
  font-size: 12px;
  white-space: nowrap;
}

.curation-notes-table .curation-notes-title {
  max-width: 280px;
}

.curation-notes-extlink {
  margin-left: 6px;
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
}

.curation-notes-action {
  font-size: 12px;
  white-space: nowrap;
}

.curation-notes-eye {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--muted);
  padding: 0 4px;
}

.curation-notes-eye:hover {
  color: var(--accent);
}

.curation-notes-when {
  font-size: 12px;
  white-space: nowrap;
}

.curation-notes-expand td {
  padding-top: 0;
  padding-bottom: 12px;
}

.curation-notes-pre {
  margin: 0;
  font-size: 12px;
  font-family: monospace;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg-strong);
  border-radius: 4px;
  padding: 8px 10px;
  color: var(--ink);
}

/* ── My Activity page ─────────────────────────────────────── */

.my-activity-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
}

.my-activity-controls {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}

.my-activity-user-picker {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.my-activity-user-picker label {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

.my-activity-user-picker input,
.my-activity-user-picker select,
.my-activity-filter select {
  font-size: 0.82rem;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
}

.my-activity-count {
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.03em;
}

.my-activity-table {
  table-layout: fixed;
}

.my-activity-table th:nth-child(1) { width: 150px; }
.my-activity-table th:nth-child(2) { width: auto; }
.my-activity-table th:nth-child(3) { width: 140px; }
.my-activity-table th:nth-child(4) { width: 170px; }

.my-activity-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.my-activity-extlink {
  margin-left: 5px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.8rem;
}

.my-activity-extlink:hover {
  color: var(--accent);
}

.my-activity-domain {
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.my-activity-when {
  font-size: 0.82rem;
  white-space: nowrap;
}

.activity-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--bg-strong);
  color: var(--muted);
}

.activity-badge--flag      { background: #fef3c7; color: #92400e; }
.activity-badge--unflag    { background: #f3f4f6; color: #6b7280; }
.activity-badge--archive   { background: #ede9fe; color: #5b21b6; }
.activity-badge--unarchive { background: #f3f4f6; color: #6b7280; }
.activity-badge--expand    { background: #fef3c7; color: #92400e; }
.activity-badge--click_external { background: #dbeafe; color: #1e40af; }
.activity-badge--return_to_feed { background: #e0f2fe; color: #0c4a6e; }
.activity-badge--read      { background: #d1fae5; color: #065f46; }
.activity-badge--unread    { background: #f3f4f6; color: #6b7280; }
.activity-badge--show_summary  { background: #fef3c7; color: #92400e; }
.activity-badge--expand_topic  { background: #e0f2fe; color: #0c4a6e; }

.subtle-link {
  color: inherit;
  text-decoration: none;
}

.subtle-link:hover {
  color: var(--accent);
}

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

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

.sites-table th {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

.sites-table td {
  color: var(--ink);
}

.sites-table tbody tr:hover {
  background: var(--accent-soft);
}

/* ── Modal: use .modal-backdrop + .modal-content for ALL modals ──────────
   RULE: modals must be visually sharp and fully opaque against the page.
   - .modal-backdrop: fixed full-screen dark overlay (z-index 1000)
   - .modal-content:  solid white card (background: #ffffff — never var(--bg)
     or any semi-transparent value; always fully opaque)
   Do NOT add opacity, rgba backgrounds, or backdrop-filter to these classes.
   SAME RULE applies to ALL dropdowns and popovers.
──────────────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px;
  width: 90%;
  max-width: 700px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  position: relative;
}

.modal-content.tldr-prompt-modal {
  max-width: 720px;
}
.tldr-prompt-modal-title {
  margin: 0 0 16px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
}

.story-list-actions {
  display: flex;
  justify-content: flex-end;
  padding: 0 0 10px;
}

.modal-content.subscribe-feed-modal {
  max-width: 440px;
}
.modal-content.confirm-modal {
  max-width: 480px;
}
.modal-content.rule-set-create-modal {
  max-width: 420px;
}
.modal-content.api-key-modal {
  max-width: 540px;
}
.modal-content.prompt-edit-modal {
  max-width: 760px;
}
.modal-content.score-breakdown-modal {
  max-width: 380px;
  padding: 20px 24px;
}
.score-breakdown-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
}
.score-breakdown-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
  color: #111827;
}
.score-breakdown-score {
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #111827;
}
.score-breakdown-cluster-note {
  margin: 0 0 12px;
  padding: 8px 10px;
  font-size: 0.78rem;
  line-height: 1.4;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 6px;
}
.score-breakdown-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
}
.score-breakdown-table td {
  padding: 4px 0;
  font-size: 0.82rem;
  color: #374151;
}
.score-breakdown-section td {
  padding-top: 10px;
  padding-bottom: 5px;
  border-top: 1px solid #f3f4f6;
  color: #6b7280;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}
.score-breakdown-section:first-child td {
  padding-top: 0;
  border-top: 0;
}
.score-breakdown-label {
  font-weight: 500;
}
.score-breakdown-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono, 'SF Mono', 'Menlo', monospace);
}
.score-breakdown-row-strong td {
  padding-top: 6px;
  font-weight: 700;
  color: #111827;
}
.score-breakdown-row-detail td {
  padding-top: 1px;
  padding-bottom: 1px;
  font-size: 0.74rem;
  color: #6b7280;
}
.score-breakdown-row-detail .score-breakdown-label {
  padding-left: 14px;
  font-weight: 400;
}
.score-breakdown-details {
  border-top: 1px solid #e5e7eb;
  padding-top: 12px;
  margin-bottom: 16px;
}
.score-breakdown-detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: #6b7280;
  padding: 2px 0;
  gap: 16px;
}
.score-breakdown-detail-row span:last-child {
  text-align: right;
}
.score-breakdown-mono {
  font-family: var(--font-mono, 'SF Mono', 'Menlo', monospace);
}
.score-breakdown-justification {
  display: block;
}
.score-breakdown-justification span {
  display: block;
  text-align: left;
}
.score-breakdown-justification span:first-child {
  margin-bottom: 2px;
}
.score-breakdown-computed {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid #f3f4f6;
  font-size: 0.72rem;
}
.score-breakdown-empty {
  font-size: 0.82rem;
  color: #6b7280;
  margin: 12px 0;
}
.score-breakdown-close {
  all: unset;
  display: block;
  width: 100%;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 500;
  color: #6b7280;
  padding: 8px 0;
  cursor: pointer;
  border-radius: 8px;
}
.score-breakdown-close:hover {
  background: #f3f4f6;
  color: #374151;
}

.modal-content.inspect-modal {
  max-width: 95vw;
  width: auto;
}

.modal-content.article-search-modal {
  max-width: 960px;
  width: min(960px, 96vw);
  padding-bottom: 18px;
}

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

.article-search-modal-header h2 {
  margin: 0;
  color: var(--ink);
}

.article-search-modal-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.article-search-modal-results {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 160px;
  max-height: calc(85vh - 220px);
  overflow-y: auto;
  padding-right: 4px;
}

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

.pane-header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 4px;
}

.pane-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  color: var(--muted);
  opacity: 0.6;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
  text-decoration: none;
  flex-shrink: 0;
}

.pane-action-btn:hover {
  opacity: 1;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.channel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  width: 100%;
}

.channel-heading-left {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.channel-heading-icons {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  padding-top: 1px;
}

.channel-heading-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  width: 100%;
}

.channel-heading-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: wrap;
}

.channel-heading-name {
  margin: 0;
  font-weight: 500;
  font-size: 1.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-heading-description {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
  max-width: 820px;
}

.channel-heading-description-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.channel-heading-settings {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 0;
  width: 100%;
  max-width: 960px;
}

.channel-setting-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  margin-bottom: 2px;
  color: var(--ink);
}

.channel-setting-slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0;
}

.channel-setting-endpoint {
  font-size: 0.7rem;
  color: var(--muted);
  white-space: nowrap;
}

.channel-setting-value {
  font-size: 0.78rem;
  color: var(--gray-600, #666);
  font-variant-numeric: tabular-nums;
  min-width: 42px;
  text-align: right;
}

.channel-setting-reset {
  padding: 1px 6px;
  font-size: 0.72rem;
  color: var(--muted);
}

.channel-setting-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.channel-setting-confirm {
  padding: 4px 16px;
  font-size: 0.78rem;
}

.channel-setting-cancel {
  padding: 4px 12px;
  font-size: 0.78rem;
  color: var(--muted);
}

.channel-heading-freshness {
  font-size: 0.78rem;
  color: var(--muted);
  opacity: 0.6;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: 4px;
}

.channel-composer-empty {
  align-items: stretch;
  padding: 32px 24px;
}

.channel-composer-shell {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
}

.channel-composer-copy {
  margin-bottom: 18px;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.92rem;
}

.inspect-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.inspect-header h2 {
  font-size: 1rem;
  margin: 0;
}

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

.inspect-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.inspect-table th,
.inspect-table td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.inspect-table th {
  font-weight: 600;
  position: sticky;
  top: 0;
  background: var(--bg);
}

.inspect-cell-title {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inspect-cell-url {
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inspect-cell-url a {
  color: var(--accent);
}

.inline-fetch-button {
  padding: 2px 5px;
  font-size: 0.85rem;
  margin-left: 6px;
  opacity: 0.4;
  vertical-align: middle;
}

.inline-fetch-button:hover {
  opacity: 1;
}

.inspect-cell-id {
  font-family: monospace;
  font-size: 0.7rem;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.section-heading-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.section-heading-row h3 {
  margin: 0;
}

.inspect-section-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  background: none;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  color: var(--muted);
  opacity: 0.45;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.inspect-section-btn:hover {
  opacity: 1;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.modal-content.inspect-html-modal {
  max-width: 860px;
  width: 90vw;
}

/* ── Add link modal ──────────────────────────────── */
.modal-content.add-link-modal {
  max-width: 520px;
}

.add-link-paste-hint {
  padding: 0.55rem 1rem;
  background: var(--accent-subtle, rgba(99, 102, 241, 0.1));
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--muted);
  border-radius: 10px 10px 0 0;
}

.add-link-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 22px;
}

.add-link-modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 3px;
}

.add-link-modal-subtitle {
  font-size: 0.83rem;
  color: var(--muted);
  margin: 0;
}

.add-link-close-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.12s;
}

.add-link-close-btn:hover {
  color: var(--ink);
}

.add-link-form {
  display: grid;
  gap: 16px;
}

.add-link-label {
  display: grid;
  gap: 7px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.add-link-required {
  color: var(--warn);
}

.add-link-optional {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.8rem;
  color: var(--muted);
  opacity: 0.7;
}

.add-link-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 13px;
  background: var(--panel);
  color: var(--ink);
  font-size: 0.9rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.add-link-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.add-link-textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 13px;
  background: var(--panel);
  color: var(--ink);
  font-size: 0.9rem;
  resize: vertical;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.add-link-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.add-link-tier-picker {
  display: flex;
  gap: 7px;
}

.add-link-tier-btn {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}

.add-link-tier-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.add-link-tier-btn.active {
  border: 2px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
}

.add-link-status {
  font-size: 0.88rem;
  padding: 9px 13px;
  border-radius: 8px;
}

.add-link-status.error {
  color: var(--warn);
  background: rgba(173, 63, 47, 0.08);
}

.add-link-status.success {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.add-link-flag-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.add-link-flag-toggle input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.add-link-flag-toggle:has(input:disabled) {
  opacity: 0.5;
  cursor: not-allowed;
}

.add-link-list-picker {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.add-link-list-items {
  max-height: 140px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.add-link-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  font-size: 0.84rem;
  cursor: pointer;
  border-radius: 4px;
  user-select: none;
}
.add-link-list-item:hover {
  background: var(--bg-strong);
}
.add-link-list-item input[type="checkbox"] {
  accent-color: var(--accent);
  margin: 0;
  flex-shrink: 0;
}

.add-link-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.add-link-kbd-hint {
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 2px 7px;
  font-family: monospace;
  align-self: center;
}

.inspect-html-pre {
  margin: 0;
  font-family: monospace;
  font-size: 0.78rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  max-height: 60vh;
  overflow-y: auto;
}

@media (max-width: 1040px) {
  .reader-shell {
    grid-template-columns: 1fr;
  }

  .reader-sidebar {
    border-right: 0;
    border-bottom: 1px solid rgba(226, 232, 234, 0.9);
  }

  .reader-main {
    grid-template-columns: 1fr;
  }

  .story-list-pane {
    border-right: 0;
    border-bottom: 1px solid rgba(226, 232, 234, 0.9);
  }

  .admin-grid,
  .tuning-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  /* Narrow (phone) fallback — three-row wrapping layout. At wider widths the
     packed two-line layout (title, then everything on one meta line) fits and
     is preferred; below this the meta line can't fit, so we wrap it:
       row 1 — title (full width)
       row 2 — score · icons · domain · feed · badge · time · reading time
       row 3 — (view summary) · topic (with source count)
     We flatten the two stacked row wrappers with display:contents so all their
     children live in one wrapping flex row, then re-group them with `order` and
     two zero-height full-width breaks. */
  .feed-item {
    padding: 5px 12px;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 6px;
    row-gap: 3px;
  }

  .feed-item-line1,
  .feed-item-line2,
  .feed-item-meta {
    display: contents;
  }

  .feed-item-row-break {
    display: block;
    flex-basis: 100%;
    width: 100%;
    height: 0;
    margin: 0;
  }

  /* Row 1 — title only */
  .feed-item-title {
    order: 2;
    flex: 1 1 auto;
    font-size: 0.84rem;
  }

  /* break before row 2 */
  .feed-item > .feed-item-row-break:first-of-type {
    order: 5;
  }

  /* Row 2 */
  .feed-item-title-score {
    order: 6;
    font-size: 0.68rem;
    padding: 0 4px;
  }
  .feed-item-actions {
    order: 7;
    gap: 2px;
  }
  .feed-item-action-btn {
    width: 18px;
    height: 18px;
  }
  .feed-item-domain {
    order: 8;
    flex: 0 1 auto;
    min-width: 0;
  }
  .feed-item-source {
    order: 9;
    flex: 0 1 auto;
  }
  .feed-item-tag {
    order: 10;
    flex: 0 1 auto;
    max-width: 88px;
  }
  .feed-item-age {
    order: 11;
    flex: 0 1 auto;
  }
  /* Pack reading time next to the age instead of letting its base
     margin-left:auto shove it to the far right, which left mid-width rows
     with a large gap and split age/reading-time across wrapped lines. */
  .feed-item-reading-time {
    order: 12;
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-left: 0;
  }

  /* break before row 3 */
  .feed-item > .feed-item-row-break:last-of-type {
    order: 15;
  }

  /* Row 3 */
  .feed-item-summary-toggle {
    order: 16;
  }
  /* Fill the rest of row 3 beside (view summary) and ellipsize, so a long
     topic stays on the same line instead of wrapping to a fourth row. */
  .feed-item-topic-wrap {
    order: 17;
    min-width: 0;
    flex: 1 1 0;
  }
  .feed-item-topic {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
  }

  /* Expanded blocks always span the full width, below the three rows */
  .feed-item-expanded,
  .feed-item-summary-edit {
    order: 20;
    flex-basis: 100%;
    width: 100%;
  }
}

/* ─── Curation work page ─────────────────────────────────────────────────── */

/* Layout */
.curation-main {
  grid-template-columns: minmax(380px, 500px) minmax(0, 1fr);
}

.curation-page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.curation-back-link {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
}

.curation-page-title {
  margin: 0;
  font-size: 20px;
}

.curation-hint {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 12px;
}

/* Status tabs */
.curation-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--line);
  overflow-x: auto;
}

.curation-tab {
  padding: 8px 12px;
  border: none;
  border-bottom: 3px solid transparent;
  background: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  white-space: nowrap;
}

.curation-tab-count {
  margin-left: 5px;
  padding: 1px 5px;
  border-radius: 8px;
  background: var(--bg-strong, var(--gray-100));
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

/* Age filter */
.curation-filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 13px;
  flex-wrap: wrap;
}

.curation-filter-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.curation-filter-select {
  padding: 2px 4px;
  font: inherit;
  font-size: 13px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: inherit;
  cursor: pointer;
}

.curation-filter-select:disabled {
  background: var(--bg);
  color: var(--muted);
  cursor: not-allowed;
}

.curation-filter-number {
  width: 52px;
  padding: 2px 6px;
  font-size: 13px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.curation-filter-number:disabled {
  background: var(--bg);
  color: var(--muted);
}

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

/* Bulk action bars */
.curation-bulk-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
  font-size: 13px;
}

.curation-bulk-select-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  color: var(--muted);
}

.curation-bulk-sep {
  color: var(--muted);
}

.curation-bulk-count {
  font-weight: 600;
}

.curation-bulk-confirm-text {
  font-weight: 600;
}

.curation-bulk-confirm-text--danger { color: var(--warn); }
.curation-bulk-confirm-text--teal   { color: var(--accent); }

.curation-bulk-btn {
  padding: 4px 12px;
  border-radius: 6px;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.curation-bulk-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.curation-bulk-btn--danger         { background: var(--warn); color: #fff; }
.curation-bulk-btn--teal           { background: var(--accent); color: #fff; }
.curation-bulk-btn--outline-danger { background: none; border: 1px solid var(--warn); color: var(--warn); }
.curation-bulk-btn--outline-teal   { background: none; border: 1px solid var(--accent); color: var(--accent); }

.curation-cancel-btn {
  background: none;
  border: none;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}

.curation-clear-btn {
  background: none;
  border: none;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}

/* Article card */
.curation-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: default;
  background: var(--panel);
  transition: border-color 0.1s;
}

.curation-card.focused {
  border: 2px solid var(--accent);
  background: var(--accent-soft);
}

.curation-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.curation-card-domain {
  font-size: 12px;
  color: var(--muted);
  font-family: monospace;
}

.curation-card-date {
  font-size: 12px;
  color: var(--muted);
}

.curation-card-ext-link {
  margin-left: auto;
  font-size: 12px;
  color: var(--accent);
}

.curation-card-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
  line-height: 1.4;
}

.curation-card-title-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-weight: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
  text-align: left;
  outline: none;
}

.curation-card-summary {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 8px;
}

.curation-summary-toggle {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 12px;
  padding: 0 4px;
}

.curation-note-wrap {
  margin-bottom: 8px;
}

.curation-note-textarea {
  width: 100%;
  padding: 6px 8px;
  font-size: 13px;
  border-radius: 4px;
  border: 1px solid var(--line);
  resize: vertical;
}

.curation-note-discard {
  background: none;
  border: none;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  padding: 2px 0;
}

.curation-note-add {
  background: none;
  border: none;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  padding: 0 0 8px;
}

.curation-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.curation-action-btn {
  padding: 5px 14px;
  border-radius: 6px;
  border: none;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.curation-action-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.curation-action-key {
  margin-left: 6px;
  font-size: 11px;
  opacity: 0.7;
}

.curation-tier-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.curation-tier-1 { background: var(--gray-100); color: var(--gray-500); }
.curation-tier-2 { background: var(--gray-200); color: var(--gray-600); }
.curation-tier-3 { background: var(--gray-200); color: var(--gray-700); }
.curation-tier-4 { background: var(--green-100); color: var(--green-700); }
.curation-tier-5 { background: var(--green-200); color: var(--green-800); }

.curation-score-link {
  font-size: 11px;
  color: var(--muted);
  text-decoration: none;
  margin-left: -4px;
}

.curation-score-link:hover {
  color: var(--accent);
}

.curation-card-checkbox {
  cursor: pointer;
  flex-shrink: 0;
}

.curation-score-breakdown {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

.curation-score-component {
  font-variant-numeric: tabular-nums;
}

.curation-score-sep {
  opacity: 0.4;
}

.curation-score-reasoning {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  margin-top: 2px;
  line-height: 1.4;
}

.curation-tab--active {
  font-weight: 700;
}

.curation-load-more {
  text-align: center;
  padding: 16px 0;
}

.curation-card-provenance {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.curation-provenance-text {
  font-size: 11px;
  color: var(--muted);
}

.curation-provenance-agent {
  font-family: monospace;
}

.curation-history-chevron {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  padding: 0 2px;
  line-height: 1;
}

.curation-history-chevron:hover {
  color: var(--accent);
}

.curation-history {
  margin-top: 6px;
}

.curation-history-loading {
  font-size: 12px;
  color: var(--muted);
}

.curation-history-table {
  width: 100%;
  font-size: 11px;
  border-collapse: collapse;
  color: var(--muted);
}

.curation-history-table th {
  text-align: left;
  padding: 2px 8px 4px 0;
  font-weight: 600;
  border-bottom: 1px solid var(--line);
}

.curation-history-table td {
  padding: 3px 8px 3px 0;
  vertical-align: top;
}

.curation-history-when {
  white-space: nowrap;
}

.curation-history-agent {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
  font-family: monospace;
}

.curation-history-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
  padding: 0 2px;
}

.curation-history-link:hover {
  color: var(--accent);
}

/* Add article panel */
.curation-add-panel {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
}

.curation-add-form {
  display: flex;
  gap: 8px;
}

.curation-add-input {
  flex: 1;
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.curation-add-submit {
  padding: 6px 14px;
  border-radius: 6px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.curation-add-submit:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.curation-add-error {
  margin-top: 8px;
  font-size: 13px;
  color: var(--warn);
}

.curation-add-result {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--panel);
  border-radius: 6px;
  border: 1px solid var(--line);
}

.curation-add-result-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.curation-add-exists-badge {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 10px;
  background: #d97706;
  color: #fff;
  font-weight: 700;
}

.curation-add-result-title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 8px;
}

.curation-add-done-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.curation-add-done-text {
  font-size: 13px;
  color: #16a34a;
  font-weight: 600;
}

.curation-add-another-btn {
  background: none;
  border: none;
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
}

.curation-add-status-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.curation-add-status-label {
  font-size: 12px;
  color: var(--muted);
}

.curation-add-status-btn {
  padding: 4px 10px;
  border-radius: 6px;
  border: none;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.curation-add-status-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.curation-add-dismiss-btn {
  background: none;
  border: none;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  margin-left: 4px;
}

/* Undo bar */
.curation-undo-bar {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 12px;
}

.curation-undo-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.curation-undo-label {
  font-weight: 600;
  color: var(--muted);
}

.curation-undo-toggle {
  background: none;
  border: none;
  font-size: 11px;
  color: var(--accent);
  cursor: pointer;
}

.curation-undo-event {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  border-top: 1px solid var(--line);
}

.curation-undo-time {
  color: var(--muted);
  min-width: 70px;
}

.curation-undo-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.curation-undo-btn {
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 11px;
  cursor: pointer;
}

.curation-undo-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* Empty / loading states */
.curation-empty {
  color: var(--muted);
  font-size: 14px;
  padding: 48px 0;
  text-align: center;
}

.curation-clear-filter-btn {
  margin-top: 12px;
  padding: 6px 16px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}

.curation-clear-filter-btn:hover {
  border-color: var(--text-secondary);
  color: var(--text-secondary);
}

.curation-loading {
  color: var(--muted);
  font-size: 13px;
  padding: 24px 0;
}

@media (max-width: 720px) {
  .auth-panel,
  .story-list-pane,
  .story-detail-pane {
    padding: 20px;
  }

  .pane-header h1,
  .story-detail h2,
  .auth-panel h1 {
    font-size: 1.65rem;
  }

  .channel-heading {
    flex-wrap: wrap;
  }
}

/* ── Search input ── */
.search-input-wrap {
  margin-bottom: 12px;
}
.search-query-summary {
  margin: 8px 0 4px;
  font-size: 0.8rem;
  color: var(--muted);
}
.table-options-row {
  display: flex;
  align-items: baseline;
  gap: 18px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--muted);
}
.breakdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.column-legend summary {
  cursor: pointer;
  user-select: none;
}
.column-legend-items {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  padding: 6px 0 2px;
}
.search-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  box-sizing: border-box;
}
.search-input::placeholder {
  color: var(--muted);
}
.search-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* ── Article filter bar ── */
.article-filter-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.filter-bar-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-preset-button {
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-strong);
  color: var(--ink);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease, color 120ms ease;
  flex-shrink: 0;
}

.filter-preset-button:hover {
  transform: translateY(-1px);
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-strong);
}

.filter-preset-button.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-strong);
}

.filter-sort-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.filter-sort-label {
  font-size: 0.83rem;
  color: var(--muted);
  white-space: nowrap;
}

.filter-sort-select {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  font: inherit;
  font-size: 0.83rem;
  color: var(--ink);
  cursor: pointer;
}

.filter-sort-select:focus,
.filter-row-select:focus,
.filter-row-value:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.filter-dir-toggle {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  font: inherit;
  font-size: 0.83rem;
  color: var(--ink);
  cursor: pointer;
  transition: background 120ms ease;
  white-space: nowrap;
}

.filter-dir-toggle:hover {
  background: var(--panel-strong);
}

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

.filter-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 6px 10px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.filter-row-select {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  font: inherit;
  font-size: 0.83rem;
  color: var(--ink);
  cursor: pointer;
  flex-shrink: 0;
}

.filter-row-value {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  font: inherit;
  font-size: 0.83rem;
  color: var(--ink);
  min-width: 140px;
  flex: 1;
}

.filter-row-delete {
  padding: 3px 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 1rem;
  flex-shrink: 0;
  line-height: 1;
  margin-left: auto;
  transition: color 120ms ease, background 120ms ease;
}

.filter-row-delete:hover {
  color: var(--warn);
  background: #fef2f2;
  border-color: #fecaca;
}

.filter-bar-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.filter-add-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border: 1px dashed var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.83rem;
  cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease, background 120ms ease;
}

.filter-add-button:hover {
  color: var(--accent-strong);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.filter-clear-button {
  padding: 5px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.83rem;
  cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease, background 120ms ease;
}

.filter-clear-button:hover {
  color: var(--warn);
  border-color: var(--warn);
  background: #fef2f2;
}

/* Keyboard shortcuts overlay */
.shortcuts-overlay {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--gray-800);
  color: var(--gray-100);
  border-radius: 10px;
  padding: 16px 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  font-size: 13px;
  pointer-events: none;
  animation: shortcuts-fade-in 80ms ease;
}

@keyframes shortcuts-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.shortcuts-overlay-heading {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gray-400);
  margin-bottom: 6px;
}

.shortcuts-overlay-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  color: var(--gray-200);
}

.shortcuts-overlay-row:last-child {
  margin-bottom: 0;
}

.shortcuts-overlay kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  padding: 1px 5px;
  background: var(--gray-600);
  border-radius: 4px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  line-height: 1.6;
}

/* ── Prompts page ─────────────────────────────────────────────────────────── */

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

.prompt-card {
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 20px;
  background: var(--gray-900);
}

.prompt-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.prompt-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.prompt-card-title {
  font-weight: 600;
  font-size: 15px;
  margin-right: 10px;
}

.prompt-card-key {
  font-size: 12px;
  color: var(--gray-400);
  background: var(--gray-800);
  padding: 1px 6px;
  border-radius: 4px;
}

.prompt-card-meta {
  flex-shrink: 0;
}

.prompt-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

.prompt-badge-custom {
  background: var(--blue-900, #1e3a5f);
  color: var(--blue-300, #7ab8f5);
}

.prompt-badge-default {
  background: var(--gray-800);
  color: var(--gray-400);
}

.prompt-description {
  font-size: 13px;
  color: var(--gray-400);
  margin: 0 0 14px 0;
}

.prompt-field {
  margin-bottom: 14px;
}

.prompt-field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.prompt-textarea {
  width: 100%;
  box-sizing: border-box;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  font-family: monospace;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
}

.prompt-textarea:focus {
  outline: none;
  border-color: var(--gray-400);
}

.prompt-textarea-large {
  min-height: 200px;
}

.prompt-workbench-layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.prompt-workbench-sidebar {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  overflow: hidden;
}

.prompt-workbench-sidebar-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line);
}

.prompt-workbench-sidebar-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.prompt-workbench-sidebar-subtitle {
  margin-top: 4px;
  font-size: 12px;
  color: var(--gray-400);
  line-height: 1.4;
}

.prompt-workbench-nav-list {
  max-height: 560px;
  overflow-y: auto;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.prompt-workbench-nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
}

.prompt-workbench-nav-meta {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--ink);
}

.prompt-workbench-nav-meta-dim {
  color: var(--gray-400);
}

.prompt-workbench-nav-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.prompt-workbench-nav-preview {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--gray-400);
  font-size: 12px;
  line-height: 1.45;
}

.prompt-workbench-status-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 700;
}

.prompt-workbench-archive-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

.prompt-workbench-archive-btn:hover {
  background: var(--panel);
}

.prompt-workbench-model-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--gray-800);
  color: var(--gray-200);
  font-size: 11px;
  font-family: monospace;
}

.prompt-workbench-editor-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  padding: 16px 18px 18px;
  min-width: 0;
}

.prompt-workbench-editor-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.prompt-workbench-editor-eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.prompt-workbench-editor-title {
  margin: 4px 0 0;
  font-size: 26px;
  line-height: 1.1;
  color: var(--ink);
}

.prompt-workbench-editor-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.prompt-workbench-compact-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.prompt-workbench-compact-button:hover {
  background: var(--panel);
}

.prompt-workbench-compact-button:disabled {
  opacity: 0.55;
  cursor: default;
}

.prompt-workbench-compact-button-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #f5fbfa;
}

.prompt-workbench-compact-button-primary:hover {
  background: var(--accent-strong);
}

.prompt-workbench-select {
  width: 100%;
  padding: 8px 10px;
  background: #ffffff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13px;
}

.prompt-workbench-editor-textarea {
  min-height: 340px;
}

.prompt-workbench-empty-state {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 16px;
  color: var(--gray-400);
  font-size: 13px;
  background: var(--panel);
}

.prompt-workbench-empty-state-large {
  min-height: 240px;
  display: flex;
  align-items: center;
}

.prompt-workbench-archive-toggle {
  display: block;
  width: 100%;
  padding: 8px 2px 2px;
  background: transparent;
  border: none;
  color: var(--gray-400);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

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

.prompt-workbench-collapse-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.prompt-workbench-collapse-chevron {
  display: inline-block;
  color: var(--gray-400);
  transition: transform 0.16s ease;
}

.prompt-workbench-collapsed-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
}

.prompt-workbench-collapsed-card {
  min-width: 250px;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
}

.prompt-workbench-collapsed-card-meta {
  display: grid;
  gap: 2px;
  font-size: 12px;
  color: var(--ink);
}

@media (max-width: 980px) {
  .prompt-workbench-layout {
    grid-template-columns: 1fr;
  }

  .prompt-workbench-nav-list {
    max-height: 320px;
  }

  .prompt-workbench-editor-header {
    flex-direction: column;
  }

  .prompt-workbench-editor-actions {
    justify-content: flex-start;
  }

  .prompt-workbench-section-header {
    align-items: flex-start;
    flex-direction: column;
  }
}

.prompt-card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 4px;
}

.prompt-error {
  font-size: 13px;
  color: var(--red-400, #f87171);
  margin-right: auto;
}

.prompt-saved {
  font-size: 13px;
  color: var(--green-400, #4ade80);
  margin-right: auto;
}

.prompt-toast {
  font-size: 0.82rem;
  padding: 8px 14px;
  border-radius: 8px;
  margin-bottom: 6px;
  animation: prompt-toast-in 0.2s ease-out;
}

.prompt-toast-success {
  background: rgba(74, 222, 128, 0.1);
  color: var(--green-600, #16a34a);
  border: 1px solid rgba(74, 222, 128, 0.25);
}

.prompt-toast-error {
  background: rgba(248, 113, 113, 0.1);
  color: var(--red-600, #dc2626);
  border: 1px solid rgba(248, 113, 113, 0.25);
}

@keyframes prompt-toast-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Feed elements list */
.feed-elements-list {
  display: flex;
  flex-direction: column;
}

.feed-element-row {
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}

.feed-element-row:last-child {
  border-bottom: none;
}

.feed-element-title-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.feed-element-title {
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
}

a.feed-element-title:hover {
  text-decoration: underline;
}

.feed-element-domain {
  color: var(--muted);
  font-size: 0.85rem;
}

.feed-element-age {
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.feed-element-summary {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 4px;
  line-height: 1.4;
}

.feed-element-meta {
  display: flex;
  gap: 10px;
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--muted);
}

.feed-element-feed-name {
  opacity: 0.7;
}

.feed-element-tier {
  opacity: 0.7;
}

.muted-count {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

/* ---------------------------------------------------------------------------
   List picker dropdown (StoryDetail)
   --------------------------------------------------------------------------- */

.list-picker-container {
  position: relative;
  display: inline-flex;
}

.list-picker {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 100;
  min-width: 200px;
  max-width: 280px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
  margin-top: 4px;
  overflow: hidden;
}

.list-picker-loading {
  padding: 12px 14px;
  font-size: 0.82rem;
  color: var(--muted);
}

.list-picker-items {
  max-height: 200px;
  overflow-y: auto;
  padding: 4px 0;
}

.list-picker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  font-size: 0.84rem;
  cursor: pointer;
  color: var(--ink);
}
.list-picker-item:hover {
  background: var(--bg-strong);
}
.list-picker-item input[type="checkbox"] {
  accent-color: var(--accent);
  margin: 0;
  flex-shrink: 0;
}

.list-picker-new {
  display: flex;
  align-items: center;
  gap: 4px;
  border-top: 1px solid var(--line);
  padding: 6px 8px;
}
.list-picker-new input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 0.82rem;
  background: var(--bg);
  color: var(--ink);
  outline: none;
}
.list-picker-new input:focus {
  border-color: var(--accent);
}
.list-picker-add-btn {
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}
.list-picker-add-btn:hover {
  background: var(--accent-strong);
}

/* ---------------------------------------------------------------------------
   Lists page
   --------------------------------------------------------------------------- */

.lists-page {
  display: flex;
  height: calc(100vh - 44px);
  overflow: hidden;
}

.lists-sidebar {
  width: 240px;
  flex-shrink: 0;
  border-right: 1px solid var(--line);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.lists-sidebar-title {
  font-size: 0.95rem;
  font-weight: 600;
  padding: 14px 16px 8px;
  margin: 0;
  color: var(--ink);
}

.lists-empty {
  padding: 12px 16px;
  font-size: 0.82rem;
  color: var(--muted);
}

.lists-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.lists-list-item {
  display: flex;
  align-items: center;
  padding: 0 8px 0 0;
}

.lists-list-item.active {
  background: var(--bg-strong);
}

.lists-list-btn {
  flex: 1;
  text-align: left;
  padding: 8px 12px;
  border: none;
  background: none;
  font-size: 0.85rem;
  color: var(--ink);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lists-list-btn:hover {
  color: var(--accent);
}

.lists-item-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 100ms;
}
.lists-list-item:hover .lists-item-actions {
  opacity: 1;
}

.lists-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  border-radius: 4px;
  padding: 0;
}
.lists-action-btn:hover {
  color: var(--ink);
  background: var(--bg-strong);
}
.lists-action-delete:hover {
  color: var(--warn);
}

.lists-rename-row {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  padding: 4px 8px;
}
.lists-create-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}
.lists-rename-input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 0.82rem;
  background: var(--bg);
  color: var(--ink);
  outline: none;
}
.lists-rename-input:focus {
  border-color: var(--accent);
}
.lists-rename-save {
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
}

.lists-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
}

.lists-empty-content {
  padding: 40px 0;
  text-align: center;
  font-size: 0.88rem;
  color: var(--muted);
}

.lists-article-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.lists-article-table th {
  text-align: left;
  padding: 6px 10px;
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.lists-article-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.lists-article-table tr:hover td {
  background: var(--bg-strong);
}

.lists-article-link {
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
}
.lists-article-link:hover {
  color: var(--accent);
}

.lists-article-summary {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.4;
}

.lists-article-domain {
  font-size: 0.8rem;
  color: var(--muted);
}
.lists-article-date {
  font-size: 0.8rem;
  color: var(--muted);
}

.lists-toolbar {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 8px;
  align-items: center;
}
.lists-toggle-scores {
  font-size: 0.78rem;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
}
.lists-toggle-scores:hover {
  border-color: var(--accent);
  color: var(--ink);
}
.lists-toggle-scores.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.score-selector {
  display: inline-flex;
  gap: 2px;
}
.score-btn {
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  line-height: 22px;
  text-align: center;
}
.score-btn:hover {
  border-color: var(--accent);
  color: var(--ink);
}
.score-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.tier-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 4px;
  color: #fff;
  font-weight: 600;
  font-size: 0.82rem;
  min-width: 24px;
  text-align: center;
}
.tier-1 { background: #ef4444; }
.tier-2 { background: #f97316; }
.tier-3 { background: #eab308; }
.tier-4 { background: #22c55e; }
.tier-5 { background: #10b981; }

/* ── Admin home page ── */

.admin-index {
  max-width: 720px;
}

.admin-index-usage {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--muted);
  margin: -8px 0 4px;
}

.admin-index-usage-users summary {
  cursor: pointer;
}

.admin-index-usage-users ul {
  margin: 4px 0 0;
  padding-left: 18px;
}

.admin-index-group {
  margin-top: 22px;
}

.admin-index-eyebrow {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 6px;
}

.admin-index-rows {
  border-top: 1px solid var(--line);
}

.admin-index-row {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 16px;
  align-items: baseline;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
}

.admin-index-row:hover {
  background: var(--panel);
}

.admin-index-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.admin-index-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink);
}

.admin-index-desc {
  font-size: 0.8rem;
  color: var(--muted);
}

@media (max-width: 560px) {
  .admin-index-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

.settings-admin-link {
  display: inline-block;
  font-size: 0.85rem;
  color: var(--accent);
  text-decoration: none;
}

.settings-admin-link:hover {
  text-decoration: underline;
}

/* ── Search page pills & filters ── */
.search-pills-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.search-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #ffffff;
  color: var(--ink);
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.search-pill:hover {
  background: #e9ecef;
  border-color: #adb5bd;
}

.search-pill-overflow {
  color: var(--gray-500, #6c757d);
  border-style: dashed;
}

.search-options-pill {
  color: var(--gray-500, #6c757d);
}

.search-options-pill.open {
  background: #e9ecef;
  border-color: #adb5bd;
  color: var(--ink);
}

.search-options-modified-dot {
  width: 6px;
  height: 6px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.search-pill-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 200;
  margin-top: 4px;
  min-width: 200px;
  max-height: 280px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  padding: 4px 0;
}

.search-pill-dropdown-item {
  display: block;
  width: 100%;
  padding: 8px 14px;
  text-align: left;
  background: none;
  border: none;
  font: inherit;
  font-size: 0.85rem;
  color: var(--ink);
  cursor: pointer;
}

.search-pill-dropdown-item:hover {
  background: #f0f2f4;
}

/* ── Search controls row ── */
.search-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0 8px;
}

.search-controls-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-controls-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: none;
  font: inherit;
  font-size: 0.82rem;
  color: var(--gray-500, #6c757d);
  cursor: pointer;
  transition: all 0.15s;
}

.search-toggle-btn:hover {
  background: #f0f2f4;
  color: var(--ink);
}

.search-toggle-btn.active {
  background: #e9ecef;
  border-color: #adb5bd;
  color: var(--ink);
}

.search-toggle-btn.modified {
  color: var(--accent, #2d4a6e);
  border-color: var(--accent, #2d4a6e);
}

.scoring-panel {
  display: grid;
  gap: 14px;
  margin: 8px 0 4px;
  padding: 14px 16px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid var(--line);
}

/* ── Search status inline ── */
.search-options-panel {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface, #f8f9fa);
}

.search-toggle-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
}

.search-toggle-row input {
  margin: 0;
}

.search-toggle-action-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* One row welded to the top of the results list: count + deepen on the left,
   save controls pushed right. Replaces the old floating status line + save bar. */
.search-results-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 30px;
  font-size: 0.85rem;
}

.search-status-inline {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 0.85rem;
}

.search-status-inline-summary {
  display: inline-flex;
  margin-left: 16px;
}

.search-result-count {
  font-weight: 600;
  font-size: 1rem;
  font-family: var(--font-mono, 'SF Mono', 'Menlo', monospace);
  font-variant-numeric: tabular-nums;
}

.search-result-label {
  color: var(--gray-500, #6c757d);
}

.search-deeper-inline {
  margin-left: 10px;
  padding: 0;
  border: none;
  background: none;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 120ms ease;
}

.search-deeper-inline:hover {
  text-decoration: underline;
}

.search-deeper-inline:disabled {
  opacity: 0.5;
  cursor: default;
  pointer-events: none;
}

.search-active-filters {
  color: var(--gray-400, #adb5bd);
  font-size: 0.8rem;
  margin-left: 4px;
}

/* ── Filter pills ── */
.filter-pills-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 6px 0;
  flex-wrap: wrap;
}

.filter-pills-label {
  font-size: 0.78rem;
  color: var(--gray-400, #adb5bd);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 4px;
  white-space: nowrap;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: none;
  font: inherit;
  font-size: 0.8rem;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s;
}

.filter-pill:hover {
  background: #f0f2f4;
}

.filter-pill.excluded {
  background: #f8d7da;
  border-color: #f5c6cb;
  color: #721c24;
  text-decoration: line-through;
  opacity: 0.7;
}

.filter-pill.excluded:hover {
  opacity: 1;
}

/* ── Reading time filter ── */
.reading-time-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.reading-time-select {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  font: inherit;
  font-size: 0.8rem;
  color: var(--ink);
  background: #fff;
}

.reading-time-input {
  width: 56px;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  font: inherit;
  font-size: 0.8rem;
  color: var(--ink);
  text-align: center;
}

.reading-time-unit {
  font-size: 0.8rem;
  color: var(--gray-500, #6c757d);
}

/* ── Right side of the results toolbar: saved-search access + save controls ── */
.search-toolbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.search-toolbar-save {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

/* Compact saved-searches control (shown once a search has run) */
.search-pills-compact {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.search-pill-dropdown-right {
  left: auto;
  right: 0;
}

.search-save-trigger {
  background: none;
  border: 1px solid var(--line);
  border-radius: 5px;
  font: inherit;
  font-size: 0.8rem;
  color: var(--gray-500, #6c757d);
  cursor: pointer;
  padding: 4px 12px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.search-save-trigger:hover {
  color: var(--accent);
  border-color: var(--green-300);
  background: #f2faf9;
}

.search-toolbar-save .search-save-input {
  flex: none;
  width: 220px;
  padding: 5px 12px;
}

.search-toolbar-save .primary-button,
.search-toolbar-save .ghost-button {
  border-radius: 5px;
  padding: 5px 12px;
  font-size: 0.84rem;
}

@media (max-width: 768px) {
  .search-toolbar-right {
    margin-left: 0;
    flex-basis: 100%;
    flex-wrap: wrap;
  }
  .search-toolbar-save .search-save-input {
    flex: 1;
    width: auto;
    min-width: 0;
  }
}

.search-save-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.search-save-input {
  flex: 1;
  min-width: 0;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 8px 12px;
  font: inherit;
  font-size: 0.88rem;
  color: var(--ink);
  background: #ffffff;
}

/* ── Saved searches CRUD page ── */
.saved-searches-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 32px 48px;
  width: 100%;
  box-sizing: border-box;
}

.saved-searches-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.saved-searches-title {
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--ink);
  margin: 0;
}

.saved-searches-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.saved-search-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 20px;
  background: #fff;
  transition: box-shadow 0.15s;
}

.saved-search-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.saved-search-card-editing {
  border-color: var(--accent, #2d4a6e);
  box-shadow: 0 0 0 1px var(--accent, #2d4a6e);
}

.saved-search-card-display {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.saved-search-card-main {
  flex: 1;
  min-width: 0;
}

.saved-search-card-name {
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--accent, #2d4a6e);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}

.saved-search-card-name:hover {
  text-decoration: underline;
}

.saved-search-card-description {
  font-size: 0.84rem;
  color: var(--gray-600, #495057);
  margin-top: 4px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.saved-search-card-meta {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--gray-400, #adb5bd);
}

.saved-search-card-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.saved-search-delete-btn {
  color: #dc3545 !important;
}

.saved-search-delete-btn:hover {
  background: #f8d7da !important;
}

/* ── Saved search edit form ── */
.saved-search-edit-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.saved-search-edit-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.saved-search-edit-label {
  font-size: 0.78rem;
  color: var(--gray-500, #6c757d);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.saved-search-edit-input {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  font: inherit;
  font-size: 0.88rem;
  color: var(--ink);
}

.saved-search-edit-textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  font-size: 0.88rem;
  color: var(--ink);
  resize: vertical;
}

.saved-search-edit-row {
  display: flex;
  gap: 16px;
}

.saved-search-edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.search-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.search-status-badge.status-finished {
  background: #e6f4ea;
  color: #1e7e34;
}

.search-status-badge.status-failed {
  background: #fce8e6;
  color: #c5221f;
}

.search-status-badge.status-processing {
  background: #e8f0fe;
  color: #1967d2;
}
