/* --- En-tête ------------------------------------------------------------ */
.masthead {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4);
  border-bottom: 3px solid var(--ink); padding-bottom: var(--space-4); margin-bottom: var(--space-5);
  flex-wrap: wrap;
}
.masthead-title em { font-style: italic; color: var(--red); }
.masthead-sub { font-family: var(--font-serif); color: var(--ink-soft); max-width: 52ch; margin: var(--space-2) 0 0; }
.seal {
  flex-shrink: 0; width: 92px; height: 92px; border-radius: 50%;
  border: 2.5px solid var(--red); color: var(--red);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: var(--font-mono); transform: rotate(-6deg); position: relative;
}
.seal::before { content: ''; position: absolute; inset: 6px; border: 1px solid var(--red-soft); border-radius: 50%; }
.seal .n { font-size: 25px; font-weight: 600; line-height: 1; }
.seal .l { font-size: 8px; letter-spacing: 0.07em; text-transform: uppercase; margin-top: 2px; text-align: center; }

/* --- Navigation --------------------------------------------------------- */
.nav { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-5); }
.nav-item {
  font: inherit; font-weight: 600; font-size: var(--step--1); cursor: pointer;
  padding: var(--space-2) var(--space-4); border: 1.5px solid var(--ink);
  background: transparent; color: var(--ink); border-radius: 3px;
}
a.nav-item { text-decoration: none; display: inline-flex; align-items: center; }
.nav-item[aria-current='page'] { background: var(--ink); color: var(--paper-card); }
.nav-item:not([aria-current='page']):hover { background: rgba(28, 39, 64, 0.08); }

/* --- Cartes et boutons -------------------------------------------------- */
.card {
  background: var(--paper-card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: var(--space-5); margin-bottom: var(--space-4); box-shadow: var(--shadow-card);
}
.card > h3:first-child { border-bottom: 1px solid var(--line); padding-bottom: var(--space-2); margin-bottom: var(--space-4); }

.btn {
  font: inherit; font-weight: 600; cursor: pointer; padding: var(--space-3) var(--space-5);
  border: 1.5px solid var(--ink); background: var(--ink); color: var(--paper-card);
  border-radius: var(--radius); transition: opacity 0.15s;
}
.btn:hover { opacity: 0.88; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: rgba(28, 39, 64, 0.08); opacity: 1; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-sm { padding: var(--space-2) var(--space-3); font-size: var(--step--1); }
.btn-mono { font-family: var(--font-mono); font-size: var(--step--1); text-transform: uppercase; letter-spacing: 0.04em; }

/* --- Formulaires -------------------------------------------------------- */
.field { display: block; margin-bottom: var(--space-4); }
.field > span { display: block; font-weight: 600; font-size: var(--step--1); margin-bottom: var(--space-2); }
.field .hint { font-weight: 400; color: var(--ink-soft); }
input[type='text'], input[type='password'], input[type='email'], input[type='date'], input[type='search'], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--paper-raised);
  border: 1.5px solid var(--line); border-radius: var(--radius); padding: var(--space-3);
}
textarea { resize: vertical; font-family: var(--font-serif); font-size: var(--step-1); line-height: 1.7; }
select { cursor: pointer; }
.inline-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: var(--space-4); }

/* --- Pastilles et états ------------------------------------------------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono);
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 4px 10px; border-radius: 20px; border: 1.5px solid var(--gold); color: var(--gold);
  background: transparent; cursor: pointer;
}
.pill[aria-pressed='true'] { background: var(--gold); color: #fff; }
.tag { display: inline-block; font-family: var(--font-mono); font-size: 11px; padding: 2px 8px; border-radius: 3px; background: var(--gold-wash); color: var(--gold); }
.tag-ok { background: var(--green-wash); color: var(--green); }
.tag-no { background: var(--red-wash); color: var(--red); }

.notice { border-left: 3px solid var(--gold); background: var(--gold-wash); padding: var(--space-3) var(--space-4); border-radius: 0 var(--radius) var(--radius) 0; }
.notice-error { border-color: var(--red); background: var(--red-wash); }
.notice-ok { border-color: var(--green); background: var(--green-wash); }

/* --- Tableaux ----------------------------------------------------------- */
.table { width: 100%; border-collapse: collapse; font-size: var(--step--1); }
.table th, .table td { text-align: left; padding: var(--space-3) var(--space-2); border-bottom: 1px solid var(--line-soft); }
.table th { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); }
.table tbody tr:hover { background: rgba(28, 39, 64, 0.03); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

/* --- Indicateurs -------------------------------------------------------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--space-3); }
.kpi { border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-4); background: var(--paper-raised); }
.kpi .value { font-family: var(--font-display); font-size: var(--step-2); font-weight: 700; display: block; font-variant-numeric: tabular-nums; }
.kpi .label { font-size: var(--step--1); color: var(--ink-soft); }
.kpi .delta { font-family: var(--font-mono); font-size: 11px; font-weight: 600; }
.delta-up { color: var(--red); }
.delta-down { color: var(--green); }

.gauge { height: 6px; background: var(--line-soft); border-radius: 3px; overflow: hidden; }
.gauge > span { display: block; height: 100%; background: var(--gold); transition: width 0.25s; }

.bar-row { display: grid; grid-template-columns: 130px 1fr 40px; gap: var(--space-3); align-items: center; margin-bottom: var(--space-2); }
.bar-track { height: 14px; background: var(--line-soft); border-radius: 2px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--red); }

/* --- Sparkline ---------------------------------------------------------- */
.spark { width: 100%; height: 72px; display: block; }
.spark path { fill: none; stroke: var(--gold); stroke-width: 2; }
.spark .area { fill: var(--gold-wash); stroke: none; }

/* --- Divers ------------------------------------------------------------- */
.list-select { list-style: none; margin: 0; padding: 0; }
.list-select li {
  border: 1.5px solid var(--line); border-radius: var(--radius); padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-2); cursor: pointer; background: var(--paper-raised);
}
.list-select li:hover { border-color: var(--gold); }
.list-select li[aria-selected='true'] { border-color: var(--gold); background: var(--gold-wash); }

.spinner {
  display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor;
  border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast-region { position: fixed; right: var(--space-4); bottom: var(--space-4); display: grid; gap: var(--space-2); z-index: 40; max-width: 380px; }
.toast { background: var(--ink); color: var(--paper-card); padding: var(--space-3) var(--space-4); border-radius: var(--radius); box-shadow: 0 4px 14px rgba(0,0,0,0.18); }
.toast-error { background: var(--red); }

/* v1.1 — bouton icône (suppression d'un brouillon) */
.icon-btn {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px; padding: 0;
  border: 1px solid var(--line-soft); border-radius: 50%;
  background: transparent; color: var(--ink-soft);
  font-size: 18px; line-height: 1; cursor: pointer;
}
.icon-btn:hover, .icon-btn:focus-visible { background: var(--red); border-color: var(--red); color: var(--paper-card); }
.icon-btn:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
