/* ------------------------------------------------------------------ thèmes
   Ambiance « aurore » : violet, rose et menthe, cartes et boutons en verre
   translucide, sur fond violet nuit (sombre) ou lavande très claire (clair).
   Clair par défaut ; le sombre s'applique si le système le demande (sauf choix
   « clair » explicite) ou si l'utilisateur l'a choisi.
   --surface est l'équivalent opaque d'une carte en verre : il sert aux liserés
   des graphiques. Les quatre couleurs de séries sont validées (contraste,
   daltonisme) sur cette surface : ne pas les modifier sans relancer le validateur. */

:root {
  color-scheme: light;
  --page: #f4f0fb;
  --surface: #fbf9fe;
  --card: rgba(255, 255, 255, 0.62);
  --glass: rgba(255, 255, 255, 0.5);
  --glass-2: rgba(255, 255, 255, 0.9);
  --field: rgba(20, 13, 31, 0.055);
  --topbar: rgba(244, 240, 251, 0.66);
  --ink: #140d1f;
  --ink-2: #554c68;
  --muted: #7d7591;
  --grid: rgba(20, 13, 31, 0.09);
  --axis: rgba(20, 13, 31, 0.22);
  --border: rgba(20, 13, 31, 0.11);
  --series-1: #7c3aed;
  --series-2: #d91a6d;
  --series-3: #0e97a3;
  --series-4: #e06f00;
  --good: #006300;
  --bad: #b92d2d;
  --focus: #7c3aed;
  --grad: linear-gradient(115deg, #7c3aed, #db2777 55%, #0d9488);
  --grad-strong: linear-gradient(135deg, #a78bfa, #f472b6);
  --on-accent: #140d1f;
  --accent-glow: 0 12px 36px -12px rgba(244, 114, 182, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  --aura-1: rgba(167, 139, 250, 0.4);
  --aura-2: rgba(244, 114, 182, 0.3);
  --aura-3: rgba(94, 234, 212, 0.3);
  --tip-bg: #140d1f;
  --tip-ink: #f6f3fd;
  --shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 20px 50px -28px rgba(80, 40, 140, 0.35);
  --radius: 20px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #09070f;
    --surface: #15131b;
    --card: rgba(255, 255, 255, 0.05);
    --glass: rgba(255, 255, 255, 0.06);
    --glass-2: rgba(255, 255, 255, 0.12);
    --field: rgba(255, 255, 255, 0.07);
    --topbar: rgba(9, 7, 15, 0.6);
    --ink: #f6f3fd;
    --ink-2: #bdb6cf;
    --muted: #928ba8;
    --grid: rgba(255, 255, 255, 0.09);
    --axis: rgba(255, 255, 255, 0.2);
    --border: rgba(255, 255, 255, 0.11);
    --series-1: #8b5cf6;
    --series-2: #d6337a;
    --series-3: #1aa8b3;
    --series-4: #da7812;
    --good: #35c24a;
    --bad: #ff7a85;
    --focus: #a78bfa;
    --grad: linear-gradient(115deg, #a78bfa, #f472b6 55%, #5eead4);
    --aura-1: rgba(167, 139, 250, 0.44);
    --aura-2: rgba(244, 114, 182, 0.38);
    --aura-3: rgba(94, 234, 212, 0.18);
    --tip-bg: #f6f3fd;
    --tip-ink: #09070f;
    --shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 24px 60px -30px rgba(0, 0, 0, 0.8);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #09070f;
  --surface: #15131b;
  --card: rgba(255, 255, 255, 0.05);
  --glass: rgba(255, 255, 255, 0.06);
  --glass-2: rgba(255, 255, 255, 0.12);
  --field: rgba(255, 255, 255, 0.07);
  --topbar: rgba(9, 7, 15, 0.6);
  --ink: #f6f3fd;
  --ink-2: #bdb6cf;
  --muted: #928ba8;
  --grid: rgba(255, 255, 255, 0.09);
  --axis: rgba(255, 255, 255, 0.2);
  --border: rgba(255, 255, 255, 0.11);
  --series-1: #8b5cf6;
  --series-2: #d6337a;
  --series-3: #1aa8b3;
  --series-4: #da7812;
  --good: #35c24a;
  --bad: #ff7a85;
  --focus: #a78bfa;
  --grad: linear-gradient(115deg, #a78bfa, #f472b6 55%, #5eead4);
  --aura-1: rgba(167, 139, 250, 0.44);
  --aura-2: rgba(244, 114, 182, 0.38);
  --aura-3: rgba(94, 234, 212, 0.18);
  --tip-bg: #f6f3fd;
  --tip-ink: #09070f;
  --shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 24px 60px -30px rgba(0, 0, 0, 0.8);
}

/* ------------------------------------------------------------------ base */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  background: var(--page);
}

body {
  margin: 0;
  min-height: 100dvh;
  overflow-x: clip;
  background:
    radial-gradient(62vw 52vh at 10% -8%, var(--aura-1), transparent 70%),
    radial-gradient(58vw 56vh at 90% 2%, var(--aura-2), transparent 70%),
    radial-gradient(54vw 48vh at 50% 108%, var(--aura-3), transparent 70%),
    var(--page);
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
p,
ul,
dl,
dd {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.muted {
  color: var(--ink-2);
}

.fine {
  color: var(--muted);
  font-size: 13px;
}

.hint {
  color: var(--muted);
  font-size: 13px;
}

.error {
  color: var(--bad);
  font-size: 14px;
}

.boot {
  padding: 4rem 1rem;
  text-align: center;
  color: var(--muted);
}

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

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

/* ------------------------------------------------------------------ boutons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 40px;
  padding: 0 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  font-weight: 550;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s, transform 0.15s;
}

.btn:hover {
  background: var(--glass-2);
}

.btn:disabled {
  opacity: 0.55;
  cursor: progress;
}

.btn svg {
  width: 15px;
  height: 15px;
}

.btn.primary {
  background: var(--grad-strong);
  border-color: transparent;
  color: var(--on-accent);
  font-weight: 600;
  box-shadow: var(--accent-glow);
}

.btn.primary:hover {
  background: var(--grad-strong);
  transform: translateY(-1px);
}

.btn.small {
  min-height: 32px;
  padding: 0 0.8rem;
  font-size: 13px;
}

.btn.ghost {
  margin-top: 0.6rem;
  border-style: dashed;
  background: transparent;
  color: var(--ink-2);
  width: 100%;
}

.btn.ghost:hover {
  background: var(--field);
  color: var(--ink);
}

.icon-btn {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  cursor: pointer;
  transition: background 0.15s;
}

.icon-btn:hover {
  background: var(--glass-2);
}

.is-invisible {
  visibility: hidden;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.icon-btn.subtle {
  width: 32px;
  height: 32px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.icon-btn.subtle:hover {
  background: var(--field);
  color: var(--bad);
}

.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-2);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  font-size: 13px;
}

.link.danger:hover {
  color: var(--bad);
}

/* Onglets et sélecteurs à deux positions */

.tabs,
.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
}

.tabs button,
.segmented button {
  min-height: 34px;
  padding: 0 1rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-weight: 550;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.segmented button {
  min-height: 28px;
  padding: 0 0.75rem;
  font-size: 13px;
}

.tabs button:hover,
.segmented button:hover {
  color: var(--ink);
}

.tabs button[aria-selected="true"] {
  background: var(--grad-strong);
  color: var(--on-accent);
  font-weight: 600;
  box-shadow: var(--accent-glow);
}

.segmented button[aria-pressed="true"] {
  background: var(--glass-2);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

/* ------------------------------------------------------------------ cartes */

.card {
  background: var(--card);
  backdrop-filter: blur(18px) saturate(1.2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  min-width: 0;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 1.1rem;
}

.card-head h2,
.empty h2 {
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.card-total {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.card-foot {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--grid);
  text-align: right;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 550;
}

.swatch {
  flex: none;
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

/* ------------------------------------------------------------------ connexion */

.login {
  position: relative;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.login-theme {
  position: absolute;
  top: 1rem;
  right: 1rem;
}

.login-card {
  width: min(100%, 380px);
  padding: 2.5rem 1.75rem;
  display: grid;
  justify-items: center;
  gap: 0.75rem;
  text-align: center;
}

.login-card h1 {
  font-size: 26px;
  letter-spacing: -0.02em;
}

.login-card .logo {
  width: 52px;
  height: 52px;
}

.google-button {
  min-height: 44px;
  margin-top: 0.75rem;
  display: grid;
  place-items: center;
  color-scheme: light;
}

.logo {
  flex: none;
  width: 28px;
  height: 28px;
}

.brand span {
  font-size: 16px;
}

/* ------------------------------------------------------------------ barre du haut */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--topbar);
  backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0.65rem 1.25rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.75rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.month-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.month-label {
  min-width: 8.75rem;
  text-align: center;
  font-weight: 650;
  font-size: 16px;
}

.account {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
  min-width: 0;
}

.account > span[title] {
  display: inline-flex;
}

.save-status {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.save-status[data-kind="error"] {
  color: var(--bad);
}

.avatar {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--field);
  border: 1px solid var(--border);
  font-weight: 650;
  font-size: 13px;
  object-fit: cover;
}

/* ------------------------------------------------------------------ page */

.page {
  max-width: 1240px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 4rem;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.1rem;
}

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

.grid > * {
  animation: rise 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.grid > :nth-child(2) {
  animation-delay: 0.04s;
}

.grid > :nth-child(3) {
  animation-delay: 0.08s;
}

.grid > :nth-child(n + 4) {
  animation-delay: 0.12s;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

.hero {
  grid-column: span 7;
  align-self: stretch;
}

.savings {
  grid-column: span 5;
  align-self: stretch;
}

.tiles {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.1rem;
}

.span-5 {
  grid-column: span 5;
  align-self: stretch;
}

.span-7 {
  grid-column: span 7;
  align-self: stretch;
}

.span-12 {
  grid-column: 1 / -1;
}

.empty {
  max-width: 560px;
  margin: 3rem auto;
  padding: 2.25rem;
  display: grid;
  gap: 0.75rem;
  text-align: center;
  justify-items: center;
}

.empty h2 {
  font-size: 20px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

.empty-note {
  color: var(--muted);
  padding: 0.75rem 0;
}

/* ------------------------------------------------------------------ synthèse */

.hero {
  position: relative;
  overflow: hidden;
  padding: 1.75rem;
  background:
    radial-gradient(460px 240px at 100% 0%, var(--aura-2), transparent 70%),
    radial-gradient(420px 220px at 0% 100%, var(--aura-1), transparent 70%),
    var(--card);
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.hero-value {
  margin-top: 0.5rem;
  font-size: clamp(52px, 7.5vw, 80px);
  font-weight: 680;
  line-height: 1.05;
  letter-spacing: -0.045em;
  /* Chiffre phare dans le dégradé de la marque ; couleur pleine si le navigateur ne sait pas découper le fond. */
  width: fit-content;
  padding-right: 0.06em;
  color: var(--series-2);
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .hero-value {
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }
}

.status {
  margin-top: 0.75rem;
  font-size: 14px;
  font-weight: 550;
}

.split {
  display: flex;
  gap: 2px;
  height: 28px;
  margin-top: 1.6rem;
}

.split.is-empty {
  border-radius: 4px;
  background: var(--field);
}

.seg {
  position: relative;
  min-width: 0;
  border-radius: 4px;
}

.seg span {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  font-size: 13px;
  color: var(--ink-2);
}

#split-legend {
  margin-top: 0.8rem;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.legend-item b {
  color: var(--ink);
  font-weight: 600;
}

/* Épargne : anneau + chiffres */

.savings {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.savings-side {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 0.2rem;
}

.ring {
  display: block;
}

.ring-track {
  fill: none;
  stroke-width: 14;
  opacity: 0.2;
}

.ring-fill {
  fill: none;
  stroke-width: 14;
  stroke-linecap: round;
}

.ring-value {
  fill: var(--ink);
  font-size: 30px;
  font-weight: 680;
  letter-spacing: -0.03em;
}

.ring-caption {
  fill: var(--muted);
  font-size: 12px;
}

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--grid);
}

.facts dt,
.stats dt {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--ink-2);
  font-size: 13px;
}

.facts dd {
  font-weight: 650;
  font-size: 16px;
}

/* Tuiles */

.tile {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.tile-value {
  margin-top: 0.35rem;
  font-size: 30px;
  font-weight: 660;
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.tile-note {
  color: var(--ink-2);
  font-size: 13px;
}

.delta {
  display: block;
  margin-top: auto;
  padding-top: 0.6rem;
  color: var(--muted);
  font-size: 13px;
  font-weight: 550;
}

.savings-side .delta {
  padding-top: 0.1rem;
}

.delta.is-good {
  color: var(--good);
}

.delta.is-bad {
  color: var(--bad);
}

/* Chiffres en ligne (année, bandeau de saisie) */

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem 1.5rem;
}

.stats dd {
  margin-top: 0.2rem;
  font-size: 24px;
  font-weight: 660;
  letter-spacing: -0.02em;
}

.stats .is-bad dd {
  color: var(--bad);
}

.strip {
  position: sticky;
  top: 68px;
  z-index: 5;
  padding: 1rem 1.5rem;
}

/* Points clés */

.insights {
  display: grid;
  gap: 0.9rem;
}

.insights li {
  display: grid;
  gap: 0.3rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--grid);
}

.insights li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.insights p {
  color: var(--ink-2);
}

.insights b {
  color: var(--ink);
  font-weight: 650;
}

.tag {
  width: fit-content;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  background: var(--field);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
}

/* ------------------------------------------------------------------ graphiques */

.meters {
  display: grid;
  gap: 1.2rem;
}

.meter-row {
  display: grid;
  gap: 0.4rem;
  border-radius: 8px;
}

.meter-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.meter-label {
  font-weight: 600;
}

.meter-label small {
  margin-left: 0.5rem;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.meter-value {
  flex: none;
  color: var(--ink-2);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.meter-value b {
  color: var(--ink);
  font-size: 15px;
}

.meter {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--fill) 20%, transparent);
}

.meter-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--fill);
}

.meter-target {
  position: absolute;
  top: -5px;
  width: 2px;
  height: 18px;
  margin-left: -1px;
  border-radius: 2px;
  background: var(--ink);
  box-shadow: 0 0 0 2px var(--surface);
}

.meter-status {
  font-size: 13px;
  font-weight: 550;
}

.hbars {
  display: grid;
  gap: 0.65rem;
}

.hbar-row {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  align-items: center;
  gap: 0.75rem;
  border-radius: 6px;
}

.hbar-label {
  color: var(--ink-2);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hbar-track {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.hbar {
  flex: none;
  height: 16px;
  min-width: 3px;
  border-radius: 0 4px 4px 0;
  background: var(--series-2);
}

.hbar-value {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.trend {
  width: 100%;
  min-height: 240px;
}

.trend svg {
  display: block;
  max-width: 100%;
}

.trend .gridline {
  stroke: var(--grid);
  stroke-width: 1;
}

.trend .axis {
  stroke: var(--axis);
  stroke-width: 1;
}

.trend .tick {
  fill: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.trend .tick.is-current {
  fill: var(--ink);
  font-weight: 650;
}

.trend .line {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.trend .dot {
  stroke: var(--surface);
  stroke-width: 2;
}

.trend .crosshair {
  stroke: var(--axis);
  stroke-width: 1;
}

.trend .hit {
  fill: transparent;
  cursor: pointer;
}

.table-view {
  margin-top: 0.75rem;
  font-size: 13px;
}

.table-view summary {
  color: var(--ink-2);
  cursor: pointer;
  width: fit-content;
}

.table-view > div {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  margin-top: 0.5rem;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.data-table th,
.data-table td {
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--grid);
  text-align: right;
  white-space: nowrap;
}

.data-table th:first-child {
  text-align: left;
}

.data-table thead th {
  color: var(--ink-2);
  font-weight: 550;
}

.data-table tbody th {
  font-weight: 550;
}

.tooltip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 50;
  max-width: 280px;
  padding: 0.5rem 0.7rem;
  border-radius: 10px;
  background: var(--tip-bg);
  color: var(--tip-ink);
  font-size: 13px;
  line-height: 1.4;
  pointer-events: none;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
}

.tip-table {
  display: grid;
  gap: 0.2rem;
  min-width: 170px;
}

.tip-table strong {
  margin-bottom: 0.15rem;
}

.tip-table div {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.tip-table b {
  margin-left: auto;
  padding-left: 1rem;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------ saisie */

.rows {
  display: grid;
}

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 8rem 32px;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--grid);
}

#rows-income .row {
  grid-template-columns: minmax(0, 1fr) 8rem 32px;
}

.row input,
.row select,
.goal input {
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
}

.cell-label {
  width: 100%;
  padding: 0 0.5rem;
  font-weight: 550;
  text-overflow: ellipsis;
}

.cell-category {
  max-width: 8.5rem;
  padding: 0 0.35rem;
  color: var(--ink-2);
  font-size: 13px;
  cursor: pointer;
}

.row input:hover,
.row select:hover {
  background: var(--field);
}

.row input:focus,
.row select:focus,
.goal input:focus {
  background: var(--field);
  border-color: var(--focus);
  outline: none;
}

.amount {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--ink-2);
}

.amount input {
  width: 100%;
  min-width: 0;
  padding: 0 0.5rem;
  text-align: right;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  background: var(--field);
}

.amount input[aria-invalid] {
  border-color: var(--bad);
  color: var(--bad);
}

.row.is-zero .amount input {
  color: var(--muted);
  font-weight: 500;
}

.goal {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 9rem;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
  padding: 1rem;
  border-radius: 14px;
  background: var(--field);
  border: 1px solid var(--border);
}

.goal label {
  display: grid;
  gap: 0.1rem;
  font-size: 13px;
}

.goal-title {
  font-size: 15px;
  font-weight: 650;
}

.goal .amount input {
  min-height: 40px;
  background: var(--glass-2);
  border-color: var(--border);
  font-size: 16px;
}

/* ------------------------------------------------------------------ responsive */

@media (max-width: 1000px) {
  .hero,
  .savings,
  .span-5,
  .span-7 {
    grid-column: 1 / -1;
  }
}

@media (max-width: 700px) {
  .topbar-inner {
    grid-template-columns: 1fr auto;
    grid-template-areas: "brand account" "nav nav";
    padding-inline: 1rem;
  }

  .brand {
    grid-area: brand;
  }

  .account {
    grid-area: account;
  }

  .month-nav {
    grid-area: nav;
    justify-content: center;
  }

  .page {
    padding-inline: 1rem;
  }

  .page-head {
    justify-content: center;
  }

  .card,
  .hero {
    padding: 1.15rem;
  }

  .hero-top .btn {
    font-size: 0;
    gap: 0;
    width: 32px;
    padding: 0;
  }

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

  .savings > :first-child {
    align-self: center;
  }

  .savings-side {
    width: 100%;
  }

  .tiles {
    grid-template-columns: 1fr;
  }

  .tile {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: baseline;
    column-gap: 1rem;
  }

  .tile-value {
    grid-column: 2;
    grid-row: 1;
    margin: 0;
    font-size: 22px;
  }

  .tile-note {
    grid-column: 1;
  }

  .tile .delta {
    grid-column: 2;
    grid-row: 2;
    padding: 0;
    text-align: right;
  }

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

  .stats dd {
    font-size: 20px;
  }

  .strip {
    position: static;
  }

  .meter-label small {
    display: block;
    margin: 0;
  }

  .row {
    grid-template-columns: minmax(0, 1fr) 6.5rem 32px;
    grid-template-areas: "label amount delete" "category amount delete";
    row-gap: 0;
  }

  .row .cell-label {
    grid-area: label;
  }

  .row .cell-category {
    grid-area: category;
    justify-self: start;
    min-height: 28px;
  }

  .row .amount {
    grid-area: amount;
  }

  .row .icon-btn {
    grid-area: delete;
  }

  #rows-income .row {
    grid-template-columns: minmax(0, 1fr) 6.5rem 32px;
    grid-template-areas: "label amount delete";
  }

  .hbar-row {
    grid-template-columns: 6rem minmax(0, 1fr);
  }

  .save-status {
    display: none;
  }

  .save-status[data-kind="error"] {
    display: inline;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}
