:root {
  color-scheme: light;
  --bg: #f5f6f3;
  --surface: #ffffff;
  --surface-2: #eef1ed;
  --text: #171a18;
  --muted: #626b65;
  --line: #d9ded8;
  --green: #167a4b;
  --green-soft: #e4f3eb;
  --amber: #9a5b00;
  --amber-soft: #fff0d3;
  --red: #b42318;
  --red-soft: #ffe3df;
  --ink: #22312a;
  --accent: #226f73;
  --shadow: 0 12px 30px rgba(28, 35, 30, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 8px 0 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1, h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 4rem, 4.4rem);
  line-height: 0.96;
}

h2 {
  font-size: 1.05rem;
  line-height: 1.2;
}

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

.mode-pill, .refresh-button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.mode-pill {
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  font-weight: 800;
}

.refresh-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  cursor: pointer;
}

.refresh-button:hover { border-color: var(--accent); }

.status-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.status-item, .panel, .notice {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.status-item {
  min-height: 78px;
  padding: 14px;
}

.label, .subtle {
  color: var(--muted);
  font-size: 0.82rem;
}

.status-item strong {
  display: block;
  margin-top: 8px;
  font-size: 1.12rem;
  overflow-wrap: anywhere;
}

.notice {
  margin-bottom: 14px;
  padding: 13px 16px;
  color: #26332d;
  background: #eef7f3;
}

.grid {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}

.grid.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.grid.wide-left { grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.75fr); }

.panel {
  padding: 16px;
  min-width: 0;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.gate-list, .provider-list, .source-list, .headline-list {
  display: grid;
  gap: 8px;
}

.gate, .provider, .source-row, .headline {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.gate, .provider, .source-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 50px;
  padding: 10px;
}

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

.ok .dot { background: var(--green); }
.warn .dot { background: var(--amber); }
.bad .dot { background: var(--red); }

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--green);
  background: var(--green-soft);
}

.warn .badge {
  color: var(--amber);
  background: var(--amber-soft);
}

.bad .badge {
  color: var(--red);
  background: var(--red-soft);
}

.primary-text {
  font-weight: 800;
  overflow-wrap: anywhere;
}

.secondary-text {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.snapshot-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.snapshot {
  min-height: 132px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfa;
}

.snapshot .symbol {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.snapshot .price {
  margin-top: 16px;
  font-size: 1.65rem;
  font-weight: 900;
  line-height: 1;
  overflow-wrap: anywhere;
}

.snapshot .time {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.78rem;
}

.headline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 12px;
}

.headline a {
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.headline a:hover { color: var(--accent); }

.tag-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.tag {
  border-radius: 999px;
  background: var(--surface-2);
  color: #39423d;
  padding: 4px 8px;
  font-size: 0.72rem;
  font-weight: 700;
}

.empty {
  min-height: 70px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

@media (max-width: 980px) {
  .status-strip, .grid.two, .grid.wide-left { grid-template-columns: 1fr; }
  .snapshot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .shell {
    width: min(100% - 20px, 1480px);
    padding-top: 18px;
  }

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

  .top-actions, .refresh-button, .mode-pill { width: 100%; }
  .refresh-button, .mode-pill { justify-content: center; }
  .status-strip, .snapshot-grid { grid-template-columns: 1fr; }
  .headline, .gate, .provider, .source-row { grid-template-columns: auto minmax(0, 1fr); }
  .headline .badge, .gate .badge, .provider .badge, .source-row .badge {
    grid-column: 2;
    justify-self: start;
  }
}
