:root {
  --bg: #f5efe4;
  --surface: rgba(255, 251, 245, 0.88);
  --surface-strong: #fff9ef;
  --ink: #1f2a2c;
  --muted: #64706f;
  --line: rgba(31, 42, 44, 0.12);
  --accent: #c96b32;
  --accent-2: #2f7d6a;
  --accent-3: #d7a437;
  --shadow: 0 24px 60px rgba(72, 52, 24, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(201, 107, 50, 0.22), transparent 28%),
    radial-gradient(circle at bottom right, rgba(47, 125, 106, 0.18), transparent 24%),
    linear-gradient(145deg, #f7f2e8, #efe6d7 55%, #e5d8c7);
}

.app-shell {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 64px;
}

.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 28px;
  align-items: center;
  margin-bottom: 28px;
}

.hero-copy h1 {
  margin: 0 0 16px;
  font-size: clamp(2.5rem, 5vw, 4.8rem);
  line-height: 0.95;
  max-width: 10ch;
}

.lead,
.panel-header p,
.empty-state p,
small {
  color: var(--muted);
}

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

.hero-card,
.panel,
.empty-state {
  background: var(--surface);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.hero-card {
  padding: 24px;
}

form {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

input[type="text"],
input[type="file"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.75);
  font: inherit;
}

.sr-only-file {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.file-picker {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.75);
  cursor: pointer;
}

.file-picker-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(31, 42, 44, 0.08);
  font-weight: 800;
}

.file-picker-text {
  color: var(--muted);
  font-weight: 600;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 15px 20px;
  font: inherit;
  font-weight: 800;
  color: white;
  background: linear-gradient(135deg, var(--accent), #de8b4c);
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease;
  box-shadow: 0 14px 32px rgba(201, 107, 50, 0.3);
}

button:hover {
  transform: translateY(-1px);
}

.results {
  display: grid;
  gap: 22px;
}

.results-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
}

.summary-pills {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.results-header h2,
.panel-header h3 {
  margin: 0;
}

.summary-pill {
  padding: 14px 18px;
  border-radius: 20px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  display: grid;
  gap: 4px;
}

.summary-pill span {
  font-size: 0.8rem;
  color: var(--muted);
}

.summary-pill select {
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.75);
  font: inherit;
  color: var(--ink);
}

.summary-pill strong {
  font-size: 1.5rem;
}

.dashboard {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}

.panel {
  padding: 22px;
}

.chart-panel {
  display: grid;
  gap: 16px;
}

.chart-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 320px;
}

.legend,
.category-list {
  display: grid;
  gap: 12px;
}

.legend-item,
.category-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(31, 42, 44, 0.08);
}

.category-card {
  width: 100%;
  text-align: left;
  cursor: pointer;
  flex-direction: column;
  align-items: stretch;
}

.category-card summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.category-card summary::-webkit-details-marker {
  display: none;
}

.category-card[open] summary {
  margin-bottom: 14px;
}

.legend-item {
  justify-content: start;
}

.legend-item > div,
.category-card > div {
  display: grid;
  gap: 4px;
}

.swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.amount {
  font-weight: 800;
}

.category-transactions {
  display: grid;
  gap: 10px;
}

.category-transaction {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.category-transaction strong {
  display: block;
  margin-bottom: 4px;
}

.chevron {
  color: var(--muted);
  font-weight: 800;
}

.table-wrap {
  overflow: auto;
}

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

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

th {
  font-size: 0.85rem;
  color: var(--muted);
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(47, 125, 106, 0.12);
  color: var(--accent-2);
  font-weight: 700;
  font-size: 0.85rem;
}

.empty-state {
  padding: 28px;
  text-align: center;
}

.hidden {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

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

  .summary-pills {
    width: 100%;
  }

  .app-shell {
    width: min(100% - 20px, 1200px);
    padding-top: 22px;
  }

  .hero-copy h1 {
    max-width: none;
  }
}
