:root {
  --bg: #f3efe5;
  --bg-accent: radial-gradient(circle at top left, rgba(211, 124, 54, 0.25), transparent 30%),
    radial-gradient(circle at right, rgba(42, 88, 68, 0.18), transparent 25%),
    linear-gradient(145deg, #f5f1e8 0%, #ebe1cf 100%);
  --panel: rgba(255, 252, 246, 0.88);
  --panel-strong: #fffaf1;
  --text: #16261d;
  --muted: #5f685e;
  --accent: #a54d23;
  --accent-soft: #e8b78b;
  --good: #2f7a52;
  --bad: #b13d29;
  --line: rgba(22, 38, 29, 0.12);
  --shadow: 0 18px 50px rgba(68, 49, 22, 0.12);
  --hero-dark: linear-gradient(180deg, rgba(23, 79, 61, 0.94), rgba(13, 48, 38, 0.92));
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg-accent);
  font-family: "Source Sans 3", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.18) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.4), transparent 75%);
}

.landing-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.landing-shell,
.dashboard-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto 40px;
}

.hero {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 18px;
  margin-bottom: 18px;
}

.hero-card,
.panel,
.status-panel,
.metric-card {
  backdrop-filter: blur(12px);
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: var(--shadow);
}

.hero-card {
  max-width: 760px;
  padding: 56px;
  border-radius: 28px;
}

.hero-main {
  padding: 30px 30px 26px;
  position: relative;
  overflow: hidden;
}

.hero-main::after {
  content: "";
  position: absolute;
  inset: auto -50px -60px auto;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(165, 77, 35, 0.18), transparent 68%);
  pointer-events: none;
}

.hero-side {
  padding: 24px;
  display: grid;
  gap: 16px;
  align-content: start;
  background: var(--hero-dark);
  color: #eff6f0;
}

.section-label {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  font-weight: 700;
  margin: 0 0 10px;
  color: rgba(239, 246, 240, 0.74);
}

.hero-title {
  font-size: clamp(2rem, 3.2vw, 3.5rem);
  line-height: 0.98;
  max-width: 12ch;
}

.hero-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.tag {
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(255, 250, 241, 0.7);
  border: 1px solid rgba(22, 38, 29, 0.1);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
}

.palette-grid {
  display: grid;
  gap: 10px;
}

.palette-card {
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 12px;
  align-items: start;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.swatch {
  width: 13px;
  height: 13px;
  border-radius: 999px;
  display: inline-block;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.72), 0 0 0 3px rgba(10, 18, 12, 0.28);
  margin-top: 2px;
}

.palette-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.98);
  margin-bottom: 2px;
}

.palette-note,
.control-note {
  font-size: 0.8rem;
  line-height: 1.4;
  color: rgba(239, 246, 240, 0.78);
}

.top-items-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.selector-label {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.selector-input {
  width: min(340px, 100%);
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--text);
  padding: 12px 14px;
  font: inherit;
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
}

h1,
h2 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
}

h1 {
  font-size: clamp(2.4rem, 5vw, 4.6rem);
  line-height: 0.96;
  max-width: 12ch;
}

.hero-copy,
.hero-note,
.subtitle,
.panel-heading span,
.status-panel,
th,
td,
.summary-label,
.summary-value,
.list-meta {
  color: var(--muted);
}

.hero-copy {
  max-width: 48ch;
  font-size: 1.15rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 28px 0 18px;
}

.button,
.header-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 12px 18px;
  text-decoration: none;
  font-weight: 700;
}

.button {
  background: var(--accent);
  color: #fff8f2;
}

.button-secondary,
.header-link {
  background: rgba(255, 250, 241, 0.76);
  color: var(--text);
  border: 1px solid var(--line);
}

.page-header {
  width: min(1180px, calc(100vw - 32px));
  margin: 28px auto 24px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.subtitle {
  margin-top: 8px;
  max-width: 54ch;
}

.status-panel {
  padding: 16px 18px;
  border-radius: 18px;
  margin-bottom: 18px;
}

.filter-bar {
  position: sticky;
  top: 14px;
  z-index: 20;
  padding: 14px 18px;
  margin-bottom: 18px;
  border-radius: 18px;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.metric-grid,
.panel-grid {
  display: grid;
  gap: 18px;
}

.metric-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-bottom: 18px;
}

.metric-card {
  padding: 22px;
  border-radius: 24px;
  border-left: 6px solid transparent;
}

.metric-card:nth-child(1) { border-left-color: #174f3d; }
.metric-card:nth-child(2) { border-left-color: var(--good); }
.metric-card:nth-child(3) { border-left-color: var(--bad); }
.metric-card:nth-child(4) { border-left-color: var(--accent); }
.metric-card:nth-child(5) { border-left-color: #6b7c72; }

.metric-label {
  margin: 0 0 8px;
  font-size: 0.95rem;
  color: var(--muted);
}

.metric-value {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.45rem, 2.4vw, 2.3rem);
  line-height: 1.05;
}

.metric-delta {
  margin-top: 8px;
  font-size: 0.95rem;
}

.positive {
  color: var(--good);
}

.negative {
  color: var(--bad);
}

.panel-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 18px;
}

.panel {
  border-radius: 24px;
  padding: 22px;
}

.section-accent {
  border-top: 5px solid transparent;
}

.section-net { border-top-color: #174f3d; }
.section-mix { border-top-color: var(--accent); }
.section-expense { border-top-color: var(--bad); }
.section-cash { border-top-color: var(--good); }
.section-table { border-top-color: #6b7c72; }

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

.chart-slot {
  min-height: 260px;
}

.trend-analysis {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.chart-svg {
  width: 100%;
  height: 100%;
}

.stacked-chart {
  display: grid;
  gap: 14px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  color: var(--muted);
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(22, 38, 29, 0.12);
}

.bar-label {
  font-size: 12px;
  fill: var(--muted);
}

.bar-value {
  font-size: 12px;
  fill: var(--text);
  font-weight: 700;
}

.summary-stack,
.expense-list {
  display: grid;
  gap: 12px;
}

.summary-row,
.expense-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.summary-value,
.expense-value {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  color: var(--text);
}

.money-pair {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.16em;
  max-width: 100%;
}

.money-primary,
.money-secondary {
  display: block;
  white-space: nowrap;
}

.money-secondary {
  font-size: 0.66em;
  line-height: 1.1;
  color: var(--muted);
}

td .money-secondary,
.expense-value .money-secondary,
.summary-value .money-secondary {
  color: currentColor;
  opacity: 0.72;
}

.table-wrap {
  overflow: auto;
}

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

th,
td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
}

th {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.footer-note {
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
  text-align: center;
}

.empty-state {
  padding: 24px;
  border-radius: 18px;
  background: var(--panel-strong);
  border: 1px dashed var(--line);
}

@media (max-width: 900px) {
  .hero,
  .metric-grid,
  .panel-grid {
    grid-template-columns: 1fr;
  }

  .hero-card {
    padding: 32px 24px;
  }

  .page-header {
    flex-direction: column;
  }
}
