/* ── Variables ───────────────────────────────────────────────────────────── */
:root {
  --bg:      #fbf9f4;
  --card:    #ffffff;
  --input:   #f4efe5;
  --accent:  #2563a8;
  --accent-h:#1a4f8f;
  --ok:      #2f6d4a;
  --ok-bg:   #e8f4ed;
  --warn:    #c87a25;
  --warn-bg: #fef3e2;
  --danger:  #b94343;
  --danger-bg:#fdeaea;
  --text:    #1f2230;
  --text2:   #4b4f5e;
  --sub:     #8a8d99;
  --border:  #e9e3d4;
  --shadow:  0 1px 4px rgba(0,0,0,.06);
  --radius:  10px;
  --sidebar-w: 230px;
}

/* ── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; line-height: 1.5; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
input, select, button, textarea { font: inherit; }
img { display: block; max-width: 100%; }

/* ── Layout ──────────────────────────────────────────────────────────────── */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  transition: transform .25s ease;
}
.sidebar-header {
  padding: 1.25rem 1rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 700;
  font-size: .95rem;
  color: var(--text);
}
.logo-icon { font-size: 1.3rem; }
.sidebar-close {
  display: none;
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--sub);
  padding: .25rem;
}
.sidebar-nav {
  flex: 1;
  padding: .75rem 0;
  overflow-y: auto;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .65rem 1.1rem;
  color: var(--text2);
  font-size: .9rem;
  border-radius: 0;
  transition: background .15s, color .15s;
  text-decoration: none;
}
.nav-link:hover { background: var(--input); color: var(--text); text-decoration: none; }
.nav-link.active { background: #e8f0fb; color: var(--accent); font-weight: 600; border-right: 3px solid var(--accent); }
.nav-icon { font-size: 1rem; width: 1.2rem; text-align: center; }
.sidebar-footer {
  padding: .85rem 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.user-email { font-size: .75rem; color: var(--sub); word-break: break-all; }
.btn-logout {
  font-size: .8rem;
  color: var(--danger);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  padding: 0;
  text-decoration: none;
}
.btn-logout:hover { text-decoration: underline; }
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 199;
}

/* ── Main ────────────────────────────────────────────────────────────────── */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ──────────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .75rem 1.5rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.hamburger {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: .35rem;
}
.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}
.period-selector {
  display: flex;
  align-items: center;
  gap: .6rem;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .3rem .75rem;
}
.period-nav {
  font-size: 1.3rem;
  line-height: 1;
  color: var(--text2);
  text-decoration: none;
  padding: 0 .15rem;
}
.period-nav:hover { color: var(--accent); text-decoration: none; }
.period-label { font-weight: 600; font-size: .9rem; color: var(--text); min-width: 120px; text-align: center; }
.topbar-right { margin-left: auto; font-size: .8rem; color: var(--sub); }

/* ── Page content ────────────────────────────────────────────────────────── */
.page-content { padding: 1.5rem; }
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.page-title { font-size: 1.2rem; font-weight: 700; color: var(--text); }
.section-title {
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--sub);
  margin: 1.25rem 0 .6rem;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow);
}
.card-title {
  font-weight: 700;
  font-size: .9rem;
  color: var(--text);
  margin-bottom: .85rem;
}

/* ── Metrics ─────────────────────────────────────────────────────────────── */
.metrics-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.metric-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  flex: 1;
  min-width: 140px;
  box-shadow: var(--shadow);
}
.metric-label { font-size: .75rem; color: var(--sub); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .25rem; }
.metric-value { font-size: 1.5rem; font-weight: 700; color: var(--text); }
.metric-revenus { border-top: 3px solid var(--accent); }
.metric-depenses { border-top: 3px solid var(--warn); }
.metric-epargne { border-top: 3px solid var(--ok); }
.metric-deficit { border-top: 3px solid var(--danger); }

/* ── Member cards ────────────────────────────────────────────────────────── */
.member-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.member-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}
.member-card-child { background: var(--input); }
.member-card-name { font-weight: 700; font-size: .95rem; margin-bottom: .15rem; }
.member-card-role { font-size: .72rem; color: var(--sub); margin-bottom: .5rem; text-transform: uppercase; letter-spacing: .05em; }
.member-card-amount { font-size: 1.3rem; font-weight: 700; color: var(--text); }
.member-card-sub { font-size: .72rem; color: var(--sub); }
.member-card-dual { margin-top: .25rem; display: flex; flex-direction: column; gap: .4rem; }
.member-card-dual-row { display: flex; flex-direction: column; gap: .05rem; }
.member-card-dual-label { font-size: .72rem; color: var(--sub); text-transform: uppercase; letter-spacing: .03em; }
.member-card-dual-val { font-size: 1rem; font-weight: 700; color: var(--text); line-height: 1.2; }
.member-card-dual-sub .member-card-dual-val { font-size: .88rem; font-weight: 600; color: var(--text2); }

/* ── Household title ─────────────────────────────────────────────────────── */
.household-title { font-size: 1rem; font-weight: 600; color: var(--accent); margin-bottom: .1rem; }

/* ── Charts ──────────────────────────────────────────────────────────────── */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.chart-card { }
.chart-wrap { max-width: 280px; margin: 0 auto; }
.chart-wrap-bar { max-width: 100%; height: 320px; }

/* ── Budget bars ─────────────────────────────────────────────────────────── */
.budget-list { display: flex; flex-direction: column; gap: .55rem; }
.budget-row { }
.budget-row-header {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-bottom: .2rem;
}
.budget-cat { font-size: .82rem; font-weight: 500; flex: 1; }
.budget-amounts { font-size: .75rem; color: var(--sub); margin-left: auto; }
.budget-warn-icon { color: var(--warn); font-size: .85rem; }
.budget-bar-track {
  height: 7px;
  background: var(--input);
  border-radius: 4px;
  overflow: hidden;
}
.budget-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width .3s;
}
.budget-bar-ok { background: var(--ok); }
.budget-bar-warn { background: var(--warn); }
.budget-bar-danger { background: var(--danger); }

/* ── Table ───────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table-card { padding: 0; }
.table-card .card-title { padding: 1rem 1.25rem .75rem; margin-bottom: 0; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}
.table th {
  background: var(--input);
  color: var(--sub);
  font-weight: 600;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: .55rem .9rem;
  text-align: left;
  white-space: nowrap;
}
.table td {
  padding: .6rem .9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--bg); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-sub { color: var(--text2); }
.amount { font-weight: 600; }

/* ── Tags & badges ───────────────────────────────────────────────────────── */
.tag {
  display: inline-block;
  background: var(--input);
  color: var(--text2);
  border-radius: 4px;
  padding: .1rem .45rem;
  font-size: .75rem;
  font-weight: 500;
  white-space: nowrap;
}
.type-badge {
  display: inline-block;
  border-radius: 4px;
  padding: .1rem .45rem;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.type-fixe { background: var(--warn-bg); color: var(--warn); }
.type-variable { background: var(--ok-bg); color: var(--ok); }
.dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: .25rem;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1rem;
  border-radius: 7px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 500;
  font-size: .85rem;
  transition: background .15s, box-shadow .15s;
  text-decoration: none;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-h); text-decoration: none; color: #fff; }
.btn-outline {
  background: transparent;
  color: var(--text2);
  border-color: var(--border);
}
.btn-outline:hover { background: var(--input); text-decoration: none; }
.btn-full { width: 100%; justify-content: center; }
.btn-sm { padding: .3rem .7rem; font-size: .78rem; }
.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: .95rem;
  padding: .25rem;
  border-radius: 5px;
  transition: background .15s;
}
.btn-icon:hover { background: var(--input); }
.btn-remove-member {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--danger);
  font-size: .9rem;
  padding: .25rem .4rem;
  border-radius: 5px;
}
.btn-remove-member:hover { background: var(--danger-bg); }

/* ── Filters bar ─────────────────────────────────────────────────────────── */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  padding: .65rem 1rem;
  margin-bottom: 1rem;
}
.filter-select {
  padding: .35rem .65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--input);
  color: var(--text);
  font-size: .82rem;
  cursor: pointer;
}

/* ── Bicolor bar ─────────────────────────────────────────────────────────── */
.bicolor-bar {
  display: flex;
  height: 10px;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: .4rem;
}
.bicolor-segment { transition: width .3s; }
.bicolor-legend {
  display: flex;
  gap: 1rem;
  font-size: .78rem;
  color: var(--text2);
  align-items: center;
}

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--card);
  border-radius: var(--radius);
  width: 100%;
  max-width: 480px;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem .75rem;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-weight: 700; font-size: 1rem; }
.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--sub);
  font-size: 1rem;
  padding: .25rem;
}
.modal-form { padding: 1rem 1.25rem; }
.modal-footer {
  display: flex;
  gap: .65rem;
  justify-content: flex-end;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  margin-top: 1rem;
}

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  margin-bottom: .75rem;
}
.form-group label { font-size: .8rem; font-weight: 600; color: var(--text2); }
.form-group input,
.form-group select,
.form-group textarea {
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--input);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,168,.12);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}

/* ── Flash messages ──────────────────────────────────────────────────────── */
.flash-container { padding: 0 1.5rem; margin-top: .75rem; }
.flash {
  padding: .6rem 1rem;
  border-radius: 7px;
  font-size: .85rem;
  margin-bottom: .4rem;
}
.flash-error { background: var(--danger-bg); color: var(--danger); border: 1px solid #f1c4c4; }
.flash-success { background: var(--ok-bg); color: var(--ok); border: 1px solid #b7dcc8; }

/* ── Auth pages ──────────────────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 1.5rem;
}
.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 4px 24px rgba(0,0,0,.08);
}
.auth-page-wide { align-items: flex-start; padding-top: 2rem; }
.auth-card-wide { max-width: 540px; }
.auth-logo { font-size: 2.5rem; text-align: center; margin-bottom: .5rem; }
.auth-title { font-size: 1.3rem; font-weight: 800; text-align: center; color: var(--text); margin-bottom: .15rem; }
.auth-sub { font-size: .82rem; color: var(--sub); text-align: center; margin-bottom: 1.25rem; }
.auth-form { margin-top: 1rem; }
.auth-link { font-size: .82rem; color: var(--sub); text-align: center; margin-top: 1rem; }
.checkbox-label {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .82rem;
  color: var(--text2);
  margin-bottom: .75rem;
  cursor: pointer;
}

/* ── Setup members ───────────────────────────────────────────────────────── */
.members-section { margin-top: 1rem; }
.members-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .4rem;
}
.label-text { font-size: .8rem; font-weight: 600; color: var(--text2); }
.members-hint { font-size: .75rem; color: var(--sub); margin-bottom: .6rem; }
.member-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .5rem;
}
.member-input-name {
  flex: 1;
  padding: .4rem .65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--input);
}
.member-input-role {
  padding: .4rem .5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--input);
  font-size: .82rem;
}
.payer-check {
  display: flex;
  align-items: center;
  gap: .25rem;
  font-size: .78rem;
  color: var(--text2);
  white-space: nowrap;
}

/* ── Settings ────────────────────────────────────────────────────────────── */
.settings-section { margin-bottom: 1.25rem; }
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .75rem;
  margin-bottom: .75rem;
}
.settings-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .75rem;
  margin-bottom: .75rem;
}
.settings-desc { font-size: .82rem; color: var(--text2); margin-bottom: .65rem; }
.reconduire-result { font-size: .82rem; margin-left: .75rem; }
.text-ok { color: var(--ok); }
.text-danger { color: var(--danger); }

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: .65rem 1.1rem;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 500;
  z-index: 1000;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
  transition: opacity .3s;
}
.toast.hidden { display: none; }
.toast-ok { background: var(--ok); color: #fff; }
.toast-error { background: var(--danger); color: #fff; }

/* ── Misc ────────────────────────────────────────────────────────────────── */
.empty-state { color: var(--sub); font-size: .85rem; padding: .75rem 0; }
.hidden { display: none !important; }
.no-results { color: var(--sub); font-size: .85rem; padding: .75rem 1.25rem; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-close { display: block; }
  .sidebar-overlay.open { display: block; }

  .main { margin-left: 0; }
  .hamburger { display: flex; }

  .charts-row { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .metrics-row { gap: .6rem; }
  .metric-card { min-width: 130px; }
  .page-content { padding: 1rem; }
  .topbar { padding: .6rem 1rem; }
  .member-cards-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .modal { margin: 0; border-radius: var(--radius) var(--radius) 0 0; }
  .modal-overlay { align-items: flex-end; }
  .filters-bar { gap: .4rem; }
  .filter-select { font-size: .78rem; }
  .auth-card { padding: 1.5rem 1.25rem; }
}

@media (max-width: 480px) {
  .bicolor-legend { font-size: .72rem; gap: .6rem; }
  .member-row { flex-wrap: wrap; }
  .period-label { min-width: 100px; font-size: .82rem; }
}

/* ── Login page ──────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
}

/* Left brand panel */
.login-brand {
  flex: 1.05;
  background: oklch(38% 0.14 258);
  background-image: url('/static/hero.jpg');
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3.5rem 3rem;
  position: relative;
  overflow: hidden;
}
.login-brand::before {
  content: '';
  position: absolute;
  inset: 0;
  background: oklch(30% 0.13 258 / 0.84);
  z-index: 0;
}
.login-brand-inner {
  max-width: 380px;
  width: 100%;
  position: relative;
  z-index: 1;
}
.login-logo-mark {
  display: flex;
  align-items: center;
  gap: .7rem;
  margin-bottom: 1.75rem;
}
.login-logo-icon { font-size: 2rem; }
.login-logo-text {
  font-size: 1.25rem;
  font-weight: 800;
  color: oklch(97% 0.01 258);
  letter-spacing: -.015em;
}
.login-tagline {
  font-size: .9rem;
  line-height: 1.7;
  color: oklch(84% 0.04 258);
  margin-bottom: 2rem;
}
.login-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .7rem;
  margin-bottom: 2.5rem;
}
.login-features li {
  display: flex;
  align-items: center;
  gap: .7rem;
  font-size: .85rem;
  color: oklch(90% 0.03 258);
}
.login-feat-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: oklch(70% 0.09 258);
  flex-shrink: 0;
}
.login-privacy-note {
  display: flex;
  align-items: flex-start;
  gap: .7rem;
  background: oklch(33% 0.11 258);
  border-radius: 8px;
  padding: .9rem 1.05rem;
}
.login-privacy-icon { font-size: .95rem; flex-shrink: 0; margin-top: .1rem; }
.login-privacy-note p {
  font-size: .77rem;
  line-height: 1.55;
  color: oklch(82% 0.04 258);
  margin: 0;
}

/* Right form panel */
.login-form-side {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 2.5rem;
  background: var(--bg);
}
.login-form-inner {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
}
.login-form-header { margin-bottom: 1.5rem; }
.login-form-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.02em;
  margin-bottom: .3rem;
}
.login-form-sub {
  font-size: .85rem;
  color: var(--sub);
}
.login-form { display: flex; flex-direction: column; gap: .85rem; }
.login-submit { margin-top: .4rem; padding: .75rem 1rem; font-size: .95rem; }
.login-pwd-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.login-forgot-link {
  font-size: .75rem;
  color: var(--sub);
  font-weight: 400;
}
.login-forgot-link:hover { color: var(--accent); text-decoration: none; }
.login-register-link {
  font-size: .82rem;
  color: var(--sub);
  text-align: center;
  margin-top: 1.25rem;
}
.login-register-link a { color: var(--accent); font-weight: 500; }
.reset-info-box {
  margin: 1.25rem 0 .5rem;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .85rem 1rem;
  font-size: .82rem;
  color: var(--text2);
  line-height: 1.6;
}
.reset-info-box p { margin: 0; }
.login-signature {
  text-align: center;
  font-size: .7rem;
  color: var(--sub);
  margin-top: 2rem;
  letter-spacing: .06em;
  opacity: .7;
}

/* Login responsive */
@media (max-width: 860px) {
  .login-page { flex-direction: column; }
  .login-brand {
    flex: none;
    padding: 2.25rem 1.75rem 2rem;
  }
  .login-brand-inner { max-width: 100%; }
  .login-features {
    flex-direction: row;
    flex-wrap: wrap;
    gap: .5rem .75rem;
  }
  .login-form-side { padding: 2.25rem 1.5rem; }
}
@media (max-width: 480px) {
  .login-features { display: none; }
  .login-brand { padding: 1.75rem 1.25rem 1.5rem; }
  .login-tagline { margin-bottom: 1.25rem; }
  .login-form-title { font-size: 1.35rem; }
}

/* ── Contact page ────────────────────────────────────────────────────────── */
.contact-card { max-width: 480px; }
.contact-optional { font-size: .75rem; color: var(--sub); font-weight: 400; }
.contact-card textarea {
  width: 100%;
  resize: vertical;
  min-height: 110px;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .55rem .75rem;
  font: inherit;
  color: var(--text);
  transition: border-color .15s;
}
.contact-card textarea:focus { outline: none; border-color: var(--accent); }
.contact-link-sep { display: none; }
.login-contact-link {
  text-align: center;
  font-size: .8rem;
  margin-top: .75rem;
}
.login-contact-link a { color: var(--sub); }
.login-contact-link a:hover { color: var(--accent); }

/* ── Admin messages ──────────────────────────────────────────────────────── */
.admin-badge {
  font-size: .72rem;
  font-weight: 600;
  background: var(--warn-bg);
  color: var(--warn);
  padding: .2rem .65rem;
  border-radius: 999px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.msg-unread { background: oklch(98% 0.01 258); }
.msg-unread td:first-child { font-weight: 600; }
.msg-text { max-width: 320px; white-space: pre-wrap; word-break: break-word; font-size: .85rem; color: var(--text2); }
.msg-status-lu { font-size: .75rem; color: var(--sub); }

/* ── Admin dashboard ─────────────────────────────────────────────────────── */
.admin-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1.25rem;
}
.admin-stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
.admin-stat-card.admin-stat-danger { border-color: var(--danger); background: var(--danger-bg); }
.admin-stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
.admin-stat-danger .admin-stat-value { color: var(--danger); }
.admin-stat-label { font-size: .8rem; color: var(--sub); font-weight: 500; }

.badge {
  display: inline-block;
  font-size: .7rem;
  font-weight: 600;
  padding: .2rem .55rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.badge-admin   { background: oklch(93% 0.04 258); color: var(--accent); }
.badge-user    { background: var(--input); color: var(--sub); }
.badge-active  { background: var(--ok-bg); color: var(--ok); }
.badge-blocked { background: var(--danger-bg); color: var(--danger); }

.user-blocked td { opacity: .55; }
.btn-danger {
  background: var(--danger);
  color: #fff;
  border: none;
}
.btn-danger:hover { background: oklch(40% 0.15 25); }

@media (max-width: 640px) {
  .admin-stats-row { grid-template-columns: 1fr; }
}

/* ── Guide d'utilisation ─────────────────────────────────────────────────── */
.guide-page {
  max-width: 780px;
}
.guide-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 0 1.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.guide-hero-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.guide-hero-icon {
  font-size: 2.25rem;
  line-height: 1;
}
.guide-hero-title {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.guide-hero-sub {
  font-size: .9rem;
  color: var(--sub);
  margin-top: .2rem;
}
.guide-pdf-btn {
  white-space: nowrap;
  flex-shrink: 0;
}
.guide-pdf-icon { margin-right: .25rem; }

.guide-toc {
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
}
.guide-toc-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--sub);
  margin-bottom: .6rem;
}
.guide-toc-list {
  margin: 0;
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.guide-toc-list li { font-size: .88rem; }
.guide-toc-list a { color: var(--text2); }
.guide-toc-list a:hover { color: var(--accent); text-decoration: none; }

.guide-section {
  margin-bottom: 2.5rem;
}
.guide-section-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.guide-section-num {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .9rem;
  margin-top: .1rem;
}
.guide-section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.guide-section-intro {
  font-size: .85rem;
  color: var(--sub);
  margin-top: .2rem;
}

.guide-steps {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-left: 3rem;
}
.guide-step {
  display: flex;
  align-items: flex-start;
  gap: .85rem;
}
.guide-step-num {
  flex-shrink: 0;
  width: 1.55rem;
  height: 1.55rem;
  border: 2px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  color: var(--sub);
  margin-top: .15rem;
}
.guide-step-body { flex: 1; }
.guide-step-body strong {
  display: block;
  font-weight: 600;
  color: var(--text);
  margin-bottom: .3rem;
}
.guide-step-body p {
  font-size: .88rem;
  color: var(--text2);
  line-height: 1.6;
}

.guide-list {
  margin: .4rem 0 0 1rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.guide-list li {
  font-size: .87rem;
  color: var(--text2);
  line-height: 1.5;
}

.guide-tip {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  background: oklch(97% 0.015 90);
  border: 1px solid oklch(88% 0.04 90);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  font-size: .85rem;
  color: var(--text2);
  margin-top: 1rem;
  margin-left: 3rem;
  line-height: 1.55;
}
.guide-tip-icon { font-size: 1rem; flex-shrink: 0; line-height: 1.55; }

.guide-badge {
  display: inline-block;
  padding: .1rem .45rem;
  border-radius: 4px;
  font-size: .8rem;
  font-weight: 600;
}
.guide-badge-ok     { background: var(--ok-bg);     color: var(--ok); }
.guide-badge-warn   { background: var(--warn-bg);   color: var(--warn); }
.guide-badge-danger { background: var(--danger-bg); color: var(--danger); }

.guide-footer {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  margin-top: 1rem;
  font-size: .8rem;
  color: var(--sub);
  text-align: center;
}

/* ── Liste de courses ─────────────────────────────────────────────────────── */
.courses-section-label {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--sub);
  padding: .25rem 0 .4rem;
  margin-top: 1rem;
}
.courses-section-done { color: var(--ok); }

.courses-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem .9rem;
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.courses-item:last-child { border-bottom: none; }
.courses-item:hover { background: var(--input); }
.courses-item-done .courses-nom { text-decoration: line-through; color: var(--sub); }
.courses-item-done .courses-qty { color: var(--sub); }
.courses-item-done { background: #f6faf7; }

.courses-check-wrap {
  display: flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}
.courses-checkbox { display: none; }
.courses-checkmark {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, border-color .15s;
  flex-shrink: 0;
}
.courses-checkbox:checked + .courses-checkmark {
  background: var(--ok);
  border-color: var(--ok);
}
.courses-checkbox:checked + .courses-checkmark::after {
  content: '✓';
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
}

.courses-item-body {
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: .5rem;
}
.courses-nom { font-weight: 600; font-size: .95rem; }
.courses-qty { font-size: .82rem; color: var(--sub); }

.courses-item-meta {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .75rem;
  color: var(--sub);
}
.courses-by {
  background: var(--input);
  padding: .1rem .45rem;
  border-radius: 20px;
  font-weight: 600;
}
.courses-del {
  background: none;
  border: none;
  color: var(--sub);
  cursor: pointer;
  font-size: .85rem;
  padding: .25rem .35rem;
  border-radius: 4px;
  line-height: 1;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity .15s, color .15s;
}
.courses-item:hover .courses-del { opacity: 1; }
.courses-del:hover { color: var(--danger); }

.courses-empty {
  padding: 1.5rem;
  text-align: center;
  color: var(--sub);
  font-size: .9rem;
}

/* ── Print / Export PDF ──────────────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .hamburger, .sidebar-overlay,
  .page-header button, .btn, .filters-bar,
  .btn-icon, .modal-overlay, .toast, .no-print { display: none !important; }
  .main { margin-left: 0; }
  .page-content { padding: .5rem; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .charts-row { grid-template-columns: 1fr 1fr; }
  .chart-wrap { max-width: 220px; }
  body { background: #fff; }
  .household-title { color: #000; }

  /* Guide-specific print styles */
  .guide-page { max-width: 100%; }
  .guide-hero { padding: .5rem 0 1rem; border-bottom: 2px solid #ccc; }
  .guide-hero-title { font-size: 1.6rem; }
  .guide-section { break-inside: avoid; margin-bottom: 1.75rem; }
  .guide-section-num { background: #1f2230; color: #fff; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .guide-tip { border: 1px solid #ccc; background: #f9f9f9; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .guide-badge { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .guide-footer { display: block !important; margin-top: 2rem; }
  a { color: #000; text-decoration: none; }
}
