:root {
  color-scheme: dark;
  --bg: #090806;
  --panel: rgba(18, 20, 24, 0.88);
  --panel-strong: rgba(13, 20, 31, 0.94);
  --ink: #fff7de;
  --muted: #b8ad91;
  --line: rgba(238, 191, 87, 0.22);
  --accent: #f0bd48;
  --accent-2: #1d6ea8;
  --blue: #6db8ff;
  --bad: #ff7268;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.44);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 50% -10%, rgba(240, 189, 72, 0.24), transparent 34%),
    linear-gradient(135deg, rgba(9, 39, 67, 0.60), transparent 38%),
    linear-gradient(225deg, rgba(111, 72, 24, 0.42), transparent 36%),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 460px);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 16px;
}

.hero-copy,
.hero-console,
.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.hero-copy {
  min-height: 220px;
  display: grid;
  grid-template-columns: minmax(150px, 280px) minmax(0, 1fr);
  align-items: end;
  gap: 22px;
  padding: 24px;
  overflow: hidden;
  position: relative;
  background:
    linear-gradient(90deg, rgba(8, 13, 20, 0.72), rgba(14, 26, 39, 0.86)),
    var(--panel);
}

.hero-copy::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(115deg, transparent 30%, rgba(240, 189, 72, 0.16) 49%, transparent 52%),
    repeating-linear-gradient(90deg, rgba(240, 189, 72, 0.07) 0 1px, transparent 1px 42px);
  opacity: 0.75;
  pointer-events: none;
}

.hero-mark,
.hero-title {
  position: relative;
  z-index: 1;
}

.hero-mark {
  align-self: center;
}

.hero-mark img {
  display: block;
  width: min(100%, 260px);
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid rgba(240, 189, 72, 0.42);
  border-radius: 8px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.52), 0 0 34px rgba(240, 189, 72, 0.18);
}

.hero-console {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(13, 32, 54, 0.94), rgba(13, 17, 20, 0.94)),
    var(--panel-strong);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  max-width: 11ch;
  font-size: clamp(42px, 7vw, 86px);
  line-height: 0.92;
  letter-spacing: 0;
  color: #fff9e8;
  text-shadow: 0 2px 0 rgba(88, 54, 10, 0.82), 0 0 34px rgba(240, 189, 72, 0.22);
}

h2 {
  font-size: 20px;
}

.hero-text {
  max-width: 620px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 17px;
}

.status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.16);
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 18px currentColor;
}

.status.ok .status-dot {
  background: var(--accent);
}

.status.error .status-dot {
  background: var(--bad);
}

.pulse-readout {
  align-self: center;
}

.pulse-readout strong {
  display: block;
  margin: 4px 0;
  color: var(--accent);
  font-size: clamp(54px, 9vw, 92px);
  line-height: 0.9;
}

.pulse-readout small {
  color: var(--muted);
}

.pulse-bars {
  display: grid;
  grid-template-columns: repeat(18, 1fr);
  align-items: end;
  gap: 5px;
  height: 70px;
}

.pulse-bars span {
  min-height: 8px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, var(--accent), rgba(29, 110, 168, 0.52));
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.metric {
  padding: 18px;
}

.metric-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.metric strong {
  font-size: 26px;
  line-height: 1.1;
}

.policy-panel {
  margin-bottom: 12px;
}

.policy-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(320px, 1.35fr);
  gap: 10px;
  padding: 14px 18px 18px;
}

.policy-rate-card,
.policy-signals,
.policy-history {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
}

.policy-rate-card {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 168px;
}

.policy-rate-card strong {
  color: var(--accent);
  font-size: 42px;
  line-height: 1;
}

.policy-rate-card.recommended strong {
  color: var(--blue);
}

.policy-rate-card.delta strong {
  color: var(--ink);
}

.policy-rate-card p,
.history-row p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.policy-signals {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.signal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 34px;
  padding: 7px 9px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.16);
}

.signal-row span,
.history-row span {
  color: var(--muted);
  font-size: 12px;
}

.signal-row strong {
  color: var(--ink);
  font-size: 13px;
  white-space: nowrap;
}

.policy-history {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
}

.history-row {
  display: grid;
  grid-template-columns: minmax(150px, 220px) 1fr;
  gap: 12px;
  padding: 10px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.14);
}

.history-row strong,
.history-row span {
  display: block;
}

.history-row strong {
  color: var(--accent);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1.45fr;
  gap: 12px;
  margin-bottom: 12px;
}

.panel {
  overflow: hidden;
}

.compact-panel {
  min-height: 255px;
}

.panel-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.panel-heading.tight {
  align-items: start;
  padding-bottom: 14px;
}

.panel-heading p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.controls {
  display: flex;
  align-items: end;
  gap: 10px;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

select,
input,
button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.18);
  color: var(--ink);
  font: inherit;
}

select,
input {
  padding: 0 10px;
}

input {
  width: min(360px, 38vw);
}

button {
  padding: 0 14px;
  background: var(--accent);
  color: #06110e;
  border-color: var(--accent);
  font-weight: 900;
  cursor: pointer;
}

.stack-list,
.rank-list {
  display: grid;
  gap: 10px;
  padding: 14px 18px 18px;
}

.stack-row,
.rank-row {
  display: grid;
  gap: 6px;
}

.row-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink);
  font-size: 14px;
}

.row-top strong {
  overflow-wrap: anywhere;
}

.stack-row small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.row-top span {
  color: var(--muted);
  white-space: nowrap;
}

.bar-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.bar-fill {
  height: 100%;
  width: var(--bar-width, 0%);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--blue));
}

.rank-row {
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
}

.rank-number {
  color: var(--accent);
  font-weight: 900;
}

.rank-name {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 800;
}

.rank-meta,
.rank-amount {
  color: var(--muted);
  font-size: 13px;
}

.rank-amount {
  color: var(--accent);
  font-weight: 900;
  white-space: nowrap;
}

.channel-panel {
  margin-bottom: 12px;
}

.channel-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 18px 18px;
}

.channel-card {
  display: grid;
  gap: 8px;
  min-height: 168px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
}

.channel-card-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.channel-card-top strong {
  font-size: 14px;
  overflow-wrap: anywhere;
}

.channel-card-top span,
.channel-meta,
.channel-card p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.channel-card-top span {
  white-space: nowrap;
}

.channel-amount {
  color: var(--accent);
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
}

.channel-card.server_source_sink .channel-amount,
.channel-card.server_money_source .channel-amount {
  color: var(--blue);
}

.channel-card.audit .channel-amount,
.channel-card.data_quality .channel-amount {
  color: var(--bad);
}

.feed-panel {
  margin-bottom: 16px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

td {
  font-size: 14px;
  vertical-align: top;
}

.amount {
  text-align: right;
}

.badge {
  display: inline-flex;
  padding: 4px 7px;
  border-radius: 5px;
  background: rgba(240, 189, 72, 0.12);
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.badge.audit {
  background: rgba(109, 184, 255, 0.13);
  color: var(--blue);
}

.badge.unknown {
  background: rgba(255, 114, 104, 0.14);
  color: var(--bad);
}

.event-row.audit td {
  background: rgba(109, 184, 255, 0.035);
}

.event-row.unknown td {
  background: rgba(255, 114, 104, 0.045);
}

.event-role,
.event-note,
.event-meta {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  white-space: normal;
}

.event-role {
  color: var(--ink);
  font-weight: 800;
}

.event-meta {
  color: rgba(184, 173, 145, 0.76);
}

.account-main {
  display: block;
  max-width: 260px;
  overflow-wrap: anywhere;
  white-space: normal;
}

.empty {
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1020px) {
  .hero,
  .dashboard-grid,
  .channel-grid,
  .policy-grid {
    grid-template-columns: 1fr;
  }

  .policy-history {
    grid-column: auto;
  }

  .hero-copy {
    min-height: 190px;
  }
}

@media (max-width: 840px) {
  .hero-copy {
    grid-template-columns: 1fr;
  }

  .hero-mark img {
    width: min(220px, 74vw);
  }

  .panel-heading,
  .controls {
    align-items: stretch;
    flex-direction: column;
  }

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

  .policy-signals {
    grid-template-columns: 1fr;
  }

  input {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .shell {
    width: min(100% - 20px, 1720px);
    padding: 18px 0;
  }

  .hero-copy,
  .hero-console,
  .metric {
    padding: 14px;
  }

  h1 {
    font-size: 42px;
  }

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

  .rank-row {
    grid-template-columns: 24px 1fr;
  }

  .rank-amount {
    grid-column: 2;
  }

  .history-row {
    grid-template-columns: 1fr;
  }

  th,
  td {
    padding: 11px 12px;
  }
}
