/* --------------------------------------------------------------------------
   BudgBaby — démo publique
   Palette reprise de l'application : crème, prune et terracotta.
   -------------------------------------------------------------------------- */

:root {
  --bg: #f8efeb;
  --bg-deep: #f3e4de;
  --paper: #fffaf7;
  --ink: #3c2a2c;
  --muted: #7c6264;
  --line: #ecd9d2;
  --line-strong: #dfc2b9;
  --plum: #8c3c4e;
  --plum-dark: #6d2c3c;
  --plum-soft: #f4dfe2;
  --terracotta: #c97f6d;
  --green: #3f7d5b;
  --shadow: 0 18px 45px rgba(97, 52, 49, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 8% 0%, rgba(201, 127, 109, 0.16), transparent 34%),
    radial-gradient(circle at 100% 10%, rgba(140, 60, 78, 0.08), transparent 30%),
    var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

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

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

/* Bandeau de démonstration */

.demo-strip {
  margin: 0;
  padding: 8px 16px;
  background: var(--plum);
  color: #fff8f5;
  font-size: 0.76rem;
  font-weight: 550;
  letter-spacing: 0.01em;
  text-align: center;
}

.page {
  width: min(1180px, 100% - 40px);
  margin: 0 auto;
  padding: 22px 0 28px;
}

/* En-tête */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 2px 22px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-script {
  font-family: "Segoe Script", "Brush Script MT", "Lucida Handwriting", cursive;
  font-size: clamp(1.8rem, 3.4vw, 2.4rem);
  line-height: 1;
  color: var(--plum);
}

.demo-pill {
  padding: 3px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--paper);
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.topnav a {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
}

.topnav a:hover {
  color: var(--plum);
}

/* Intro */

.intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  padding: 10px 2px 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--plum);
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  max-width: 18ch;
  margin: 0;
  font-size: clamp(2rem, 4.4vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.06;
}

h1 span {
  color: var(--plum);
}

.lead {
  max-width: 54ch;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
}

.intro-note {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 230px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 250, 247, 0.7);
  color: var(--muted);
  font-size: 0.78rem;
}

.intro-note strong {
  color: var(--ink);
  font-size: 0.8rem;
}

/* Statistiques */

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 128px;
  padding: 17px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.stat-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.stat-value {
  margin-top: 6px;
  font-size: clamp(1.45rem, 2.6vw, 1.85rem);
  font-weight: 780;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.stat-note {
  color: var(--muted);
  font-size: 0.76rem;
}

.stat--balance {
  border-color: transparent;
  background: linear-gradient(145deg, var(--plum), var(--plum-dark));
  color: #fff8f5;
}

.stat--balance .stat-label,
.stat--balance .stat-note {
  color: #f0d9db;
}

.stat--goal .progress {
  margin-top: 8px;
}

.progress {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #efdfd8;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--plum), var(--terracotta));
}

/* Tableau de bord */

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.8fr);
  gap: 18px;
  align-items: start;
}

.side {
  display: grid;
  gap: 18px;
}

.panel {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.panel h2 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.panel-sub {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.filter {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.filter:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.filter[aria-pressed="true"] {
  border-color: var(--plum);
  background: var(--plum);
  color: #fff8f5;
}

/* Opérations */

.tx-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tx {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto 26px;
  gap: 11px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.tx:first-child {
  border-top: 0;
  padding-top: 0;
}

.tx-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--c, var(--plum));
  color: #fff;
  font-size: 0.76rem;
  font-weight: 750;
  letter-spacing: 0.02em;
}

.tx-title {
  display: block;
  overflow: hidden;
  font-size: 0.9rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tx-meta {
  display: block;
  color: var(--muted);
  font-size: 0.73rem;
}

.tx-amount {
  font-size: 0.88rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tx-amount--in {
  color: var(--green);
}

.tx-delete {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #b9a19b;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.tx-delete:hover {
  background: var(--plum-soft);
  color: var(--plum-dark);
}

/* Graphique */

.chart-total {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--plum);
  white-space: nowrap;
}

.bars {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.bar-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
  font-size: 0.76rem;
}

.bar-head strong {
  font-weight: 650;
}

.bar-head span {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.bar-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #f1e6e1;
}

.bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--c, var(--plum));
}

/* Formulaire */

.add-form {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.add-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.add-form label > span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 650;
}

.add-form input,
.add-form select {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 0.84rem;
}

.add-form input::placeholder {
  color: #b7a19a;
}

.add-form input:focus,
.add-form select:focus {
  border-color: var(--plum);
  outline: none;
  box-shadow: 0 0 0 3px rgba(140, 60, 78, 0.12);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.btn {
  min-height: 42px;
  margin-top: 2px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--plum);
  color: #fff8f5;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}

.btn:hover {
  background: var(--plum-dark);
}

.btn:active {
  transform: translateY(1px);
}

.form-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.7rem;
  text-align: center;
}

.empty {
  margin: 12px 0 2px;
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

/* Pied de page */

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 26px;
  padding: 18px 2px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.75rem;
}

.site-footer p {
  margin: 0;
}

.site-footer strong {
  color: var(--ink);
}

.footer-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.footer-actions a {
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
}

.footer-actions a:hover {
  color: var(--plum);
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.link-button:hover {
  color: var(--plum);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 50;
  max-width: calc(100% - 32px);
  margin: 0;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--plum-dark);
  color: #fff8f5;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 12px 30px rgba(60, 42, 44, 0.25);
  opacity: 0;
  transform: translate(-50%, 8px);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

.toast:not(:empty) {
  opacity: 1;
  transform: translate(-50%, 0);
}

.noscript {
  position: fixed;
  inset: auto 16px 16px;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--plum);
  color: #fff;
  text-align: center;
}

/* Responsive */

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

  .side {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

@media (max-width: 760px) {
  .page {
    width: min(100% - 28px, 1180px);
  }

  .intro {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .intro-note {
    max-width: none;
  }

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

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

@media (max-width: 520px) {
  .demo-strip {
    font-size: 0.68rem;
  }

  .topbar {
    padding-bottom: 16px;
  }

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

  .stat {
    min-height: 0;
  }

  .panel {
    padding: 16px;
  }

  .panel-head {
    flex-direction: column;
  }

  .tx {
    grid-template-columns: 34px minmax(0, 1fr) auto;
  }

  .tx-delete {
    grid-column: 3;
    grid-row: 1;
  }

  .tx-amount {
    grid-column: 2;
    grid-row: 2;
    justify-self: start;
    font-size: 0.82rem;
  }

  .tx-icon {
    width: 34px;
    height: 34px;
  }

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

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

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