:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --panel: #ffffff;
  --ink: #171b1f;
  --muted: #5d6670;
  --line: #d8ded7;
  --blue: #265c7f;
  --green: #2f684e;
  --red: #9b3c38;
  --amber: #8a6622;
  --soft-blue: #e9f1f6;
  --soft-green: #e8f2ec;
  --soft-red: #f7e9e7;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

.shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0;
}

.topbar,
.panel-heading,
.toolbar,
.status-strip,
.search-form {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.1;
}

h2 {
  margin-bottom: 0;
  font-size: 16px;
  line-height: 1.2;
}

h3 {
  margin-bottom: 6px;
  font-size: 15px;
  line-height: 1.3;
}

.toolbar {
  gap: 8px;
}

.icon-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  cursor: pointer;
}

.icon-button:hover {
  border-color: var(--blue);
}

.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.icon-button.compact {
  min-height: 34px;
  padding: 0 10px;
}

.status-strip {
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.status-pill {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--muted);
  padding: 6px 10px;
  font-size: 13px;
}

.status-pill.ok {
  background: var(--soft-green);
  color: var(--green);
  border-color: #b7d3c3;
}

.status-pill.warn {
  background: #fff6de;
  color: var(--amber);
  border-color: #ead89f;
}

.status-pill.error,
.alert {
  background: var(--soft-red);
  color: var(--red);
  border-color: #e5b8b3;
}

.alert {
  border: 1px solid;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 16px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(360px, 1fr) minmax(300px, 420px);
  gap: 16px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
}

.panel-heading {
  min-height: 58px;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.count {
  min-width: 28px;
  border-radius: 999px;
  background: var(--soft-blue);
  color: var(--blue);
  text-align: center;
  padding: 3px 8px;
  font-weight: 700;
  font-size: 12px;
}

.sources-list,
.feed-list,
.story-detail {
  padding: 12px;
}

.source-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  min-height: 58px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.source-row:last-child {
  border-bottom: 0;
}

.source-row p,
.story-card p,
.story-detail p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 0;
}

.switch {
  width: 42px;
  height: 24px;
  position: relative;
  display: inline-block;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #c7cec8;
  border-radius: 999px;
  transition: background 0.16s ease;
}

.slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.16s ease;
}

.switch input:checked + .slider {
  background: var(--green);
}

.switch input:checked + .slider::before {
  transform: translateX(18px);
}

.search-form {
  flex: 1;
  max-width: 520px;
  justify-content: flex-end;
  gap: 8px;
}

.search-form input {
  width: min(100%, 320px);
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
}

.feed-list {
  display: grid;
  gap: 10px;
}

.story-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
  padding: 12px;
  cursor: pointer;
}

.story-card:hover,
.story-card.active {
  border-color: var(--blue);
  background: var(--soft-blue);
}

.story-meta,
.article-meta {
  color: var(--muted);
  font-size: 12px;
}

.story-detail.empty {
  color: var(--muted);
}

.article-list {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
  display: grid;
  gap: 10px;
}

.article-list li {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.article-list a {
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
}

.article-list a:hover {
  text-decoration: underline;
}

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

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

  .detail-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 20px, 720px);
    padding: 16px 0;
  }

  .topbar,
  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .search-form {
    width: 100%;
    max-width: none;
  }

  .search-form input {
    width: 100%;
  }
}
