/* ===========================
   THEME APP DARK FLAT + NANOOK
   =========================== */

   :root {
    /* Palette principale */
    --fm-bg: #0b1120;
    --fm-bg-soft: #0b1120;
    --fm-card-bg: #111827;
    --fm-section-bg: #111827;
    --fm-border: #1f2937;
    --fm-border-soft: #273549;
  
    /* Couleurs de texte */
    --fm-text: #e5edf5;
    --fm-muted: #8a9ba8;
    --fm-subtle: #64748b;
  
    /* Accent identitaire Nanook */
    --fm-accent: #bbd9a8;
    --fm-accent-soft: rgba(187, 217, 168, 0.12);
  
    --fm-radius: 14px;
  
    /* Fonts */
    --fm-font: "Gilroy", system-ui, -apple-system, BlinkMacSystemFont,
      "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
    --fm-font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
      "Liberation Mono", "Courier New", monospace;
  }
  
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }
  
  body {
    margin: 0;
    padding: 40px;
    font-family: var(--fm-font);
    font-weight: 400;
    background: var(--fm-bg);
    color: var(--fm-text);
  }
  
  /* ===== Logo Nanook au-dessus de la box (flat) ===== */
  
  body::before {
    content: "";
    display: block;
    width: 160px;
    height: 35px;
    background-image: url("./img/logo.png");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    margin: 0 auto 40px auto;
    opacity: 0.96;
  }
  
  /* Ajustement responsive du logo */
  @media (max-width: 480px) {
    body::before {
      width: 160px;
      height: 35px;
      margin-bottom: 32px;
    }
  }
  
  /* ----- Container principal (flat) ----- */
  
  .fm-calculateur {
    max-width: 960px;
    margin: 0 auto;
    background: var(--fm-card-bg);
    border-radius: 18px;
    padding: 24px 22px 20px;
    border: 1px solid var(--fm-border-soft);
  }
  
  /* ----- Header ----- */
  
  .fm-header {
    margin-bottom: 18px;
  }
  
  .fm-header h1 {
    margin: 0 0 6px;
    font-size: 1.4rem;
    letter-spacing: 0.02em;
    color: #e2e8f0;
    font-weight: 700; /* Gilroy Bold */
  }
  
  .fm-header p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--fm-muted);
    font-weight: 400; /* Regular */
  }
  
  /* ----- META : numéro + description ----- */
  
  .fm-meta {
    margin-bottom: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--fm-section-bg);
    border-radius: 12px;
    padding: 12px;
    border: 1px solid var(--fm-border-soft);
  }
  
  .fm-meta-field label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--fm-subtle);
    font-weight: 600; /* SemiBold */
  }
  
  .fm-meta-field .fm-input {
    width: 100%;
  }
  
  /* Champ numéro plus petit */
  
  .fm-input--small {
    max-width: 140px;
    text-align: center;
    font-family: var(--fm-font-mono);
    font-size: 0.9rem;
    font-weight: 500;
  }
  
  /* Zone description */
  
  .fm-description {
    width: 100%;
    border-radius: 10px;
    border: 1px solid var(--fm-border-soft);
    padding: 10px 11px;
    resize: vertical;
    min-height: 90px;
    font-family: var(--fm-font-mono);
    font-size: 0.86rem;
    background: #020617;
    color: var(--fm-text);
    line-height: 1.5;
  }
  
  .fm-description:focus {
    outline: none;
    border-color: var(--fm-accent);
    box-shadow: 0 0 0 1px var(--fm-accent-soft);
  }
  
  .fm-meta-field small {
    display: block;
    margin-top: 4px;
    font-size: 0.75rem;
    color: var(--fm-muted);
    font-weight: 300; /* Light */
  }
  
  /* ----- Grille des lignes ----- */
  
  .fm-form {
    margin-bottom: 20px;
    background: var(--fm-section-bg);
    border-radius: 12px;
    padding: 10px 12px 6px;
    border: 1px solid var(--fm-border-soft);
  }
  
  .fm-grid {
    display: grid;
    grid-template-columns: 1.6fr 0.9fr 0.8fr 0.9fr;
    align-items: center;
    gap: 10px;
    padding: 6px 4px;
  }
  
  .fm-grid-header {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--fm-subtle);
    border-bottom: 1px solid var(--fm-border);
    padding-bottom: 8px;
    font-weight: 600;
  }
  
  .fm-row {
    font-size: 0.94rem;
    border-radius: 6px;
    border-bottom: 1px solid transparent;
  }
  
  .fm-row span:first-child {
    font-weight: 500;
    color: #e5e7eb;
  }
  
  .fm-row span:nth-child(2) {
    font-variant-numeric: tabular-nums;
    color: #cbd5f5;
    font-weight: 400;
  }
  
  /* ----- Inputs ----- */
  
  .fm-input {
    width: 100%;
    padding: 6px 8px;
    border-radius: 999px;
    border: 1px solid var(--fm-border-soft);
    font-family: var(--fm-font);
    font-weight: 500;
    text-align: center;
    font-variant-numeric: tabular-nums;
    background: #020617;
    color: var(--fm-text);
    transition: border 0.15s ease, background 0.15s ease;
  }
  
  .fm-input::placeholder {
    color: #6b7280;
    font-weight: 300;
  }
  
  .fm-input:focus {
    outline: none;
    border-color: var(--fm-accent);
    background: #020617;
  }
  
  .fm-line-total {
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: #e5e7eb;
    font-family: var(--fm-font-mono);
    font-size: 0.88rem;
    font-weight: 400;
  }
  
  /* ----- Résultats ----- */
  
  .fm-resultats {
    border-top: 1px solid var(--fm-border);
    padding-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
  }
  
  .fm-total-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 0.96rem;
  }
  
  .fm-total-row span:first-child {
    color: var(--fm-muted);
    font-weight: 400;
  }
  
  .fm-total-row span:last-child {
    font-variant-numeric: tabular-nums;
    font-family: var(--fm-font-mono);
    color: #e5edf9;
    font-weight: 500;
  }
  
  /* Total de pages */
  
  #fm-total-pages {
    color: #bfdbfe;
  }
  
  /* Total TVAC mis en avant */
  
  .fm-total-tvac {
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px dashed var(--fm-border);
    font-size: 1.02rem;
    font-weight: 600;
  }
  
  .fm-total-tvac span:first-child {
    color: var(--fm-text);
  }
  
  .fm-total-tvac span:last-child {
    color: var(--fm-accent);
  }
  
  /* ----- Bouton ----- */
  
  .fm-actions {
    margin-top: 10px;
    display: flex;
    justify-content: flex-end;
  }
  
  #fm-reset {
    border: 1px solid var(--fm-accent);
    border-radius: 999px;
    padding: 6px 18px;
    font-size: 0.88rem;
    cursor: pointer;
    background: var(--fm-accent-soft);
    color: var(--fm-accent);
    font-family: var(--fm-font);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  }
  
  #fm-reset:hover {
    background: var(--fm-accent);
    color: #0b1120;
    border-color: var(--fm-accent);
  }
  
  #fm-reset:active {
    background: #a4c68f;
  }
  
  /* ----- Responsive ----- */
  
  @media (max-width: 720px) {
    body {
      padding: 24px;
    }
  
    .fm-calculateur {
      padding: 20px 14px 16px;
    }
  
    .fm-grid,
    .fm-grid-header {
      grid-template-columns: 1.4fr 0.8fr 0.7fr 0.9fr;
      font-size: 0.84rem;
    }
  }
  
  @media (max-width: 540px) {
    .fm-grid,
    .fm-grid-header {
      grid-template-columns: 1.5fr 0.8fr 0.7fr 0.9fr;
    }
  }
  