:root {
  color-scheme: light;
  --bg: #f4f7f3;
  --bg-strong: #e8f0ec;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-solid: #ffffff;
  --surface-soft: rgba(255, 255, 255, 0.58);
  --ink: #111617;
  --muted: #687475;
  --line: rgba(24, 35, 36, 0.12);
  --line-strong: rgba(24, 35, 36, 0.2);
  --accent: #116b5a;
  --accent-2: #2f6fc9;
  --accent-3: #c97044;
  --warn: #bb7a16;
  --danger: #b74342;
  --shadow: 0 24px 70px rgba(37, 52, 47, 0.15);
  --shadow-soft: 0 16px 40px rgba(37, 52, 47, 0.1);
  --radius: 8px;
  --radius-lg: 20px;
  --max: 1280px;
  --serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c1111;
  --bg-strong: #121a1b;
  --surface: rgba(22, 29, 30, 0.84);
  --surface-solid: #151d1e;
  --surface-soft: rgba(23, 33, 34, 0.76);
  --ink: #edf5f1;
  --muted: #a6b3b0;
  --line: rgba(228, 239, 235, 0.14);
  --line-strong: rgba(228, 239, 235, 0.24);
  --accent: #72c8a9;
  --accent-2: #8db7ff;
  --accent-3: #e5a27b;
  --warn: #e8bd70;
  --danger: #ff9794;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
  --shadow-soft: 0 16px 40px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 14% 10%, rgba(68, 132, 103, 0.18), transparent 28rem),
    linear-gradient(145deg, var(--bg), var(--bg-strong) 54%, var(--bg));
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.5;
}

body::before {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(18, 28, 26, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(18, 28, 26, 0.035) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.45), transparent 70%);
}

:root[data-theme="dark"] body::before {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

code {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.46);
  padding: 0.1rem 0.32rem;
  color: var(--ink);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.88em;
}

:root[data-theme="dark"] code {
  background: rgba(255, 255, 255, 0.08);
}

.skip-link {
  position: absolute;
  z-index: 10;
  top: 12px;
  left: 12px;
  transform: translateY(-160%);
  border-radius: 6px;
  background: var(--ink);
  color: var(--bg);
  padding: 0.7rem 0.9rem;
  transition: transform 0.2s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.page-backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: url("https://images.unsplash.com/photo-1516321318423-f06f85e504b3?auto=format&fit=crop&w=1800&q=82");
  background-position: center top;
  background-size: cover;
  opacity: 0.12;
  filter: saturate(0.9);
}

:root[data-theme="dark"] .page-backdrop {
  opacity: 0.08;
  filter: saturate(0.8) brightness(0.7);
}

.topbar,
.app-shell {
  width: min(calc(100% - 32px), var(--max));
  margin-inline: auto;
}

.topbar {
  position: sticky;
  top: 16px;
  z-index: 5;
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 0.75rem 1rem;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(20px) saturate(1.25);
}

.brand {
  display: inline-flex;
  min-height: 44px;
  min-width: max-content;
  align-items: center;
  gap: 0.75rem;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(17, 107, 90, 0.26);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(17, 107, 90, 0.16), rgba(47, 111, 201, 0.12));
  color: var(--accent);
}

.brand-mark svg {
  width: 24px;
  height: 24px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-family: var(--serif);
  font-size: clamp(1.25rem, 2vw, 1.65rem);
  line-height: 1;
}

.brand small {
  margin-top: 0.14rem;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.55rem, 2vw, 1.65rem);
  color: var(--muted);
  font-size: 0.95rem;
}

.nav-links a {
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-bottom: 2px solid transparent;
  padding-inline: 0.35rem;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  border-bottom-color: var(--ink);
  color: var(--ink);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.icon-button,
.theme-toggle,
.primary-action,
.secondary-action,
.utility-button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--ink);
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background-color 0.18s ease;
}

.icon-button:hover,
.theme-toggle:hover,
.primary-action:hover,
.secondary-action:hover,
.utility-button:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
}

.icon-button {
  display: grid;
  width: 44px;
  place-items: center;
  padding: 0;
}

.icon-button.small {
  min-height: 36px;
  width: 36px;
}

.theme-toggle,
.primary-action,
.secondary-action,
.utility-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.72rem 1rem;
}

.primary-action {
  border-color: rgba(17, 107, 90, 0.28);
  background: #101617;
  color: #ffffff;
  font-weight: 720;
}

:root[data-theme="dark"] .primary-action {
  background: #eff8f4;
  color: #0e1515;
}

.primary-action.full {
  width: 100%;
}

.secondary-action,
.utility-button,
.theme-toggle {
  background: rgba(255, 255, 255, 0.56);
}

:root[data-theme="dark"] .secondary-action,
:root[data-theme="dark"] .utility-button,
:root[data-theme="dark"] .theme-toggle {
  background: rgba(255, 255, 255, 0.08);
}

.app-shell {
  padding: 18px 0 64px;
}

.hero-panel {
  display: grid;
  min-height: 520px;
  grid-template-columns: minmax(0, 0.9fr) minmax(360px, 1.1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px) saturate(1.15);
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(2rem, 5vw, 4rem);
}

.eyebrow,
.section-kicker {
  margin: 0 0 0.8rem;
  color: var(--accent-3);
  font-size: 0.76rem;
  font-weight: 780;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 11.5ch;
  margin-bottom: 1.1rem;
  font-family: var(--serif);
  font-size: clamp(3rem, 7vw, 5.75rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-family: var(--serif);
  font-size: clamp(1.55rem, 2.5vw, 2.35rem);
  line-height: 1.05;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 0.5rem;
  font-family: var(--serif);
  font-size: 1.25rem;
  line-height: 1.18;
}

.hero-text {
  max-width: 58ch;
  margin-bottom: 1.6rem;
  color: var(--muted);
  font-size: 1.02rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.hero-visual {
  position: relative;
  min-height: 520px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.4), transparent 38%),
    url("https://images.unsplash.com/photo-1497366811353-6870744d04b2?auto=format&fit=crop&w=1500&q=84");
  background-position: center;
  background-size: cover;
}

:root[data-theme="dark"] .hero-visual {
  background:
    linear-gradient(90deg, rgba(12, 17, 17, 0.64), transparent 42%),
    url("https://images.unsplash.com/photo-1497366811353-6870744d04b2?auto=format&fit=crop&w=1500&q=80");
  background-position: center;
  background-size: cover;
}

.featured-card {
  position: absolute;
  right: clamp(1rem, 4vw, 2rem);
  bottom: clamp(1rem, 4vw, 2rem);
  width: min(360px, calc(100% - 2rem));
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.74);
  padding: 1.35rem;
  box-shadow: 0 20px 50px rgba(21, 30, 28, 0.18);
  backdrop-filter: blur(22px) saturate(1.22);
}

:root[data-theme="dark"] .featured-card {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(13, 20, 20, 0.78);
}

.featured-card span {
  color: var(--accent-3);
  font-size: 0.72rem;
  font-weight: 820;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.featured-card strong {
  display: block;
  margin: 0.55rem 0 0.4rem;
  font-family: var(--serif);
  font-size: 1.8rem;
  line-height: 1.05;
}

.featured-card p {
  margin-bottom: 0.85rem;
  color: var(--muted);
}

.featured-card a {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  border-bottom: 2px solid var(--accent-3);
  font-weight: 700;
}

.metric-strip,
.topic-panel,
.filter-rail,
.feed-column,
.rules-panel,
.agent-panel,
.source-section {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px) saturate(1.12);
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin-top: 18px;
}

.metric-strip article {
  min-width: 0;
  background: rgba(255, 255, 255, 0.34);
  padding: 1rem;
}

:root[data-theme="dark"] .metric-strip article {
  background: rgba(255, 255, 255, 0.04);
}

.metric-strip span {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
}

.metric-strip strong {
  display: block;
  margin-top: 0.4rem;
  overflow: hidden;
  font-size: clamp(1.25rem, 2.4vw, 2rem);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topic-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-top: 18px;
  padding: 1.4rem 1.6rem;
}

.topic-pills,
.category-list,
.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.topic-pill,
.category-pill,
.segment-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.52);
  color: var(--ink);
  padding: 0.46rem 0.8rem;
  font-size: 0.88rem;
}

.topic-pill {
  min-height: 44px;
  padding-inline: 1rem;
}

:root[data-theme="dark"] .topic-pill,
:root[data-theme="dark"] .category-pill,
:root[data-theme="dark"] .segment-button {
  background: rgba(255, 255, 255, 0.08);
}

.topic-pill[aria-pressed="true"],
.category-pill[aria-pressed="true"],
.segment-button[aria-pressed="true"] {
  border-color: transparent;
  background: var(--ink);
  color: var(--bg);
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(245px, 280px) minmax(0, 1fr) minmax(280px, 340px);
  align-items: start;
  gap: 18px;
  margin-top: 18px;
}

.filter-rail,
.feed-column,
.rules-panel,
.agent-panel,
.source-section {
  padding: 1.25rem;
}

.filter-rail,
.side-stack {
  position: sticky;
  top: 108px;
}

.panel-heading,
.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.15rem;
}

.section-heading {
  align-items: center;
}

.field-label,
.rules-form span {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 720;
}

.search-box {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.6);
  padding: 0 0.8rem;
}

:root[data-theme="dark"] .search-box {
  background: rgba(255, 255, 255, 0.08);
}

.search-box input {
  width: 100%;
  min-height: 44px;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.search-box input::placeholder,
.rules-form input::placeholder {
  color: color-mix(in srgb, var(--muted) 74%, transparent);
}

.control-group {
  margin-top: 1.15rem;
}

.segmented {
  gap: 0.45rem;
}

.segment-button {
  flex: 1 1 calc(50% - 0.45rem);
  min-height: 44px;
  border-radius: var(--radius);
}

.category-list {
  max-height: 260px;
  overflow: auto;
  padding-right: 0.2rem;
}

.category-pill {
  flex: 1 1 100%;
  display: flex;
  justify-content: space-between;
  border-radius: var(--radius);
}

.check-row {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 0.7rem;
  margin-top: 1rem;
  color: var(--ink);
}

.check-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.check-row.compact {
  margin-top: 0;
}

.export-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin-top: 1rem;
}

.utility-button {
  width: 100%;
  min-width: 0;
  padding-inline: 0.75rem;
}

.result-count {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  padding: 0.35rem 0.72rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.insight-list {
  display: grid;
  gap: 0.9rem;
}

.insight-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.62);
  padding: 1rem;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

:root[data-theme="dark"] .insight-card {
  background: rgba(255, 255, 255, 0.07);
}

.insight-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: 0 14px 34px rgba(25, 38, 35, 0.1);
}

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

.insight-meta,
.card-meta,
.source-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.status-badge,
.tag {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border-radius: 999px;
  padding: 0.2rem 0.52rem;
  font-size: 0.78rem;
  font-weight: 760;
}

.status-badge {
  border: 1px solid currentColor;
}

.status-fresh {
  color: var(--accent);
}

.status-recent {
  color: var(--accent-2);
}

.status-stale,
.status-unknown,
.status-feed-no-date {
  color: var(--warn);
}

.status-offline {
  color: var(--danger);
}

.tag {
  background: rgba(17, 107, 90, 0.1);
  color: var(--accent);
}

.insight-card h3 {
  margin-top: 0.55rem;
}

.insight-card h3 a:hover,
.source-card h3 a:hover {
  color: var(--accent);
}

.insight-card p,
.source-card p,
.agent-panel p {
  color: var(--muted);
}

.insight-card p {
  display: -webkit-box;
  margin-bottom: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.insight-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.open-link {
  display: inline-flex;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.54);
  color: var(--ink);
}

:root[data-theme="dark"] .open-link {
  background: rgba(255, 255, 255, 0.08);
}

.side-stack {
  display: grid;
  gap: 18px;
}

.rules-form {
  display: grid;
  gap: 0.85rem;
}

.rules-form label {
  display: grid;
  gap: 0.35rem;
}

.rules-form input,
.rules-form select,
.sort-select {
  min-height: 44px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink);
  padding: 0 0.75rem;
}

:root[data-theme="dark"] .rules-form input,
:root[data-theme="dark"] .rules-form select,
:root[data-theme="dark"] .sort-select {
  background: rgba(255, 255, 255, 0.08);
}

.saved-rule {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.42);
  padding: 0.85rem;
  color: var(--muted);
  font-size: 0.9rem;
}

:root[data-theme="dark"] .saved-rule {
  background: rgba(255, 255, 255, 0.06);
}

.command-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.46);
  padding: 0.55rem;
}

:root[data-theme="dark"] .command-box {
  background: rgba(255, 255, 255, 0.06);
}

.command-box code {
  display: block;
  overflow: hidden;
  border: 0;
  background: transparent;
  padding: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-list {
  margin: 1rem 0 0;
  padding-left: 1.1rem;
  color: var(--muted);
}

.agent-list li + li {
  margin-top: 0.45rem;
}

.source-section {
  margin-top: 18px;
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.source-card {
  display: flex;
  min-height: 310px;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.64);
}

:root[data-theme="dark"] .source-card {
  background: rgba(255, 255, 255, 0.07);
}

.source-cover {
  min-height: 112px;
  background:
    linear-gradient(135deg, rgba(17, 107, 90, 0.24), rgba(47, 111, 201, 0.2)),
    var(--cover-image, url("https://images.unsplash.com/photo-1453928582365-b6ad33cbcf64?auto=format&fit=crop&w=900&q=80"));
  background-position: center;
  background-size: cover;
}

.source-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 1rem;
}

.source-body p {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.source-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: auto;
  padding-top: 0.8rem;
}

.feed-chip {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border-radius: 999px;
  background: rgba(47, 111, 201, 0.1);
  color: var(--accent-2);
  padding: 0.25rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 760;
}

.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.38);
  padding: 2rem;
  color: var(--muted);
  text-align: center;
}

:root[data-theme="dark"] .empty-state {
  background: rgba(255, 255, 255, 0.05);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 36px));
  transform: translateY(20px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--bg);
  opacity: 0;
  padding: 0.85rem 1rem;
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent-2) 72%, white);
  outline-offset: 3px;
}

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

  .side-stack {
    position: static;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .source-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .nav-links {
    order: 3;
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    padding-top: 0.2rem;
  }

  .hero-panel {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    padding: 2rem;
  }

  .hero-visual {
    min-height: 360px;
  }

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

  .metric-strip article:last-child {
    grid-column: 1 / -1;
  }

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

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

  .filter-rail {
    position: static;
  }

  .side-stack {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 620px) {
  .topbar,
  .app-shell {
    width: min(calc(100% - 20px), var(--max));
  }

  .topbar {
    top: 10px;
    min-height: 64px;
    border-radius: 16px;
    padding: 0.65rem;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .brand small,
  .theme-toggle span {
    display: none;
  }

  .nav-links {
    gap: 1rem;
  }

  .hero-panel {
    min-height: auto;
    border-radius: 18px;
  }

  .hero-copy {
    padding: 1.35rem;
  }

  h1 {
    max-width: 11ch;
    font-size: clamp(2.6rem, 15vw, 4rem);
  }

  .hero-text {
    font-size: 0.96rem;
  }

  .hero-actions,
  .export-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .primary-action,
  .secondary-action,
  .utility-button {
    width: 100%;
  }

  .hero-visual {
    min-height: 300px;
  }

  .featured-card {
    left: 1rem;
    width: auto;
  }

  .featured-card strong {
    font-size: 1.42rem;
  }

  .metric-strip {
    grid-template-columns: 1fr;
  }

  .metric-strip article:last-child {
    grid-column: auto;
  }

  .topic-panel,
  .filter-rail,
  .feed-column,
  .rules-panel,
  .agent-panel,
  .source-section {
    border-radius: 16px;
    padding: 1rem;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .insight-card {
    grid-template-columns: 1fr;
  }

  .insight-actions {
    justify-content: flex-start;
  }

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
