/* Polices hébergées localement (Fontsource, licence OFL) : aucune requête vers Google. */
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 200 800; font-display: swap; src: url("fonts/manrope-latin-wght-normal.woff2") format("woff2"); }
@font-face { font-family: "Hanken Grotesk"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("fonts/hanken-grotesk-latin-wght-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/ibm-plex-mono-latin-600-normal.woff2") format("woff2"); }


  /* L'appli n'a qu'un seul thème : sombre. */
  :root {
    --bg: #10111c;
    --surface: #191c2b;
    --surface-2: #212439;
    --border: #2b2e45;
    --border-strong: #3c4060;
    --text: #edeef7;
    --muted: #9599b5;
    --accent: #8490ff;
    --accent-dark: #a3adff;
    --accent-soft: rgba(132, 144, 255, 0.14);
    --on-accent: #10111c;
    --green: #3fd48a;
    --green-bg: rgba(63, 212, 138, 0.13);
    --red: #ff7269;
    --red-bg: rgba(255, 114, 105, 0.13);
    --amber: #e3a13d;
    --amber-bg: rgba(227, 161, 61, 0.14);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 14px 32px -16px rgba(0, 0, 0, 0.6);
    --bg-image: url("bg-dark.svg");
    --font-display: "Manrope", -apple-system, "Segoe UI", sans-serif;
    --font-body: "Hanken Grotesk", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    color-scheme: dark;
  }
  * { box-sizing: border-box; }
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: 0.001ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.001ms !important;
    }
  }
  body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    margin: 0;
    padding: 28px 16px 64px;
    -webkit-font-smoothing: antialiased;
  }
  body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background: var(--bg-image) center / cover no-repeat;
    pointer-events: none;
  }
  .wrap { max-width: 920px; margin: 0 auto; }
  header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
  }
  h1 {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .brand-logo { display: block; width: 38px; height: 38px; border-radius: 50%; flex: 0 0 auto; box-shadow: 0 0 0 1px var(--border-strong), 0 2px 10px rgba(0, 0, 0, 0.35); }
  .month-picker {
    display: flex;
    align-items: center;
    gap: 2px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 4px 5px;
    box-shadow: var(--shadow-sm);
  }
  .month-picker button {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    padding: 5px 9px;
    border-radius: 7px;
    transition: background 0.15s ease, color 0.15s ease;
  }
  .month-picker button:hover { background: var(--surface-2); color: var(--text); }
  .month-label {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 0.82rem;
    min-width: 128px;
    text-align: center;
    text-transform: capitalize;
    color: var(--text);
  }

  .cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
  }
  .card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 18px 18px 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
  }
  .card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--border-strong);
  }
  .card.income::before { background: var(--green); }
  .card.expense::before { background: var(--red); }
  .card.balance::before { background: var(--accent); }
  .card .label {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
  }
  .card .value {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.01em;
  }
  .card.income .value { color: var(--green); }
  .card.expense .value { color: var(--red); }
  .card.balance .value.pos { color: var(--green); }
  .card.balance .value.neg { color: var(--red); }
  .card.balance .value.warn { color: var(--amber); }
  .balance-warn-badge[hidden] { display: none; }
  .balance-warn-badge {
    display: inline-block;
    margin-top: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--amber);
    background: var(--amber-bg);
    border: 1px solid var(--amber);
    border-radius: 999px;
    padding: 2px 9px;
  }
  .balance-alert {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
  }
  .balance-alert label { font-size: 0.72rem; color: var(--muted); font-weight: 500; margin: 0; }
  .balance-alert input {
    width: 64px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 0.75rem;
    color: var(--text);
  }
  .balance-alert .unit { color: var(--muted); font-size: 0.72rem; }

  .panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
    padding: 18px;
    margin-bottom: 16px;
  }
  .panel h2 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.005em;
    margin: 0 0 14px;
    font-size: 1.02rem;
  }

  .panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
  }
  .panel-header h2 { margin: 0; }
  .collapse-btn {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--muted);
    border-radius: 9px;
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
  }
  .collapse-btn:hover { border-color: var(--accent); color: var(--accent); }
  .collapse-btn .chevron { transition: transform 0.2s ease; }
  .collapse-btn.collapsed .chevron { transform: rotate(-90deg); }

  form.add-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    align-items: end;
  }
  form.add-form .field { display: flex; flex-direction: column; gap: 4px; }
  form.add-form label { font-size: 0.75rem; color: var(--muted); font-weight: 500; }
  input, select {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 9px;
    padding: 9px 10px;
    font-family: inherit;
    font-size: 0.9rem;
    width: 100%;
    transition: border-color 0.15s ease, background 0.15s ease;
  }
  input[type="number"], input[type="date"] { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
  input:hover, select:hover { border-color: var(--border-strong); }
  input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); background: var(--surface); }
  .type-toggle {
    display: flex;
    border: 1px solid var(--border);
    border-radius: 9px;
    overflow: hidden;
  }
  .type-toggle button {
    flex: 1;
    border: none;
    background: var(--surface-2);
    color: var(--muted);
    padding: 9px 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
  }
  .type-toggle button.active[data-type="income"] { background: var(--green-bg); color: var(--green); font-weight: 700; }
  .type-toggle button.active[data-type="expense"] { background: var(--red-bg); color: var(--red); font-weight: 700; }

  button.submit-btn {
    background: var(--accent);
    color: var(--on-accent);
    border: none;
    border-radius: 9px;
    padding: 10px 16px;
    font-family: var(--font-body);
    font-weight: 700;
    cursor: pointer;
    font-size: 0.9rem;
    box-shadow: var(--shadow-sm);
    transition: background 0.15s ease, transform 0.1s ease;
  }
  button.submit-btn:hover { background: var(--accent-dark); }
  button.submit-btn:active { transform: translateY(1px); }

  table { width: 100%; border-collapse: collapse; margin-top: 4px; }
  th {
    text-align: left;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
  }
  td { padding: 10px; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
  tr:last-child td { border-bottom: none; }
  tr:hover td { background: var(--surface-2); }
  td:first-child {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    font-size: 0.82rem;
  }
  td.amount {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    text-align: right;
    font-weight: 600;
    white-space: nowrap;
  }
  td.amount.income { color: var(--green); }
  td.amount.expense { color: var(--red); }
  .cat-pill {
    display: inline-block;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 0.78rem;
  }
  select.cat-select {
    display: inline-block;
    width: auto;
    max-width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px 22px 2px 10px;
    font-size: 0.78rem;
    color: var(--text);
    cursor: pointer;
  }
  select.cat-select:hover { border-color: var(--accent); }
  .subcat-input {
    display: block;
    width: auto;
    max-width: 100%;
    margin-top: 4px;
    background: transparent;
    border: 1px dashed var(--border-strong);
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 0.72rem;
    color: var(--muted);
  }
  .subcat-input:focus { border-style: solid; border-color: var(--accent); color: var(--text); }
  .subcat-input::placeholder { color: var(--muted); opacity: 0.7; }
  .del-btn {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 4px 6px;
    border-radius: 6px;
    transition: color 0.15s ease, background 0.15s ease;
  }
  .del-btn:hover { color: var(--red); background: var(--red-bg); }
  .empty { color: var(--muted); text-align: center; padding: 30px 10px; font-size: 0.9rem; }

  .breakdown-total {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
  }
  .breakdown-total .label { color: var(--muted); font-size: 0.82rem; }
  .breakdown-total .amt {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--red);
  }

  .breakdown-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
    font-size: 0.85rem;
  }
  .breakdown-row .cat-name {
    width: 132px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .breakdown-row .cat-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
  }
  .breakdown-row .bar-bg {
    flex: 1;
    background: var(--surface-2);
    border-radius: 999px;
    height: 12px;
    overflow: hidden;
  }
  .breakdown-row .bar-fill {
    height: 100%;
    border-radius: 999px;
    width: 0%;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .breakdown-row .amt-wrap {
    width: 128px;
    flex-shrink: 0;
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 8px;
  }
  .breakdown-row .amt {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
  }
  .breakdown-row .pct { color: var(--muted); font-size: 0.75rem; width: 34px; text-align: right; }

  .card .sub { color: var(--muted); font-size: 0.75rem; margin-top: 4px; }

  .evolution-chart {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    height: 150px;
    padding-top: 8px;
    border-bottom: 1px solid var(--border);
  }
  .evolution-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    gap: 6px;
    padding: 4px 2px 6px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s ease;
  }
  .evolution-col:hover { background: var(--surface-2); }
  .evolution-col.current { background: var(--surface-2); }
  .evolution-col.current .evolution-label { color: var(--text); font-weight: 700; }
  .evolution-bars {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 4px;
    flex: 1;
    width: 100%;
  }
  .evolution-bar {
    width: 12px;
    min-height: 2px;
    border-radius: 4px 4px 0 0;
    transition: height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .evolution-bar.income { background: var(--green); }
  .evolution-bar.expense { background: var(--red); }
  .evolution-label { font-size: 0.72rem; color: var(--muted); text-transform: capitalize; white-space: nowrap; }
  .evolution-solde {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 0.68rem;
    font-weight: 700;
    white-space: nowrap;
  }
  .evolution-solde.pos { color: var(--green); }
  .evolution-solde.neg { color: var(--red); }

  .evolution-legend {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-top: 12px;
    font-size: 0.78rem;
    color: var(--muted);
  }
  .evolution-legend .dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
    vertical-align: middle;
  }
  .evolution-hint { margin-left: auto; font-size: 0.72rem; opacity: 0.75; }

  .sub-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.85rem;
    margin: 18px 0 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
  }
  .salary-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: var(--green-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    flex-wrap: wrap;
  }
  .salary-box label { font-weight: 600; font-size: 0.9rem; display: block; margin-bottom: 4px; }
  .salary-hint { color: var(--muted); font-size: 0.78rem; max-width: 420px; }
  .salary-fixed-toggle {
    display: flex !important;
    align-items: center;
    gap: 7px;
    margin-top: 10px;
    font-weight: 500 !important;
    font-size: 0.78rem !important;
    color: var(--text);
    cursor: pointer;
    user-select: none;
  }
  .salary-fixed-toggle input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
  }
  .salary-input-wrap { display: flex; align-items: center; gap: 6px; }
  .salary-input-wrap input {
    width: 140px;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--green);
    background: var(--surface);
  }
  .salary-input-wrap .unit { color: var(--muted); font-weight: 600; }

  form.recurring-form { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); margin-top: 4px; }

  .recurring-list { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
  .recurring-item {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    row-gap: 6px;
    gap: 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 12px;
  }
  .recurring-item .rec-desc { flex: 1; min-width: 80px; font-size: 0.9rem; }
  .recurring-item .rec-amt {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    white-space: nowrap;
    margin-left: auto;
  }
  .recurring-item .rec-amt.income { color: var(--green); }
  .recurring-item .rec-amt.expense { color: var(--red); }
  .rec-day-input {
    width: 64px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 0.78rem;
    color: var(--text);
  }
  select.rec-notify-select {
    display: inline-block;
    width: auto;
    max-width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px 22px 2px 10px;
    font-size: 0.78rem;
    color: var(--text);
    cursor: pointer;
  }
  .debit-status {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 999px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .debit-status.passed {
    background: var(--surface);
    color: var(--muted);
    border: 1px solid var(--border);
  }
  .debit-status.soon {
    background: var(--amber-bg);
    color: var(--amber);
    border: 1px solid var(--amber);
  }
  .fixed-note { color: var(--muted); font-size: 0.78rem; margin-top: 10px; }

  .notif-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
  }
  .notif-status { color: var(--muted); font-size: 0.78rem; flex: 1; min-width: 220px; }
  .submit-btn.small { padding: 7px 12px; font-size: 0.78rem; white-space: nowrap; }

  .reminder-banner[hidden] { display: none; }
  .reminder-banner {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    max-width: min(92vw, 460px);
    background: var(--surface);
    border: 1px solid var(--accent);
    box-shadow: var(--shadow);
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1000;
    font-size: 0.85rem;
  }
  .reminder-banner button {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 1rem;
    flex-shrink: 0;
    padding: 2px 4px;
  }

  .theme-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 10px;
    padding: 8px 12px;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    font-size: 0.85rem;
    transition: border-color 0.15s ease;
  }
  .theme-btn:hover { border-color: var(--accent); }

  .acct-dot {
    display: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--muted);
    margin-right: 7px;
    vertical-align: middle;
  }
  .acct-dot.on { display: inline-block; }
  .acct-dot.ok { background: var(--green); }
  .acct-dot.warn { background: var(--amber); }
  .acct-dot.err { background: var(--red); }

  .account-dialog {
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow);
    padding: 20px;
    width: min(92vw, 400px);
    font-family: var(--font-body);
  }
  .account-dialog::backdrop { background: rgba(10, 12, 24, 0.6); }
  .acct-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
  .acct-head h2 { font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; margin: 0; }
  .acct-intro { color: var(--muted); font-size: 0.88rem; margin: 0 0 14px; }
  .acct-intro strong { color: var(--text); word-break: break-all; }
  .acct-status { font-size: 0.82rem; color: var(--muted); margin: 0 0 14px; }
  .acct-form { display: grid; gap: 10px; }
  .acct-form .field { display: flex; flex-direction: column; gap: 4px; }
  .acct-form label { font-size: 0.75rem; color: var(--muted); font-weight: 500; }
  .acct-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
  .acct-secondary {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 10px 16px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
  }
  .acct-secondary:hover { border-color: var(--accent); }
  .acct-secondary.small-btn { padding: 7px 12px; font-size: 0.78rem; white-space: nowrap; }
  .acct-secondary:disabled { opacity: 0.6; cursor: default; }
  .acct-link {
    background: none;
    border: none;
    padding: 0;
    color: var(--accent);
    font-family: var(--font-body);
    font-size: 0.8rem;
    text-align: left;
    cursor: pointer;
  }
  .account-dialog { max-height: 90vh; overflow-y: auto; }
  .acct-data { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
  .acct-data summary { cursor: pointer; font-size: 0.85rem; font-weight: 600; color: var(--text); }
  .acct-hint { display: block; color: var(--muted); font-size: 0.78rem; margin: 8px 0 6px; }
  .acct-data textarea {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 9px;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    padding: 8px 10px;
    resize: vertical;
  }
  .acct-data textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
  .acct-data .acct-link { margin-top: 10px; }
  .acct-danger { display: grid; gap: 8px; margin-top: 14px; justify-items: start; }
  .acct-link-danger { color: var(--red); }
  .acct-msg { min-height: 1.2em; font-size: 0.82rem; margin: 12px 0 0; color: var(--muted); }
  .acct-msg.err { color: var(--red); }
  .acct-msg.ok { color: var(--green); }

  @media (max-width: 760px) {
    .cards { grid-template-columns: 1fr; }
    form.add-form { grid-template-columns: 1fr 1fr; }
    form.add-form .field.type-field { grid-column: 1 / -1; }
    form.add-form .submit-field { grid-column: 1 / -1; }
    #txContent table, #txContent thead, #txContent tbody, #txContent th, #txContent td, #txContent tr { display: block; }
    #txContent thead { display: none; }
    #txContent tr { border-bottom: 1px solid var(--border); padding: 8px 0; position: relative; }
    #txContent tr:hover td { background: none; }
    #txContent td { border: none; padding: 3px 0; }
    #txContent td.amount { text-align: left; }
    #txContent .del-btn { position: absolute; top: 8px; right: 0; }
    form.recurring-form { grid-template-columns: 1fr 1fr; }
    .salary-box { flex-direction: column; align-items: stretch; }
    .salary-input-wrap { justify-content: flex-end; }
    .breakdown-row { flex-wrap: wrap; }
    .breakdown-row .cat-name { width: auto; flex: 1; }
    .breakdown-row .bar-bg { flex-basis: 100%; order: 3; }
    .breakdown-row .amt-wrap { width: auto; }
    .evolution-chart { gap: 4px; height: 130px; }
    .evolution-bar { width: 9px; }
    .evolution-label { font-size: 0.62rem; }
    .evolution-solde { font-size: 0.6rem; }
    .evolution-hint { display: none; }
  }

/* Pages légales et 404 */
.doc { max-width: 760px; margin: 0 auto; padding: 24px 16px 48px; }
.doc h1 { font-family: var(--font-display); font-size: 1.6rem; margin: 0 0 4px; }
.doc h2 { font-family: var(--font-display); font-size: 1.05rem; margin: 26px 0 8px; }
.doc p, .doc li { line-height: 1.6; }
.doc ul { padding-left: 22px; }
.doc a { color: var(--accent-dark); }
.doc-meta { color: var(--muted); font-size: 0.85rem; margin: 0 0 8px; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; margin: 8px 0; }
.doc-table th, .doc-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.doc-actions { margin: 28px 0 8px; }
.doc-links { margin: 0; font-size: 0.9rem; }
.doc-cta { display: inline-block; background: var(--accent); color: var(--on-accent); font-weight: 700; text-decoration: none; padding: 11px 18px; border-radius: 9px; }
.doc .doc-cta { color: var(--on-accent); }
.doc-cta:focus-visible, .doc a:focus-visible { outline: 3px solid var(--accent-dark); outline-offset: 2px; }
.doc-center { text-align: center; padding: 40px 20px; }
.doc-code { font-family: var(--font-mono); font-size: 3.4rem; font-weight: 600; color: var(--muted); margin: 0; }

/* Pied de page de l'application */
.site-footer { text-align: center; font-size: 0.85rem; color: var(--muted); padding: 8px 0 28px; }
.site-footer a { color: var(--muted); text-decoration: underline; }
.acct-legal { font-size: 0.8rem; color: var(--muted); margin: 8px 0 0; line-height: 1.5; }
.acct-legal a { color: var(--muted); text-decoration: underline; }
.doc-table td:first-child { font-family: var(--font-body); font-weight: 600; }
.doc-center h1 { justify-content: center; text-align: center; }

/* Bandeau d'installation de l'application (téléphone / tablette) */
.install-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 14px; background: var(--accent-soft); border: 1px solid var(--border-strong); border-radius: 14px; padding: 12px 14px; margin-bottom: 16px; }
.install-bar[hidden], .install-bar [hidden] { display: none; }
.install-text { display: grid; gap: 2px; min-width: 0; flex: 1 1 200px; }
.install-text strong { font-family: var(--font-display); font-size: 0.95rem; color: var(--text); }
.install-text span { font-size: 0.82rem; color: var(--text); line-height: 1.4; }
.install-actions { display: flex; align-items: center; gap: 14px; }
.install-actions .acct-link { padding: 8px 2px; }

/* Champ mot de passe avec bouton Afficher / Masquer */
.pw-wrap { position: relative; display: flex; }
.pw-wrap input { padding-right: 82px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--accent-dark); font-family: var(--font-body); font-size: 0.78rem; font-weight: 600; padding: 6px 8px; border-radius: 7px; cursor: pointer; }
.pw-toggle:hover { text-decoration: underline; }
.pw-toggle:focus-visible { outline: 2px solid var(--accent-dark); outline-offset: 1px; }

/* Menu Options : onglets */
.opt-tabs { display: flex; gap: 4px; margin: 4px 0 14px; padding-bottom: 2px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--border); }
.opt-tabs::-webkit-scrollbar { display: none; }
.opt-tab { flex: 0 0 auto; background: none; border: none; border-bottom: 2px solid transparent; color: var(--muted); font-family: var(--font-body); font-size: 0.85rem; font-weight: 600; padding: 8px 10px; cursor: pointer; border-radius: 8px 8px 0 0; }
.opt-tab[hidden], .opt-panel[hidden] { display: none; }
.opt-tab:hover { color: var(--text); }
.opt-tab[aria-selected="true"] { color: var(--accent-dark); border-bottom-color: var(--accent); }
.opt-tab:focus-visible { outline: 2px solid var(--accent-dark); outline-offset: -2px; }
.acct-data.flat { margin-top: 0; border-top: 0; padding-top: 0; }
.inline-link { display: inline; font-size: inherit; font-weight: 600; text-decoration: underline; }

/* Bouton « Continuer avec Google » */
.google-block { margin-bottom: 14px; }
.google-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; background: #ffffff; color: #1f1f1f; border: 1px solid #747775; border-radius: 9px; padding: 10px 14px; font-family: var(--font-body); font-size: 0.9rem; font-weight: 600; cursor: pointer; }
.google-btn:hover { background: #f1f3f4; }
.google-btn:focus-visible { outline: 2px solid var(--accent-dark); outline-offset: 2px; }
.acct-or { display: flex; align-items: center; gap: 10px; margin: 12px 0 0; color: var(--muted); font-size: 0.78rem; }
.acct-or::before, .acct-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* À propos et statistiques */
.about-list { margin: 0 0 8px; display: grid; gap: 8px; }
.about-list div { display: grid; gap: 2px; }
.about-list dt { color: var(--muted); font-size: 0.78rem; }
.about-list dd { margin: 0; font-family: var(--font-mono); font-size: 0.85rem; word-break: break-word; }
.stats-body { display: grid; gap: 14px; margin-bottom: 10px; }
.stats-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.stats-kpi { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.stats-kpi .n { font-family: var(--font-mono); font-size: 1.25rem; font-weight: 600; }
.stats-kpi .l { color: var(--muted); font-size: 0.75rem; }
.stats-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.stats-table th, .stats-table td { text-align: right; padding: 5px 6px; border-bottom: 1px solid var(--border); font-family: var(--font-mono); }
.stats-table th:first-child, .stats-table td:first-child { text-align: left; }
.stats-table th { color: var(--muted); font-weight: 500; font-family: var(--font-body); }
.footer-version { font-family: var(--font-mono); font-size: 0.78rem; }

/* Navigation Budget / Épargne */
.view-nav { display: inline-flex; gap: 4px; padding: 4px; margin: 0 0 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.view-tab { background: none; border: none; color: var(--muted); font-family: var(--font-body); font-size: 0.9rem; font-weight: 600; padding: 8px 18px; border-radius: 9px; cursor: pointer; }
.view-tab:hover { color: var(--text); }
.view-tab[aria-current="page"] { background: var(--accent-soft); color: var(--accent-dark); }
.view-tab:focus-visible { outline: 2px solid var(--accent-dark); outline-offset: 1px; }
.month-picker[hidden] { display: none; }
#viewBudget[hidden], #viewSavings[hidden] { display: none; }

/* Page Épargne */
.sv-horizon { margin-left: 6px; width: auto; padding: 2px 6px; font-size: 0.78rem; border-radius: 7px; }
.sv-proj-card .label { display: flex; align-items: center; flex-wrap: wrap; }
.sv-actions { display: flex; flex-direction: row; align-items: center; gap: 10px; }
.sv-list { display: grid; gap: 12px; }
.sv-item { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 14px; display: grid; gap: 6px; }
.sv-item-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; align-items: flex-start; }
.sv-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.sv-title strong { font-family: var(--font-display); font-size: 1rem; word-break: break-word; }
.sv-type { color: var(--muted); font-size: 0.78rem; }
.sv-item-actions { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.sv-item-actions .acct-link { padding: 4px 0; }
.sv-balance { font-family: var(--font-mono); font-size: 1.35rem; font-weight: 600; }
.sv-meta { color: var(--muted); font-size: 0.8rem; }
.sv-proj-line { font-size: 0.85rem; }
.sv-progress { height: 8px; border-radius: 6px; background: var(--border); overflow: hidden; }
.sv-progress-fill { height: 100%; background: var(--green); border-radius: 6px; }
.sv-update { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 4px; }
.sv-update[hidden] { display: none; }
.sv-update input { width: 150px; }
.sv-chart { display: flex; align-items: flex-end; gap: 6px; height: 170px; padding: 8px 4px 0; }
.sv-col { flex: 1 1 0; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; gap: 6px; }
.sv-bar { background: var(--accent); border-radius: 6px 6px 2px 2px; opacity: 0.55; min-height: 2px; }
.sv-bar.current { opacity: 1; }
.sv-bar.none { background: var(--border-strong); opacity: 0.5; }
.sv-lab { color: var(--muted); font-size: 0.7rem; text-align: center; white-space: nowrap; }
@media (max-width: 480px) {
  .sv-chart { gap: 4px; }
  .sv-lab { font-size: 0.62rem; }
  .sv-col:nth-child(even) .sv-lab { visibility: hidden; }
}
.savings-hint { grid-column: 1 / -1; margin: 0; font-size: 0.82rem; color: var(--muted); line-height: 1.4; }
.savings-hint[hidden], form.add-form .field[hidden] { display: none; }

/* Boutons d'action des lignes (modifier, détails) */
.edit-btn, .rec-toggle { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 0.95rem; padding: 4px 6px; border-radius: 6px; transition: color 0.15s ease, background 0.15s ease; }
.edit-btn:hover, .rec-toggle:hover { color: var(--accent-dark); background: var(--accent-soft); }
.edit-btn:focus-visible, .rec-toggle:focus-visible { outline: 2px solid var(--accent-dark); outline-offset: 1px; }
.rec-toggle { transition: transform 0.15s ease, color 0.15s ease, background 0.15s ease; }
.rec-toggle[aria-expanded="true"] { transform: rotate(180deg); }
.row-actions { white-space: nowrap; text-align: right; }

/* Ligne d'opération fixe compacte : détails repliés par défaut */
.rec-details { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-top: 4px; border-top: 1px dashed var(--border); }
.rec-details[hidden] { display: none; }
.rec-details select { width: auto; min-width: 130px; max-width: 100%; }
.rec-badge { font-size: 0.72rem; font-weight: 600; color: var(--accent-dark); background: var(--accent-soft); border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.rec-badge.warn { color: var(--amber); background: var(--amber-bg); }
@media (max-width: 760px) {
  #txContent .edit-btn { position: absolute; top: 8px; right: 34px; }
  #txContent .row-actions { text-align: left; }
}
