/* HanaBuy — adopting HanaOS design tokens.
   Built on top of Bootstrap 5; overrides only what the design system mandates. */

@import url('tokens.css');

/* =============================================================
   Bootstrap variable overrides (CSS custom props that BS5 reads)
   ============================================================= */
:root {
  --bs-primary: var(--brand-primary);
  --bs-primary-rgb: 207, 23, 54;
  --bs-body-font-family: var(--font-sans);
  --bs-body-font-size: 0.875rem;       /* design system body2 in tables/cards */
  --bs-body-color: var(--fg-primary);
  --bs-body-bg: var(--bg-default);
  --bs-border-color: var(--border-cool);
  --bs-border-radius: var(--radius);
  --bs-link-color: var(--brand-primary);
  --bs-link-hover-color: var(--brand-primary-dark);
}

html, body {
  font-family: var(--font-sans);
  background: var(--bg-default);
  color: var(--fg-primary);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Display sizes follow the token ladder — tight tracking, bold weight */
h1, .h1 { font-size: var(--fs-h1); font-weight: var(--fw-bold); line-height: 1; letter-spacing: -0.02em; }
h2, .h2 { font-size: var(--fs-h2); font-weight: var(--fw-bold); line-height: 1.111; letter-spacing: -0.01em; }
h3, .h3 { font-size: var(--fs-h3); font-weight: var(--fw-bold); line-height: 1.2; letter-spacing: -0.01em; }
h4, .h4 { font-size: var(--fs-h4); font-weight: var(--fw-bold); line-height: 1.333; letter-spacing: -0.005em; }
h5, .h5 { font-size: var(--fs-h5); font-weight: var(--fw-semibold); line-height: 1.4; }
h6, .h6 { font-size: var(--fs-h6); font-weight: var(--fw-semibold); line-height: 1.556; letter-spacing: 0.005em; }

/* =============================================================
   Shell layout — app bar, sidebar (drawer-capable), main content
   ============================================================= */

.app-shell {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
}

.app-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ── App bar ─────────────────────────────────────── */
.appbar {
  position: sticky;
  top: 0;
  z-index: 1020;             /* below sidebar so the sidebar visually wins on mobile drawer */
  height: var(--appbar-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  background: var(--bg-paper);
  border-bottom: 1px solid var(--border-cool);
  box-shadow: var(--shadow-appbar);
}

.appbar .appbar-title {
  font-weight: var(--fw-semibold);
  font-size: var(--fs-body1);
  letter-spacing: -0.005em;
  color: var(--fg-primary);
}

.appbar .appbar-spacer { flex: 1 1 auto; }

.appbar-toggle {
  border: 1px solid var(--border-cool);
  background: var(--bg-paper);
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-secondary);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.appbar-toggle:hover { background: var(--grey-100); color: var(--fg-primary); }
.appbar-toggle:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 1px; }

/* App-bar lang & user cluster, pinned right (per HanaOS pattern) */
.appbar-cluster {
  display: flex;
  align-items: center;
  gap: 12px;
}
.appbar-cluster .lang-link {
  font-size: var(--fs-caption);
  font-weight: var(--fw-medium);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-secondary);
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  text-decoration: none;
}
.appbar-cluster .lang-link.active {
  color: var(--brand-primary);
  background: var(--brand-primary-soft);
}
.appbar-cluster .lang-link:hover { color: var(--fg-primary); }

.appbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: var(--radius);
}
.appbar-user .avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--brand-primary);
  color: #fff;
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
}
.appbar-user .meta { line-height: 1.2; }
.appbar-user .meta .name { font-size: var(--fs-body2); font-weight: var(--fw-medium); }
.appbar-user .meta .role { font-size: var(--fs-tiny); color: var(--fg-secondary); letter-spacing: 0.1em; text-transform: uppercase; }

/* ── Sidebar — full-height left column ───────────── */
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--bg-paper);
  border-right: 1px solid var(--border-cool);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  transition: transform 0.22s ease;
  z-index: 1030;             /* above appbar — appbar lives only over content area */
  box-shadow: var(--shadow-appbar);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  height: var(--appbar-h);   /* aligns visually with the appbar on the right */
  border-bottom: 1px solid var(--border-cool);
}
.sidebar-brand .brand-logo {
  width: 36px; height: 36px;
  border-radius: var(--radius);
  object-fit: contain;
  flex-shrink: 0;
}
.sidebar-brand .brand-text { line-height: 1.2; min-width: 0; }
.sidebar-brand .brand-title {
  font-size: var(--fs-body1);
  font-weight: var(--fw-bold);
  letter-spacing: -0.01em;
  color: var(--fg-primary);
}
.sidebar-brand .brand-sub {
  font-size: var(--fs-tiny);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-secondary);
}

/* ── App switcher (HanaBuy ↔ HanaSupply) ─────────── */
.app-switcher {
  display: flex;
  gap: 4px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-cool);
  background: var(--bg-paper);
}
.app-switcher-btn {
  flex: 1;
  padding: 5px 6px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-caption);
  font-weight: var(--fw-medium);
  text-align: center;
  text-decoration: none;
  color: var(--fg-secondary);
  background: transparent;
  border: 1px solid transparent;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
  white-space: nowrap;
  line-height: 1.4;
}
.app-switcher-btn:hover:not(.active) {
  background: var(--grey-100);
  color: var(--fg-primary);
  text-decoration: none;
}
.app-switcher-btn.active {
  background: var(--brand-primary);
  color: #fff;
  border-color: var(--brand-primary);
  pointer-events: none;
}

.sidebar-scroll {
  flex: 1 1 auto;
  padding: 8px 8px 16px;
}

/* Section dividers — overline style, per design system */
.sidebar .nav-header {
  font-size: var(--fs-caption);
  font-weight: var(--fw-medium);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-secondary);
  padding: 16px 12px 6px;
  margin: 0;
  list-style: none;
}

/* Sidebar nav links */
.sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  margin: 1px 0;
  font-size: var(--fs-body2);
  font-weight: var(--fw-medium);
  color: var(--fg-secondary);
  border-radius: var(--radius);
  border-left: 3px solid transparent;
  text-decoration: none;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.sidebar .nav-link i { font-size: 1rem; width: 18px; text-align: center; flex-shrink: 0; }
.sidebar .nav-link:hover {
  background: var(--grey-100);
  color: var(--fg-primary);
}
.sidebar .nav-link.active {
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
  border-left-color: var(--brand-primary);
  font-weight: var(--fw-semibold);
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border-cool);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sidebar-footer .btn { font-size: var(--fs-caption); }

/* ── Main content ────────────────────────────────── */
.main-content {
  flex: 1 1 auto;
  min-width: 0;
  padding: 24px;
  background: var(--bg-default);
}
@media (max-width: 575.98px) {
  .main-content { padding: 16px 12px; }
}

/* ── Backdrop (drawer mode) ──────────────────────── */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.32);
  z-index: 1024;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
body.sidebar-open .sidebar-backdrop {
  opacity: 1;
  pointer-events: auto;
}

/* ── Responsive: drawer below lg, fixed above ─────── */
@media (max-width: 991.98px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(-100%);
    box-shadow: var(--shadow-3);
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open { overflow: hidden; }
}
@media (min-width: 992px) {
  /* Hamburger doubles as a collapse toggle on desktop. Backdrop never shows. */
  .sidebar-backdrop { display: none; }
}

/* ── Collapsed sidebar (desktop only) ─────────────── */
@media (min-width: 992px) {
  body.sidebar-collapsed .sidebar {
    flex-basis: var(--sidebar-w-collapsed);
    width: var(--sidebar-w-collapsed);
    overflow: visible;        /* allow flyout labels to escape */
  }
  body.sidebar-collapsed .sidebar-scroll { overflow: visible; }
  body.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 12px 8px; }
  body.sidebar-collapsed .sidebar-brand .brand-text,
  body.sidebar-collapsed .sidebar .nav-header,
  body.sidebar-collapsed .sidebar-footer .btn span {
    display: none;
  }
  body.sidebar-collapsed .sidebar .nav-link {
    justify-content: center;
    padding: 9px 0;
    position: relative;
  }
  /* Hide labels inline; reveal as flyout on hover */
  body.sidebar-collapsed .sidebar .nav-link span {
    position: absolute;
    left: calc(var(--sidebar-w-collapsed) + 4px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-paper);
    color: var(--fg-primary);
    border: 1px solid var(--border-cool);
    border-radius: var(--radius);
    padding: 6px 12px;
    font-size: var(--fs-body2);
    font-weight: var(--fw-medium);
    white-space: nowrap;
    box-shadow: var(--shadow-2);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s;
    z-index: 1100;
  }
  body.sidebar-collapsed .sidebar .nav-link:hover span,
  body.sidebar-collapsed .sidebar .nav-link:focus-visible span {
    opacity: 1;
  }
  /* Active link in collapsed mode: keep the crimson left border + tint */
  body.sidebar-collapsed .sidebar .nav-link.active {
    border-left-width: 3px;
  }
  body.sidebar-collapsed .sidebar-footer .btn {
    padding: 6px 0;
    justify-content: center;
  }
}

/* =============================================================
   Cards — outline + subtle shadow-1 (the design system's
   "barely-there glow" — gives the surface lift on a slightly
   darker page bg without violating the no-heavy-shadow rule).
   ============================================================= */
.card {
  background: var(--bg-paper);
  border: 1px solid var(--border-cool);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}
.card-header {
  background: var(--bg-paper);
  border-bottom: 1px solid var(--border-cool);
  padding: 12px 16px;
  font-weight: var(--fw-semibold);
  font-size: var(--fs-body2);
}
.card-body { padding: 16px; }

/* =============================================================
   Buttons — calm, no ripple, no scale
   ============================================================= */
.btn {
  font-family: var(--font-sans);
  font-weight: var(--fw-medium);
  font-size: var(--fs-body2);
  letter-spacing: 0;
  border-radius: var(--radius);
  padding: 6px 14px;
  text-transform: none;
  transition: background-color 0.12s, color 0.12s, border-color 0.12s;
}
.btn:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 1px; box-shadow: none; }
.btn-primary {
  background-color: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
}
.btn-primary:hover, .btn-primary:focus {
  background-color: var(--brand-primary-dark);
  border-color: var(--brand-primary-dark);
  color: #fff;
}
.btn-outline-primary {
  color: var(--brand-primary);
  border-color: var(--brand-primary);
}
.btn-outline-primary:hover {
  background-color: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
}
.btn-outline-secondary {
  color: var(--fg-secondary);
  border-color: var(--border-cool);
  background-color: var(--bg-paper);
}
.btn-outline-secondary:hover {
  color: var(--fg-primary);
  background-color: var(--grey-100);
  border-color: var(--border-cool-strong);
}

/* =============================================================
   Forms — 1.5px rest, 2px focus (focus colour from tokens)
   ============================================================= */
.form-control, .form-select {
  font-family: var(--font-sans);
  font-size: var(--fs-body2);
  border: 1.5px solid var(--border-cool);
  border-radius: var(--radius);
  padding: 6px 10px;
  background: var(--bg-paper);
  color: var(--fg-primary);
  transition: border-color 0.12s;
}
.form-control:hover, .form-select:hover { border-color: var(--border-cool-strong); }
.form-control:focus, .form-select:focus {
  border-color: var(--border-focus);
  border-width: 2px;
  box-shadow: none;
  outline: none;
}
.form-label {
  font-size: var(--fs-caption);
  font-weight: var(--fw-medium);
  color: var(--fg-secondary);
  letter-spacing: 0.02em;
  margin-bottom: 4px;
}

/* =============================================================
   Tables — overline column headers, tabular nums, 1px borders
   ============================================================= */
.table {
  font-size: var(--fs-body2);
  color: var(--fg-primary);
  --bs-table-bg: var(--bg-paper);
  --bs-table-border-color: var(--border-cool);
  --bs-table-hover-bg: var(--grey-100);
}
.table > thead {
  background: var(--bg-paper);
}
.table > thead th {
  font-size: var(--fs-caption);
  font-weight: var(--fw-medium);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-secondary);
  border-bottom: 1px solid var(--border-cool);
  white-space: nowrap;
  padding: 10px 12px;
}
.table > tbody td {
  padding: 10px 12px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-cool);
}
.table-numeric, .table-numeric td, td.numeric, th.numeric {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* Selected row: 3px text-primary left border (per design system spec) */
.table > tbody tr.selected td:first-child {
  box-shadow: inset 3px 0 0 var(--fg-primary);
}

/* =============================================================
   Chips / pills — variance, status, today
   ============================================================= */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-caption);
  font-weight: var(--fw-medium);
  background: var(--brand-primary-soft);
  border: 1px solid rgba(207, 23, 54, 0.30);
  color: var(--brand-primary);
}
.chip-success {
  background: rgba(5, 150, 105, 0.06);
  border-color: rgba(5, 150, 105, 0.30);
  color: var(--color-success);
}
.chip-warning {
  background: rgba(217, 119, 6, 0.06);
  border-color: rgba(217, 119, 6, 0.30);
  color: var(--color-warning);
}
.chip-info {
  background: rgba(2, 132, 199, 0.06);
  border-color: rgba(2, 132, 199, 0.30);
  color: var(--color-info);
}
.chip-neutral {
  background: var(--grey-100);
  border-color: var(--border-cool);
  color: var(--fg-secondary);
}
.pill-today {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  background: var(--brand-primary);
  color: #fff;
  font-size: var(--fs-tiny);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* =============================================================
   Misc — alerts, badges, links
   ============================================================= */
.alert {
  border: 1px solid var(--border-cool);
  border-radius: var(--radius);
  font-size: var(--fs-body2);
  padding: 10px 14px;
}
.alert-success { background: rgba(5,150,105,0.06); border-color: rgba(5,150,105,0.30); color: var(--color-success); }
.alert-danger  { background: rgba(225,29,72,0.06); border-color: rgba(225,29,72,0.30); color: var(--color-error); }
.alert-warning { background: rgba(217,119,6,0.06); border-color: rgba(217,119,6,0.30); color: var(--color-warning); }
.alert-info    { background: rgba(2,132,199,0.06); border-color: rgba(2,132,199,0.30); color: var(--color-info); }

.badge { font-weight: var(--fw-medium); border-radius: var(--radius-sm); }
.text-muted-soft { color: var(--fg-secondary) !important; }

/* =============================================================
   Per-page legacy classes — preserved from pre-design-system
   templates (page-header, detail-grid, form-section, badges).
   Restyled with the HanaOS tokens.
   ============================================================= */

.page-header {
  margin: 8px 0 32px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-cool);
  gap: 16px;
}
.page-header h1 {
  /* Per HanaOS spec: page titles render at h4 size, not display h1 */
  font-size: var(--fs-h4);
  font-weight: var(--fw-bold);
  line-height: 1.333;
  letter-spacing: -0.005em;
  margin: 0 0 6px;
}
.page-header p {
  margin: 0;
  color: var(--fg-secondary);
  font-size: var(--fs-body2);
}

.form-section {
  background: var(--bg-paper);
  border: 1px solid var(--border-cool);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  padding: 18px;
  margin-bottom: 18px;
}
.form-section > h5 {
  font-size: var(--fs-body1);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.005em;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--fg-primary);
}
.form-section > h5 i { color: var(--fg-secondary); font-size: 1rem; }

/* Detail rows — label above value, two-up grid on >= sm */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px 24px;
}
.detail-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.detail-item > label {
  font-size: var(--fs-caption);
  font-weight: var(--fw-medium);
  color: var(--fg-secondary);
  letter-spacing: 0.02em;
  margin: 0;
}
.detail-item > span {
  font-size: var(--fs-body2);
  color: var(--fg-primary);
  word-break: break-word;
}

/* Tables — `.table-hb` is the legacy alias; just inherits .table */
.table-hb { /* no extra rules — base .table styling already applies */ }

/* Workflow / status badges (used across references, pricing, suppliers) */
.badge {
  font-size: var(--fs-caption);
  font-weight: var(--fw-medium);
  padding: 3px 8px;
  letter-spacing: 0.01em;
}
.badge.badge-workflow { font-size: var(--fs-tiny); letter-spacing: 0.05em; }

.badge-supply {
  background: rgba(2, 132, 199, 0.10);
  color: var(--color-info);
  border: 1px solid rgba(2, 132, 199, 0.30);
}
.badge-admin-bdd {
  background: rgba(13, 148, 136, 0.10);
  color: #0d9488;
  border: 1px solid rgba(13, 148, 136, 0.30);
}
.badge-codes {
  background: rgba(59, 130, 246, 0.10);
  color: #2563eb;
  border: 1px solid rgba(59, 130, 246, 0.30);
}
.badge-prix {
  background: rgba(217, 119, 6, 0.10);
  color: var(--color-warning);
  border: 1px solid rgba(217, 119, 6, 0.30);
}

/* Action-toggled fieldsets in pricing form — JS toggles display */
.action-fields { display: none; }
.action-fields.is-active { display: block; }

/* ── Dashboard KPI / stat cards ─────────────────────
   HanaOS pattern: small label → big value → small caption.
   Overrides `.border-0` from the existing template. */
.stat-card {
  background: var(--bg-paper);
  border: 1px solid var(--border-cool) !important;
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  transition: border-color 0.12s, box-shadow 0.12s, transform 0.12s;
}
.stat-card:hover {
  border-color: var(--border-cool-strong) !important;
  box-shadow: var(--shadow-2);
  transform: translateY(-1px);
}

/* The number itself takes the semantic color via .text-* classes; the
   card stays plain white. Keeps the layout calm and lets the digit
   colour do the work. */
.stat-card .stat-number.text-success { color: var(--color-success); }
.stat-card .stat-number.text-warning { color: var(--color-warning); }
.stat-card .stat-number.text-info    { color: var(--color-info); }
.stat-card .stat-number.text-danger  { color: var(--brand-primary); }
.stat-card .card-body {
  padding: 18px 16px !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}
.stat-card .stat-number {
  font-size: var(--fs-h3);                /* 30px — design spec hero number */
  font-weight: var(--fw-bold);
  line-height: 1.1;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  color: var(--fg-primary);
}
.stat-card .stat-label {
  font-size: var(--fs-caption);
  font-weight: var(--fw-medium);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-secondary);
  line-height: 1.3;
}

/* Total references badge on dashboard — make it sit naturally on bg */
.bg-dark.fs-6 {
  background: var(--fg-primary) !important;
  color: #fff;
  font-weight: var(--fw-medium) !important;
  letter-spacing: 0.02em;
}

/* Slightly more generous component spacing globally */
.row.g-3 { --bs-gutter-x: 16px; --bs-gutter-y: 16px; }
.mb-3 { margin-bottom: 20px !important; }
.mb-4 { margin-bottom: 28px !important; }

/* Footer (legacy class) */
.app-footer {
  margin-top: 32px;
  padding: 16px 0;
  font-size: var(--fs-caption);
  color: var(--fg-secondary);
  text-align: center;
  border-top: 1px solid var(--border-cool);
}

/* =============================================================
   Login & no-auth pages — keep it centred, tokens applied
   ============================================================= */
.auth-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--bg-default);
  padding: 24px;
}
.auth-flash {
  width: 100%;
  max-width: 420px;
}
.auth-flash .alert { margin-bottom: 0; }
.auth-card,
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-paper);
  border: 1px solid var(--border-cool);
  border-radius: var(--radius);
  padding: 24px;
}
/* Login template predates the design adoption — give its container the
   auth-shell behaviour so it centres correctly inside the noauth wrapper. */
.login-container {
  width: 100%;
  display: flex;
  justify-content: center;
}

/* =============================================================
   Navigation progress bar — fine ligne cramoisie en haut de page
   ============================================================= */
#nav-progress {
  position: fixed;
  top: 0; left: 0;
  width: 0%;
  height: 2px;
  background: var(--brand-primary);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  border-radius: 0 2px 2px 0;
  transition: width 0.25s ease-out, opacity 0.3s ease;
}
#nav-progress.np-active { opacity: 1; }
#nav-progress.np-done   {
  width: 100% !important;
  opacity: 0;
  transition: width 0.12s ease, opacity 0.35s ease 0.05s;
}

/* =============================================================
   Page entry animation — le contenu glisse en douceur à l'arrivée
   ============================================================= */
@keyframes hb-page-enter {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
.main-content {
  animation: hb-page-enter 0.22s ease;
}

/* =============================================================
   Bouton en cours de chargement (soumission de formulaire)
   ============================================================= */
.btn-loading {
  pointer-events: none;
  opacity: 0.72;
}
.btn-loading .btn-spinner {
  display: inline-block;
  width: 0.75em; height: 0.75em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
  vertical-align: -0.1em;
  margin-right: 0.35em;
  flex-shrink: 0;
}
@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

/* =============================================================
   Lien actif dans la sidebar — feedback immédiat au clic
   ============================================================= */
#sidebar .nav-link.nav-optimistic {
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
  border-left-color: var(--brand-primary);
}
