:root {
  color-scheme: light dark;
  --bg: #f6f3ec;
  --fg: #181614;
  --lead: #2d2926;
  --muted: #6b635b;
  --card: #fbf9f4;
  --soft-card: #faf8f2;
  --line: #d6cfc2;
  --rule-strong: #181614;
  --accent: #8b1e1e;
  --rel: #0f6b63;
  --new: #b91c1c;
  --ok: #15803d;
  --warn: #b45309;
  --err: #dc2626;
  --font-serif: Georgia, "Iowan Old Style", "Palatino Linotype", Charter, "Times New Roman", serif;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11100f;
    --fg: #ede9e0;
    --lead: #cfc9be;
    --muted: #9a9288;
    --card: #1b1916;
    --soft-card: #161412;
    --line: #2d2926;
    --rule-strong: #d6cfc2;
    --accent: #f87171;
    --rel: #2dd4bf;
    --new: #f87171;
    --ok: #4ade80;
    --warn: #fbbf24;
    --err: #f87171;
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f3ec;
  --fg: #181614;
  --lead: #2d2926;
  --muted: #6b635b;
  --card: #fbf9f4;
  --soft-card: #faf8f2;
  --line: #d6cfc2;
  --rule-strong: #181614;
  --accent: #8b1e1e;
  --rel: #0f6b63;
  --new: #b91c1c;
  --ok: #15803d;
  --warn: #b45309;
  --err: #dc2626;
}

:root[data-theme="dark"],
:root[data-theme="auto"].auto-dark {
  color-scheme: dark;
  --bg: #11100f;
  --fg: #ede9e0;
  --lead: #cfc9be;
  --muted: #9a9288;
  --card: #1b1916;
  --soft-card: #161412;
  --line: #2d2926;
  --rule-strong: #d6cfc2;
  --accent: #f87171;
  --rel: #2dd4bf;
  --new: #f87171;
  --ok: #4ade80;
  --warn: #fbbf24;
  --err: #f87171;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

body {
  margin: 0;
  font: 15px/1.58 var(--font-sans);
  background: var(--bg);
  color: var(--fg);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.site-header {
  position: sticky;
  top: 0;
  background: var(--bg);
  border-bottom: 2px solid var(--rule-strong);
  padding: 12px 0;
  padding-top: max(12px, env(safe-area-inset-top));
  z-index: 30;
}

/* Identical horizontal geometry for .bar and .container */
.bar {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 12px 24px 64px;
}

/* Full Monitor Width Mode */
:root[data-width="full"] .bar,
:root[data-width="full"] .container {
  max-width: 100%;
  padding-left: 32px;
  padding-right: 32px;
}

.logo {
  font-family: var(--font-serif);
  font-weight: 900;
  font-size: clamp(22px, 2.5vw, 27px);
  letter-spacing: -0.02em;
  color: var(--fg);
  text-decoration: none;
}

.logo span {
  color: var(--accent);
  font-style: italic;
}

.search-wrap {
  flex: 1;
  min-width: 220px;
  max-width: 520px;
}

.search-wrap input[type="search"] {
  width: 100%;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
  color: var(--fg);
  font: inherit;
  font-size: 13.5px;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tool-btn.mobile-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 38px;
  padding: 6px 11px;
  font-size: 18px;
  line-height: 1;
}

.user-slot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 6px;
}

.header-sync-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 38px;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
}

.main-nav a.user-account-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  min-height: 38px;
  line-height: 1.2;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--fg);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.main-nav a.user-account-badge:hover {
  border-color: var(--rule-strong);
  background: var(--soft-card);
}

.user-avatar-icon {
  font-size: 13px;
}

.user-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--line);
  color: var(--muted);
}

.user-role-badge.admin {
  background: rgba(185, 28, 28, 0.12);
  color: var(--accent);
  border: 1px solid rgba(185, 28, 28, 0.25);
}

.main-nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 4px 2px;
}

.main-nav a[aria-current="page"] {
  color: var(--fg);
  font-weight: 700;
  border-bottom: 2px solid var(--accent);
}

.theme-btn {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--fg);
  border-radius: 4px;
  padding: 5px 10px;
  cursor: pointer;
  font: inherit;
  font-size: 12.5px;
  text-transform: none;
  letter-spacing: 0;
}

.theme-btn:hover {
  border-color: var(--rule-strong);
}

/* Mini Settings Popover in Header */
.settings-wrap {
  position: relative;
}

.settings-trigger[aria-expanded="true"] {
  background: var(--rule-strong);
  color: var(--bg);
  border-color: var(--rule-strong);
}

.settings-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: 310px;
  background: var(--card);
  border: 1px solid var(--rule-strong);
  border-top: 3px solid var(--accent);
  border-radius: 4px;
  padding: 14px 16px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
  z-index: 60;
  text-transform: none;
  letter-spacing: 0;
}

.settings-title {
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg);
  padding-bottom: 8px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
}

.settings-row:last-child {
  border-bottom: 0;
  padding-bottom: 2px;
}

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

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

/* Newspaper Edition Masthead Bar */
.newspaper-masthead {
  border-bottom: 3px double var(--rule-strong);
  padding: 6px 0 8px;
  margin-bottom: 14px;
}

.masthead-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.masthead-date {
  font-family: var(--font-serif);
  font-weight: 700;
  color: var(--fg);
  font-size: 12.5px;
}

/* Controls & Filter Strip (Inside Left Editorial Column) */
.controls {
  background: var(--soft-card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 24px;
}

.controls-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.controls-search-wrap {
  margin-bottom: 14px;
}

.top-search-wrap {
  display: flex;
  align-items: stretch;
  gap: 10px;
  margin-top: 6px;
  margin-bottom: 20px;
}

.controls-search-input {
  flex: 1;
  min-width: 0;
  padding: 12px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--fg);
  font: inherit;
  font-size: 14.5px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.controls-search-btn {
  padding: 0 20px;
  min-height: 44px;
  border: 1px solid var(--fg);
  border-radius: 8px;
  background: var(--fg);
  color: var(--bg);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s ease;
}

.controls-search-btn:hover {
  opacity: 0.88;
}

.controls-search-input:focus {
  outline: none;
  border-color: var(--rule-strong);
  box-shadow: 0 0 0 2px rgba(185, 28, 28, 0.15);
}

:root[data-card-style="boxed"] .controls,
.newspaper-board[data-card-style="boxed"] .controls {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 24px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.chip,
.tag-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--fg);
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.chip:hover,
.tag-chip:hover {
  border-color: var(--rule-strong);
}

.chip[aria-pressed="true"],
.tag-chip[aria-pressed="true"] {
  background: var(--rule-strong);
  border-color: var(--rule-strong);
  color: var(--bg);
  font-weight: 600;
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--fg);
  padding: 8px 16px;
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  min-height: 38px;
  line-height: 1.2;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.tool-btn:hover {
  background: var(--soft-card);
  border-color: var(--rule-strong);
  color: var(--fg);
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}

.tool-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.tool-btn[aria-pressed="true"] {
  background: var(--rule-strong);
  border-color: var(--rule-strong);
  color: var(--bg);
  font-weight: 600;
}

.tool-btn.primary,
.tool-btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff !important;
}

.tool-btn.primary:hover,
.tool-btn-primary:hover {
  background: var(--accent);
  opacity: 0.92;
  border-color: var(--accent);
  color: #ffffff !important;
  box-shadow: 0 2px 6px rgba(185, 28, 28, 0.25);
}

.tool-btn.danger,
.tool-btn-danger {
  color: var(--err) !important;
  border-color: rgba(220, 38, 38, 0.3);
}

.tool-btn.danger:hover,
.tool-btn-danger:hover {
  background: rgba(220, 38, 38, 0.08);
  border-color: var(--err);
}

.controls .row {
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  margin: 0;
}

.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 10px 0 6px;
}

.seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: var(--card);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.seg button {
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--fg);
  padding: 6px 14px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.seg button:hover {
  background: var(--bg-hover, rgba(0, 0, 0, 0.04));
}

.seg button:last-child {
  border-right: 0;
}

.seg button[aria-pressed="true"] {
  background: var(--rule-strong);
  color: var(--bg);
  font-weight: 600;
}

:root[data-theme="dark"] .seg button[aria-pressed="true"],
:root[data-theme="auto"].auto-dark .seg button[aria-pressed="true"] {
  background: #f1f5f9;
  color: #0f172a;
}

.visit-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--muted);
}

.link-btn {
  border: 0;
  background: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 12px;
  text-decoration: underline;
  padding: 0;
}

.tags-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 8px;
}

/* Two-Zone Newspaper Board */
.newspaper-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  column-gap: 28px;
  row-gap: 0;
  align-items: start;
}

.newspaper-board[data-view="release"],
.newspaper-board[data-sidebar="off"] {
  grid-template-columns: minmax(0, 1fr);
}

.newspaper-board[data-sidebar="off"] .releases-sidebar {
  display: none;
}

.newspaper-board[data-sidebar="off"] .editorial-left-col,
.newspaper-board[data-sidebar="off"] > .pagination-nav {
  grid-column: 1;
}

/* Sidebar Position Modifiers */
.newspaper-board[data-sidebar-pos="left"] {
  grid-template-columns: 300px minmax(0, 1fr);
}

.newspaper-board[data-sidebar-pos="left"] .editorial-left-col {
  grid-column: 2;
  grid-row: 1;
}

.newspaper-board[data-sidebar-pos="left"] > .pagination-nav {
  grid-column: 2;
  grid-row: 2;
}

.newspaper-board[data-sidebar-pos="left"] .releases-sidebar {
  grid-column: 1;
  grid-row: 1 / span 2;
  border-left: 0;
  padding-left: 0;
  border-right: 1px solid var(--line);
  padding-right: 22px;
}

.newspaper-board[data-sidebar-pos="above"] {
  grid-template-columns: minmax(0, 1fr);
}

.newspaper-board[data-sidebar-pos="above"] .releases-sidebar {
  grid-column: 1;
  grid-row: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
  align-items: stretch;
  background: var(--soft-card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 16px 16px;
  margin-bottom: 20px;
}

.newspaper-board[data-sidebar-pos="above"] .sidebar-box .markets-list,
.newspaper-board[data-sidebar-pos="below"] .sidebar-box .markets-list,
.newspaper-board[data-sidebar-pos="above"] .almanac-box .markets-list,
.newspaper-board[data-sidebar-pos="below"] .almanac-box .markets-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
}

.newspaper-board[data-sidebar-pos="above"] .sidebar-box .market-item,
.newspaper-board[data-sidebar-pos="below"] .sidebar-box .market-item,
.newspaper-board[data-sidebar-pos="above"] .almanac-box .market-item,
.newspaper-board[data-sidebar-pos="below"] .almanac-box .market-item {
  border-bottom: 1px dashed var(--line);
  padding: 6px 0;
}

.newspaper-board[data-sidebar-pos="above"] .sidebar-box,
.newspaper-board[data-sidebar-pos="above"] .almanac-box,
.newspaper-board[data-sidebar-pos="above"] .calendar-box,
.newspaper-board[data-sidebar-pos="above"] .saved-sidebar-box,
.newspaper-board[data-sidebar-pos="above"] .releases-box,
.newspaper-board[data-sidebar-pos="below"] .sidebar-box,
.newspaper-board[data-sidebar-pos="below"] .almanac-box,
.newspaper-board[data-sidebar-pos="below"] .calendar-box,
.newspaper-board[data-sidebar-pos="below"] .saved-sidebar-box,
.newspaper-board[data-sidebar-pos="below"] .releases-box {
  margin-bottom: 0;
  height: 100%;
}

.newspaper-board[data-sidebar-pos="above"] .editorial-left-col {
  grid-column: 1;
  grid-row: 2;
}

.newspaper-board[data-sidebar-pos="above"] > .pagination-nav {
  grid-column: 1;
  grid-row: 3;
}

.newspaper-board[data-sidebar-pos="below"] {
  grid-template-columns: minmax(0, 1fr);
}

.newspaper-board[data-sidebar-pos="below"] .editorial-left-col {
  grid-column: 1;
  grid-row: 1;
}

.newspaper-board[data-sidebar-pos="below"] > .pagination-nav {
  grid-column: 1;
  grid-row: 2;
}

.newspaper-board[data-sidebar-pos="below"] .releases-sidebar {
  grid-column: 1;
  grid-row: 3;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
  align-items: stretch;
  border-left: 0;
  padding-left: 0;
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin-top: 24px;
}

/* Main Editorial Columns (Left / Center) */
.editorial-left-col,
.editorial-main {
  min-width: 0;
}

.editorial-left-col {
  grid-column: 1;
  grid-row: 1;
}

.newspaper-board > .pagination-nav {
  grid-column: 1;
  grid-row: 2;
}

.releases-sidebar {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.newspaper-board[data-view="release"] .editorial-left-col {
  grid-column: 1;
  grid-row: 1;
}

.newspaper-board[data-view="release"] .releases-sidebar {
  grid-column: 1;
  grid-row: 2;
}

.newspaper-board[data-view="release"] > .pagination-nav {
  grid-column: 1;
  grid-row: 3;
}

.day-group {
  margin-bottom: 32px;
}

.day-heading-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 14px;
}

.day-heading,
.search-results h2 {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--fg);
  margin: 0;
  padding: 2px 0 2px 10px;
  border-left: 3px solid var(--accent);
  border-top: 0;
  border-bottom: 0;
}

.search-results h2 {
  margin-bottom: 16px;
}

/* 2-Column Broadsheet Newspaper Flow inside each Day (Zero Vertical Gaps) */
.articles-columns {
  column-count: 2;
  column-gap: 22px;
  column-rule: 0;
}

:root[data-width="full"] .articles-columns {
  column-count: auto;
  column-width: 380px;
  column-gap: 22px;
  column-rule: 0;
}

.newspaper-board[data-sidebar-pos="above"] .articles-columns {
  column-count: 3;
  column-width: auto;
  column-gap: 22px;
  column-rule: 0;
}

/* Default entry-card fallback */
.entry-card {
  background: transparent;
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
  min-width: 0;
  overflow: hidden;
}

/* ==========================================================================
   Editorial Article Cards: Variant C (Hybrid Default) vs Variant A (Boxed)
   ========================================================================== */
.editorial-article {
  position: relative;
  display: inline-block;
  vertical-align: top;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  background: var(--soft-card);
  border: 0;
  border-top: 2px solid var(--line);
  border-radius: 2px;
  padding: 16px 18px 18px;
  margin: 0 0 22px;
  break-inside: avoid-column;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  page-break-inside: avoid;
}

.lead-card-container {
  width: 100%;
  margin: 0 0 22px;
}

.editorial-article.is-lead {
  display: block;
  background: var(--soft-card);
  border: 0;
  border-top: 2px solid var(--accent);
  border-radius: 2px;
  padding: 18px 20px 20px;
  margin: 0 0 22px;
}

/* Variant A: Boxed Cards with 4-sided border, rounded corners, and elevation */
:root[data-card-style="boxed"] .editorial-article,
.newspaper-board[data-card-style="boxed"] .editorial-article {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 16px 18px 18px;
  margin: 0 0 24px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

:root[data-card-style="boxed"] .editorial-article.is-lead,
.newspaper-board[data-card-style="boxed"] .editorial-article.is-lead {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: 6px;
  padding: 18px 20px 20px;
  margin: 0 0 24px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

:root[data-card-style="boxed"] .releases-sidebar,
.newspaper-board[data-card-style="boxed"] .releases-sidebar {
  border-left: none;
  padding-left: 0;
}

.kicker {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 6px;
}

.kicker .source-name {
  color: var(--fg);
  font-weight: 700;
}

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

.editorial-article h3.headline,
.entry-card h3 {
  font-family: var(--font-serif);
  font-size: clamp(18px, 1.8vw, 21px);
  line-height: 1.26;
  font-weight: 700;
  margin: 0 0 10px;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.editorial-article.is-lead h3.headline {
  font-size: clamp(21px, 2.4vw, 27px);
  line-height: 1.18;
  margin-bottom: 12px;
}

.editorial-article h3.headline a,
.entry-card h3 a {
  color: var(--fg);
  text-decoration: none;
}

.editorial-article h3.headline a:hover,
.entry-card h3 a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Newspaper Article Illustrations (Fluid Aspect Ratio & Safe Elevation) */
.article-figure {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0 0 12px;
  border: 1px solid var(--line);
  background: var(--card);
  overflow: hidden;
  border-radius: 4px;
}

.article-figure a {
  display: block;
  width: 100%;
}

.article-img {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  aspect-ratio: 16 / 9;
  height: auto !important;
  max-height: 220px !important;
  object-fit: cover;
  object-position: center;
  filter: contrast(1.02) saturate(0.92);
  transition: transform 0.2s ease;
}

.editorial-article:hover .article-img {
  transform: scale(1.015);
}

.editorial-article.is-lead .article-figure {
  margin: 0 0 16px;
}

.editorial-article.is-lead .article-img {
  aspect-ratio: 21 / 9;
  max-height: 320px !important;
}

/* Hide images when toggled off */
.newspaper-board[data-images="off"] .article-figure {
  display: none !important;
}

/* Article Lead & Text Length Modes (Short / Medium / Long) */
.article-lead,
.entry-card p {
  font-family: var(--font-serif);
  font-size: 15px;
  line-height: 1.62;
  color: var(--lead);
  margin: 0 0 10px;
  text-align: left;
  overflow-wrap: anywhere;
}

.editorial-article.is-lead .article-lead {
  font-size: 16.5px;
  line-height: 1.65;
  max-width: 82ch;
}

.newspaper-board[data-length="short"] .editorial-article:not([data-expanded="true"]) .article-lead {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.newspaper-board[data-length="medium"] .editorial-article:not([data-expanded="true"]) .article-lead {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
}

.newspaper-board[data-length="medium"] .editorial-article.is-lead:not([data-expanded="true"]) .article-lead {
  -webkit-line-clamp: 5;
}

.newspaper-board[data-length="long"] .editorial-article .article-lead,
.editorial-article[data-expanded="true"] .article-lead {
  display: block;
  overflow: visible;
}

.newspaper-board[data-length="long"] .expand-lead-btn {
  display: none;
}

.expand-lead-btn {
  align-self: flex-start;
  border: 0;
  background: none;
  color: var(--accent);
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 600;
  padding: 0;
  margin: -2px 0 10px;
  cursor: pointer;
}

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

.meta {
  font-size: 11.5px;
  color: var(--muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 6px;
}

.article-byline {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dotted var(--line);
}

:root[data-card-style="boxed"] .article-byline,
.newspaper-board[data-card-style="boxed"] .article-byline {
  border-top: 1px dashed var(--line);
}

.article-byline span {
  color: var(--muted);
  margin: 0 4px;
}

.byline-link {
  color: var(--fg);
  font-weight: 600;
  text-decoration: none;
}

.byline-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* Save entry action in article bylines - Variant 1 (consistent flat editorial link) */
button.save-entry-btn.byline-link {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  font-size: inherit;
  font-weight: 600;
  color: var(--fg);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  line-height: inherit;
  vertical-align: baseline;
  transition: color 0.15s ease;
}

button.save-entry-btn.byline-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

button.save-entry-btn.byline-link.is-saved,
button.save-entry-btn.byline-link[aria-pressed="true"] {
  color: var(--accent);
  font-weight: 700;
}

button.save-entry-btn.byline-link.is-saved:hover,
button.save-entry-btn.byline-link[aria-pressed="true"]:hover {
  color: var(--accent);
  text-decoration: underline;
}

.badge {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1px 6px;
  border-radius: 2px;
  border: 1px solid currentColor;
}

.badge.blog {
  color: var(--accent);
}

.badge.release {
  color: var(--rel);
}

.badge.isnew {
  color: var(--new);
}

.entry-tag {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

/* Subordinate Right-Hand Releases Column ("Depesze / Wydania") */
.releases-sidebar {
  border-left: 1px solid var(--line);
  padding-left: 22px;
  font-size: 13px;
  color: var(--muted);
  min-width: 0;
}

.newspaper-board[data-view="release"] .releases-sidebar {
  border-left: 0;
  padding-left: 0;
}

/* Top-of-Right-Sidebar Box (Date, Weather, Markets) */
.sidebar-box,
.almanac-box {
  background: var(--soft-card);
  border: 0;
  border-top: 3px solid var(--rule-strong);
  border-radius: 2px;
  padding: 14px 15px;
  margin-bottom: 14px;
  color: var(--fg);
}

:root[data-card-style="boxed"] .sidebar-box,
.newspaper-board[data-card-style="boxed"] .sidebar-box,
:root[data-card-style="boxed"] .almanac-box,
.newspaper-board[data-card-style="boxed"] .almanac-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 3px solid var(--rule-strong);
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.sidebar-date,
.almanac-date {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.sidebar-day-tile,
.almanac-day-tile {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: 3px;
}

.sidebar-date-meta,
.almanac-date-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.sidebar-month-year,
.almanac-month-year {
  font-family: var(--font-serif);
  font-size: 16.5px;
  font-weight: 800;
  color: var(--fg);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.sidebar-sub-row,
.almanac-sub-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11.5px;
}

.sidebar-weekday,
.almanac-weekday {
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.sidebar-dot,
.almanac-dot {
  color: var(--muted);
}

.sidebar-week-badge,
.almanac-week-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

/* Browser-Location Weather Section */
.sidebar-weather,
.almanac-weather {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.weather-main-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.weather-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.weather-icon {
  font-size: 29px;
  line-height: 1;
}

.weather-temp {
  font-family: var(--font-mono);
  font-size: 21px;
  font-weight: 800;
  color: var(--fg);
  letter-spacing: -0.02em;
}

.weather-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  min-width: 0;
  gap: 2px;
}

.weather-city-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.weather-city {
  font-size: 13px;
  font-weight: 800;
  color: var(--fg);
}

.weather-desc {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--lead);
}

.weather-details {
  font-size: 10.5px;
  color: var(--muted);
}

.weather-metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

.weather-metric {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.weather-metric-label {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.weather-metric-val {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Calendar Stats & Sync Timestamps */
.calendar-stats {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.calendar-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 10px;
}

.calendar-stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.calendar-stat-label {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.calendar-stat-val {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

.calendar-updates {
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.calendar-update-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.calendar-admin-sync {
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.sidebar-sync-btn,
.almanac-sync-btn {
  font-size: 11px;
  padding: 5px 10px;
}

.sidebar-sync-status,
.almanac-sync-status {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

/* Stock / ETF Market Quotes Section */
.sidebar-markets,
.almanac-markets {
  padding-top: 11px;
}

.markets-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 6px;
}

.markets-cadence {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10px;
}

.markets-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.market-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line);
}

.market-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.market-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.market-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.market-meta-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.market-ticker {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
}

.market-type-badge {
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 4px;
  line-height: 1.35;
}

.market-quote {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
  font-family: var(--font-mono);
}

.market-price {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--fg);
}

.market-price small {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--muted);
}

.market-change {
  font-size: 10.5px;
  font-weight: 700;
  padding: 0 5px;
  border-radius: 2px;
}

.market-change.up {
  color: var(--ok);
  background: rgba(34, 197, 94, 0.1);
}

.market-change.down {
  color: var(--err);
  background: rgba(239, 68, 68, 0.1);
}

.market-change.flat {
  color: var(--muted);
}

/* ==========================================================================
   Interactive Archive Calendar Box in Right Sidebar
   ========================================================================== */
.calendar-box {
  background: var(--soft-card);
  border: 0;
  border-top: 2px solid var(--line);
  border-radius: 2px;
  padding: 12px 14px;
  margin-bottom: 14px;
  color: var(--fg);
}

:root[data-card-style="boxed"] .calendar-box,
.newspaper-board[data-card-style="boxed"] .calendar-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

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

.calendar-title {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.cal-reset-btn {
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.cal-reset-btn:hover {
  text-decoration: underline;
}

.calendar-controls {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 8px;
}

.cal-nav-btn {
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--fg);
  border-radius: 3px;
  width: 28px;
  height: 28px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.cal-nav-btn:hover {
  border-color: var(--rule-strong);
}

.cal-select {
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--fg);
  border-radius: 3px;
  height: 28px;
  padding: 0 6px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.cal-year-select {
  flex: 0 0 74px;
  font-family: var(--font-mono);
}

.calendar-scope-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 10px;
}

.cal-scope-btn {
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--muted);
  border-radius: 3px;
  padding: 4px 8px;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

.cal-scope-btn:hover {
  border-color: var(--rule-strong);
  color: var(--fg);
}

.cal-scope-btn[aria-pressed="true"] {
  background: var(--rule-strong);
  border-color: var(--rule-strong);
  color: var(--bg);
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.cal-day {
  position: relative;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 3px;
  height: 29px;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cal-day.is-empty {
  pointer-events: none;
}

.cal-day.has-entries {
  color: var(--fg);
  font-weight: 700;
  background: var(--bg);
  border-color: var(--line);
}

.cal-day.has-entries::after {
  content: "";
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.cal-day:hover:not(.is-empty) {
  border-color: var(--rule-strong);
  color: var(--fg);
}

.cal-day.is-today {
  border-color: var(--accent);
}

.cal-day.in-range {
  background: var(--soft-card);
  border-color: var(--rule-strong);
}

.cal-day.is-selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  font-weight: 800;
}

.cal-day.is-selected::after {
  background: #ffffff;
}

.active-date-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  padding: 7px 12px;
  background: var(--soft-card);
  border: 1px solid var(--accent);
  border-radius: 3px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--fg);
}

/* Saved Entries in Sidebar */
.saved-sidebar-box {
  background: var(--soft-card);
  border: 0;
  border-top: 2px solid var(--line);
  border-radius: 2px;
  padding: 12px 14px;
  margin-bottom: 14px;
  color: var(--fg);
}

:root[data-card-style="boxed"] .saved-sidebar-box,
.newspaper-board[data-card-style="boxed"] .saved-sidebar-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.saved-sidebar-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
}

.saved-sidebar-header h2 {
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg);
  margin: 0;
  white-space: nowrap;
}

.saved-view-all-link {
  font-size: 11px;
  color: var(--accent);
  text-decoration: underline;
  padding: 0;
  display: inline-block;
}

.saved-sidebar-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.saved-sidebar-item {
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}

.saved-sidebar-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.saved-sidebar-item-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.saved-sidebar-title {
  font-family: var(--font-serif);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--fg);
  text-decoration: none;
  flex: 1;
}

.saved-sidebar-title:hover {
  color: var(--accent);
  text-decoration: underline;
}

.saved-sidebar-remove {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
  padding: 2px 5px;
  cursor: pointer;
  border-radius: 3px;
  opacity: 0.6;
  transition: opacity 0.15s, color 0.15s, background-color 0.15s;
}

.saved-sidebar-remove:hover {
  opacity: 1;
  color: #e53e3e;
  background-color: rgba(229, 62, 62, 0.1);
}

.saved-sidebar-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
  display: flex;
  gap: 5px;
}

.releases-box {
  background: var(--soft-card);
  border: 0;
  border-top: 2px solid var(--line);
  border-radius: 2px;
  padding: 12px 14px;
  color: var(--fg);
}

:root[data-card-style="boxed"] .releases-box,
.newspaper-board[data-card-style="boxed"] .releases-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.releases-header {
  border-top: 0;
  border-bottom: 1px solid var(--line);
  padding: 0 0 8px;
  margin-bottom: 6px;
}

.releases-header h2 {
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 2px;
}

.releases-header p {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
}

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

.newspaper-board[data-view="release"] .releases-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.release-brief {
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
  margin: 0;
}

.release-brief:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.release-meta-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 2px;
}

.release-source {
  font-weight: 600;
  color: var(--lead);
}

.release-brief h3.release-title {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  margin: 0 0 3px;
}

.release-brief h3.release-title a {
  color: var(--lead);
  text-decoration: none;
}

.release-brief h3.release-title a:hover {
  color: var(--rel);
  text-decoration: underline;
}

.release-brief p.release-note {
  font-family: var(--font-sans);
  font-size: 12px;
  line-height: 1.42;
  color: var(--muted);
  margin: 2px 0 5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.release-tags {
  font-size: 10.5px;
  gap: 6px;
}

/* ==========================================================================
   Full Article Reader Subpage (articles/<id>.html) with Floating Action Bar
   ========================================================================== */
.reader-article {
  width: 100%;
  max-width: 100%;
  margin: 8px auto 64px;
}

.reader-nav-bar {
  position: sticky;
  top: 62px;
  z-index: 25;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  margin: 0 0 22px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-bottom: 2px solid var(--rule-strong);
  border-radius: 4px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
  font-size: 13px;
}

.reader-nav-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.reader-action-btn,
.reader-nav-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 600;
  padding: 7px 14px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--fg);
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  line-height: 1.2;
  min-height: 36px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.reader-action-btn:hover,
.reader-nav-action-btn:hover {
  background: var(--soft-card);
  border-color: var(--rule-strong);
  color: var(--fg);
}

.reader-action-btn.is-saved,
.reader-nav-action-btn.is-saved {
  background: var(--soft-card);
  border-color: var(--ok);
  color: var(--ok);
  font-weight: 600;
}

.reader-action-btn.reader-remove-btn,
.reader-nav-action-btn.reader-remove-btn {
  color: var(--err);
  border-color: rgba(220, 38, 38, 0.3);
}

.reader-action-btn.reader-remove-btn:hover,
.reader-nav-action-btn.reader-remove-btn:hover {
  background: rgba(220, 38, 38, 0.08);
  border-color: var(--err);
  color: var(--err);
}

.reader-action-btn.reader-orig-btn,
.reader-orig-btn {
  background: var(--rule-strong);
  color: var(--bg);
  border-color: var(--rule-strong);
}

.reader-action-btn.reader-orig-btn:hover,
.reader-orig-btn:hover {
  opacity: 0.92;
  color: var(--bg);
}

.reader-action-btn.reader-back-btn:hover,
.reader-back-btn:hover {
  border-color: var(--rule-strong);
  color: var(--accent);
}

.reader-header {
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.reader-headline {
  font-family: var(--font-serif);
  font-size: clamp(26px, 3.6vw, 38px);
  line-height: 1.16;
  font-weight: 800;
  margin: 8px 0 14px;
  letter-spacing: -0.015em;
}

.reader-byline {
  font-size: 12.5px;
}

.reader-hero-figure {
  height: auto;
  max-height: 420px;
  margin-bottom: 24px;
}

.reader-hero-img {
  height: auto !important;
  max-height: 420px !important;
}

.reader-body {
  font-family: var(--font-serif);
  font-size: clamp(16.5px, 1.9vw, 18.5px);
  line-height: 1.74;
  color: var(--fg);
  overflow-wrap: anywhere;
}

.reader-body p {
  margin: 0 0 1.25em;
}

.reader-body h2,
.reader-body h3,
.reader-body h4 {
  font-family: var(--font-serif);
  line-height: 1.25;
  margin: 1.6em 0 0.6em;
  color: var(--fg);
}

.reader-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.reader-body pre {
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.5;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 14px 16px;
  overflow-x: auto;
  margin: 1.4em 0;
}

.reader-body code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--card);
  padding: 2px 5px;
  border-radius: 3px;
}

.reader-body pre code {
  background: none;
  padding: 0;
}

.reader-body blockquote {
  margin: 1.4em 0;
  padding: 6px 0 6px 18px;
  border-left: 3px solid var(--accent);
  color: var(--lead);
  font-style: italic;
}

.reader-body img {
  max-width: 100%;
  height: auto;
  max-height: 460px;
  object-fit: contain;
  margin: 1.2em auto;
  border: 1px solid var(--line);
  border-radius: 3px;
}

.reader-footer-box {
  margin-top: 36px;
  padding: 18px 20px;
  background: var(--soft-card);
  border: 0;
  border-top: 2px solid var(--rule-strong);
  border-radius: 2px;
  font-size: 13.5px;
  color: var(--muted);
}

:root[data-card-style="boxed"] .reader-footer-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 2px solid var(--rule-strong);
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

:root[data-card-style="boxed"] .reader-nav-bar {
  border-radius: 6px;
}

.reader-brand {
  color: var(--fg);
  font-family: var(--font-serif);
}

.reader-brand span {
  color: var(--accent);
  font-style: italic;
}

.reader-footer-box p {
  margin: 0 0 12px;
}

.reader-footer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.reader-primary-link {
  background: var(--rule-strong);
  color: var(--bg);
  border-color: var(--rule-strong);
  font-weight: 600;
}

/* Sources & Archive pages */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.summary-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--muted);
}

.summary-box strong {
  display: block;
  font-family: var(--font-serif);
  font-size: 17px;
  color: var(--fg);
  margin-top: 2px;
}

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

.sources-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 13.5px;
}

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

.sources-table th {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.sources-table a {
  color: var(--accent);
  text-decoration: none;
}

.status-ok {
  color: var(--ok);
}

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

.status-err {
  color: var(--err);
}

.status-muted,
.muted-intro,
.empty-state {
  color: var(--muted);
}

.archive-grid {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}

.archive-grid li a {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 10px 12px;
  color: var(--fg);
  text-decoration: none;
  font-family: var(--font-serif);
}

.archive-grid li a:hover {
  border-color: var(--rule-strong);
}

.archive-grid li small {
  font-family: var(--font-sans);
  color: var(--muted);
  display: block;
}

.site-footer {
  margin-top: 32px;
  padding: 20px 16px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
}

.site-footer-inner {
  max-width: var(--container-max, 1280px);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}

.site-footer-brand {
  font-family: var(--font-display, Georgia, serif);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--fg);
}

.site-footer-brand span {
  color: var(--accent);
}

.site-footer-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.site-footer-sep {
  opacity: 0.45;
}

.site-footer a {
  color: var(--accent);
}

/* Settings: Per-category RSS Aggregator Links */
.rss-links-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rss-link-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  flex-wrap: wrap;
}

.rss-link-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1 1 260px;
}

.rss-link-url {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  word-break: break-all;
}

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

/* ==========================================================================
   Newspaper Edition Pagination & Load-More Bar
   ========================================================================== */
.pagination-nav {
  margin: 28px 0 12px;
  padding-top: 20px;
  border-top: 3px double var(--rule-strong);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.pagination-load-more-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
}

.load-more-btn {
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 700;
  border-color: var(--rule-strong);
}

.load-more-btn:hover {
  background: var(--rule-strong);
  color: var(--bg);
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.page-numbers {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.page-mobile-indicator {
  display: none;
  font-family: var(--font-serif);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--fg);
  padding: 0 8px;
}

.page-btn {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--fg);
  border-radius: 3px;
  padding: 6px 11px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  min-width: 34px;
  text-align: center;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.page-btn:hover:not(:disabled) {
  border-color: var(--rule-strong);
}

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

.page-btn.is-active {
  background: var(--rule-strong);
  border-color: var(--rule-strong);
  color: var(--bg);
  font-weight: 700;
}

.page-btn[aria-current="page"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.page-ellipsis {
  color: var(--muted);
  padding: 0 4px;
  font-size: 13px;
}

.pagination-meta {
  font-size: 12px;
  color: var(--muted);
  font-family: var(--font-sans);
  text-align: center;
}

/* ==========================================================================
   Full RWD Breakpoints (Tablet <= 980px, Mobile <= 720px)
   ========================================================================== */
@media (max-width: 980px) {
  .main-nav {
    display: flex;
    align-items: center;
    gap: 4px 8px;
    flex-wrap: wrap;
  }

  .newspaper-board,
  .newspaper-board[data-sidebar-pos="left"] {
    grid-template-columns: minmax(0, 1fr);
  }

  .editorial-left-col,
  .newspaper-board[data-sidebar-pos="left"] .editorial-left-col {
    grid-column: 1;
    grid-row: 1;
  }

  .newspaper-board > .pagination-nav,
  .newspaper-board[data-sidebar-pos="left"] > .pagination-nav {
    grid-column: 1;
    grid-row: 2;
    margin-bottom: 24px;
  }

  .releases-sidebar,
  .newspaper-board[data-sidebar-pos="left"] .releases-sidebar {
    grid-column: 1;
    grid-row: 3;
    border-left: 0;
    border-right: 0;
    border-top: 2px solid var(--rule-strong);
    padding-left: 0;
    padding-right: 0;
    padding-top: 20px;
  }

  .newspaper-board[data-sidebar-pos="above"] .releases-sidebar {
    grid-row: 1;
    border-top: 0;
    padding-top: 0;
  }

  .newspaper-board[data-sidebar-pos="above"] .editorial-left-col {
    grid-row: 2;
  }

  .newspaper-board[data-sidebar-pos="above"] > .pagination-nav {
    grid-row: 3;
  }

  .newspaper-board[data-sidebar-pos="above"] .articles-columns {
    column-count: 2;
  }

  .newspaper-board[data-view="release"] .releases-sidebar {
    grid-row: 2;
    border-top: 0;
    padding-top: 0;
  }

  .newspaper-board[data-view="release"] > .pagination-nav {
    grid-row: 3;
  }

  .sidebar-box,
  .almanac-box {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    align-items: start;
  }

  .sidebar-date,
  .sidebar-weather,
  .almanac-date,
  .almanac-weather {
    border-bottom: 0;
    padding-bottom: 0;
  }

  .sidebar-markets,
  .almanac-markets {
    padding-top: 0;
    grid-column: 1 / -1;
    border-top: 1px solid var(--line);
    padding-top: 10px;
  }

  .releases-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    column-gap: 20px;
  }
}

@media (max-width: 720px) {
  .bar,
  .container,
  :root[data-width="full"] .bar,
  :root[data-width="full"] .container {
    padding-left: 14px;
    padding-right: 14px;
  }

  .bar {
    gap: 10px;
  }

  .tool-btn.mobile-menu-toggle {
    display: inline-flex;
  }

  .main-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
  }

  .main-nav.open {
    display: flex;
  }

  .main-nav > a {
    padding: 9px 10px;
    border-radius: 6px;
    font-size: 14px;
  }

  .main-nav > a[aria-current="page"] {
    background: var(--soft);
  }

  .user-slot {
    margin-left: 0;
    margin-top: 6px;
    padding-top: 10px;
    border-top: 1px dashed var(--line);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
  }

  .settings-popover {
    width: min(310px, calc(100vw - 28px));
  }

  .search-wrap {
    order: 3;
    flex: 1 1 100%;
    max-width: 100%;
  }

  .masthead-edition {
    display: none;
  }

  .filters,
  .tags-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .filters::-webkit-scrollbar,
  .tags-bar::-webkit-scrollbar {
    display: none;
  }

  .chip,
  .tag-chip,
  .tool-btn,
  .seg button {
    padding: 7px 12px;
    font-size: 13px;
  }

  .articles-columns,
  :root[data-width="full"] .articles-columns,
  .newspaper-board[data-sidebar-pos="above"] .articles-columns {
    column-count: 1;
    column-width: auto;
    column-rule: 0;
  }

  .sidebar-box,
  .almanac-box {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .sidebar-date,
  .sidebar-weather,
  .almanac-date,
  .almanac-weather {
    border-bottom: 1px solid var(--line);
    padding-bottom: 10px;
  }

  .sidebar-markets,
  .almanac-markets {
    border-top: 0;
    padding-top: 2px;
  }

  .releases-list {
    grid-template-columns: 1fr;
  }

  .load-more-btn {
    width: 100%;
    justify-content: center;
    padding: 10px 14px;
  }

  .pagination-bar {
    justify-content: space-between;
  }

  .page-numbers {
    display: none;
  }

  .page-mobile-indicator {
    display: inline-block;
  }

  .page-step-btn {
    padding: 8px 14px;
    font-size: 13px;
  }

  .sources-table,
  .sources-table tbody,
  .sources-table tr,
  .sources-table td {
    display: block;
    width: 100%;
  }

  .sources-table thead {
    display: none;
  }

  .sources-table tr {
    padding: 10px 12px;
    border-bottom: 2px solid var(--line);
  }

  .sources-table td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 4px 0;
    border-bottom: 0;
    text-align: right;
  }

  .sources-table td::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--muted);
    text-align: left;
    flex-shrink: 0;
  }
}

/* ==========================================================================
   Save to List Popover & Multi-List Selection
   ========================================================================== */
.save-lists-popover {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  z-index: 100;
  min-width: 220px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  padding: 10px 12px;
  font-family: var(--font-sans);
  color: var(--fg);
}

.save-lists-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px;
}

.save-lists-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 160px;
  overflow-y: auto;
  margin-bottom: 8px;
}

.save-list-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  cursor: pointer;
  padding: 3px 4px;
  border-radius: 3px;
}

.save-list-option:hover {
  background: var(--soft-card);
}

.save-list-new-form {
  display: flex;
  gap: 6px;
  border-top: 1px dashed var(--line);
  padding-top: 8px;
}

.save-list-new-form input {
  flex: 1;
  font-size: 12px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--bg);
  color: var(--fg);
}

.save-list-new-form button {
  padding: 4px 8px;
  font-size: 11.5px;
}

/* ==========================================================================
   Category Story Clusters (Google News Style for Specific Categories)
   ========================================================================== */
.category-clusters-board {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
}

.channel-cluster-card {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.channel-cluster-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.cluster-main-story {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.cluster-main-figure {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  overflow: hidden;
  margin: 0 0 12px;
  background: var(--bg);
}

.cluster-main-figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cluster-source-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.cluster-source-icon {
  width: 14px;
  height: 14px;
  border-radius: 2px;
}

.cluster-main-headline {
  font-family: var(--font-serif);
  font-size: 20px;
  line-height: 1.25;
  font-weight: 700;
  margin: 0 0 8px;
}

.cluster-main-headline a {
  color: var(--fg);
  text-decoration: none;
}

.cluster-main-headline a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.cluster-main-lead {
  font-family: var(--font-serif);
  font-size: 14px;
  line-height: 1.55;
  color: var(--lead);
  margin: 0 0 12px;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.cluster-side-stories {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 12px;
  border-left: 1px solid var(--line);
  padding-left: 20px;
}

.cluster-side-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--line);
}

.cluster-side-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.cluster-side-source {
  font-size: 10.5px;
  color: var(--muted);
  font-weight: 600;
}

.cluster-side-title {
  font-family: var(--font-serif);
  font-size: 14.5px;
  line-height: 1.35;
  font-weight: 600;
  margin: 0;
}

.cluster-side-title a {
  color: var(--fg);
  text-decoration: none;
}

.cluster-side-title a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.cluster-side-meta {
  font-size: 11px;
  color: var(--muted);
}

@media (max-width: 820px) {
  .channel-cluster-card {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 16px;
  }
  .cluster-side-stories {
    border-left: none;
    border-top: 1px solid var(--line);
    padding-left: 0;
    padding-top: 14px;
  }
}

/* ==========================================================================
   Video / YouTube Material Identification & Reader Enhancements
   ========================================================================== */

.badge.video-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(185, 28, 28, 0.1);
  color: #c5221f;
  border: 1px solid rgba(197, 34, 31, 0.35);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 1px 7px;
  border-radius: 4px;
  text-transform: uppercase;
}

:root[data-theme="dark"] .badge.video-badge,
:root[data-theme="auto"].auto-dark .badge.video-badge {
  background: rgba(248, 113, 113, 0.16);
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.45);
}

.article-figure {
  position: relative;
}

.video-play-indicator {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.75);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  padding-left: 2px;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease, background 0.15s ease;
  z-index: 2;
}

.article-figure:hover .video-play-indicator {
  transform: scale(1.12);
  background: #c5221f;
}

/* Collapsible Video Summary in Reader Mode */
.reader-video-body .video-desc-header h3 {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  margin: 0 0 10px 0;
  color: var(--fg);
}

.video-summary-wrapper {
  position: relative;
  background: var(--soft-card);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 16px 20px;
  margin-top: 14px;
}

.video-summary-content {
  max-height: 180px;
  overflow: hidden;
  position: relative;
  line-height: 1.6;
  font-size: 15px;
  transition: max-height 0.25s ease;
}

.video-summary-wrapper:not(.is-expanded) .video-summary-content::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: linear-gradient(transparent, var(--soft-card));
  pointer-events: none;
}

.video-summary-wrapper.is-expanded .video-summary-content {
  max-height: none;
}

.toggle-video-summary-btn {
  margin-top: 12px;
  display: inline-flex;
}

/* ==========================================================================
   Settings & Admin Overhaul: Tabs, Typography & Forms
   ========================================================================== */

.settings-page-container {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding-top: 12px;
}

.settings-page-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.settings-page-header h1 {
  font-family: var(--font-serif);
  font-size: clamp(1.8rem, 3.2vw, 2.35rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 6px 0;
  color: var(--fg);
}

.settings-page-subtitle {
  font-size: 15px;
  color: var(--muted);
  margin: 0;
  line-height: 1.45;
}

/* Tab Bar Navigation */
.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 2px solid var(--line);
  padding-bottom: 0;
  margin-bottom: 26px;
  overflow: visible;
}

.settings-tabs::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  padding: 10px 18px;
  border-radius: 8px 8px 0 0;
  border: 1px solid transparent;
  border-bottom: none;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  bottom: -2px;
}

.tab-btn:hover {
  color: var(--fg);
  background: rgba(0, 0, 0, 0.04);
}

:root[data-theme="dark"] .tab-btn:hover,
:root[data-theme="auto"].auto-dark .tab-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

.tab-btn.active {
  background: var(--soft-card);
  color: var(--fg);
  border-color: var(--line) var(--line) var(--soft-card);
  border-bottom: 2px solid var(--soft-card);
  box-shadow: 0 -3px 0 0 var(--accent);
  font-weight: 700;
}

/* Tab Panes & Typography */
.settings-tab-pane {
  animation: fadeInPane 0.18s ease;
}

@keyframes fadeInPane {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

.settings-tab-pane h2 {
  font-family: var(--font-serif);
  font-size: 1.55rem;
  font-weight: 700;
  margin: 0 0 8px 0;
  color: var(--fg);
  letter-spacing: -0.01em;
}

.settings-tab-pane h3 {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 600;
  margin: 1.25rem 0 0.6rem 0;
  color: var(--fg);
}

.settings-tab-pane h4 {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--muted);
  margin: 1.25rem 0 0.5rem 0;
}

.section-desc {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 16px 0;
  line-height: 1.5;
}

/* Modern Form & Fieldsets */
.settings-form fieldset {
  border: 1px solid var(--line);
  background: var(--soft-card);
  padding: 1.5rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
}

.settings-form legend {
  padding: 0 8px;
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--fg);
}

.settings-form .form-group {
  margin-bottom: 1.15rem;
}

.settings-form label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 5px;
}

.settings-form .form-hint {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.4;
}

.form-input,
.form-select,
.settings-form input[type="text"],
.settings-form input[type="number"],
.settings-form input[type="password"],
.settings-form input[type="url"],
.settings-form select {
  width: 100%;
  max-width: 520px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus,
.form-select:focus,
.settings-form input[type="text"]:focus,
.settings-form input[type="number"]:focus,
.settings-form input[type="password"]:focus,
.settings-form input[type="url"]:focus,
.settings-form select:focus {
  border-color: var(--rule-strong);
  outline: none;
  box-shadow: 0 0 0 2px rgba(139, 30, 30, 0.18);
}

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

.form-row input,
.form-row select {
  flex: 1 1 180px;
  max-width: none;
}

/* Admin Cards & Widgets */
.admin-card {
  background: var(--soft-card);
  padding: 1.75rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  margin-bottom: 1.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.admin-subcard {
  background: var(--card);
  padding: 1.25rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  margin-top: 1.25rem;
}

.interval-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
  gap: 8px;
  margin-bottom: 1.25rem;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s ease;
}

.radio-label:hover {
  border-color: var(--rule-strong);
}

.radio-label:has(input:checked) {
  border-color: var(--accent);
  background: rgba(185, 28, 28, 0.06);
  font-weight: 700;
  color: var(--accent);
}

.custom-interval-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.custom-interval-input {
  width: 105px !important;
  flex: none !important;
}

.sync-action-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.sync-spinner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--muted);
  font-style: italic;
  margin-left: 8px;
  vertical-align: middle;
}

.sync-spinner::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.sync-result-box {
  margin-top: 1rem;
  padding: 0.85rem 1.15rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 13.5px;
  line-height: 1.5;
}

.sync-result-box.success {
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.08);
  color: var(--fg);
}

.sync-result-box.error {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.08);
  color: #dc2626;
}

.admin-users-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

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

.admin-users-table th {
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.04em;
}

.self-tag {
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
}

.form-feedback {
  margin-top: 10px;
  font-size: 13.5px;
  font-weight: 600;
  min-height: 20px;
}

.form-feedback.success {
  color: var(--ok);
}

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

.user-ticker-row,
.admin-ticker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.ticker-symbol {
  font-size: 1.05rem;
  font-weight: 700;
  margin-right: 0.5rem;
}

.ticker-type {
  font-size: 11px;
  margin-left: 0.5rem;
}

.ticker-sub {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.ticker-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 40;
  margin-top: 4px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  max-height: 260px;
  overflow-y: auto;
}

.ticker-suggestion-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  font-size: 0.88rem;
}

.ticker-suggestion-item:last-child {
  border-bottom: 0;
}

.ticker-suggestion-item:hover,
.ticker-suggestion-item:focus-visible {
  background: var(--soft-card);
  outline: none;
}

.ticker-suggestion-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.ticker-suggestion-name {
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ticker-suggestion-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--muted);
}

/* Responsive Grids for Settings & Admin Panels (v2-4 Redesign) */
.settings-grid-2col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 1.25rem;
  align-items: start;
  margin-bottom: 1.25rem;
}

.settings-grid-2col > .admin-card {
  margin-bottom: 0;
}

.pref-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.9rem 1.15rem;
  margin-bottom: 1.15rem;
}

.pref-grid .form-group {
  margin-bottom: 0;
}

.pref-grid .form-input,
.pref-grid .form-select,
.pref-grid input[type="text"],
.pref-grid input[type="number"],
.pref-grid select {
  max-width: 100%;
}

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

.compact-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  padding: 0.55rem 0.8rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.compact-row-meta {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.compact-row-meta small {
  color: var(--muted);
  display: block;
}

.compact-row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.form-actions-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.tab-section-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 1rem;
}

.tab-section-heading h2 {
  margin: 0;
}

.tab-section-kicker {
  font-size: 0.85rem;
  color: var(--muted);
}

/* Mobile Polish */
@media (max-width: 720px) {
  .settings-grid-2col,
  .pref-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .header-sync-btn {
    min-height: 34px;
    padding: 5px 9px;
  }
  .settings-tabs {
    gap: 4px;
    margin-bottom: 18px;
    flex-wrap: wrap;
    overflow-x: visible;
  }
  .user-category-row,
  .user-subscription-row,
  .user-ticker-row,
  .admin-ticker-row,
  .rss-link-row {
    flex-wrap: wrap;
    gap: 8px;
    max-width: 100%;
  }
  .user-subscription-row > div,
  .rss-link-info {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
  }
  .cat-actions,
  .sub-actions,
  .rss-link-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  .tab-btn {
    padding: 8px 12px;
    font-size: 13px;
    min-height: 38px;
  }
  .admin-card {
    padding: 1.25rem;
  }
}

/* ==========================================================================
   Saved Articles Page (/saved) — 3-Column Editorial Layout
   ========================================================================== */
.saved-page-container {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 20px 0 40px;
}

.saved-page-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--rule-strong);
}

.saved-page-header h1 {
  font-family: var(--font-serif);
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 800;
  margin: 0 0 4px;
  letter-spacing: -0.02em;
}

.saved-page-subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.saved-lists-panel {
  background: var(--soft-card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 24px;
}

.saved-lists-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.saved-lists-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.saved-lists-chips a.chip {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.saved-lists-chips a.chip.is-active {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
  font-weight: 600;
}

.saved-list-chip-wrap {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
  color: var(--fg);
  overflow: hidden;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.saved-list-chip-wrap:hover {
  border-color: var(--rule-strong);
}

.saved-list-chip-wrap.is-active {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}

.saved-list-chip-wrap a.chip {
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  padding: 7px 12px;
}

.saved-list-chip-wrap.is-active a.chip.is-active {
  background: transparent;
  color: inherit;
  border-color: transparent;
  font-weight: 600;
}

.saved-list-chip-wrap .delete-list-btn {
  border: 0;
  border-left: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 0;
  padding: 0 9px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}

.saved-list-chip-wrap.is-active .delete-list-btn {
  border-left-color: rgba(128, 128, 128, 0.35);
  color: inherit;
  opacity: 0.72;
}

.saved-list-chip-wrap .delete-list-btn:hover {
  color: var(--accent);
  background: rgba(185, 28, 28, 0.08);
  opacity: 1;
}

.new-list-form {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.new-list-input {
  background: var(--card);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 11px;
  font: inherit;
  font-size: 13px;
  width: 170px;
  transition: border-color 0.15s;
}

.new-list-input:focus {
  outline: none;
  border-color: var(--accent);
}

.new-list-submit {
  padding: 7px 12px;
  border-radius: 6px;
  font-weight: 700;
}

.saved-entries-grid.articles-columns {
  column-count: 3;
  column-gap: 22px;
  column-rule: 0;
}

.saved-card .remove-saved-btn {
  color: var(--accent);
}

@media (max-width: 1024px) {
  .saved-entries-grid.articles-columns {
    column-count: 2;
  }
}

@media (max-width: 700px) {
  .saved-entries-grid.articles-columns {
    column-count: 1;
  }
  .saved-lists-row {
    flex-direction: column;
    align-items: stretch;
  }
  .new-list-form {
    width: 100%;
  }
  .new-list-input {
    flex: 1;
    width: auto;
  }
}

/* ==========================================================================
   Sources Feed Reader (/sources)
   ========================================================================== */
.sources-reader-page {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 20px 0 40px;
}

.sources-page-header {
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--rule-strong);
}

.sources-page-header h1 {
  font-family: var(--font-serif);
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 800;
  margin: 0 0 4px;
  letter-spacing: -0.02em;
}

.sources-page-subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

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

.sources-sidebar {
  background: var(--soft-card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100vh - 32px);
  min-width: 0;
  width: 100%;
}

.sources-sidebar-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sources-filter-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
  color: var(--fg);
  font: inherit;
  font-size: 13px;
}

.sources-filter-input:focus {
  outline: none;
  border-color: var(--accent);
}

.sources-type-seg {
  width: 100%;
  display: flex;
}

.sources-type-seg button {
  flex: 1;
  padding: 5px 8px;
  font-size: 12px;
}

.sources-channel-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  padding-right: 2px;
}

.source-channel-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 10px;
  border-radius: 6px;
  border: 1px solid transparent;
  text-decoration: none;
  color: var(--fg);
  transition: background 0.12s ease, border-color 0.12s ease;
}

.source-channel-item:hover {
  background: var(--card);
  border-color: var(--line);
}

.source-channel-item.is-active {
  background: var(--card);
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

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

.source-channel-name {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.status-dot {
  font-size: 9px;
  flex-shrink: 0;
}
.status-dot.is-ok { color: #22c55e; }
.status-dot.is-warn { color: #f59e0b; }
.status-dot.is-err { color: #ef4444; }
.status-dot.is-muted { color: var(--muted); }

.source-channel-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: var(--soft-card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 7px;
  flex-shrink: 0;
}

.source-channel-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
}

.source-type-pill {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.source-type-pill.is-yt {
  color: var(--accent);
  border-color: rgba(185, 28, 28, 0.35);
}

.sources-feed-main {
  min-width: 0;
}

.sources-channel-header {
  background: var(--soft-card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 20px;
}

.sources-channel-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.sources-channel-header h2 {
  font-family: var(--font-serif);
  font-size: clamp(20px, 2.2vw, 26px);
  font-weight: 800;
  margin: 4px 0;
}

.sources-channel-submeta {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
}

.sources-channel-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sources-channel-links .tool-btn {
  text-decoration: none;
  padding: 6px 12px;
}

.sources-inner-search {
  margin-top: 14px;
  margin-bottom: 0;
}

.sources-entries-grid.articles-columns {
  column-count: 2;
  column-gap: 22px;
  column-rule: 0;
}

@media (max-width: 960px) {
  .sources-reader-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .sources-sidebar {
    position: static;
    max-height: 340px;
  }
  .sources-type-seg {
    flex-wrap: wrap;
  }
  .source-channel-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .sources-entries-grid.articles-columns {
    column-count: 1;
  }
}

@media (max-width: 480px) {
  .main-nav:not(.open) .header-sync-text {
    display: none;
  }
  .main-nav.open .header-sync-text {
    display: inline;
  }
  .header-sync-btn {
    padding: 5px 8px;
  }
}

/* Login Page (Desktop & Mobile) */
.login-container {
  min-height: calc(100vh - 280px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 36px 0;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: 8px;
  padding: 32px 28px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.08);
}

.login-heading {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 900;
  margin: 0 0 22px;
  color: var(--fg);
  letter-spacing: -0.01em;
}

.login-form .form-group {
  margin-bottom: 16px;
}

.login-form label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 6px;
}

.login-form input[type="text"],
.login-form input[type="password"] {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 15px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-form input[type="text"]:focus,
.login-form input[type="password"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(176, 38, 30, 0.14);
}

.login-form .form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
}

.tool-btn.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  font-weight: 700;
  padding: 10px 20px;
  font-size: 14px;
  border-radius: 6px;
  cursor: pointer;
}

.tool-btn.btn-primary:hover {
  filter: brightness(1.08);
}

.btn-link {
  color: var(--muted);
  font-size: 13.5px;
  text-decoration: none;
}

.btn-link:hover {
  color: var(--fg);
  text-decoration: underline;
}

.alert-error {
  background: rgba(176, 38, 30, 0.12);
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13.5px;
  margin-bottom: 16px;
}

@media (max-width: 520px) {
  .login-container {
    min-height: auto;
    padding: 20px 0;
  }
  .login-card {
    padding: 24px 18px;
  }
  .login-form .form-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .tool-btn.btn-primary {
    width: 100%;
    text-align: center;
  }
  .btn-link {
    text-align: center;
    padding: 6px 0;
  }
}
