:root {
  --bg: #f6f7f2;
  --panel: #ffffff;
  --ink: #17211b;
  --muted: #66716b;
  --line: #dde3dc;
  --green: #137f4b;
  --green-ink: #0d5131;
  --red: #b53b32;
  --blue: #1d5f8f;
  --shadow: 0 18px 45px rgba(29, 39, 33, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.65), rgba(255, 255, 255, 0)),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid rgba(221, 227, 220, 0.82);
  background: rgba(246, 247, 242, 0.88);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--ink);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.nav a,
.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 14px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}

.button.primary {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.button.small {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 13px;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin: 16px 0 24px;
}

.hero.compact h1 {
  font-size: clamp(34px, 5vw, 58px);
}

.hero h1,
.section-title h1,
.section-title h2 {
  margin: 0;
  letter-spacing: 0;
  line-height: 1.05;
}

.hero h1 {
  max-width: 680px;
  font-size: clamp(36px, 7vw, 72px);
}

.eyebrow,
.section-title p {
  margin: 0 0 8px;
  color: var(--green-ink);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.metrics,
.grid {
  display: grid;
  gap: 16px;
}

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

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

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

.panel {
  margin-bottom: 16px;
  padding: 22px;
}

.metric {
  padding: 20px;
}

.metric span,
.muted {
  color: var(--muted);
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
  line-height: 1.1;
}

.metric.positive strong,
.positive-text {
  color: var(--green);
}

.metric.negative strong,
.negative-text {
  color: var(--red);
}

.filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: end;
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

input:focus,
select:focus,
.button:focus {
  outline: 3px solid rgba(29, 95, 143, 0.2);
  border-color: var(--blue);
}

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

.chart-row {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 14px;
  align-items: center;
}

.chart-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.chart-bars {
  display: grid;
  gap: 5px;
}

.bar {
  display: flex;
  min-width: 54px;
  height: 28px;
  align-items: center;
  justify-content: flex-end;
  border-radius: 6px;
  padding: 0 8px;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
}

.bar.income {
  background: var(--green);
}

.bar.expense {
  background: var(--red);
}

.section-title {
  margin-bottom: 18px;
}

.section-title.inline {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

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

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

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

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

td span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.right {
  text-align: right;
}

.amount {
  font-weight: 900;
  white-space: nowrap;
}

.actions-cell {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}

.actions-cell form {
  margin: 0;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 900;
}

.status-suggested {
  color: var(--blue);
}

.status-confirmed {
  color: var(--green);
}

.status-rejected {
  color: var(--red);
}

.inline-form {
  margin: 0;
}

.inline-form select {
  min-width: 150px;
}

.auth-shell {
  display: grid;
  min-height: calc(100vh - 160px);
  place-items: center;
}

.auth-card {
  width: min(430px, 100%);
}

.auth-card,
.upload-card,
.panel form {
  display: grid;
  gap: 14px;
}

.dropzone {
  min-height: 180px;
  place-items: center;
  border: 1px dashed #a9b4ac;
  border-radius: 8px;
  background: #f8faf8;
  text-align: center;
  cursor: pointer;
}

.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.dropzone span {
  color: var(--ink);
  font-size: 20px;
  font-weight: 900;
}

.dropzone small,
.copy {
  color: var(--muted);
}

.category-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  border: 1px solid currentColor;
  padding: 5px 10px;
  background: #fff;
  font-size: 13px;
  font-weight: 900;
}

.w-5 { width: 5%; }
.w-10 { width: 10%; }
.w-15 { width: 15%; }
.w-20 { width: 20%; }
.w-25 { width: 25%; }
.w-30 { width: 30%; }
.w-35 { width: 35%; }
.w-40 { width: 40%; }
.w-45 { width: 45%; }
.w-50 { width: 50%; }
.w-55 { width: 55%; }
.w-60 { width: 60%; }
.w-65 { width: 65%; }
.w-70 { width: 70%; }
.w-75 { width: 75%; }
.w-80 { width: 80%; }
.w-85 { width: 85%; }
.w-90 { width: 90%; }
.w-95 { width: 95%; }
.w-100 { width: 100%; }

.flash {
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
  font-weight: 800;
}

.flash-success {
  border-color: rgba(19, 127, 75, 0.24);
  background: rgba(19, 127, 75, 0.08);
  color: var(--green-ink);
}

.flash-error {
  border-color: rgba(181, 59, 50, 0.24);
  background: rgba(181, 59, 50, 0.08);
  color: var(--red);
}

.flash-info {
  border-color: rgba(29, 95, 143, 0.24);
  background: rgba(29, 95, 143, 0.08);
  color: var(--blue);
}

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

@media (max-width: 860px) {
  .topbar,
  .hero,
  .section-title.inline {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .hero h1 {
    font-size: 42px;
  }

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

@media (max-width: 560px) {
  .page {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
  }

  .panel,
  .metric {
    padding: 16px;
  }

  .nav a {
    min-height: 36px;
    padding: 7px 10px;
  }
}
