:root {
  /* warm editorial paper + ink + single oxblood signal */
  --bg: #f4f2ec;
  --bg-soft: #ebe7dd;
  --panel: #fbfaf6;
  --panel-2: #ffffff;
  --ink: #1c1a17;
  --ink-soft: #4a463f;
  --muted: #847e72;
  --faint: #aaa494;
  --line: #e5e0d4;
  --line-strong: #d4ccbc;
  --signal: #8f2a2a;
  --signal-soft: #f3e6e2;
  --accent: #1c1a17;
  --accent-soft: #eae5da;
  --ok: #2f6a4c;
  --warn: #8a6312;
  --err: #9c2f29;
  --radius: 10px;
  --radius-sm: 7px;
  --pill: 999px;
  --shadow-sm: 0 1px 2px rgba(28, 26, 23, 0.05);
  --shadow-card: 0 1px 2px rgba(28, 26, 23, 0.05), 0 8px 24px -16px rgba(28, 26, 23, 0.18);
  --font-ui: Inter, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", ui-sans-serif,
    system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: Georgia, "Times New Roman", "Songti SC", STSong, "SimSun",
    "Noto Serif SC", "Source Han Serif SC", serif;
}

* { box-sizing: border-box; }

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

button { cursor: pointer; }
a { color: inherit; }

:focus-visible {
  outline: 1.5px solid var(--ink);
  outline-offset: 2px;
  border-radius: 3px;
}

::selection { background: rgba(143, 42, 42, 0.14); }

svg { display: block; }

.hidden { display: none !important; }

.app-shell {
  display: grid;
  grid-template-columns: 232px minmax(340px, 410px) minmax(460px, 1fr);
  width: 100vw;
  height: 100vh;
  min-width: 0;
  overflow: hidden;
}

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

.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  flex: 0 0 auto;
  object-fit: cover;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.brand strong {
  display: block;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.22;
}

.brand span:last-child {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11.5px;
}

.icon-link,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 35px;
  height: 34px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.icon-link svg,
.icon-button svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 1.9;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-link:hover,
.icon-button:hover {
  background: var(--bg-soft);
  color: var(--ink);
}

.icon-button:disabled {
  color: var(--faint);
  cursor: wait;
}

.icon-button.is-loading svg { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.live-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--pill);
  background: var(--panel);
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}

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

.live-state.connected { color: var(--ok); }
.live-state.connecting { color: var(--warn); }
.live-state.fallback,
.live-state.offline { color: var(--muted); }

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
}

.dot.running {
  background: var(--warn);
  animation: blink 1.1s ease-in-out infinite;
}

@keyframes blink { 50% { opacity: 0.4; } }

.error-inline { color: var(--err); }

/* ---------- sidebar ---------- */
.sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  padding: 18px 14px;
  border-right: 1px solid var(--line);
  background: rgba(244, 242, 236, 0.92);
  overflow: hidden;
}

.sidebar .brand {
  padding: 3px 8px 18px;
  border-bottom: 1px solid var(--line);
}

.site-switch {
  display: flex;
  gap: 4px;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
}

.site-tab {
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  padding: 0 8px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.site-tab:hover {
  color: var(--ink);
}

.site-tab.active {
  border-color: var(--signal);
  color: var(--signal);
}

.channel-nav {
  padding: 17px 0 8px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.rail-label {
  padding: 0 11px 10px;
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.channel {
  display: grid;
  grid-template-columns: 6px 1fr;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 36px;
  margin-bottom: 2px;
  padding: 0 11px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-soft);
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}

.channel:hover {
  background: var(--bg-soft);
  color: var(--ink);
}

.channel.active {
  background: var(--ink);
  color: #f4f2ec;
}

.marker,
.cat-dot,
.source-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
}

.marker.all { background: var(--signal); }

.sidebar-spacer { flex: 1 1 auto; min-height: 16px; }

.sidebar-actions {
  display: grid;
  gap: 9px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.action-row {
  display: flex;
  gap: 7px;
}

.action-row .icon-link { flex: 1 1 auto; }

.status-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  min-height: 34px;
  color: var(--muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.status-strip strong {
  color: var(--ink);
  font-weight: 600;
}

/* ---------- entry list ---------- */
.entry-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: var(--panel);
  overflow: hidden;
}

.entry-header {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 164px;
  gap: 10px;
  padding: 15px 16px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 250, 246, 0.94);
}

.search,
.importance {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  height: 40px;
  padding: 0 7px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.search:focus-within,
.importance:focus-within {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(28, 26, 23, 0.07);
}

.search span,
.importance span {
  color: var(--faint);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.search input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 13px;
}

.search input::placeholder { color: var(--faint); }

.search button {
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  background: var(--ink);
  color: #f4f2ec;
}

.search button svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.importance {
  padding-right: 10px;
}

.importance input {
  min-width: 46px;
  width: 100%;
  accent-color: var(--signal);
}

.importance strong {
  min-width: 15px;
  font-family: var(--font-display);
  font-size: 15px;
  text-align: center;
}

.item-count {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.feed-controls {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.sort-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.feed-controls .reader-tab {
  min-width: auto;
  height: 28px;
  padding: 0 10px;
  border-color: var(--line);
  background: var(--panel);
  color: var(--ink-soft);
}

.feed-controls .reader-tab.active {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg);
}

.feed-controls .item-count {
  margin-left: auto;
}

.ticker {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 16px 8px;
  border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
}

.ticker-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 260px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: var(--pill);
  background: var(--bg);
  color: var(--ink-soft);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
}

a.ticker-chip:hover {
  border-color: var(--line-strong);
  background: var(--panel-2);
}

.ticker-chip.disabled {
  color: var(--faint);
  cursor: default;
}

.feed {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
}

.entry-card {
  position: relative;
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 10px;
  padding: 16px 15px 16px 13px;
  border-bottom: 1px solid var(--line);
  background: transparent;
  outline: none;
  transition: background 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

.entry-card:hover {
  background: rgba(28, 26, 23, 0.025);
}

.entry-card.active {
  background: var(--signal-soft);
  box-shadow: inset 3px 0 0 var(--signal);
}

.entry-card.is-selected:not(.active) {
  background: var(--bg-soft);
  box-shadow: inset 3px 0 0 var(--line);
}

.entry-card.fresh {
  animation: fresh-item 4.4s ease-out;
}

.entry-card.is-read {
  opacity: 0.66;
}

.entry-card.is-read.active,
.entry-card.is-read:hover {
  opacity: 1;
}

.unread-dot {
  width: 7px;
  height: 7px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--signal);
}

.entry-card.is-read .unread-dot {
  background: transparent;
  border: 1px solid var(--line-strong);
}

.entry-main { min-width: 0; }

.entry-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11.2px;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
}

.entry-meta .src {
  color: var(--ink-soft);
  font-weight: 600;
}

.entry-meta .more-src {
  color: var(--signal);
  font-weight: 600;
}

.entry-card h2 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.36;
  color: var(--ink);
}

.entry-card p {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  margin: 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.55;
}

.entry-card.is-expanded p {
  display: block;
  overflow: visible;
}

.summary-toggle {
  margin-top: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--signal);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.4;
}

.summary-toggle:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.importance-pill {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 7px;
  border: 1px solid var(--line-strong);
  border-radius: var(--pill);
  background: transparent;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.fav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 22px;
  margin-left: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--pill);
  background: var(--panel);
  color: var(--ink-soft);
}

.fav-btn[aria-pressed="true"] {
  color: var(--signal);
}

.fav-btn svg,
.reader-fav-toggle svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fav-btn svg.is-filled,
.reader-fav-toggle svg.is-filled {
  fill: currentColor;
}

.entry-card.importance-4 .importance-pill {
  border-color: #e2c9a0;
  color: var(--warn);
}

.entry-card.importance-5 {
  background-image: linear-gradient(90deg, rgba(143, 42, 42, 0.05), rgba(143, 42, 42, 0) 72%);
}

.entry-card.importance-5 h2 { color: var(--signal); }

.entry-card.importance-5 .importance-pill {
  border-color: var(--signal);
  background: var(--signal);
  color: #f4f2ec;
}

@keyframes fresh-item {
  0% { background-color: rgba(47, 106, 76, 0.08); }
  100% { background-color: transparent; }
}

/* ---------- reader ---------- */
.reader-pane {
  position: relative;
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--bg);
  scrollbar-width: thin;
}

.reader-empty {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 13px;
  min-height: 100%;
  color: var(--muted);
}

.reader-empty-logo {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  object-fit: cover;
  opacity: 0.86;
  box-shadow: var(--shadow-card);
}

.reader-empty p {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
}

.reader {
  min-height: 100%;
  padding: 34px 44px 70px;
}

.reader-back {
  display: none;
  margin-bottom: 16px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--ink-soft);
  font-size: 12px;
}

.reader-head,
.reader-tabs,
.reader-panel {
  max-width: 760px;
  margin-right: auto;
  margin-left: auto;
}

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

.reader-head h1 {
  margin: 13px 0 8px;
  font-family: var(--font-display);
  font-size: clamp(29px, 4vw, 42px);
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: 0;
  color: var(--ink);
}

.reader-title-zh {
  margin: 0 0 12px;
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1.5;
}

.reader-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.reader-open,
.reader-foot a,
.reader-content a {
  color: var(--signal);
  text-decoration: none;
}

.reader-open:hover,
.reader-foot a:hover,
.reader-content a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.reader-tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 6px;
  margin-top: 24px;
  padding: 10px 0 12px;
  background: rgba(244, 242, 236, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.reader-tab {
  min-width: 66px;
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--pill);
  background: var(--panel);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
}

.reader-tab.active {
  border-color: var(--ink);
  background: var(--ink);
  color: #f4f2ec;
}

.reader-fav-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: auto;
}

.reader-panel {
  padding-top: 22px;
}

.reader-content {
  max-width: 70ch;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1.82;
}

.reader-content > *:first-child { margin-top: 0; }
.reader-content > *:last-child { margin-bottom: 0; }

.reader-content p,
.reader-content li {
  font-size: 16px;
  line-height: 1.82;
}

.reader-content p {
  margin: 0 0 1em;
}

.reader-content h1,
.reader-content h2,
.reader-content h3,
.reader-content h4 {
  margin: 1.45em 0 0.55em;
  font-family: var(--font-display);
  line-height: 1.28;
  letter-spacing: 0;
}

.reader-content h1 { font-size: 30px; }
.reader-content h2 { font-size: 24px; }
.reader-content h3 { font-size: 20px; }
.reader-content h4 { font-size: 17px; }

.reader-content ul,
.reader-content ol {
  padding-left: 1.4em;
  margin: 0 0 1em;
}

.reader-content blockquote {
  margin: 1.2em 0;
  padding: 0.05em 0 0.05em 1em;
  border-left: 3px solid var(--signal);
  color: var(--ink-soft);
}

.reader-content img,
.reader-content video {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
}

.reader-content pre {
  overflow-x: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.65;
}

.reader-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}

.reader-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
  font-family: var(--font-ui);
  font-size: 13px;
}

.reader-content th,
.reader-content td {
  border: 1px solid var(--line);
  padding: 8px 9px;
  text-align: left;
  vertical-align: top;
}

.reader-content th {
  background: var(--bg-soft);
  font-weight: 600;
}

.reader-content.is-fallback {
  color: var(--ink-soft);
}

.reader-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  max-width: 70ch;
  margin-bottom: 14px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.reader-status strong {
  color: var(--ink);
  font-weight: 600;
}

.reader-status.is-fallback strong {
  color: var(--warn);
}

.translated-gist {
  padding-top: 4px;
}

.reader-note {
  max-width: 70ch;
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

.agent-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  max-width: 760px;
  margin: 6px auto 0;
  padding: 12px 0 8px;
  border-top: 1px solid var(--line);
}

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

.agent-btn {
  padding: 0 11px;
  min-width: 0;
  height: 30px;
  border-radius: var(--pill);
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease, opacity 0.15s ease,
    border-color 0.15s ease;
}

.agent-btn:hover {
  background: var(--bg-soft);
  color: var(--ink);
}

.agent-btn.is-loading {
  opacity: 0.65;
  cursor: wait;
}

.agent-result {
  max-width: 760px;
  margin: 10px auto 0;
  padding: 12px 14px;
  border-left: 2px solid rgba(28, 26, 23, 0.28);
  border-radius: 0 8px 8px 0;
  background: rgba(255, 255, 255, 0.48);
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.7;
}

.agent-result-content {
  color: var(--ink);
}

.agent-result-title {
  margin-bottom: 4px;
  color: var(--signal);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.reader-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  max-width: 70ch;
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 12px;
}

/* ---------- ops telemetry ---------- */
.ops {
  flex: 0 0 auto;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  overflow: hidden;
}

.ops > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  list-style: none;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 600;
  user-select: none;
}

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

.ops > summary::after {
  content: "";
  margin-left: auto;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--faint);
  border-bottom: 1.5px solid var(--faint);
  transform: rotate(-45deg);
  transition: transform 0.2s ease;
}

.ops[open] > summary::after { transform: rotate(45deg); }
.ops > summary:hover { background: var(--bg); }

.ops-hint {
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 500;
}

.ops-body {
  display: grid;
  max-height: 42vh;
  overflow-y: auto;
  padding: 0 12px 12px;
  scrollbar-width: thin;
}

.panel {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 11px;
}

.panel-title strong {
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 600;
}

.panel-title span {
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.quality-list {
  display: grid;
  gap: 0 14px;
}

.quality-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-height: 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11.5px;
}

.quality-row strong {
  min-width: 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  text-align: right;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.sources,
.runs,
.link-problems,
.opportunities,
.importance-standard {
  display: grid;
  gap: 0;
}

.source,
.run,
.link-problem,
.opportunity,
.importance-rule {
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.source:first-child,
.run:first-child,
.link-problem:first-child,
.opportunity:first-child,
.importance-rule:first-child {
  border-top: 0;
  padding-top: 0;
}

.source {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
}

.source strong,
.run-head strong,
.link-problem-head a,
.opportunity-head strong,
.importance-rule strong {
  min-width: 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.source span,
.source small,
.source em,
.run-meta,
.run-error,
.link-problem-meta,
.link-problem-error,
.opportunity-meta,
.opportunity-requirement,
.opportunity p,
.importance-rule p {
  display: block;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.42;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.source em,
.run-error,
.link-problem-error { color: var(--warn); font-style: normal; }

.run-head,
.link-problem-head,
.opportunity-head,
.importance-rule div {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.source-health,
.run-status,
.opportunity-status,
.tag {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: var(--pill);
  background: var(--bg-soft);
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 500;
  white-space: nowrap;
}

.source-health.ok,
.run-status.success { color: var(--ok); background: rgba(47, 106, 76, 0.1); }
.source-health.error,
.run-status.failed { color: var(--err); background: rgba(156, 47, 41, 0.1); }
.source-health.cooldown { color: var(--ink-soft); background: var(--bg-soft); }
.source-health.pending,
.opportunity-status.unsupported { color: var(--warn); background: rgba(138, 99, 18, 0.12); }
.opportunity-status.unavailable { color: var(--err); background: rgba(156, 47, 41, 0.1); }

.link-status.valid { color: var(--ok); background: rgba(47, 106, 76, 0.1); }
.link-status.invalid,
.link-status.local { color: var(--err); background: rgba(156, 47, 41, 0.1); }
.link-status.restricted,
.link-status.unknown,
.link-status.unchecked { color: var(--warn); background: rgba(138, 99, 18, 0.12); }

.importance-rule.score-5 {
  padding: 10px;
  border: 1px solid rgba(143, 42, 42, 0.35);
  border-radius: var(--radius-sm);
  background: var(--signal-soft);
}

.empty,
.error,
.empty-mini {
  margin: 16px;
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.empty-mini {
  margin: 0;
  padding: 12px;
  font-size: 11.5px;
  border-style: solid;
  border-color: var(--line);
}

.error {
  border-style: solid;
  border-color: rgba(156, 47, 41, 0.4);
  background: rgba(156, 47, 41, 0.06);
  color: var(--err);
}

/* ---------- responsive ---------- */
@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 206px minmax(320px, 390px) minmax(420px, 1fr);
  }

  .reader {
    padding-right: 28px;
    padding-left: 28px;
  }
}

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

  .sidebar {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: 1fr;
    height: auto;
    max-height: 44vh;
    padding: 10px 12px 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow: hidden;
  }

  .sidebar .brand {
    padding: 0 4px 10px;
  }

  .brand span:last-child { display: none; }

  .channel-nav {
    display: flex;
    gap: 7px;
    padding: 8px 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }

  .channel-nav::-webkit-scrollbar { display: none; }
  .rail-label { display: none; }
  .channel-nav #channels { display: flex; gap: 7px; }

  .channel {
    grid-template-columns: 6px max-content;
    min-width: max-content;
    height: 33px;
    margin-bottom: 0;
    border: 1px solid var(--line);
  }

  .channel.active { border-color: var(--ink); }
  .sidebar-spacer { display: none; }

  .sidebar-actions {
    grid-template-columns: 1fr auto;
    align-items: center;
    padding: 8px 0;
  }

  .action-row { justify-content: flex-end; }
  .status-strip { grid-column: 1 / -1; }

  .ops {
    display: none;
  }

  .entry-pane {
    height: 100vh;
    padding-top: 174px;
    border-right: 0;
  }

  .entry-header {
    grid-template-columns: 1fr;
  }

  .reader-pane {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: none;
    background: var(--bg);
  }

  .reader-pane.is-open {
    display: block;
  }

  .reader {
    padding: 18px 18px 46px;
  }

  .reader-back {
    display: inline-flex;
    align-items: center;
  }

  .reader-head h1 {
    font-size: 30px;
  }

  .reader-tabs {
    top: 0;
  }
}

@media (max-width: 520px) {
  .sidebar-actions {
    grid-template-columns: 1fr;
  }

  .live-state {
    width: max-content;
  }

  .entry-pane {
    padding-top: 210px;
  }

  .ticker {
    display: none;
  }

  .entry-card {
    padding: 15px 13px;
  }

  .entry-card h2 {
    font-size: 16.5px;
  }

  .reader {
    padding-right: 15px;
    padding-left: 15px;
  }

  .reader-content,
  .reader-content p,
  .reader-content li {
    font-size: 15.5px;
    line-height: 1.78;
  }
}

/* Annotation / discussion UI */
.annotation-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  border-radius: var(--pill);
  background: var(--signal-soft);
  color: var(--signal);
  font-size: 11px;
  font-weight: 600;
}

.annotation-selection-popup {
  position: fixed;
  z-index: 1000;
  background: transparent;
  border: none;
  padding: 0;
  box-shadow: none;
  pointer-events: auto;
}

.annotation-selection-popup::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid var(--panel-2);
}

.annotation-selection-popup.below::after {
  bottom: auto;
  top: -6px;
  border-top: none;
  border-bottom: 6px solid var(--panel-2);
}

.annotation-selection-popup button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: var(--pill);
  background: var(--panel-2);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  white-space: nowrap;
}

.annotation-selection-popup button:hover {
  background: var(--signal-soft);
  border-color: var(--signal);
  color: var(--signal);
}

.annotation-form,
.annotation-reply-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
}

.annotation-form textarea,
.annotation-reply-form textarea {
  width: 100%;
  min-height: 112px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.55;
  outline: none;
  resize: vertical;
}

.annotation-form textarea:focus,
.annotation-reply-form textarea:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(28, 26, 23, 0.07);
}

.annotations-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 12px;
}

.annotation {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.annotation-quote {
  margin: 0 0 10px;
  padding: 8px 12px;
  border-left: 3px solid var(--signal);
  background: var(--bg-soft);
  color: var(--ink-soft);
  font-size: 13px;
}

.annotation-note {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
}

.annotation-replies {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.annotation-reply {
  font-size: 13px;
  color: var(--ink-soft);
}

.annotation-user {
  color: var(--ink);
  font-weight: 600;
}

.annotation-actions {
  margin-top: 10px;
}

.annotation-reply-btn {
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--ink-soft);
  font-size: 12px;
  cursor: pointer;
}

.annotation-reply-btn:hover {
  background: var(--bg-soft);
}

/* === brand tagline === */
.brand-tagline {
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* === importance-5 badge === */
.imp-5-badge {
  display: inline-block;
  font-size: 0.7rem;
  color: #c9a227;
  vertical-align: middle;
  margin-right: 3px;
  line-height: 1;
}
