/*
 * Calculateur Plus-Value BTC — PMAP France
 * Styles — light/dark theme
 * PHP 8.1+ · Laragon
 */

  :root {
    --bg:       #f4f5f7;
    --surface:  #ffffff;
    --surface2: #f0f1f4;
    --border:   #dde0e8;
    --accent:   #d97706;
    --accent2:  #f59e0b;
    --text:     #1a1d27;
    --muted:    #6b7280;
    --green:    #16a34a;
    --red:      #dc2626;
    --blue:     #1d4ed8;
    --radius:   10px;
    --font:     'IBM Plex Mono', 'Courier New', monospace;
    --sans:     'IBM Plex Sans', system-ui, sans-serif;
  }
  @import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans:wght@400;500;600&display=swap');

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

  body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
  }

  /* ── Header ── */
  header {
    border-bottom: 1px solid var(--border);
    padding: 10px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  }
  body.dark header { box-shadow: 0 2px 8px rgba(0,0,0,0.4); }
  .header-logo {
    display: flex; align-items: center; flex-shrink: 0;
  }
  .header-logo img { border-radius: 8px; }
  .logo {
    width: 40px; height: 40px;
    background: var(--accent);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font);
    font-weight: 600;
    font-size: 20px;
    color: #000;
    flex-shrink: 0;
  }
  .header-title h1 {
    font-family: var(--font);
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.01em;
    line-height: 1.2;
  }
  .header-title p {
    font-size: 11px;
    color: var(--muted);
    font-family: var(--font);
  }
  .header-toggle {
    display: flex;
    align-items: center;
  }
  .header-toggle .vue-toggle {
    margin-bottom: 0;
  }
  .header-spacer { flex: 1; }
  .btn-header {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 7px 14px;
    font-size: 12px;
    font-family: var(--font);
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
    transition: border-color 0.15s, background 0.15s;
    flex-shrink: 0;
  }
  .btn-header:hover { border-color: var(--accent); background: var(--surface); }
  #upload-form-mini { display: inline; }

  /* ── Layout ── */
  main { max-width: 1280px; margin: 0 auto; padding: 32px; }

  /* ── Upload zone ── */
  .upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 48px 32px;
    text-align: center;
    background: var(--surface);
    transition: border-color 0.2s;
    cursor: pointer;
  }
  .upload-zone:hover { border-color: var(--accent); }
  .upload-zone input[type=file] { display: none; }
  .upload-icon {
    font-size: 40px;
    margin-bottom: 16px;
  }
  .upload-zone h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text);
  }
  .upload-zone p { color: var(--muted); font-size: 13px; margin-bottom: 24px; }
  .btn-primary {
    background: var(--accent);
    color: #000;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    padding: 10px 24px;
    font-size: 14px;
    font-family: var(--font);
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    display: inline-block;
  }
  .btn-primary:hover { background: var(--accent2); }
  .btn-primary:active { transform: scale(0.98); }
  #file-label {
    display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  }
  #file-name {
    font-family: var(--font);
    font-size: 13px;
    color: var(--accent);
    margin-top: 12px;
    min-height: 20px;
  }

  /* ── Error ── */
  .alert-error {
    background: #fef2f2;
    border: 1px solid var(--red);
    border-radius: var(--radius);
    padding: 16px 20px;
    color: var(--red);
    margin-bottom: 24px;
    font-family: var(--font);
    font-size: 13px;
  }

  /* ── Synthèse cards ── */
  .summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
  }
  .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
  }
  .card-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    font-family: var(--font);
    margin-bottom: 8px;
  }
  .card-value {
    font-family: var(--font);
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
  }
  .card-value.positive { color: var(--green); }
  .card-value.negative { color: var(--red); }
  .card-value.neutral  { color: var(--accent); }
  .card-sub {
    font-size: 11px;
    color: var(--muted);
    margin-top: 4px;
    font-family: var(--font);
  }
  .card.highlight {
    border-color: var(--accent);
    background: #fffbeb;
  }

  /* ── Section title ── */
  .section-title {
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    margin: 32px 0 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .section-title span.dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    display: inline-block;
  }
  .dot-green  { background: var(--green); }
  .dot-red    { background: var(--red); }
  .dot-blue   { background: var(--blue); }
  .dot-orange { background: var(--accent); }

  /* ── Tables ── */
  .table-wrap {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 70vh;
    border: 1px solid var(--border);
    border-radius: var(--radius);
  }
  table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font);
    font-size: 12.5px;
  }
  thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--surface2);
    color: var(--muted);
    padding: 10px 14px;
    text-align: right;
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
    box-shadow: 0 1px 0 var(--border);
  }
  thead th:first-child { text-align: left; }
  tbody tr { border-top: 1px solid var(--border); }
  tbody tr:hover { background: var(--surface2); }
  tbody td {
    padding: 9px 14px;
    text-align: right;
    color: var(--text);
    vertical-align: middle;
    white-space: nowrap;
  }
  tbody td:first-child { text-align: left; }
  .td-date { color: var(--muted); font-size: 11px; }
  .td-btc  { color: var(--accent); }
  .td-eur  { color: var(--blue); }
  .td-pv-positive { color: var(--green); font-weight: 600; }
  .td-pv-negative { color: var(--red); font-weight: 600; }
  .td-muted { color: var(--muted); }
  .badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
  }
  .badge-achat { background: #f0fdf4; color: var(--green); border: 1px solid #bbf7d0; }
  .badge-vente { background: #fef2f2; color: var(--red);   border: 1px solid #fecaca; }
  .badge-ignore{ background: var(--surface2); color: var(--muted); border: 1px solid var(--border); }

  /* ── Détail vente ── */
  .vente-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
  }
  .vente-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
  }
  .vente-card h3 {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 14px;
    font-family: var(--font);
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .vente-card h3 .pv-badge {
    font-weight: 600;
    font-size: 14px;
  }
  .detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    font-size: 12px;
    border-bottom: 1px solid var(--border);
  }
  .detail-row:last-child { border-bottom: none; }
  .detail-row .lbl { color: var(--muted); }
  .detail-row .val { font-weight: 500; }

  /* ── Formule box ── */
  .formula-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 32px;
    font-family: var(--font);
    font-size: 13px;
    line-height: 2;
  }
  .formula-box h4 {
    color: var(--accent);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 12px;
  }
  .formula-line { color: var(--text); }
  .formula-line .op { color: var(--muted); }
  .formula-line .var { color: var(--blue); }
  .formula-line .res { color: var(--green); font-weight: 600; }

  /* ── Disclaimer ── */
  .disclaimer {
    margin-top: 40px;
    padding: 16px 20px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--radius);
    font-size: 12px;
    color: #92400e;
    font-family: var(--font);
    line-height: 1.7;
  }
  .disclaimer strong { color: #b45309; }

  /* ── Footer ── */
  footer {
    text-align: center;
    padding: 24px;
    font-size: 11px;
    color: var(--muted);
    font-family: var(--font);
    border-top: 1px solid var(--border);
    margin-top: 40px;
  }

  /* ── Dark theme overrides ── */
  body.dark {
    --bg:       #0f1117;
    --surface:  #171b24;
    --surface2: #1e2330;
    --border:   #2a2f3e;
    --accent:   #f7931a;
    --accent2:  #ffb347;
    --text:     #e8e8f0;
    --muted:    #7a7f94;
    --green:    #3ecf8e;
    --red:      #f65c5c;
    --blue:     #5b8def;
  }
  body.dark .card.highlight    { background: #1e1810; }
  body.dark .badge-loi         { background: #1c2035; }
  body.dark .alert-error       { background: #2a1515; }
  body.dark .badge-achat       { background: #0d2e1e; border-color: #1a5c3a; }
  body.dark .badge-vente       { background: #2a1515; border-color: #5c1a1a; }
  body.dark .badge-ignore      { background: #1c1c2a; }

  body.dark .cerfa-input      { background: #1e2330; color: #e8e8f0; }
  body.dark .cerfa-intro      { background: #171b24; }
  body.dark .cerfa-card       { background: #171b24; }
  body.dark .cerfa-card-header{ background: #1e2330; }
  body.dark .cerfa-result-row { background: #1e2330; }
  body.dark .cerfa-note       { background: #1e2330; }
  body.dark .disclaimer       { background: #171014; border-color: #3a2525; color: #8a7070; }
  body.dark .disclaimer strong { color: var(--red); }
  body.dark .disclaimer        { background: #171014; border-color: #3a2525; color: #8a7070; }
  body.dark .disclaimer strong { color: var(--red); }

  /* ── Theme toggle button ── */
  .theme-toggle {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 12px;
    font-family: var(--font);
    color: var(--muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: border-color 0.2s, color 0.2s;
    white-space: nowrap;
  }
  .theme-toggle:hover { border-color: var(--accent); color: var(--text); }

  /* ── PDF button ── */
  .btn-pdf {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 20px;
    font-size: 13px;
    font-family: var(--font);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: border-color 0.15s, background 0.15s;
    margin-bottom: 24px;
  }
  .btn-pdf:hover { border-color: var(--accent); background: var(--surface2); }

  /* ── Print / PDF styles ── */
  @media print {
    header .theme-toggle,
    header .badge-loi,
    #upload-form,
    .btn-pdf,
    footer { display: none !important; }

    body { font-size: 11px; background: #fff; color: #000; }
    body.dark { background: #0f1117; color: #e8e8f0; }

    header {
      border-bottom: 1px solid #ccc;
      margin-bottom: 16px;
      padding: 12px 0;
    }
    main { padding: 0; max-width: 100%; }

    .summary-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .card { border: 1px solid #ccc; padding: 10px; break-inside: avoid; }
    body.dark .card { border-color: #2a2f3e; }

    .vente-detail-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .vente-card { break-inside: avoid; border: 1px solid #ccc; }
    body.dark .vente-card { border-color: #2a2f3e; }

    .table-wrap {
      border: none;
      overflow: visible;
      overflow-x: visible;
      overflow-y: visible;
      max-height: none;
    }
    table { font-size: 10px; }
    thead th {
      position: static !important;
      background: #f0f0f0 !important;
      color: #444 !important;
      box-shadow: none !important;
    }
    body.dark thead th { background: #1e2330 !important; color: #7a7f94 !important; }
    tbody tr { break-inside: avoid; }

    .section-title { break-after: avoid; margin-top: 20px; }
    .formula-box { break-inside: avoid; }
    .disclaimer {
      break-inside: avoid;
      break-before: auto;
      clear: both;
      margin-top: 24px;
      position: static !important;
    }

    .print-header {
      display: block !important;
      font-family: 'IBM Plex Mono', monospace;
      font-size: 10px;
      color: #888;
      margin-bottom: 20px;
      padding-bottom: 8px;
      border-bottom: 1px solid #ddd;
    }
  }

  /* ── Données générales ── */
  .gen-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 0;
  }
  .gen-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
  }
  .gen-block-title {
    font-family: var(--font);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 12px;
  }
  .gen-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    font-size: 13px;
    font-family: var(--font);
    border-bottom: 1px dashed var(--border);
  }
  .gen-row:last-child { border-bottom: none; }
  .gen-row .lbl { color: var(--muted); }
  .gen-row .val { font-weight: 600; color: var(--text); }
  .gen-row .val.blue { color: var(--blue); }
  .gen-row .val.orange { color: var(--accent); }

  /* ── Bloc données année filtrée ── */
  #gen-year-block .gen-block {
    border-left: 3px solid var(--accent);
  }
  #gen-year-block .gen-block-title {
    color: var(--accent);
  }
  /* ── Vue mode label (remplace les toggles locaux) ── */
  .vue-mode-label {
    font-family: var(--font);
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 12px;
    padding: 6px 12px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
  }
  .vue-mode-label span:first-of-type {
    color: var(--text);
    font-weight: 600;
  }
  @media print { .vue-mode-label { display: none !important; } }

  /* toggle-global-wrap est maintenant dans le header sticky */

  /* ── Vue toggle (par transaction / par journée) ── */
  .vue-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
  }
  .vue-btn {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 7px 16px;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .vue-btn:hover { border-color: var(--accent); color: var(--text); }
  .vue-btn.active {
    background: var(--surface);
    border-color: var(--accent);
    color: var(--text);
    font-weight: 600;
  }
  .vue-badge {
    background: var(--accent);
    color: #000;
    font-size: 10px;
    font-weight: 700;
    border-radius: 10px;
    padding: 1px 6px;
  }
  @media print {
    .vue-toggle { display: none; }
    #vue-journee { display: block !important; }
    #vue-transactions { display: none !important; }
    #cerfa-tabs-jour { display: block !important; }
    #cerfa-tabs-tx   { display: none !important; }
  }

  /* ── Year selector ── */
  .year-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
  }
  .year-btn {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 7px 18px;
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    transition: all 0.15s;
  }
  .year-btn:hover { border-color: var(--accent); color: var(--text); }
  .year-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #000;
  }
  .year-desc {
    font-size: 12px;
    font-family: var(--font);
    color: var(--muted);
    margin-top: 8px;
    line-height: 1.6;
  }
  .year-desc strong { color: var(--text); }

  /* ── Journal — hors-période rows ── */
  tr.hors-periode { opacity: 0.35; }

  @media (max-width: 640px) {
    .gen-grid { grid-template-columns: 1fr; }
  }
  @media print {
    .year-selector { display: none; }
    tr.hors-periode { display: none; }
  }

  /* ── Reconciliation block ── */
  .reconcile-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 24px;
    overflow: hidden;
  }
  .reconcile-title {
    background: var(--surface2);
    border-bottom: 1px solid var(--border);
    padding: 10px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
  }
  .reconcile-status {
    font-size: 12px;
    font-weight: 600;
  }
  .reconcile-grid {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 20px 24px;
  }
  .reconcile-col {
    flex: 1;
    text-align: center;
  }
  .reconcile-sep {
    flex: 0 0 40px;
    text-align: center;
    font-family: var(--font);
    font-size: 18px;
    font-weight: 600;
    color: var(--muted);
  }
  .reconcile-label {
    font-family: var(--font);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted);
    margin-bottom: 6px;
  }
  .reconcile-val {
    font-family: var(--font);
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
  }
  .reconcile-note {
    font-size: 11px;
    color: var(--muted);
    font-family: var(--font);
  }
  .reconcile-footer {
    border-top: 1px solid var(--border);
    background: var(--surface2);
    padding: 10px 18px;
    font-family: var(--font);
    font-size: 12px;
    color: var(--text);
    line-height: 1.6;
  }
  @media (max-width: 640px) {
    .reconcile-grid { flex-direction: column; gap: 12px; }
    .reconcile-sep  { transform: rotate(90deg); }
  }
  @media print {
    .reconcile-box { break-inside: avoid; }
  }

  /* ── CSV order banner ── */
  .csv-order-banner {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--blue);
    border-radius: var(--radius);
    padding: 10px 16px;
    font-size: 12px;
    font-family: var(--font);
    color: var(--muted);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .csv-order-banner strong { color: var(--text); }
  .csv-order-icon { font-size: 16px; }
  @media print { .csv-order-banner { display: none; } }

  /* ── Cerfa 2086 ── */
  .cerfa-section {
    margin-bottom: 32px;
  }
  .cerfa-intro {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--blue);
    border-radius: var(--radius);
    padding: 14px 18px;
    font-size: 12px;
    color: var(--muted);
    font-family: var(--font);
    margin-bottom: 20px;
    line-height: 1.7;
  }
  .cerfa-intro strong { color: var(--text); }
  .cerfa-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
  }
  .cerfa-tab {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 12px;
    font-family: var(--font);
    color: var(--muted);
    cursor: pointer;
    transition: all 0.15s;
  }
  .cerfa-tab:hover { border-color: var(--accent); color: var(--text); }
  .cerfa-tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #000;
    font-weight: 600;
  }
  .cerfa-panel { display: none; }
  .cerfa-panel.active { display: block; }
  .cerfa-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
  }
  .cerfa-card-header {
    background: var(--surface2);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
  }
  .cerfa-card-header span {
    font-family: var(--font);
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
  }
  .cerfa-card-header .pv-result {
    font-size: 15px;
    font-weight: 600;
  }
  .cerfa-group {
    padding: 4px 0;
    margin: 0 16px;
    border-bottom: 1px solid var(--border);
  }
  .cerfa-group:last-child { border-bottom: none; }
  .cerfa-group-title {
    font-family: var(--font);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    padding: 10px 0 4px;
  }
  .cerfa-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px dashed var(--border);
  }
  .cerfa-row:last-child { border-bottom: none; }
  .cerfa-ligne-num {
    flex: 0 0 36px;
    font-family: var(--font);
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 4px;
    text-align: center;
    padding: 2px 0;
  }
  .cerfa-ligne-label {
    flex: 1;
    font-size: 12px;
    color: var(--muted);
    font-family: var(--font);
    line-height: 1.4;
  }
  .cerfa-ligne-val {
    flex: 0 0 160px;
    text-align: right;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
  }
  .cerfa-ligne-val.editable-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: flex-end;
  }
  .cerfa-input {
    width: 120px;
    text-align: right;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    background: var(--surface2);
    border: 1px solid var(--accent);
    border-radius: 6px;
    padding: 4px 8px;
    color: var(--text);
    outline: none;
  }
  .cerfa-input:focus { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(91,141,239,0.15); }
  .cerfa-eur { font-size: 11px; color: var(--muted); }
  .cerfa-computed {
    color: var(--blue);
  }
  .cerfa-result-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--surface2);
    border-top: 2px solid var(--accent);
    margin-top: 2px;
  }
  .cerfa-result-row .cerfa-ligne-num {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
  }
  .cerfa-result-row .cerfa-ligne-label {
    font-weight: 600;
    color: var(--text);
    font-size: 13px;
  }
  .cerfa-result-row .cerfa-ligne-val {
    font-size: 16px;
  }
  .cerfa-note {
    font-size: 11px;
    color: var(--muted);
    padding: 8px 16px 10px;
    font-family: var(--font);
    font-style: italic;
    border-top: 1px solid var(--border);
    background: var(--surface2);
  }
  .cerfa-hint {
    font-size: 10px;
    color: var(--muted);
    font-style: italic;
  }
  @media print {
    .cerfa-tabs { display: none !important; }
    .cerfa-panel { display: block !important; page-break-inside: avoid; margin-bottom: 16px; }
    .cerfa-input { border: 1px solid #aaa; background: #f9f9f9; }
  }
  body.dark .cerfa-input { background: #1e2330; }
  /* ── Prefill button ── */
  .btn-prefill {
    display: block;
    width: 100%;
    background: var(--surface2);
    border: 1px dashed var(--accent);
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 11px;
    font-family: var(--font);
    color: var(--accent);
    cursor: pointer;
    text-align: center;
    transition: background 0.15s;
    margin-bottom: 6px;
  }
  .btn-prefill:hover { background: var(--accent); color: #000; }
  .prefill-method {
    font-size: 10px;
    font-family: var(--font);
    color: var(--text);
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 8px;
    line-height: 1.6;
    margin-top: 4px;
  }
  @media print {
    .btn-prefill { display: none !important; }
    .prefill-method { display: block !important; font-size: 9px; }
  }

  .print-header { display: none; }

  @media (max-width: 640px) {
    main { padding: 16px; }
    header { padding: 16px; }
    .card-value { font-size: 18px; }
  }
