/* Stock & Repair — feuille de style partagée. Esthétique sobre et professionnelle :
   aplats, bordures fines, angles peu arrondis, aucune ombre portée marquée, aucune animation décorative. */
/* Police Inter (licence SIL OFL) hébergée sur le site : aucune requête vers un service tiers. */
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('vendor/fonts/inter-latin-wght-normal.woff2') format('woff2');
}

:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --surface-3: #eceef2;
  --text: #111827;
  --text-2: #4b5563;
  --text-3: #8b94a3;
  --border: #d5d9e0;
  --primary: #1a56a0;
  --primary-hover: #134282;
  --primary-2: #1a56a0;
  --primary-soft: rgba(26, 86, 160, 0.09);
  --accent: #1a56a0;
  --success: #15803d;
  --success-soft: rgba(21, 128, 61, 0.11);
  --warning: #b45309;
  --warning-soft: rgba(180, 83, 9, 0.11);
  --danger: #b91c1c;
  --danger-soft: rgba(185, 28, 28, 0.09);
  --radius: 8px;
  --radius-sm: 6px;
  --shadow-sm: none;
  --shadow: 0 1px 3px rgba(17, 24, 39, 0.10);
  --shadow-lg: 0 8px 24px rgba(17, 24, 39, 0.18);
  --gradient: var(--primary);
  --ease: ease;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12151a; --surface: #1a1f26; --surface-2: #1f252d; --surface-3: #262d37;
    --text: #e6e8ec; --text-2: #a9b1be; --text-3: #6f7886; --border: #323a46;
    --primary: #5b9bd5; --primary-hover: #7ab0e0; --primary-2: #5b9bd5; --accent: #5b9bd5; --primary-soft: rgba(91, 155, 213, 0.14);
    --success: #4ade80; --success-soft: rgba(74, 222, 128, 0.12); --warning: #f0b45a; --warning-soft: rgba(240, 180, 90, 0.13);
    --danger: #f08a8a; --danger-soft: rgba(240, 138, 138, 0.12);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.5); --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12151a; --surface: #1a1f26; --surface-2: #1f252d; --surface-3: #262d37;
  --text: #e6e8ec; --text-2: #a9b1be; --text-3: #6f7886; --border: #323a46;
  --primary: #5b9bd5; --primary-hover: #7ab0e0; --primary-2: #5b9bd5; --accent: #5b9bd5; --primary-soft: rgba(91, 155, 213, 0.14);
  --success: #4ade80; --success-soft: rgba(74, 222, 128, 0.12); --warning: #f0b45a; --warning-soft: rgba(240, 180, 90, 0.13);
  --danger: #f08a8a; --danger-soft: rgba(240, 138, 138, 0.12);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.5); --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  margin: 0; font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif; font-size: 15px;
  background: var(--bg); color: var(--text); line-height: 1.5; -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); }
button { font-family: inherit; }
.hidden { display: none !important; }

/* Barre du haut */
.topbar {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 12px;
  padding: 10px max(16px, 3vw); background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); text-decoration: none; font-size: 1rem; }
.brand-mark { width: 32px; height: 32px; border-radius: 6px; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: .95rem; }
.topbar .spacer { flex: 1; }
.topbar > * { flex-shrink: 0; }
.topbar-title { font-weight: 600; font-size: .95rem; display: flex; align-items: center; gap: 8px; color: var(--text-2); padding-left: 12px; border-left: 1px solid var(--border); }
.topbar-title i { color: var(--text-3); }
@media (max-width: 720px) {
  .topbar { gap: 4px; padding: 8px 12px; }
  .brand span:not(.brand-mark) { display: none; }
  .topbar-title { font-size: .88rem; padding-left: 8px; }
  .topbar .btn:not(.btn-icon) { padding: 7px 10px; }
}

/* Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 15px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); font-weight: 600; font-size: .88rem;
  cursor: pointer; text-decoration: none; transition: background .12s, border-color .12s, color .12s;
  white-space: nowrap; color: var(--text); background: var(--surface);
}
.btn:hover:not(:disabled) { background: var(--surface-3); border-color: var(--text-3); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible, .chip:focus-visible, .tab:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover:not(:disabled) { filter: brightness(.92); background: var(--success); border-color: var(--success); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); border-color: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); border-color: transparent; color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: .8rem; }
.btn-icon { width: 36px; height: 36px; padding: 0; }

/* Cartes, champs */
.container { max-width: 1280px; margin: 0 auto; padding: 22px max(16px, 3vw) 72px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label { font-size: .8rem; font-weight: 600; color: var(--text-2); }
.input, .field input, .field select, .field textarea {
  width: 100%; padding: 9px 11px; background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font: inherit; font-size: .9rem; transition: border-color .12s, box-shadow .12s;
}
.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 14px; }
.hint { font-size: .76rem; color: var(--text-3); }

/* Puces / badges */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); font-size: .82rem; font-weight: 600; cursor: pointer; transition: background .12s, border-color .12s;
}
.chip:hover { border-color: var(--text-3); color: var(--text); }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.chip .count { background: var(--surface-3); color: var(--text-2); border-radius: 999px; padding: 0 7px; font-size: .72rem; }
.chip.active .count { background: rgba(255,255,255,.22); color: #fff; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 4px; font-size: .72rem; font-weight: 700; letter-spacing: .01em; }
.badge-ok { background: var(--success-soft); color: var(--success); }
.badge-out { background: var(--danger-soft); color: var(--danger); }
.badge-low { background: var(--warning-soft); color: var(--warning); }
.badge-muted { background: var(--surface-3); color: var(--text-2); }

/* Tableau */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th { text-align: left; padding: 10px 14px; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); background: var(--surface-2); position: sticky; top: 0; border-bottom: 1px solid var(--border); white-space: nowrap; font-weight: 700; }
table.data td { padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: .9rem; vertical-align: middle; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: none; }
code, .mono { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: .82rem; background: var(--surface-3); padding: 1px 6px; border-radius: 4px; }

/* Panneau latéral et recouvrement */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(17, 24, 39, .45); opacity: 0; pointer-events: none; transition: opacity .15s; }
.overlay.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 101; width: min(500px, 100vw); background: var(--surface);
  border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); transform: translateX(105%);
  transition: transform .2s ease; display: flex; flex-direction: column;
}
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.drawer-head h2 { margin: 0; font-size: 1rem; }
.drawer-body { padding: 18px; overflow-y: auto; flex: 1; }
.drawer-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; gap: 10px; background: var(--surface-2); }
.drawer-foot .btn { flex: 1; }

/* Onglets */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab { padding: 9px 16px; border: none; border-bottom: 2px solid transparent; background: transparent; font-weight: 600; font-size: .86rem; color: var(--text-2); cursor: pointer; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Notifications */
#toast-container { position: fixed; bottom: 18px; right: 18px; z-index: 300; display: flex; flex-direction: column; gap: 8px; max-width: min(92vw, 380px); }
.toast { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 11px 14px; font-size: .86rem; animation: fadeUp .15s ease both; }
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--success); }

.empty { text-align: center; padding: 48px 20px; color: var(--text-3); }
.empty i { font-size: 2rem; margin-bottom: 10px; display: block; opacity: .6; }

@keyframes fadeUp { from { opacity: 0; } to { opacity: 1; } }
.fade-up { animation: fadeUp .15s ease both; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
