:root {
    /* Palette Design B - Soft */
    --bg: #f5f5f0;
    --paper: #ffffff;
    --ink: #1d1d1f;
    --ink-soft: #424248;
    --muted: #86868b;
    --line: #f0f0eb;
    --line-strong: #e3e3dc;
    --blue: #4a76d6;
    --green: #6a9c75;
    --orange: #d68b4a;
    --pink: #d67aa1;
    --soft-blue: #e8eef9;
    --soft-green: #ecf2ee;
    --soft-orange: #faeee0;
    --soft-pink: #f8eaf0;

    /* Aliases pour les anciens noms (compat) */
    --cream: var(--bg);
    --cream-deep: var(--line);
    --paper-bg: var(--paper);
    --terra: var(--pink);
    --terra-deep: #b85a82;
    --forest: var(--green);
    --forest-light: #87b292;
    --gold: var(--orange);
    --rose: var(--pink);
    --blue-deep: #3958a3;
    --shadow: 0 1px 2px rgba(29, 29, 31, 0.04);
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  html, body {
    background: var(--bg);
    color: var(--ink);
    font-family: 'DM Sans', -apple-system, sans-serif;
    font-feature-settings: 'tnum';
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.5;
  }
  .app { max-width: 1280px; margin: 0 auto; padding: 36px 32px 80px; }

  header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 28px;
    padding: 0;
    border: none;
  }
  .logo {
    font-size: 24px; font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
  }
  .logo span { color: var(--muted); font-weight: 400; font-style: normal; }
  .date-now {
    background: var(--paper);
    padding: 10px 18px;
    border-radius: 100px;
    font-size: 13px;
    color: var(--ink-soft);
    font-weight: 500;
    text-align: right;
    letter-spacing: 0;
    text-transform: none;
  }
  .date-now strong { color: var(--ink); font-weight: 600; display: inline; text-transform: capitalize; }
  .date-now div { display: inline; color: var(--muted); }
  .date-now div::after { content: ' · '; }

  /* NAV - pills */
  .nav-tabs {
    display: flex; gap: 6px;
    margin-bottom: 28px;
    background: var(--paper);
    padding: 6px;
    border-radius: 14px;
    width: fit-content;
    border: none;
  }
  .nav-tab {
    padding: 10px 18px;
    border: none;
    background: transparent;
    color: var(--muted);
    font-family: inherit; font-size: 13px; font-weight: 500;
    cursor: pointer;
    border-radius: 9px;
    transition: all .2s;
    letter-spacing: 0;
    text-transform: none;
    margin-bottom: 0;
  }
  .nav-tab:hover { color: var(--ink-soft); }
  .nav-tab.active {
    background: var(--ink);
    color: white;
    border-bottom: none;
  }

  /* HERO */
  .hero {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr 1fr;
    gap: 14px;
    margin-bottom: 24px;
    background: transparent;
    border-radius: 0;
    overflow: visible;
    box-shadow: none;
  }
  @media (max-width: 900px) { .hero { grid-template-columns: 1fr 1fr; } }
  .hero-block {
    background: var(--paper);
    border-radius: 20px;
    padding: 22px 24px;
    border: none;
  }
  .hero-block.primary {
    background: linear-gradient(145deg, #2d3142 0%, #1d1d1f 100%);
    color: white;
    grid-row: span 1;
    position: relative;
    overflow: hidden;
  }
  .hero-label {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 6px;
    letter-spacing: 0;
    text-transform: none;
    font-weight: 500;
  }
  .hero-block.primary .hero-label { color: rgba(255,255,255,.55); }
  .hero-value {
    font-size: 28px; font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.1;
    font-family: 'DM Sans', sans-serif;
  }
  .hero-block.primary .hero-value { font-size: 38px; }
  .hero-value .cents { font-size: 15px; color: var(--muted); font-weight: 500; }
  .hero-value .eur { font-size: 14px; color: var(--muted); margin-left: 4px; font-weight: 500;}
  .hero-block.primary .hero-value .cents { color: rgba(255,255,255,.5); font-size: 18px; }
  .hero-block.primary .hero-value .eur { color: rgba(255,255,255,.5); font-size: 16px; }
  .hero-sub {
    margin-top: 8px;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.4;
  }
  .hero-block.primary .hero-sub { color: rgba(255,255,255,.6); }
  .hero-sub strong { color: var(--green); font-weight: 600; }
  .hero-block.primary .hero-sub strong { color: var(--orange); }
  .hero-progress {
    margin-top: 14px;
    height: 4px;
    background: rgba(255,255,255,.1);
    border-radius: 100px;
    overflow: hidden;
  }
  .hero-progress-fill {
    height: 100%;
    background: var(--orange);
    border-radius: 100px;
    transition: width .6s ease-out, background .3s;
  }
  .hero-progress-fill.warn { background: var(--pink); }
  .hero-progress-fill.good { background: var(--green); }

  /* FORMS */
  .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
  }
  .form-row.tri { grid-template-columns: 1fr 1fr 1fr; }
  .form-row.single { grid-template-columns: 1fr; }
  .field label {
    display: block;
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 6px;
    letter-spacing: 0;
    text-transform: none;
    font-weight: 500;
  }
  input, select, textarea {
    width: 100%;
    background: var(--bg);
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 10px 14px;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    color: var(--ink);
    transition: all .2s;
  }
  input:focus, select:focus {
    outline: none;
    border-color: var(--blue);
    background: var(--paper);
  }
  input[type="number"] { font-family: 'DM Sans', sans-serif; font-size: 16px; font-weight: 600; }
  input[type="date"] { color-scheme: light; }
  .btn {
    background: var(--ink);
    color: white;
    border: none;
    padding: 12px 20px;
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    border-radius: 10px;
    transition: opacity .2s, transform .15s;
    width: 100%;
    margin-top: 12px;
    letter-spacing: 0;
    text-transform: none;
  }
  .btn:hover { opacity: .88; }
  .btn:active { transform: scale(0.98); }
  .btn.ghost {
    background: var(--bg);
    color: var(--ink-soft);
    border: 1px solid var(--line-strong);
    padding: 8px 14px;
    font-size: 12px;
    margin-top: 0;
    width: auto;
  }
  .btn.ghost:hover { background: var(--line); color: var(--ink); }
  .btn.dark { background: var(--ink); color: white; }
  .btn.dark:hover { opacity: .88; }
  .btn.blue { background: var(--blue); color: white; }
  .btn.blue:hover { opacity: .88; }

  .filter-row {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    flex-wrap: wrap;
  }
  .filter-chip {
    padding: 7px 14px;
    background: var(--bg);
    border: 1px solid transparent;
    border-radius: 100px;
    font-size: 12.5px;
    cursor: pointer;
    color: var(--ink-soft);
    transition: all .2s;
    font-family: inherit;
    font-weight: 500;
  }
  .filter-chip:hover { background: var(--line); }
  .filter-chip.active {
    background: var(--ink);
    color: white;
    border-color: var(--ink);
  }

  /* GRID LAYOUTS */
  .grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .grid-3 {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
  }
  @media (max-width: 1100px) {
    .grid-3 { grid-template-columns: 1fr 1fr; }
  }
  @media (max-width: 800px) {
    .grid, .grid-3 { grid-template-columns: 1fr; }
  }

  /* Card pleine largeur (au-dessus de la grille) */
  .card-full {
    margin-bottom: 12px;
  }
  .form-row-4 {
    grid-template-columns: 2fr 1fr 1fr 1.3fr;
    gap: 14px;
  }
  @media (max-width: 800px) {
    .form-row-4 { grid-template-columns: 1fr 1fr; }
  }
  .btn-inline {
    width: auto;
    padding: 10px 20px;
    margin-top: 14px;
  }

  /* CARD */
  .card {
    background: var(--paper);
    border: none;
    border-radius: 16px;
    padding: 16px 18px 18px;
    box-shadow: none;
    margin-bottom: 12px;
  }
  .card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.01em;
    text-transform: none;
    font-family: 'DM Sans', sans-serif;
  }
  .card-title::before { content: none; }
  .card-title .meta {
    margin-left: auto;
    font-weight: 500;
    color: var(--muted);
    text-transform: none;
    letter-spacing: 0;
    font-size: 12px;
    font-family: 'DM Sans', sans-serif;
  }

  /* TX LIST */
  .tx-list { list-style: none; }
  .tx-item {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: 10px;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
    animation: fadeIn .3s ease-out;
  }
  .tx-item:last-child { border-bottom: none; }
  @keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
  }
  .tx-cat-dot {
    width: 32px; height: 32px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px;
    font-weight: 600;
    background: var(--bg);
    position: relative;
  }
  .tx-cat-dot.recur::after {
    content: '↻';
    position: absolute;
    bottom: -2px; right: -2px;
    width: 16px; height: 16px;
    background: var(--orange);
    color: white;
    border-radius: 50%;
    font-size: 9px;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--paper);
    font-weight: 700;
  }
  .tx-main { display: flex; flex-direction: column; min-width: 0;}
  .tx-label { font-size: 13.5px; color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}
  .tx-meta { font-size: 11.5px; color: var(--muted); margin-top: 1px;}
  .tx-amount {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    white-space: nowrap;
    font-family: 'DM Sans', sans-serif;
    font-variant-numeric: tabular-nums;
  }
  .tx-amount.income { color: var(--green); }
  .tx-amount::before { content: '−'; color: var(--muted); margin-right: 2px; font-weight: 500;}
  .tx-amount.income::before { content: '+'; color: var(--green); margin-right: 2px;}
  .tx-amount.neutral::before { content: ''; }
  .tx-amount.neutral { color: var(--ink); }
  .tx-del {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 14px;
    padding: 4px 8px;
    border-radius: 6px;
    opacity: 0;
    transition: all .2s;
  }
  .tx-item:hover .tx-del { opacity: 1; }
  .tx-del:hover { color: var(--pink); background: var(--soft-pink);}

  .empty {
    text-align: center;
    padding: 36px 0;
    color: var(--muted);
    font-style: normal;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
  }

  /* RECURRING */
  .recur-list { list-style: none; }
  .recur-item {
    display: grid;
    grid-template-columns: auto 1fr auto auto auto;
    gap: 14px;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }
  .recur-item:last-child { border-bottom: none; }
  .day-badge {
    background: var(--bg);
    color: var(--ink-soft);
    font-size: 11.5px;
    padding: 4px 10px;
    border-radius: 100px;
    font-weight: 600;
    white-space: nowrap;
    font-family: 'DM Sans', sans-serif;
  }
  .toggle {
    width: 38px; height: 22px;
    background: var(--line-strong);
    border-radius: 100px;
    position: relative;
    cursor: pointer;
    transition: background .2s;
  }
  .toggle::after {
    content: '';
    position: absolute;
    top: 2px; left: 2px;
    width: 18px; height: 18px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
    transition: transform .2s;
  }
  .toggle.on { background: var(--green); }
  .toggle.on::after { transform: translateX(16px); }

  /* BUDGETS */
  .budget-item { margin-bottom: 12px; }
  .budget-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
  }
  .budget-cat { font-size: 13px; font-weight: 500; }
  .budget-val { font-size: 12px; color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums;}
  .budget-val strong { color: var(--ink); font-weight: 600;}
  .progress {
    height: 6px;
    background: var(--line);
    border-radius: 100px;
    overflow: hidden;
  }
  .progress-fill {
    height: 100%;
    background: var(--green);
    border-radius: 100px;
    transition: width .5s ease-out, background .3s;
  }
  .progress-fill.warn { background: var(--orange); }
  .progress-fill.danger { background: var(--pink); }
  .progress-fill.blue { background: var(--blue); }

  /* CHART */
  .chart-wrap {
    height: 180px;
    margin: 8px 0 4px;
    position: relative;
  }
  .chart-legend {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
  }
  .legend-item {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12.5px;
  }
  .legend-dot { width: 9px; height: 9px; border-radius: 3px; }
  .legend-label { flex: 1; color: var(--ink-soft); font-weight: 500;}
  .legend-val { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums;}

  .quick-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
  }
  .quick-cat {
    padding: 6px 12px;
    border: 1px solid transparent;
    border-radius: 100px;
    background: var(--bg);
    font-size: 12.5px;
    cursor: pointer;
    transition: all .15s;
    font-family: inherit;
    font-weight: 500;
    color: var(--ink-soft);
  }
  .quick-cat:hover { background: var(--line); }
  .quick-cat.active { background: var(--green); color: white; border-color: var(--green);}

  /* BREAKDOWN */
  .breakdown { display: flex; flex-direction: column; gap: 2px; margin-top: 4px;}
  .breakdown-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 0;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
  }
  .breakdown-row:last-child { border-bottom: none; }
  .breakdown-label {
    display: flex; align-items: center; gap: 8px;
    color: var(--ink-soft);
  }
  .breakdown-dot { width: 7px; height: 7px; border-radius: 50%; }
  .breakdown-val {
    font-size: 14px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
  }
  .breakdown-row.total {
    border-bottom: none;
    border-top: 1.5px solid var(--ink);
    margin-top: 4px;
    padding-top: 11px;
  }
  .breakdown-row.total .breakdown-label { font-weight: 700; color: var(--ink);}
  .breakdown-row.total .breakdown-val { font-size: 17px;}

  .alert {
    background: var(--pink);
    color: white;
    padding: 12px 18px;
    border-radius: 12px;
    margin-bottom: 12px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn .4s ease-out;
    font-weight: 500;
  }
  .alert.warn { background: var(--orange); color: white; }
  .alert.success { background: var(--green); color: white;}
  @keyframes slideIn {
    from { opacity: 0; transform: translateX(-8px);}
    to { opacity: 1; transform: translateX(0);}
  }
  .alert-icon {
    font-size: 18px;
    line-height: 1;
    font-weight: 700;
  }

  .view { display: none; }
  .view.active { display: block; animation: fadeIn .3s; }

  footer {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--line);
    text-align: center;
    font-size: 12.5px;
    color: var(--muted);
    font-family: 'DM Sans', sans-serif;
  }
  footer .ornament {
    font-size: 18px;
    color: var(--orange);
    margin-bottom: 6px;
  }

  .section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
  }
  .section-head h3 {
    font-weight: 600;
    font-size: 14px;
    font-style: normal;
    letter-spacing: -0.005em;
  }
  .section-head .count {
    font-size: 12px;
    color: var(--muted);
    letter-spacing: 0;
    text-transform: none;
    font-weight: 500;
  }

  /* SAVINGS ACCOUNTS - cards en dégradés doux */
  .accounts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
  }
  .account-card {
    background: linear-gradient(140deg, #4a76d6 0%, #3958a3 100%);
    color: white;
    border-radius: 16px;
    padding: 20px 22px 18px;
    position: relative;
    overflow: hidden;
    box-shadow: none;
    cursor: pointer;
    transition: transform .2s;
    border: none;
  }
  .account-card:hover { transform: translateY(-2px); }
  .account-card.active {
    outline: 3px solid var(--ink);
    outline-offset: 3px;
  }
  .account-card.livret-a {
    background: linear-gradient(140deg, #6a9c75 0%, #4d7a58 100%);
  }
  .account-card.ldds {
    background: linear-gradient(140deg, #d68b4a 0%, #a66833 100%);
  }
  .account-card::before {
    content: '';
    position: absolute;
    top: -40px; right: -40px;
    width: 120px; height: 120px;
    background: rgba(255,255,255,.1);
    border-radius: 50%;
  }
  .account-name {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 4px;
    position: relative;
    font-style: normal;
  }
  .account-type {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255,255,255,.7);
    margin-bottom: 18px;
    position: relative;
    font-weight: 500;
  }
  .account-balance {
    font-weight: 700;
    font-size: 30px;
    letter-spacing: -0.025em;
    line-height: 1;
    position: relative;
    font-variant-numeric: tabular-nums;
  }
  .account-balance .cents {
    font-size: 16px;
    color: rgba(255,255,255,.55);
    font-weight: 500;
  }
  .account-balance .eur {
    font-size: 14px;
    color: rgba(255,255,255,.55);
    margin-left: 4px;
    font-weight: 500;
  }
  .account-meta {
    margin-top: 12px;
    font-size: 11.5px;
    color: rgba(255,255,255,.7);
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .account-month-change {
    font-size: 12.5px;
    font-weight: 600;
    color: rgba(255,255,255,.95);
  }
  .account-month-change.neg { color: #ffd5db; }

  .account-detail {
    background: var(--paper);
    border: none;
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: none;
  }
  .account-detail-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 18px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
    gap: 12px;
    flex-wrap: wrap;
  }
  .account-detail-name {
    font-size: 20px;
    font-weight: 700;
    font-style: normal;
    letter-spacing: -0.015em;
  }
  .account-detail-type {
    font-size: 11.5px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    margin-top: 4px;
    font-weight: 500;
  }
  .transfer-form {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 12px;
    align-items: end;
    padding: 18px;
    background: var(--bg);
    border-radius: 14px;
    margin-top: 14px;
  }
  @media (max-width: 700px) {
    .transfer-form { grid-template-columns: 1fr 1fr; }
  }
  .transfer-form .btn { margin: 0; padding: 10px 16px; }

  .stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg);
    border: none;
    padding: 5px 12px;
    border-radius: 100px;
    font-size: 12.5px;
    color: var(--ink-soft);
    font-weight: 500;
  }
  .stat-pill strong { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }

  .accounts-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 20px;
  }
  .summary-tile {
    background: var(--bg);
    border-radius: 14px;
    padding: 16px 20px;
    border: none;
  }
  .summary-label {
    font-size: 12px;
    letter-spacing: 0;
    text-transform: none;
    color: var(--muted);
    margin-bottom: 6px;
    font-weight: 500;
  }
  .summary-val {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
  }
  .summary-sub {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
  }

  .empty-account-state {
    text-align: center;
    padding: 50px 20px;
    background: var(--bg);
    border-radius: 16px;
    border: 2px dashed var(--line-strong);
  }
  .empty-account-state h3 {
    font-weight: 700;
    font-style: normal;
    font-size: 18px;
    margin-bottom: 8px;
    letter-spacing: -0.01em;
  }
  .empty-account-state p {
    color: var(--muted);
    font-size: 13.5px;
    margin-bottom: 20px;
  }
  .empty-account-state .actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
  }
  .empty-account-state .btn { width: auto; margin: 0; }

  .link-info {
    font-size: 12px;
    color: var(--muted);
    margin-top: 6px;
    font-style: normal;
  }

  /* COMPARISON */
  .compare-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; flex-wrap: wrap; gap: 8px; }
  .compare-months { font-size: 13px; color: var(--ink-soft); font-style: normal; }
  .compare-months strong { color: var(--ink); text-transform: capitalize; font-weight: 600; font-style: normal; }
  .compare-row { display: grid; grid-template-columns: 1fr auto auto auto; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
  .compare-row:last-child { border-bottom: none; }
  .compare-label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-soft); font-weight: 500; }
  .compare-label .dot { width: 7px; height: 7px; border-radius: 50%; }
  .compare-prev { font-size: 12px; color: var(--muted); text-align: right; min-width: 60px; font-variant-numeric: tabular-nums; font-weight: 500;}
  .compare-curr { font-size: 15px; font-weight: 700; text-align: right; min-width: 70px; font-variant-numeric: tabular-nums; letter-spacing: -0.01em;}
  .compare-delta { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 100px; min-width: 56px; text-align: center; font-family: 'DM Sans', sans-serif; white-space: nowrap; }
  .compare-delta.up { background: var(--soft-pink); color: var(--pink); }
  .compare-delta.down { background: var(--soft-green); color: var(--green); }
  .compare-delta.neutral { background: var(--bg); color: var(--muted); }
  .compare-delta.up-good { background: var(--soft-green); color: var(--green); }
  .compare-delta.down-good { background: var(--soft-pink); color: var(--pink); }
  .compare-bar-wrap { margin-top: 5px; height: 4px; background: var(--bg); border-radius: 100px; position: relative; overflow: hidden; }
  .compare-bar-prev { position: absolute; height: 100%; background: var(--muted); opacity: .25; border-radius: 100px; }
  .compare-bar-curr { position: absolute; height: 100%; border-radius: 100px; }
  .compare-row.highlight { padding-top: 12px; padding-bottom: 12px; border-bottom: none; border-top: 1.5px solid var(--ink); margin-top: 4px; }
  .compare-row.highlight .compare-label { font-weight: 700; color: var(--ink); font-size: 14px; }
  .compare-row.highlight .compare-curr { font-size: 18px; }

  .cat-evolution { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; padding-top: 18px; border-top: 1px solid var(--line); }
  .cat-evolution-title { font-size: 13px; color: var(--ink-soft); margin-bottom: 4px; font-weight: 600; font-style: normal; }
  .cat-evo-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: center; font-size: 13px; padding: 6px 0; }
  .cat-evo-icon { width: 28px; height: 28px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600;}
  .cat-evo-name { color: var(--ink-soft); font-weight: 500;}
  .cat-evo-val { font-weight: 600; font-size: 14px; color: var(--ink); text-align: right; font-variant-numeric: tabular-nums;}
  .cat-evo-delta { font-size: 11.5px; padding: 3px 9px; border-radius: 100px; min-width: 55px; text-align: center; font-weight: 600;}

  /* ANALYSE */
  .analyse-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
  @media (max-width: 700px) { .analyse-stats { grid-template-columns: repeat(2, 1fr); } }
  .ana-tile { background: var(--bg); border: none; border-radius: 14px; padding: 14px 16px; }
  .ana-label { font-size: 12px; letter-spacing: 0; text-transform: none; color: var(--muted); margin-bottom: 4px; font-weight: 500;}
  .ana-val { font-size: 22px; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums;}
  .ana-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
  .ana-empty { text-align: center; padding: 60px 0; color: var(--muted); font-style: normal; font-size: 13.5px;}
  .ana-month-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
  .ana-month-row { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 12px; background: var(--bg); border-radius: 9px; font-size: 12.5px; }
  .ana-month-row .m { color: var(--muted); text-transform: capitalize; font-weight: 500;}
  .ana-month-row .v { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums;}

  /* LOOKUP */
  .lookup-suggest { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
  .lookup-chip { padding: 7px 14px; background: var(--bg); border: none; border-radius: 100px; font-size: 12.5px; cursor: pointer; transition: all .15s; font-family: inherit; color: var(--ink-soft); font-weight: 500; }
  .lookup-chip:hover { background: var(--ink); color: white; }
  .lookup-chip .badge { background: rgba(0,0,0,.08); color: var(--muted); padding: 2px 8px; border-radius: 100px; margin-left: 6px; font-size: 11.5px; font-weight: 600; }
  .lookup-chip:hover .badge { background: rgba(255,255,255,.2); color: white; }
  .lookup-result-hero { background: linear-gradient(145deg, #2d3142 0%, #1d1d1f 100%); color: white; border-radius: 16px; padding: 22px 24px; margin-top: 8px; }
  .lookup-result-label { font-size: 12.5px; letter-spacing: 0; text-transform: none; color: rgba(255,255,255,.55); margin-bottom: 6px; font-weight: 500;}
  .lookup-result-query { font-size: 16px; margin-bottom: 12px; color: rgba(255,255,255,.9); font-style: normal; font-weight: 500;}
  .lookup-result-amount { font-weight: 700; font-size: 38px; letter-spacing: -0.025em; line-height: 1; font-variant-numeric: tabular-nums;}
  .lookup-result-amount .cents { font-size: 20px; color: rgba(255,255,255,.5); font-weight: 500;}
  .lookup-result-amount .eur { font-size: 16px; color: rgba(255,255,255,.5); margin-left: 4px; font-weight: 500;}
  .lookup-result-meta { margin-top: 12px; font-size: 12.5px; color: rgba(255,255,255,.65); display: flex; gap: 16px; flex-wrap: wrap; }
  .lookup-result-meta strong { color: white; font-weight: 600; font-variant-numeric: tabular-nums;}
  .lookup-history { margin-top: 14px; }
  .lookup-history-head { font-size: 13px; color: var(--ink-soft); margin-bottom: 8px; font-style: normal; font-weight: 600;}
  .lookup-noresult { padding: 20px; text-align: center; color: var(--muted); font-style: normal; background: var(--bg); border-radius: 14px; font-size: 13.5px;}

  /* IMPORT */
  .import-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 16px;
  }
  @media (max-width: 700px) { .import-summary { grid-template-columns: 1fr 1fr; } }
  .import-tile {
    background: var(--bg);
    border-radius: 12px;
    padding: 12px 14px;
  }
  .import-tile.warn { background: var(--soft-orange); }
  .import-tile.danger { background: var(--soft-pink); }
  .import-tile.ok { background: var(--soft-green); }
  .import-tile-label { font-size: 11.5px; color: var(--muted); margin-bottom: 2px; font-weight: 500;}
  .import-tile-val { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums;}
  .import-mapping {
    background: var(--bg);
    border-radius: 14px;
    padding: 14px 18px;
    margin-bottom: 16px;
  }
  .import-mapping-title {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 10px;
    font-weight: 500;
    letter-spacing: 0.02em;
  }
  .import-mapping-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }
  @media (max-width: 700px) { .import-mapping-row { grid-template-columns: 1fr; } }
  .import-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
  }
  .import-actions .btn { width: auto; margin: 0; }
  .import-actions .info {
    margin-left: auto;
    font-size: 12.5px;
    color: var(--muted);
    font-weight: 500;
  }
  .import-table {
    background: var(--paper);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--line);
    margin-bottom: 16px;
  }
  .import-row {
    display: grid;
    grid-template-columns: 28px 90px 1fr 120px 100px 90px;
    gap: 12px;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
    transition: background .15s;
  }
  @media (max-width: 900px) {
    .import-row { grid-template-columns: 24px 80px 1fr 100px 90px; }
    .import-row .type-col { display: none; }
  }
  .import-row:last-child { border-bottom: none; }
  .import-row.duplicate { opacity: .55; background: var(--bg); }
  .import-row.excluded { opacity: .4; }
  .import-row.error { background: var(--soft-pink); }
  .import-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--ink); cursor: pointer; }
  .import-row .date-col { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
  .import-row .label-col { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .import-row .label-col .dup-badge {
    background: var(--soft-orange);
    color: var(--orange);
    font-size: 10.5px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 100px;
    margin-left: 6px;
  }
  .import-row select {
    padding: 5px 8px;
    font-size: 12px;
    background: var(--bg);
    border-radius: 7px;
    border: 1px solid transparent;
  }
  .import-row select:hover { border-color: var(--line-strong); }
  .import-row .amount-col {
    font-weight: 700;
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-size: 13.5px;
  }
  .import-row .amount-col.dep { color: var(--ink); }
  .import-row .amount-col.rev { color: var(--green); }
  .import-row .type-col {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    font-weight: 600;
    text-align: center;
  }
  .import-row .type-col.rev { color: var(--green); }

  .import-bulk {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg);
    border-radius: 10px;
    margin-bottom: 10px;
    font-size: 12.5px;
    color: var(--ink-soft);
    flex-wrap: wrap;
  }
  .import-bulk select {
    padding: 5px 10px;
    font-size: 12.5px;
    background: var(--paper);
    border-radius: 7px;
    border: 1px solid var(--line-strong);
  }
  .import-bulk strong { font-weight: 600; color: var(--ink); }

  /* ── Apprentissage des libellés (import mode 'learn') ─────── */
  .learn-bulk {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg);
    border-radius: 10px;
    margin-bottom: 10px;
    font-size: 12.5px;
    color: var(--ink-soft);
    flex-wrap: wrap;
  }
  .learn-bulk select {
    padding: 5px 10px;
    font-size: 12.5px;
    background: var(--paper);
    border-radius: 7px;
    border: 1px solid var(--line-strong);
  }
  .learn-bulk strong { font-weight: 600; color: var(--ink); }

  /* ── Badge "historique" pour les transactions importées en mode analyse ── */
  .tx-historique-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 1px 7px;
    background: var(--bg);
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    border-radius: 100px;
    vertical-align: middle;
  }
  .tx-item.tx-historique { opacity: 0.78; }
  .tx-item.tx-historique:hover { opacity: 1; }

  /* ── Sélecteur d'emoji (modale) ───────────────────────────── */
  .emoji-input-row {
    display: flex;
    gap: 6px;
    align-items: stretch;
  }
  .emoji-input-row input { flex: 1; }
  .emoji-input-btn {
    background: var(--bg);
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 0 12px;
    font-size: 18px;
    cursor: pointer;
    transition: all .15s;
    min-width: 44px;
  }
  .emoji-input-btn:hover { border-color: var(--line-strong); background: var(--paper); }

  .emoji-custom-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px dashed var(--line);
  }
  .emoji-custom-row input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--bg);
    font-size: 14px;
    font-family: inherit;
  }
  .emoji-custom-row input:focus {
    outline: none;
    border-color: var(--ink);
    background: var(--paper);
  }

  .emoji-group { margin-bottom: 16px; }
  .emoji-group:last-child { margin-bottom: 0; }
  .emoji-group-title {
    font-size: 11px;
    color: var(--muted);
    letter-spacing: 0.4px;
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 8px;
  }
  .emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 4px;
  }
  .emoji-btn {
    background: transparent;
    border: none;
    border-radius: 10px;
    padding: 8px 0;
    font-size: 22px;
    cursor: pointer;
    transition: all .12s;
    font-family: inherit;
    line-height: 1;
    aspect-ratio: 1;
  }
  .emoji-btn:hover {
    background: var(--bg);
    transform: scale(1.15);
  }
  @media (max-width: 600px) {
    .emoji-grid { grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); }
    .emoji-btn { font-size: 19px; padding: 6px 0; }
  }
  .learn-table {
    background: var(--paper);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--line);
    margin-bottom: 14px;
  }
  .learn-row {
    display: grid;
    grid-template-columns: 28px 1fr 50px 1.3fr 1fr;
    gap: 10px;
    align-items: center;
    padding: 9px 14px;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
  }
  .learn-row:last-child { border-bottom: none; }
  .learn-row.excluded { opacity: 0.45; }
  .learn-row input[type="checkbox"] {
    width: 16px; height: 16px;
    accent-color: var(--ink);
    cursor: pointer;
  }
  .learn-row .learn-label {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .learn-row .learn-count {
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    font-size: 12px;
  }
  .learn-row select {
    padding: 5px 8px;
    font-size: 12.5px;
    background: var(--bg);
    border: 1px solid transparent;
    border-radius: 7px;
    cursor: pointer;
    transition: border-color .15s;
  }
  .learn-row select:hover { border-color: var(--line-strong); }
  @media (max-width: 600px) {
    .learn-row {
      grid-template-columns: 22px 1fr 40px;
      grid-template-areas:
        "check label count"
        "check cat   type";
      row-gap: 4px;
      font-size: 12px;
    }
    .learn-row input[type="checkbox"] { grid-area: check; }
    .learn-row .learn-label { grid-area: label; }
    .learn-row .learn-count { grid-area: count; }
    .learn-row > select:nth-of-type(1) { grid-area: cat; }
    .learn-row > select:nth-of-type(2) { grid-area: type; }
  }

  /* SETTINGS BUTTON IN HEADER */
  .settings-btn {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--ink-soft);
    transition: all .15s;
    padding: 0;
  }
  .settings-btn:hover {
    color: var(--ink);
    border-color: var(--line-strong);
    transform: rotate(30deg);
  }

  /* SETTINGS PAGE */
  .settings-header {
    margin-bottom: 16px;
    padding: 4px 4px 0;
  }
  .settings-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0 0 4px;
  }
  .settings-subtitle {
    color: var(--muted);
    font-size: 13.5px;
    margin: 0;
  }

  /* CATEGORY EDITOR LIST */
  .cat-row {
    display: grid;
    grid-template-columns: 40px 36px 1fr 110px 40px;
    gap: 10px;
    align-items: center;
    padding: 10px 8px;
    border-bottom: 1px solid var(--line);
  }
  .cat-row:last-of-type { border-bottom: none; }
  .cat-row .drag-handle {
    cursor: grab;
    color: var(--muted);
    font-size: 18px;
    text-align: center;
    user-select: none;
  }
  .cat-row .cat-icon-edit {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    transition: transform .15s;
  }
  .cat-row .cat-icon-edit:hover { transform: scale(1.1); }
  .cat-row .cat-nom-input {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 13.5px;
    font-weight: 500;
    width: 100%;
    transition: border-color .15s;
  }
  .cat-row .cat-nom-input:hover { border-color: var(--line); }
  .cat-row .cat-nom-input:focus {
    border-color: var(--ink);
    outline: none;
    background: var(--bg);
  }
  .cat-row .cat-color-input {
    width: 36px;
    height: 28px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0;
    cursor: pointer;
    background: transparent;
  }
  .cat-row .cat-id-pill {
    background: var(--bg);
    padding: 3px 8px;
    border-radius: 100px;
    font-size: 11px;
    color: var(--muted);
    font-family: ui-monospace, monospace;
    text-align: center;
  }
  .cat-row .cat-del {
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 18px;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    transition: all .15s;
  }
  .cat-row .cat-del:hover { background: var(--soft-pink); color: var(--pink); }
  .cat-row .cat-del:disabled {
    opacity: 0.3;
    cursor: not-allowed;
  }
  .cat-row .cat-del:disabled:hover { background: transparent; color: var(--muted); }
  .cat-row.is-system .cat-id-pill::after {
    content: " système";
    color: var(--muted);
    opacity: 0.6;
  }
  .cat-row .drag-handle:active { cursor: grabbing; }
  .cat-row-ghost {
    opacity: 0.35;
    background: var(--bg);
  }
  .cat-row-chosen {
    background: var(--bg);
  }
  .cat-row-drag {
    background: var(--paper);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    border-radius: 10px;
    border-bottom-color: transparent;
  }

  /* ── Dashboard : tuiles réordonnables ──────────────────────── */
  .dashboard-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
  }
  .btn-ghost {
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 100px;
    padding: 6px 14px;
    font-family: inherit;
    font-size: 12px;
    color: var(--muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all .15s;
  }
  .btn-ghost:hover { border-color: var(--ink); color: var(--ink); }
  .btn-ghost.active {
    background: var(--ink);
    color: var(--paper);
    border-color: var(--ink);
  }
  .dashboard-edit-icon { font-size: 13px; }

  .dashboard-tiles {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-items: start;
  }
  @media (max-width: 800px) {
    .dashboard-tiles { grid-template-columns: 1fr; }
  }
  .dashboard-tiles > .card { position: relative; }
  .dashboard-tiles .tile-drag-handle,
  .dashboard-tiles .tile-hide {
    display: none;
  }
  .dashboard-tiles.edit-mode > .card {
    outline: 2px dashed var(--line);
    outline-offset: -2px;
  }
  .dashboard-tiles.edit-mode .tile-drag-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 8px;
    left: 10px;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: var(--bg);
    color: var(--muted);
    font-size: 14px;
    cursor: grab;
    user-select: none;
    z-index: 2;
  }
  .dashboard-tiles.edit-mode .tile-drag-handle:active { cursor: grabbing; }
  .dashboard-tiles.edit-mode .tile-hide {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 8px;
    right: 10px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--bg);
    border: none;
    color: var(--muted);
    font-size: 16px;
    cursor: pointer;
    transition: all .15s;
    z-index: 2;
  }
  .dashboard-tiles.edit-mode .tile-hide:hover {
    background: var(--soft-pink);
    color: var(--pink);
  }
  .dashboard-tile-ghost {
    opacity: 0.35;
  }
  .dashboard-tile-drag {
    box-shadow: 0 12px 32px rgba(0,0,0,0.15);
  }

  .dashboard-hidden-zone {
    margin-top: 14px;
    padding: 14px 16px;
    background: var(--paper);
    border: 1px dashed var(--line);
    border-radius: 16px;
  }
  .dashboard-hidden-title {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 10px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
  }
  .dashboard-hidden-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .dashboard-hidden-chip {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 100px;
    padding: 6px 12px;
    font-size: 12.5px;
    color: var(--ink);
    cursor: pointer;
    transition: all .15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }
  .dashboard-hidden-chip:hover {
    background: var(--ink);
    color: var(--paper);
    border-color: var(--ink);
  }
  .dashboard-hidden-chip::before {
    content: "↺";
    font-size: 13px;
  }

  /* ── Dashboard : widgets personnalisables ─────────────────── */
  .dashboard-add-zone {
    margin-top: 10px;
    display: flex;
    justify-content: center;
  }
  .dashboard-tiles.edit-mode .tile-config {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 8px;
    right: 44px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--bg);
    border: none;
    color: var(--muted);
    font-size: 13px;
    cursor: pointer;
    transition: all .15s;
    z-index: 2;
  }
  .dashboard-tiles .tile-config { display: none; }
  .dashboard-tiles.edit-mode .tile-config:hover {
    background: var(--ink);
    color: var(--paper);
  }
  .widget-empty {
    padding: 28px 14px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    font-style: italic;
  }
  .widget-chart-wrap {
    position: relative;
    height: 220px;
    margin-top: 8px;
  }
  .widget-gauge {
    margin-top: 10px;
  }
  .widget-gauge-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
  }
  .widget-gauge-spent {
    font-size: 22px;
    font-weight: 600;
    color: var(--ink);
    font-family: 'DM Sans', sans-serif;
  }
  .widget-gauge-cap {
    color: var(--muted);
    font-size: 13px;
  }
  .widget-gauge-bar {
    height: 10px;
    background: var(--bg);
    border-radius: 100px;
    overflow: hidden;
  }
  .widget-gauge-fill {
    height: 100%;
    border-radius: 100px;
    transition: width .3s ease;
  }
  .widget-gauge-fill.ok      { background: var(--green); }
  .widget-gauge-fill.warn    { background: var(--gold); }
  .widget-gauge-fill.over    { background: var(--rose); }
  .widget-gauge-foot {
    margin-top: 8px;
    font-size: 12px;
    color: var(--muted);
    display: flex;
    justify-content: space-between;
  }

  /* ── Modale légère ────────────────────────────────────────── */
  .modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(20, 18, 14, 0.45);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
  }
  .modal-panel {
    background: var(--paper);
    border-radius: 20px;
    width: 100%;
    max-width: 480px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    padding: 22px 24px;
  }
  .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
  }
  .modal-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--ink);
  }
  .modal-close {
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 22px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    line-height: 1;
  }
  .modal-close:hover { background: var(--bg); color: var(--ink); }
  .modal-content { margin-bottom: 18px; }
  .modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 14px;
    border-top: 1px dashed var(--line);
  }
  .widget-type-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .widget-type-card {
    padding: 16px;
    border: 2px solid var(--line);
    border-radius: 14px;
    cursor: pointer;
    transition: all .15s;
    background: transparent;
    font-family: inherit;
    text-align: left;
  }
  .widget-type-card:hover { border-color: var(--ink); }
  .widget-type-card.selected {
    border-color: var(--ink);
    background: var(--bg);
  }
  .widget-type-icon {
    font-size: 22px;
    margin-bottom: 6px;
  }
  .widget-type-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 4px;
  }
  .widget-type-desc {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.4;
  }
  .modal-form .form-row { margin-bottom: 12px; }
  .modal-form .field-help {
    font-size: 11.5px;
    color: var(--muted);
    margin-top: 4px;
    font-style: italic;
  }

  /* ── Auth overlay (login + change password forcé) ─────────── */
  .auth-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(145deg, #f5f5f0 0%, #ece9e0 100%);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
  }
  .auth-panel {
    background: var(--paper);
    border-radius: 20px;
    padding: 32px 30px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.10);
  }
  .auth-brand {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px dashed var(--line);
  }
  .auth-error {
    color: var(--rose);
    font-size: 12.5px;
    min-height: 16px;
    margin: 8px 0 6px;
    text-align: center;
  }

  /* ── Autocomplete libellé (Nouveau mouvement) ─────────────── */
  .tx-suggest {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.10);
    max-height: 280px;
    overflow-y: auto;
    z-index: 20;
    padding: 4px;
  }
  .tx-suggest.show { display: block; }
  .tx-suggest-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    transition: background .12s;
  }
  .tx-suggest-item:hover { background: var(--bg); }
  .tx-suggest-item .suggest-label { flex: 1; color: var(--ink); font-weight: 500; }
  .tx-suggest-item .suggest-cat {
    padding: 3px 9px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
  }

  /* ── Libellés favoris (Réglages) ──────────────────────────── */
  .fav-row {
    display: grid;
    grid-template-columns: 32px 1.6fr 1.2fr 1fr 36px;
    gap: 10px;
    align-items: center;
    padding: 10px 8px;
    border-bottom: 1px solid var(--line);
  }
  .fav-row:last-of-type { border-bottom: none; }
  .fav-row .drag-handle {
    cursor: grab;
    color: var(--muted);
    font-size: 18px;
    text-align: center;
    user-select: none;
  }
  .fav-row .drag-handle:active { cursor: grabbing; }
  .fav-row .fav-label-input,
  .fav-row .fav-cat-input,
  .fav-row .fav-type-input {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 13px;
    font-family: inherit;
    width: 100%;
    transition: border-color .15s, background .15s;
  }
  .fav-row .fav-label-input:hover,
  .fav-row .fav-cat-input:hover,
  .fav-row .fav-type-input:hover {
    border-color: var(--line);
  }
  .fav-row .fav-label-input:focus,
  .fav-row .fav-cat-input:focus,
  .fav-row .fav-type-input:focus {
    border-color: var(--ink);
    background: var(--bg);
    outline: none;
  }

  /* ═══════════════════════════════════════════════════════════
     RESPONSIVE — Tablette portrait (≤ 900px)
     ═══════════════════════════════════════════════════════════ */
  @media (max-width: 900px) {
    .app { padding: 24px 20px 60px; }
    .hero-block.primary .hero-value { font-size: 30px; }
    .hero-value { font-size: 22px; }
    .nav-tabs {
      overflow-x: auto;
      flex-wrap: nowrap;
      width: 100%;
      max-width: 100%;
      -webkit-overflow-scrolling: touch;
      scrollbar-width: thin;
    }
    .nav-tab { flex-shrink: 0; white-space: nowrap; }
    .form-row-4 { grid-template-columns: 1fr 1fr; }
  }

  /* ═══════════════════════════════════════════════════════════
     RESPONSIVE — Mobile (≤ 600px)
     ═══════════════════════════════════════════════════════════ */
  @media (max-width: 600px) {
    body { font-size: 13.5px; }
    .app { padding: 14px 12px 56px; }

    /* Header : compact horizontal, date réduite */
    header { margin-bottom: 18px; align-items: center; gap: 8px; }
    .logo { font-size: 20px; }
    header > div:last-child { gap: 10px; }
    .date-now {
      font-size: 11.5px;
      padding: 7px 11px;
      line-height: 1.2;
      max-width: 150px;
    }
    .date-now div, .date-now strong { font-size: 11.5px; }
    .settings-btn { padding: 7px; }
    .settings-btn svg { width: 17px; height: 17px; }

    /* Nav-tabs : compactes, scroll horizontal déjà actif (depuis 900px) */
    .nav-tabs { margin-bottom: 18px; padding: 4px; gap: 4px; }
    .nav-tab { padding: 8px 13px; font-size: 12px; }

    /* Hero : 1 colonne (au lieu de 2 en 600-900) */
    .hero {
      grid-template-columns: 1fr;
      gap: 10px;
      margin-bottom: 18px;
    }
    .hero-block { padding: 16px 18px; }
    .hero-block.primary .hero-value { font-size: 28px; }
    .hero-value { font-size: 20px; }

    /* Cards : padding réduit */
    .card { padding: 16px 16px; border-radius: 16px; }
    .card-title { font-size: 13.5px; margin-bottom: 12px; }

    /* Form rows : tout en 1 colonne sur mobile */
    .form-row, .form-row.tri, .form-row-4 {
      grid-template-columns: 1fr !important;
      gap: 10px;
    }

    /* Filter chips : wrap */
    .filter-row { flex-wrap: wrap; gap: 6px; }
    .filter-chip { padding: 6px 11px; font-size: 11px; }

    /* Boutons : tap target raisonnable, plein largeur */
    .btn { padding: 12px 16px; font-size: 12.5px; }
    .btn-inline { width: 100%; }

    /* Tx-list + recur-list : items plus compacts */
    .tx-item, .recur-item {
      grid-template-columns: auto 1fr auto !important;
      column-gap: 10px;
    }
    .tx-item > *:nth-child(3),
    .recur-item > *:nth-child(3) { display: none; }

    /* Comparaison : on cache la colonne du mois précédent */
    .compare-row { grid-template-columns: 1fr auto auto; gap: 8px; }
    .compare-prev { display: none; }
    .cat-evolution { gap: 4px; padding-top: 14px; }
    .cat-evo-row { grid-template-columns: auto 1fr auto auto; gap: 6px; font-size: 12px; }

    /* Settings header */
    .settings-title { font-size: 22px; }
    .settings-subtitle { font-size: 13px; }

    /* Catégories en mobile : on masque la pill ID, on compacte */
    .cat-row {
      grid-template-columns: 32px 32px 1fr auto 32px;
      gap: 8px;
      padding: 10px 4px;
    }
    .cat-row .cat-id-pill { display: none; }
    .cat-row .cat-color-input { width: 32px; height: 26px; }

    /* Favoris en mobile : 2 lignes (label seul, puis cat+type+×) */
    .fav-row {
      grid-template-columns: 28px 1fr 32px;
      grid-template-areas:
        "drag label  delete"
        "drag cat    type";
      row-gap: 6px;
      padding: 12px 4px;
    }
    .fav-row .drag-handle    { grid-area: drag; }
    .fav-row .fav-label-input { grid-area: label; }
    .fav-row .cat-del         { grid-area: delete; }
    .fav-row .fav-cat-input   { grid-area: cat; }
    .fav-row .fav-type-input  { grid-area: type; }

    /* Dashboard : déjà OK (1 colonne sous 800px). Édition : on réduit les actions */
    .dashboard-actions { margin-bottom: 8px; }
    .btn-ghost { padding: 5px 12px; font-size: 11.5px; }
    .dashboard-tiles { gap: 10px; }
    .dashboard-tiles.edit-mode .tile-drag-handle,
    .dashboard-tiles.edit-mode .tile-hide,
    .dashboard-tiles.edit-mode .tile-config {
      width: 30px; height: 30px;          /* tap target ≥ 30px */
    }

    /* Épargne : section comptes */
    .accounts-summary { grid-template-columns: 1fr; gap: 10px; }
    .summary-tile { padding: 16px; }
    .accounts-grid { grid-template-columns: 1fr; }
    .transfer-form { grid-template-columns: 1fr; }

    /* Analyse */
    .analyse-stats { grid-template-columns: 1fr 1fr; gap: 8px; }
    .ana-month-list { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }

    /* Import : on prévient le débordement, on resserre les colonnes */
    .import-summary { grid-template-columns: 1fr 1fr; }
    .import-row {
      grid-template-columns: 22px 70px 1fr 80px 70px !important;
      font-size: 11.5px;
    }
    .import-row > *:nth-child(6) { display: none; }

    /* Modale widget : full-width, padding réduit */
    .modal-backdrop { padding: 10px; }
    .modal-panel {
      padding: 18px 16px;
      border-radius: 16px;
      max-height: calc(100vh - 20px);
    }
    .modal-title { font-size: 16px; }
    .widget-type-grid { grid-template-columns: 1fr; }
    .widget-type-card { padding: 14px; }
    .modal-actions { flex-direction: column-reverse; gap: 8px; }
    .modal-actions > * { width: 100%; }
    .modal-actions .btn { width: 100% !important; }

    /* Widgets perso : hauteur graphique plus petite */
    .widget-chart-wrap { height: 180px; }

    /* Hidden zone */
    .dashboard-hidden-zone { padding: 12px 14px; }
  }
