:root {
  color-scheme: dark;
  --bg: #070908;
  --bg-grid: rgba(148, 163, 184, 0.08);
  --surface: #0d100f;
  --surface-2: #121716;
  --surface-3: #181d1b;
  --text: #e7ece9;
  --muted: #8b9490;
  --line: #26302c;
  --line-strong: #3b4741;
  --green: #43f58d;
  --cyan: #38d5ff;
  --red: #fb7185;
  --amber: #f4b63f;
  --blue: #60a5fa;
  --teal: #2dd4bf;
  --purple: #c084fc;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(rgba(67, 245, 141, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(67, 245, 141, 0.035) 1px, transparent 1px),
    var(--bg);
  background-size: 48px 48px, 48px 48px, auto;
  color: var(--text);
}

button,
select,
input {
  font: inherit;
}

a {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 20px;
  background: rgba(7, 9, 8, 0.92);
  border-bottom: 1px solid var(--line-strong);
  box-shadow: 0 1px 0 rgba(67, 245, 141, 0.18);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border: 1px solid rgba(67, 245, 141, 0.65);
  border-radius: 4px;
  background: #0a120e;
  color: var(--green);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  box-shadow: inset 0 0 18px rgba(67, 245, 141, 0.12), 0 0 18px rgba(67, 245, 141, 0.12);
}

.brand-mark::after {
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
  content: "";
}

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

h1 {
  color: #f8fffb;
  font-size: 18px;
  line-height: 1.15;
  text-transform: uppercase;
}

.brand p,
.status-label,
.eyebrow {
  color: var(--muted);
}

.brand p {
  margin-top: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.select-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
}

select,
input {
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #090c0b;
  color: var(--text);
  outline: none;
}

select:focus,
input:focus {
  border-color: rgba(67, 245, 141, 0.8);
  box-shadow: 0 0 0 2px rgba(67, 245, 141, 0.16);
}

select {
  height: 38px;
  padding: 0 34px 0 12px;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid rgba(67, 245, 141, 0.7);
  border-radius: 4px;
  background: rgba(67, 245, 141, 0.08);
  color: var(--green);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.icon-button svg {
  width: 17px;
  height: 17px;
}

.icon-button.primary:hover {
  background: rgba(67, 245, 141, 0.16);
}

.icon-button:disabled {
  cursor: progress;
  opacity: 0.72;
}

.dashboard {
  display: grid;
  gap: 14px;
  max-width: 1560px;
  margin: 0 auto;
  padding: 16px 20px 30px;
}

.status-strip,
.control-band,
.panel {
  background: rgba(13, 16, 15, 0.96);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: var(--shadow);
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
}

.status-item {
  position: relative;
  padding: 14px 16px;
  border-right: 1px solid var(--line);
}

.status-item:last-child {
  border-right: 0;
}

.status-label {
  display: block;
  margin-bottom: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.status-item strong {
  display: block;
  overflow-wrap: anywhere;
  color: #f8fffb;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 22px;
  line-height: 1.15;
}

.control-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px;
}

.segmented {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.segment {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  cursor: pointer;
}

.segment svg {
  width: 15px;
  height: 15px;
}

.segment.active {
  border-color: rgba(67, 245, 141, 0.6);
  background: rgba(67, 245, 141, 0.09);
  color: var(--green);
  font-weight: 800;
}

.segment:hover {
  border-color: var(--line-strong);
  color: var(--text);
}

.search-box {
  position: relative;
  flex: 0 1 340px;
}

.search-box svg {
  position: absolute;
  top: 50%;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--muted);
  transform: translateY(-50%);
}

.search-box input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 36px;
}

.main-grid,
.content-grid,
.lower-grid {
  display: grid;
  gap: 14px;
}

.main-grid {
  grid-template-columns: minmax(0, 1.42fr) minmax(320px, 0.58fr);
}

.content-grid {
  grid-template-columns: minmax(0, 1.18fr) minmax(360px, 0.82fr);
}

.lower-grid {
  grid-template-columns: minmax(0, 0.8fr) minmax(360px, 0.8fr);
}

.panel {
  min-width: 0;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.018);
}

.panel-head.compact {
  align-items: center;
  padding-block: 12px;
}

.panel-head h2 {
  color: #f8fffb;
  font-size: 17px;
  line-height: 1.25;
}

.panel-head svg {
  width: 19px;
  height: 19px;
  color: var(--green);
  flex: 0 0 auto;
}

.eyebrow {
  margin-bottom: 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.panel-body {
  padding: 16px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(67, 245, 141, 0.55);
  border-radius: 999px;
  background: rgba(67, 245, 141, 0.10);
  color: var(--green);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.badge.muted {
  border-color: var(--line-strong);
  background: var(--surface-2);
  color: var(--muted);
}

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

.summary-list li {
  padding: 11px 12px 11px 14px;
  border-left: 3px solid var(--green);
  background: rgba(67, 245, 141, 0.045);
  color: #d9e4df;
  line-height: 1.55;
}

.category-bars {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.bar-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.bar-row strong,
.bar-row span {
  color: #d9e4df;
}

.bar-track {
  height: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #070908;
}

.bar-fill {
  height: 100%;
  min-width: 2px;
  border-radius: inherit;
  box-shadow: 0 0 12px currentColor;
}

.watchlist,
.brief-list,
.timeline,
.source-list {
  display: grid;
}

.watch-item,
.brief-item,
.timeline-item,
.source-item,
.article {
  border-bottom: 1px solid var(--line);
}

.watch-item:last-child,
.brief-item:last-child,
.timeline-item:last-child,
.source-item:last-child,
.article:last-child {
  border-bottom: 0;
}

.watch-item,
.brief-item,
.timeline-item,
.source-item {
  padding: 13px 16px;
}

.watch-item h3,
.brief-item h3 {
  margin: 0 0 6px;
  color: #f8fffb;
  font-size: 14px;
  line-height: 1.3;
}

.watch-item p,
.brief-item p,
.timeline-item p,
.source-item span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.signal-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.signal {
  max-width: 100%;
  padding: 3px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
  color: #aab5b0;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.article-list {
  display: grid;
}

.article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 14px 16px;
  transition: background-color 140ms ease, border-color 140ms ease;
}

.article:hover {
  background: rgba(67, 245, 141, 0.035);
}

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

.article h3 {
  margin: 0 0 7px;
  font-size: 15px;
  line-height: 1.38;
}

.article h3 a {
  color: #eef8f2;
  text-decoration: none;
}

.article h3 a:hover {
  color: var(--green);
}

.article p {
  display: -webkit-box;
  overflow: hidden;
  color: #aab5b0;
  font-size: 13px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.article-summary {
  color: #d3ded9;
}

.article-original {
  margin-top: 6px;
  color: #77817d;
  font-size: 12px;
  -webkit-line-clamp: 1;
}

.article-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 9px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
}

.category-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border: 1px solid var(--pill-color);
  border-radius: 999px;
  background: transparent;
  color: var(--pill-color);
  font-weight: 900;
}

.article-score {
  min-width: 56px;
  align-self: start;
  padding: 5px 7px;
  border: 1px solid rgba(67, 245, 141, 0.45);
  border-radius: 4px;
  background: rgba(67, 245, 141, 0.06);
  color: var(--green);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  text-align: center;
}

.side-stack {
  display: grid;
  gap: 14px;
  align-content: start;
}

.timeline-item {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
}

.timeline-item h3 {
  color: #e7ece9;
  font-size: 13px;
  line-height: 1.4;
}

.timeline-date {
  color: var(--green);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 800;
}

.keyword-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 15px 16px;
}

.keyword {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
  color: #d9e4df;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.source-item {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 10px var(--red);
}

.dot.ok {
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
}

.source-name {
  overflow: hidden;
  color: #e7ece9;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-count {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.empty-state {
  padding: 16px;
  color: var(--muted);
  line-height: 1.5;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border: 1px solid rgba(67, 245, 141, 0.45);
  border-radius: 4px;
  background: #0d100f;
  box-shadow: var(--shadow);
  color: var(--text);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1100px) {
  .main-grid,
  .content-grid,
  .lower-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .topbar {
    position: static;
    align-items: stretch;
    flex-direction: column;
    padding: 14px;
  }

  .toolbar,
  .control-band {
    align-items: stretch;
    flex-direction: column;
  }

  .select-wrap,
  .icon-button,
  .search-box {
    width: 100%;
  }

  .icon-button {
    min-height: 42px;
  }

  .dashboard {
    padding: 14px;
  }

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

  .status-item:nth-child(2) {
    border-right: 0;
  }

  .status-item:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

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

  .article-score {
    justify-self: start;
  }

  .timeline-item {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .brand-mark {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  h1 {
    font-size: 16px;
  }

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

  .status-item {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .bar-row {
    grid-template-columns: 62px minmax(0, 1fr) 34px;
  }
}
