:root {
  color-scheme: dark;
  --page-bg: #020817;
  --surface: rgba(6, 22, 50, 0.78);
  --surface-strong: rgba(7, 27, 60, 0.86);
  --surface-soft: rgba(255, 255, 255, 0.045);
  --edge: rgba(140, 190, 255, 0.13);
  --edge-strong: rgba(170, 215, 255, 0.2);
  --text: #f4f8ff;
  --muted: #a5b7d2;
  --blue: #6ea8ff;
  --gold: #d8b86a;
  --income: #6ef2b2;
  --expense: #ff6f91;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--page-bg);
}

body {
  position: relative;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: #03122a;
  color: var(--text);
  font-family:
    "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-feature-settings: "tnum" 1, "ss01" 1;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

.brand-pattern {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
}

.pattern-mark {
  position: absolute;
  color: rgba(160, 200, 255, 0.058);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  line-height: 1;
  text-transform: lowercase;
  transform: translate3d(var(--x), var(--y), 0);
  white-space: nowrap;
}

.pattern-mark.is-gold {
  color: rgba(216, 184, 106, 0.047);
}

.pattern-mark.is-blue {
  color: rgba(160, 200, 255, 0.065);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(430px, 100%);
  margin: 0 auto;
  padding: 22px 16px 36px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  color: var(--text);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.02;
}

.brand p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.35;
}

.glass-card,
.glass-pill {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.018)),
    var(--surface);
  border: 1px solid var(--edge);
  box-shadow:
    0 16px 38px rgba(0, 0, 0, 0.3),
    0 0 18px rgba(83, 158, 255, 0.045),
    inset 0 1px 0 rgba(255, 255, 255, 0.085);
  backdrop-filter: blur(16px) saturate(132%);
  -webkit-backdrop-filter: blur(16px) saturate(132%);
}

.glass-card::before,
.glass-pill::before {
  position: absolute;
  left: 16px;
  right: 16px;
  top: 0;
  height: 1px;
  border-radius: 999px;
  background: rgba(210, 235, 255, 0.3);
  box-shadow: 0 0 10px rgba(125, 183, 255, 0.18);
  pointer-events: none;
  content: "";
}

.glass-pill {
  flex: 0 0 auto;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.glass-pill::before {
  left: 12px;
  right: 12px;
}

.balance-card {
  min-height: 168px;
  padding: 23px;
  margin-bottom: 14px;
  border-radius: 30px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.065), rgba(255, 255, 255, 0.02)),
    radial-gradient(circle at 96% 10%, rgba(110, 168, 255, 0.055), transparent 34%),
    var(--surface-strong);
  border-color: var(--edge-strong);
  box-shadow:
    0 22px 50px rgba(0, 0, 0, 0.34),
    0 0 22px rgba(83, 158, 255, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.panel-label {
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.balance-value {
  display: block;
  max-width: 100%;
  margin-bottom: 19px;
  overflow-wrap: normal;
  word-break: normal;
  color: var(--text);
  font-size: clamp(30px, 9.8vw, 52px);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1;
  font-variant-numeric: normal;
  text-shadow:
    0 0 24px rgba(110, 168, 255, 0.14),
    0 2px 14px rgba(0, 0, 0, 0.34);
}

.balance-lines {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}

.balance-pill {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid rgba(150, 205, 255, 0.11);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.038);
  box-shadow:
    inset 0 1px 0 rgba(210, 235, 255, 0.08),
    inset 0 -8px 16px rgba(0, 7, 24, 0.12);
}

.balance-pill span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.balance-pill b {
  display: block;
  overflow-wrap: normal;
  word-break: normal;
  color: var(--text);
  font-size: clamp(14px, 4vw, 17px);
  font-weight: 800;
  letter-spacing: -0.005em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

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

.expense,
.over {
  color: var(--expense);
}

.gold {
  color: var(--gold);
}

.section-card {
  padding: 16px;
  margin-bottom: 14px;
  border-radius: 26px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 13px;
  gap: 12px;
}

h2 {
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.section-label {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.year-card {
  padding-bottom: 15px;
}

.year-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.year-stat {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(140, 190, 255, 0.085);
  border-radius: 18px;
  background: rgba(3, 14, 34, 0.42);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

.year-stat span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.year-stat b {
  display: block;
  overflow-wrap: normal;
  word-break: normal;
  color: var(--text);
  font-size: clamp(14px, 4vw, 17px);
  font-weight: 700;
  letter-spacing: -0.005em;
  line-height: 1.12;
  font-variant-numeric: tabular-nums;
}

.stack-list {
  display: grid;
  gap: 9px;
}

.row-card,
.empty-state {
  border: 1px solid rgba(140, 190, 255, 0.085);
  border-radius: 18px;
  background: rgba(3, 14, 34, 0.5);
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.13),
    inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

.row-card {
  min-height: 56px;
  padding: 12px 13px;
}

.row-card.has-progress {
  min-height: 78px;
}

.empty-state {
  padding: 14px 13px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.42;
}

.empty-state p {
  margin: 0;
}

.row-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
}

.text-stack {
  min-width: 0;
}

.row-title {
  max-width: 100%;
  color: var(--text);
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.25;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-meta,
.row-note {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.005em;
  line-height: 1.35;
}

.row-meta {
  margin-top: 4px;
}

.row-amount {
  flex: 0 0 auto;
  max-width: 42%;
  overflow-wrap: normal;
  word-break: normal;
  text-align: right;
  font-size: clamp(15px, 4.1vw, 16.5px);
  font-weight: 800;
  letter-spacing: -0.005em;
  line-height: 1.18;
  font-variant-numeric: tabular-nums;
}

.progress-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
}

.progress {
  height: 8px;
  overflow: hidden;
  border: 1px solid rgba(150, 205, 255, 0.12);
  border-radius: 999px;
  background: rgba(2, 10, 26, 0.62);
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.1),
    inset 0 -5px 10px rgba(0, 0, 0, 0.26);
}

.progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5f9dff, #83c7ff 56%, rgba(216, 184, 106, 0.9));
  box-shadow:
    0 0 14px rgba(110, 168, 255, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.38);
}

.progress span.over-limit {
  background: linear-gradient(90deg, var(--expense), #ff9a7a);
  box-shadow:
    0 0 14px rgba(255, 111, 145, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

.percent {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.state-message {
  padding: 13px 14px;
  margin-top: 14px;
  border: 1px solid rgba(150, 205, 255, 0.16);
  border-radius: 20px;
  background: rgba(6, 27, 58, 0.62);
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 0 20px rgba(83, 158, 255, 0.06);
}

.state-message:empty {
  display: none;
}

.glass-button {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  font-family:
    "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: -0.01em;
}

@media (max-width: 620px) {
  .app-shell {
    padding: 18px 14px 28px;
  }

  .app-header {
    align-items: flex-start;
  }

  h1 {
    font-size: 22px;
  }

  .brand p,
  .glass-pill {
    font-size: 13px;
  }

  .balance-card {
    min-height: 162px;
    padding: 20px;
    border-radius: 28px;
  }

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

  .row-amount {
    max-width: 46%;
  }
}

@media (max-width: 420px) {
  .year-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .year-stat-total {
    grid-column: 1 / -1;
  }
}

@media (max-width: 340px) {
  .year-grid {
    grid-template-columns: 1fr;
  }

  .year-stat-total {
    grid-column: auto;
  }
}
