:root {
  color-scheme: dark;
  --bg: #050505;
  --ink: #f6f0db;
  --muted: #a79f86;
  --panel: #0c0c0a;
  --panel-2: #12110d;
  --line: #3a3426;
  --line-hot: #f6a800;
  --income: #00d084;
  --spending: #ff5a36;
  --accent: #f6a800;
  --cyan: #40cfff;
  --shadow: 0 0 0 1px rgba(246, 168, 0, 0.08), 0 22px 60px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(rgba(246, 168, 0, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(246, 168, 0, 0.025) 1px, transparent 1px),
    radial-gradient(circle at 78% 8%, rgba(246, 168, 0, 0.16), transparent 28rem),
    var(--bg);
  background-size: 18px 18px, 18px 18px, auto;
  color: var(--ink);
  font-family:
    "IBM Plex Mono", "Roboto Mono", "Cascadia Mono", Consolas, Monaco,
    monospace;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.025) 0,
      rgba(255, 255, 255, 0.025) 1px,
      transparent 1px,
      transparent 4px
    );
  content: "";
}

a {
  color: var(--cyan);
  font-weight: 800;
}

.page-shell {
  width: min(1280px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 34px;
}

.terminal-bar {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
  border: 1px solid var(--line-hot);
  background: #0a0905;
  color: var(--accent);
  box-shadow: var(--shadow);
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.terminal-bar span {
  padding: 8px 10px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(246, 168, 0, 0.2), transparent);
}

.terminal-bar span:last-child {
  border-right: 0;
  color: var(--income);
}

.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: end;
  margin-bottom: 12px;
  padding: 18px;
  border: 1px solid var(--line-hot);
  background:
    linear-gradient(90deg, rgba(246, 168, 0, 0.12), transparent 34%),
    rgba(6, 6, 4, 0.96);
  box-shadow: var(--shadow);
}

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

h1 {
  max-width: 860px;
  margin: 0;
  color: #ffffff;
  font-size: clamp(2.2rem, 5vw, 4.7rem);
  font-weight: 950;
  letter-spacing: 0;
  line-height: 0.95;
  text-transform: uppercase;
}

.lede {
  max-width: 760px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.55;
}

.year-picker {
  display: grid;
  gap: 6px;
  min-width: 210px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

select {
  width: 100%;
  border: 1px solid var(--line-hot);
  border-radius: 0;
  background: #030303;
  color: #ffffff;
  font: inherit;
  font-size: 1rem;
  font-weight: 900;
  padding: 10px 36px 10px 10px;
  box-shadow: inset 0 0 0 1px rgba(246, 168, 0, 0.16);
}

select:disabled {
  color: var(--muted);
}

.status {
  min-height: 38px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line-hot);
  background: #030303;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1.35;
}

.status::before {
  color: var(--accent);
  content: "MSG ";
}

.status.is-error {
  border-color: var(--spending);
  background: rgba(255, 90, 54, 0.12);
  color: #ffd6ca;
}

.status.is-error::before {
  color: var(--spending);
  content: "ERR ";
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.metric-card,
.category-widget,
dl div {
  border: 1px solid var(--line-hot);
  background:
    linear-gradient(180deg, rgba(246, 168, 0, 0.12), transparent 58px),
    linear-gradient(90deg, rgba(246, 168, 0, 0.04), transparent),
    #050503;
  box-shadow: var(--shadow);
}

.metric-card {
  min-height: 190px;
  padding: 16px;
  position: relative;
}

.metric-card::before {
  display: block;
  width: 100%;
  height: 20px;
  margin: -16px -16px 18px;
  width: calc(100% + 32px);
  content: "";
}

.metric-card.income::before {
  background:
    linear-gradient(90deg, var(--income), rgba(0, 208, 132, 0.18)),
    #000;
}

.metric-card.spending::before {
  background:
    linear-gradient(90deg, var(--spending), rgba(255, 90, 54, 0.18)),
    #000;
}

.metric-card::after {
  position: absolute;
  top: 14px;
  right: 14px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.metric-card.income::after {
  content: "RCP";
}

.metric-card.spending::after {
  content: "OUT";
}

.metric-label,
.metric-note {
  margin: 0;
  color: var(--muted);
  font-weight: 900;
}

.metric-label {
  color: var(--accent);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric-value {
  margin: 18px 0 12px;
  color: #ffffff;
  font-size: clamp(2.3rem, 5vw, 4rem);
  font-weight: 950;
  line-height: 0.95;
  text-shadow: 0 0 16px currentColor;
}

.income .metric-value {
  color: var(--income);
}

.spending .metric-value {
  color: var(--spending);
}

.metric-note {
  font-size: 0.78rem;
  line-height: 1.35;
  text-transform: uppercase;
}

.income-categories {
  grid-column: 1;
  grid-row: 2;
}

.income-state-widget {
  grid-column: 1;
  grid-row: 3;
}

.spending-categories {
  grid-column: 2;
  grid-row: 2;
}

.category-widget {
  padding: 16px;
}

.category-widget::before {
  display: block;
  margin: -16px -16px 14px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line-hot);
  background: #f6a800;
  color: #050505;
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.income-categories::before {
  content: "RCP SRC <TABLE 9>";
}

.income-state-widget::before {
  content: "IRS SOI STATE TAX <2022>";
}

.spending-categories::before {
  content: "OUT FUNC <TABLE 9>";
}

.category-heading {
  display: flex;
  gap: 18px;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 14px;
}

.category-heading h2 {
  margin: 6px 0 0;
  color: #ffffff;
  font-size: clamp(1.15rem, 2.2vw, 1.8rem);
  font-weight: 950;
  line-height: 1;
  text-transform: uppercase;
}

.category-heading p:last-child {
  max-width: 420px;
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1.35;
  text-align: right;
}

.category-stack {
  display: flex;
  width: 100%;
  height: 40px;
  overflow: hidden;
  margin: 14px 0;
  border: 1px solid var(--line-hot);
  background: #050505;
  box-shadow:
    inset 0 0 0 1px rgba(246, 168, 0, 0.12),
    0 0 16px rgba(246, 168, 0, 0.12);
}

.stack-segment {
  min-width: 2px;
  height: 100%;
  background: var(--segment-color);
  box-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.5);
}

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

.state-tax-list {
  max-height: 520px;
  overflow: auto;
  padding-right: 4px;
}

.category-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 7px;
  align-items: baseline;
  min-width: 0;
  min-height: 28px;
  padding: 6px 0 5px;
  border-top: 1px solid rgba(246, 168, 0, 0.22);
  font-size: 0.74rem;
}

.category-row:hover {
  background: rgba(246, 168, 0, 0.08);
}

.category-swatch {
  width: 10px;
  height: 10px;
  margin-top: 2px;
  background: var(--segment-color);
}

.category-name {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #f6f0db;
  font-weight: 900;
  line-height: 1.2;
  text-transform: uppercase;
}

.category-row.is-negative .category-swatch {
  border: 2px solid var(--spending);
  background: transparent;
}

.category-row.is-negative .category-amount {
  color: var(--spending);
}

.category-amount {
  color: var(--cyan);
  font-weight: 950;
  text-align: right;
  white-space: nowrap;
}

.empty-message {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.details {
  margin-top: 16px;
  padding-top: 0;
}

.details h2 {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

dl div {
  min-height: 106px;
  padding: 12px;
}

dt {
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

dd {
  margin: 0;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.45;
}

@media (max-width: 900px) {
  .page-shell {
    width: min(100% - 20px, 1280px);
    padding: 14px 0 24px;
  }

  .terminal-bar,
  .hero,
  .dashboard-grid,
  .category-list,
  dl {
    grid-template-columns: 1fr;
  }

  .terminal-bar span {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .terminal-bar span:last-child {
    border-bottom: 0;
  }

  .hero {
    align-items: stretch;
  }

  .category-heading {
    display: grid;
    align-items: start;
  }

  .category-heading p:last-child,
  .category-amount {
    text-align: left;
  }

  .category-row {
    grid-template-columns: 10px minmax(0, 1fr);
  }

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

  .metric-card {
    min-height: 158px;
  }

  .category-widget {
    grid-column: auto;
    grid-row: auto;
  }
}
