/* ==========================================================================
   QuincaPro CRM — Design system
   Charte §5.2 : bleu acier #1E3A5F, orange chantier #F28C28, neutres Slate,
   Inter (interface) + JetBrains Mono (références, montants), rayon 8 px.
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --brand-900: #0f2037; --brand-800: #16304f; --brand-700: #1e3a5f; --brand-600: #28507f; --brand-500: #3567a3; --brand-100: #e3ebf5; --brand-50: #f1f5fa;
  --accent: #f28c28; --accent-strong: #d9741a; --accent-soft: #fdf0e3; --accent-ink: #9a4b06;
  --success: #16a34a; --success-soft: #e8f6ee; --success-ink: #116b33;
  --warning: #d97706; --warning-soft: #fdf3e2; --warning-ink: #92500a;
  --danger: #dc2626; --danger-soft: #fdecec; --danger-ink: #a51d1d;
  --info: #2563eb; --info-soft: #e8effd; --info-ink: #1d4ab4;
  --violet-soft: #efeafd; --violet-ink: #5b3fc4;

  --bg: #f8fafc; --surface: #ffffff; --surface-2: #f8fafc; --surface-3: #f1f5f9;
  --border: #e2e8f0; --border-strong: #cbd5e1;
  --text: #0f172a; --text-2: #334155; --muted: #64748b; --subtle: #94a3b8;
  --primary: var(--brand-700); --primary-hover: var(--brand-800); --primary-soft: var(--brand-50);
  --ring: 0 0 0 3px rgba(53, 103, 163, .22);
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, .07), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-md: 0 8px 24px -6px rgba(15, 23, 42, .12), 0 2px 6px rgba(15, 23, 42, .05);
  --shadow-lg: 0 24px 60px -12px rgba(15, 23, 42, .28);
  --radius: 8px; --radius-lg: 12px; --radius-sm: 6px;
  --sidebar-w: 256px; --topbar-h: 60px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --sidebar-bg: #0f2037; --sidebar-text: #b4c3d6; --sidebar-muted: #6b819c; --sidebar-active: rgba(255,255,255,.08); --sidebar-border: rgba(255,255,255,.07);
  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; font-feature-settings: 'cv11', 'ss01'; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
h1, h2, h3, h4 { margin: 0; color: var(--text); letter-spacing: -.015em; line-height: 1.25; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0; }
small { font-size: 12px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }
.mono, .num { font-family: var(--mono); font-feature-settings: 'tnum'; letter-spacing: -.02em; }
.num { text-align: right; white-space: nowrap; }
.muted { color: var(--muted); }
.subtle { color: var(--subtle); }
.strong { font-weight: 600; color: var(--text); }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { flex-shrink: 0; vertical-align: middle; }
.text-success { color: var(--success-ink); } .text-danger { color: var(--danger-ink); } .text-warning { color: var(--warning-ink); }

[hidden] { display: none !important; }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; width: var(--sidebar-w); background: var(--sidebar-bg); color: var(--sidebar-text); display: flex; flex-direction: column; border-right: 1px solid var(--sidebar-border); transition: width .2s ease, transform .25s ease; }
.sidebar-brand { height: var(--topbar-h); display: flex; align-items: center; gap: 10px; padding: 0 18px; border-bottom: 1px solid var(--sidebar-border); }
.brand-logo { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: linear-gradient(140deg, var(--accent), #e06d0d); color: #fff; font-weight: 800; font-size: 15px; box-shadow: 0 4px 12px rgba(242,140,40,.35); flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand-text strong { color: #fff; font-size: 15px; letter-spacing: -.01em; }
.brand-text strong span { color: var(--accent); }
.brand-text small { color: var(--sidebar-muted); font-size: 11px; }
.store-dropdown { display: block; margin: 14px 12px 6px; }
.store-dropdown .dropdown-menu { left: 0; right: 0; }
.store-switch { width: 100%; text-align: left; cursor: pointer; font: inherit; padding: 9px 11px; border: 1px solid var(--sidebar-border); border-radius: var(--radius); display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.03); color: var(--sidebar-text); }
.store-switch:hover { background: rgba(255,255,255,.07); }
.store-switch > div { flex: 1; min-width: 0; }
.store-switch strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.store-switch small { display: block; color: var(--sidebar-muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; }
.store-switch strong { color: #e8eef6; font-size: 12.5px; font-weight: 600; }
.nav { flex: 1; overflow-y: auto; padding: 8px 10px 16px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.12) transparent; }
.nav-section { margin: 16px 10px 6px; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--sidebar-muted); }
.nav-link { position: relative; display: flex; align-items: center; gap: 11px; padding: 8px 10px; margin: 1px 0; border-radius: 7px; color: var(--sidebar-text); font-size: 13.5px; font-weight: 500; transition: background .15s, color .15s; }
.nav-link:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-link.is-active { background: var(--sidebar-active); color: #fff; }
.nav-link.is-active::before { content: ''; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav-link .icon { opacity: .85; }
.nav-link kbd, .nav-badge { margin-left: auto; }
.nav-badge { font-size: 10.5px; font-weight: 600; padding: 1px 7px; border-radius: 10px; background: rgba(242,140,40,.18); color: #f9b571; }
.nav-dot { margin-left: auto; width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px rgba(22,163,74,.2); }
.sidebar-foot { padding: 12px; border-top: 1px solid var(--sidebar-border); }
.user-card { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius); color: var(--sidebar-text); }
.user-card:hover { background: rgba(255,255,255,.05); color: #fff; }
.user-card strong { display: block; color: #e8eef6; font-size: 13px; }
.user-card small { color: var(--sidebar-muted); font-size: 11px; }
.user-card .icon:last-child { margin-left: auto; }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; transition: margin .2s ease; }
.topbar { position: sticky; top: 0; z-index: 30; height: var(--topbar-h); display: flex; align-items: center; gap: 14px; padding: 0 28px; background: color-mix(in srgb, var(--surface) 86%, transparent); backdrop-filter: saturate(1.6) blur(10px); border-bottom: 1px solid var(--border); }
.demo-banner { display: flex; align-items: center; gap: 8px; padding: 8px 28px; font-size: 13px; background: var(--info-soft); color: var(--info-ink); border-bottom: 1px solid var(--border); }
.demo-banner .icon { flex-shrink: 0; }
.demo-banner.is-ending { background: var(--warning-soft); color: var(--warning-ink); }
@media (max-width: 640px) { .demo-banner { padding: 8px 16px; font-size: 12.5px; } }
.breadcrumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); min-width: 0; }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--text); }
.breadcrumbs strong { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-search { margin-left: auto; display: flex; align-items: center; gap: 8px; width: min(360px, 34vw); height: 36px; padding: 0 10px 0 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); color: var(--subtle); font-size: 13px; cursor: pointer; transition: border-color .15s; }
.topbar-search:hover { border-color: var(--border-strong); }
.topbar-search span { flex: 1; min-width: 0; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
kbd { font: 500 11px var(--mono); padding: 1px 6px; border-radius: 4px; border: 1px solid var(--border); border-bottom-width: 2px; background: var(--surface); color: var(--muted); }
.sidebar kbd { background: transparent; border-color: var(--sidebar-border); color: var(--sidebar-muted); }
.icon-btn { position: relative; width: 36px; height: 36px; display: inline-grid; place-items: center; border: 1px solid transparent; border-radius: var(--radius); background: transparent; color: var(--muted); transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn .dot { position: absolute; top: 7px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }
.menu-toggle { display: none; }
.content { padding: 28px; max-width: 1480px; width: 100%; margin: 0 auto; flex: 1; }
.content.flush { padding: 0; max-width: none; }

body.sidebar-collapsed { --sidebar-w: 72px; }
body.sidebar-collapsed .brand-text, body.sidebar-collapsed .store-switch div, body.sidebar-collapsed .store-switch > .icon:last-child, body.sidebar-collapsed .nav-section, body.sidebar-collapsed .nav-link span, body.sidebar-collapsed .nav-link kbd, body.sidebar-collapsed .nav-badge, body.sidebar-collapsed .user-card div, body.sidebar-collapsed .user-card > .icon { display: none; }
body.sidebar-collapsed .nav-link, body.sidebar-collapsed .user-card, body.sidebar-collapsed .store-switch { justify-content: center; }
body.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 0; }
body.sidebar-collapsed .nav-section { height: 14px; }


/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head .eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 6px; }
.page-head p.lead { color: var(--muted); margin-top: 6px; font-size: 14px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: var(--radius); border: 1px solid transparent; font-size: 13.5px; font-weight: 600; white-space: nowrap; cursor: pointer; transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-disabled { opacity: .55; pointer-events: none; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 1px 0 rgba(0,0,0,.08), inset 0 1px 0 rgba(255,255,255,.15); }
.btn-primary:hover { background: var(--accent-strong); color: #fff; }
.btn-brand { background: var(--brand-700); color: #fff; }
.btn-brand:hover { background: var(--brand-800); color: #fff; }
.btn-secondary { background: var(--surface); border-color: var(--border); color: var(--text-2); box-shadow: var(--shadow-xs); }
.btn-secondary:hover { border-color: var(--border-strong); background: var(--surface-2); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { background: var(--danger-soft); color: var(--danger-ink); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #128a3e; color: #fff; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; gap: 5px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 15px; }
.btn-icon { width: 36px; padding: 0; }
.btn-sm.btn-icon { width: 30px; }
.btn-block { width: 100%; }
.btn.is-loading { color: transparent !important; position: relative; pointer-events: none; }
.btn.is-loading::after { content: ''; position: absolute; width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.55); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.btn-secondary.is-loading::after { border-color: var(--border-strong); border-top-color: var(--primary); }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.btn-group .btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.btn-group .btn + .btn { margin-left: -1px; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h3 { display: flex; align-items: center; gap: 8px; }
.card-head p { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.card-body { padding: 20px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.card-flush .table th:first-child, .card-flush .table td:first-child { padding-left: 20px; }
.card-flush .table th:last-child, .card-flush .table td:last-child { padding-right: 20px; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.grid-dash { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 20px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 20px; }

/* ---------- KPI ---------- */
.kpi { position: relative; padding: 18px 20px; overflow: hidden; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.kpi-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; }
.kpi-value { font: 700 26px/1.1 var(--font); letter-spacing: -.03em; color: var(--text); font-feature-settings: 'tnum'; }
.kpi-value small { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 3px; letter-spacing: 0; }
.kpi-foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; font-size: 12px; padding: 1px 6px; border-radius: 10px; }
.delta.up { color: var(--success-ink); background: var(--success-soft); }
.delta.down { color: var(--danger-ink); background: var(--danger-soft); }
.tone-brand { background: var(--brand-50); color: var(--primary); }
.tone-accent { background: var(--accent-soft); color: var(--accent-ink); }
.tone-success { background: var(--success-soft); color: var(--success-ink); }
.tone-warning { background: var(--warning-soft); color: var(--warning-ink); }
.tone-danger { background: var(--danger-soft); color: var(--danger-ink); }
.tone-info { background: var(--info-soft); color: var(--info-ink); }
.tone-violet { background: var(--violet-soft); color: var(--violet-ink); }
.tone-neutral { background: var(--surface-3); color: var(--text-2); }
.progress { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #f6a858); transition: width .8s cubic-bezier(.2,.8,.2,1); }
.progress.success > i { background: var(--success); } .progress.danger > i { background: var(--danger); } .progress.brand > i { background: var(--primary); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.no-dot::before { display: none; }
.badge-neutral { background: var(--surface-3); color: var(--text-2); }
.badge-info { background: var(--info-soft); color: var(--info-ink); }
.badge-primary { background: var(--violet-soft); color: var(--violet-ink); }
.badge-success { background: var(--success-soft); color: var(--success-ink); }
.badge-warning { background: var(--warning-soft); color: var(--warning-ink); }
.badge-danger { background: var(--danger-soft); color: var(--danger-ink); }
.badge-accent { background: var(--accent-soft); color: var(--accent-ink); }
.chip { white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border: 1px solid var(--border); border-radius: 20px; font-size: 12px; color: var(--text-2); background: var(--surface); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th { position: sticky; top: 0; text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--surface-2); padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text-2); }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.is-link { cursor: pointer; }
.table tr.is-muted td { opacity: .55; }
.table .cell-title { font-weight: 600; color: var(--text); }
.table .cell-sub { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; font-weight: 400; }
.table th.num, .table td.num { text-align: right; }
.table-compact td { padding: 9px 14px; }
.table-actions { display: flex; gap: 4px; justify-content: flex-end; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty .empty-icon { width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-3); color: var(--subtle); }
.empty h3 { font-size: 15px; margin-bottom: 4px; }
.empty p { font-size: 13px; margin-bottom: 14px; }

/* ---------- Toolbar / tabs ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.search-field { position: relative; flex: 1; min-width: 200px; max-width: 360px; }
.search-field .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--subtle); pointer-events: none; }
.search-field .input { padding-left: 34px; }
.tabs { display: flex; gap: 2px; padding: 0 16px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tab { display: inline-flex; align-items: center; gap: 7px; padding: 13px 10px 11px; font-size: 13.5px; font-weight: 500; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tab .count { font: 600 11px var(--mono); padding: 1px 6px; border-radius: 10px; background: var(--surface-3); color: var(--muted); }
.tab.is-active .count { background: var(--accent-soft); color: var(--accent-ink); }
.segmented { display: inline-flex; padding: 3px; background: var(--surface-3); border-radius: var(--radius); gap: 2px; }
.segmented a, .segmented button { border: 0; background: transparent; padding: 5px 12px; border-radius: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.segmented .is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.period-filter { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.period-nav { display: inline-flex; align-items: center; gap: 4px; }
.period-pick { display: inline-flex; gap: 6px; }
.period-pick .input, .period-pick .select { width: auto; }
.period-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.period-bar .period-title { font-size: 13px; color: var(--muted); }
.period-bar .period-title strong { color: var(--text); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.input, .select, .textarea { width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); font: 14px var(--font); transition: border-color .15s, box-shadow .15s; }
.textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2364748b' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.input::placeholder, .textarea::placeholder { color: var(--subtle); }
.input.is-invalid { border-color: var(--danger); background: var(--danger-soft); }
.input-sm { height: 32px; font-size: 13px; padding: 0 9px; }
.input.num { font-family: var(--mono); text-align: right; }
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-radius: var(--radius) 0 0 var(--radius); }
.input-group .addon { display: grid; place-items: center; padding: 0 10px; border: 1px solid var(--border); border-left: 0; border-radius: 0 var(--radius) var(--radius) 0; background: var(--surface-2); color: var(--muted); font-size: 12.5px; font-weight: 600; }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-2); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.form-section { padding: 20px; border-bottom: 1px solid var(--border); }
.form-section:last-child { border-bottom: 0; }
.form-section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 14px; }

/* ---------- Alerts / callouts ---------- */
.callout { display: flex; gap: 12px; padding: 12px 14px; border-radius: var(--radius); font-size: 13px; border: 1px solid transparent; }
.callout .icon { margin-top: 1px; }
.callout strong { display: block; margin-bottom: 2px; }
.callout-info { background: var(--info-soft); color: var(--info-ink); }
.callout-warning { background: var(--warning-soft); color: var(--warning-ink); }
.callout-danger { background: var(--danger-soft); color: var(--danger-ink); }
.callout-success { background: var(--success-soft); color: var(--success-ink); }

/* ---------- Avatars ---------- */
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12.5px; color: #fff; background: linear-gradient(135deg, var(--brand-600), var(--brand-800)); flex-shrink: 0; letter-spacing: .02em; }
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 56px; height: 56px; font-size: 18px; border-radius: 14px; }
.avatar-accent { background: linear-gradient(135deg, #f6a858, var(--accent-strong)); }
.avatar-square { border-radius: 9px; }

/* ---------- Lists, timeline ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; color: var(--text); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .meta { font-size: 12px; color: var(--muted); }
a.list-item:hover { background: var(--surface-2); }
.timeline { list-style: none; margin: 0; padding: 0 0 0 4px; }
.timeline li { position: relative; padding: 0 0 18px 24px; border-left: 2px solid var(--border); margin-left: 6px; }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before { content: ''; position: absolute; left: -7px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--primary); }
.timeline li.is-success::before { border-color: var(--success); background: var(--success); }
.timeline li.is-accent::before { border-color: var(--accent); background: var(--accent); }
.timeline .t-title { font-weight: 600; font-size: 13px; color: var(--text); }
.timeline .t-meta { font-size: 12px; color: var(--muted); }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 9px 16px; font-size: 13.5px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; color: var(--text); font-weight: 500; text-align: right; }

/* ---------- Pipeline (workflow) ---------- */
.steps { display: flex; align-items: center; gap: 0; padding: 16px 20px; overflow-x: auto; }
.step { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--subtle); white-space: nowrap; }
.step .step-dot { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--border-strong); background: var(--surface); color: var(--subtle); }
.step.is-done { color: var(--text-2); }
.step.is-done .step-dot { border-color: var(--success); background: var(--success); color: #fff; }
.step.is-current { color: var(--text); }
.step.is-current .step-dot { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); box-shadow: 0 0 0 4px var(--accent-soft); }
.step-line { flex: 1; min-width: 24px; height: 2px; background: var(--border); margin: 0 10px; }
.step-line.is-done { background: var(--success); }

/* ---------- Dropdown / modal ---------- */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; min-width: 220px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); opacity: 0; transform: translateY(-4px) scale(.98); pointer-events: none; transition: opacity .14s, transform .14s; }
.dropdown.is-open .dropdown-menu { opacity: 1; transform: none; pointer-events: auto; }
.dropdown-item { display: flex; width: 100%; align-items: center; gap: 9px; padding: 8px 10px; border: 0; background: none; border-radius: 6px; color: var(--text-2); font-size: 13.5px; text-align: left; }
.dropdown-item:hover { background: var(--surface-3); color: var(--text); }
.dropdown-item.danger { color: var(--danger-ink); }
.dropdown-sep { height: 1px; background: var(--border); margin: 5px 0; }
.dropdown-label { padding: 6px 10px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--subtle); font-weight: 600; }
dialog.modal { padding: 0; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); width: min(520px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); }
dialog.modal::backdrop { background: rgba(10, 18, 32, .55); backdrop-filter: blur(3px); }
dialog.modal[open] { animation: pop .18s cubic-bezier(.2,.8,.2,1); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 14px 14px; }

/* ---------- Command palette ---------- */
.palette { position: fixed; inset: 0; z-index: 100; display: none; align-items: flex-start; justify-content: center; padding-top: 12vh; background: rgba(10,18,32,.5); backdrop-filter: blur(4px); }
.palette.is-open { display: flex; animation: fade .12s ease; }
.palette-box { width: min(620px, calc(100vw - 24px)); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .16s cubic-bezier(.2,.8,.2,1); }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--border); color: var(--muted); }
.palette-input input { flex: 1; height: 54px; border: 0; outline: none; background: transparent; color: var(--text); font: 16px var(--font); }
.palette-results { max-height: 380px; overflow-y: auto; padding: 6px; }
.palette-group { padding: 8px 10px 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--subtle); }
.palette-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 8px; color: var(--text-2); cursor: pointer; }
.palette-item .pi-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); }
.palette-item .pi-text { flex: 1; min-width: 0; }
.palette-item .pi-text strong { display: block; font-size: 13.5px; color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette-item .pi-text small { color: var(--muted); }
.palette-item.is-active { background: var(--primary-soft); }
.palette-item.is-active .pi-icon { background: var(--primary); color: #fff; }
.palette-foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); background: var(--surface-2); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 120; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 40px)); }
.toast { position: relative; display: flex; gap: 12px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); overflow: hidden; animation: slideIn .28s cubic-bezier(.2,.8,.2,1); }
.toast.is-leaving { animation: slideOut .22s ease forwards; }
.toast .t-icon { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.toast strong { display: block; font-size: 13.5px; color: var(--text); }
.toast p { font-size: 13px; color: var(--muted); margin-top: 2px; }
.toast .t-close { margin-left: auto; align-self: flex-start; border: 0; background: none; color: var(--subtle); padding: 0; }
.toast .t-bar { position: absolute; left: 0; bottom: 0; height: 3px; background: currentColor; animation: shrink 5s linear forwards; opacity: .5; }
.toast-success { color: var(--success); } .toast-error { color: var(--danger); } .toast-info { color: var(--info); } .toast-warning { color: var(--warning); }

/* ---------- Charts ---------- */
.chart-box { position: relative; height: 280px; padding: 8px 20px 18px; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; font-size: 13px; }
.bar-row .progress { grid-column: span 2; }

/* ---------- Document editor ---------- */
.editor-lines { width: 100%; border-collapse: separate; border-spacing: 0; }
.editor-lines th { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); text-align: left; padding: 10px 8px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.editor-lines th:first-child { padding-left: 20px; }
.editor-lines td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.editor-lines td:first-child { padding-left: 20px; }
.editor-lines tr.line-row:hover td { background: var(--surface-2); }
.editor-lines .input { height: 34px; font-size: 13.5px; }
.editor-lines .line-total { font: 600 13.5px var(--mono); text-align: right; padding-top: 16px; white-space: nowrap; color: var(--text); }
.editor-lines .line-margin { font-size: 11px; text-align: right; margin-top: 3px; font-family: var(--mono); }
.editor-lines .drag { color: var(--subtle); padding-top: 16px; cursor: grab; text-align: center; width: 24px; font-family: var(--mono); font-size: 12px; }
.line-desc { margin-top: 5px; font-size: 12.5px !important; height: 30px !important; color: var(--muted); }
.line-row.has-warning .input[name$="[price]"], .line-row.has-warning .input[name$="[discount]"] { border-color: var(--warning); background: var(--warning-soft); }
.product-picker { position: relative; }
.picker-list { position: absolute; z-index: 60; top: calc(100% + 4px); left: 0; width: max(100%, 460px); max-height: 320px; overflow-y: auto; padding: 5px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-md); display: none; }
.picker-list.is-open { display: block; }
.picker-item { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 8px 10px; border-radius: 7px; cursor: pointer; }
.picker-item:hover, .picker-item.is-active { background: var(--primary-soft); }
.picker-item strong { font-size: 13.5px; color: var(--text); font-weight: 600; }
.picker-item .p-price { font: 600 13px var(--mono); color: var(--text); text-align: right; }
.picker-item small { color: var(--muted); font-size: 12px; }
.picker-item .p-stock { text-align: right; }
.totals { display: flex; flex-direction: column; gap: 9px; font-size: 13.5px; }
.totals .t-row { display: flex; justify-content: space-between; gap: 12px; color: var(--text-2); }
.totals .t-row span:last-child { font-family: var(--mono); font-feature-settings: 'tnum'; white-space: nowrap; }
.totals .t-grand { margin-top: 6px; padding-top: 12px; border-top: 1px dashed var(--border-strong); font-size: 17px; font-weight: 700; color: var(--text); }
.totals .t-net { padding: 10px 12px; margin-top: 4px; border-radius: var(--radius); background: var(--brand-700); color: #fff; font-weight: 700; font-size: 15px; }
.margin-meter { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px dashed var(--border-strong); font-size: 13px; }
.margin-meter strong { font-family: var(--mono); }
.sticky-side { position: sticky; top: calc(var(--topbar-h) + 20px); }

/* ---------- Document preview (A4) ---------- */
.paper-frame { background: var(--surface-3); border-radius: var(--radius-lg); padding: 24px; overflow: hidden; }
.paper-scale { position: relative; margin: 0 auto; }
.paper-frame iframe { position: absolute; top: 0; left: 0; width: 794px; height: 1123px; border: 0; background: #fff; border-radius: 4px; transform-origin: 0 0; box-shadow: 0 12px 40px -10px rgba(15,23,42,.35), 0 0 0 1px rgba(15,23,42,.06); }
@media (max-width: 640px) { .paper-frame { padding: 10px; } }
.doc-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.doc-type-icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; }
.amount-hero { font: 700 30px/1 var(--font); letter-spacing: -.03em; font-feature-settings: 'tnum'; }

/* ---------- POS ---------- */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 400px; height: calc(100vh - var(--topbar-h)); }
.pos-catalog { display: flex; flex-direction: column; min-width: 0; padding: 20px 24px; overflow: hidden; }
.pos-search { position: relative; margin-bottom: 14px; }
.pos-search .input { height: 48px; font-size: 15px; padding-left: 44px; border-radius: 10px; }
.pos-search .icon { position: absolute; left: 15px; top: 15px; color: var(--subtle); }
.pos-families { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 12px; scrollbar-width: none; }
.pos-family { border: 1px solid var(--border); background: var(--surface); color: var(--text-2); border-radius: 20px; padding: 6px 14px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.pos-family.is-active { background: var(--brand-700); border-color: var(--brand-700); color: #fff; }
.pos-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; align-content: start; padding: 2px; }
.pos-item { position: relative; display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 14px; min-height: 128px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); color: var(--text); transition: border-color .12s, transform .12s, box-shadow .12s; }
.pos-item:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.pos-item:active { transform: scale(.98); }
.pos-item .ref { font: 500 11px var(--mono); color: var(--muted); }
.pos-item strong { font-size: 13.5px; line-height: 1.3; flex: 1; }
.pos-item .price { font: 700 15px var(--mono); }
.pos-item .stock { position: absolute; top: 12px; right: 12px; }
.pos-item.is-out { opacity: .45; pointer-events: none; }
.pos-cart { display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--border); min-height: 0; }
.pos-cart-head { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.pos-lines { flex: 1; overflow-y: auto; }
.pos-line { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 12px 20px; border-bottom: 1px solid var(--border); animation: fade .2s ease; }
.pos-line strong { font-size: 13.5px; }
.pos-line .amount { font: 600 14px var(--mono); text-align: right; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.qty button { width: 28px; height: 28px; border: 0; background: var(--surface-2); color: var(--text-2); display: grid; place-items: center; }
.qty button:hover { background: var(--surface-3); }
.qty-input { width: 58px; height: 28px; border: 0; text-align: center; font: 600 13px var(--mono); background: var(--surface); color: var(--text); }
.qty-input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
.qty span { min-width: 34px; text-align: center; font: 600 13px var(--mono); }
.pos-summary { padding: 16px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }
.pos-total { display: flex; justify-content: space-between; align-items: baseline; margin: 10px 0 14px; }
.pos-total strong { font: 700 28px var(--mono); letter-spacing: -.03em; }
.pay-methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 12px; }
.pay-method { padding: 8px 4px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text-2); font-size: 12px; font-weight: 600; }
.pay-method.is-active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.conn { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 20px; }
.conn::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.conn.online { background: var(--success-soft); color: var(--success-ink); }
.conn.offline { background: var(--warning-soft); color: var(--warning-ink); }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(440px, .9fr); background: var(--bg); }
.auth-visual { position: relative; overflow: hidden; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; color: #fff; background: radial-gradient(1200px 600px at -10% -20%, #2c5687 0%, transparent 60%), radial-gradient(900px 500px at 120% 120%, rgba(242,140,40,.35) 0%, transparent 55%), linear-gradient(160deg, #16304f, #0b1a2e); }
.auth-visual::after { content: ''; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px); background-size: 44px 44px; mask-image: linear-gradient(180deg, rgba(0,0,0,.9), transparent 85%); pointer-events: none; }
.auth-visual > * { position: relative; z-index: 1; }
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand .brand-text strong { font-size: 18px; }
.auth-logo { width: 42px; height: 42px; font-size: 19px; border-radius: 11px; }
.auth-eyebrow { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; margin-bottom: 18px; border-radius: 999px; border: 1px solid rgba(249,181,113,.3); background: rgba(242,140,40,.12); color: #f9b571; font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.auth-visual h2 { color: #fff; font-size: clamp(28px, 3vw, 38px); line-height: 1.12; letter-spacing: -.03em; max-width: 540px; font-weight: 750; }
.auth-visual h2 span { color: #f9b571; }
.auth-visual p { color: #b4c3d6; max-width: 480px; margin-top: 16px; font-size: 15px; line-height: 1.6; }
.auth-features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 580px; margin-top: 36px; }
.auth-feature { display: flex; gap: 12px; align-items: center; padding: 14px; border: 1px solid rgba(255,255,255,.09); border-radius: 12px; background: rgba(255,255,255,.04); backdrop-filter: blur(4px); font-size: 13px; line-height: 1.45; color: #d6e0ec; transition: background .2s, border-color .2s, transform .2s; }
.auth-feature:hover { background: rgba(255,255,255,.07); border-color: rgba(249,181,113,.3); transform: translateY(-2px); }
.auth-feature-icon { display: grid; place-items: center; width: 36px; height: 36px; flex-shrink: 0; border-radius: 9px; background: rgba(242,140,40,.15); color: #f9b571; }
.auth-copy { font-size: 12.5px; color: #6b819c; }
.auth-form { position: relative; z-index: 2; isolation: isolate; overflow: hidden; display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: radial-gradient(520px 420px at 92% 6%, rgba(53,103,163,.16), transparent 70%), radial-gradient(460px 380px at 6% 96%, rgba(242,140,40,.16), transparent 70%), linear-gradient(165deg, #ffffff 0%, var(--brand-50) 55%, #eef3f9 100%); }
/* Arcs concentriques : bleu acier en haut à droite, orange chantier en bas à gauche */
.auth-form::before, .auth-form::after { content: ''; position: absolute; z-index: -1; border-radius: 50%; pointer-events: none; }
.auth-form::before { width: 720px; height: 720px; top: -380px; right: -360px; background: repeating-radial-gradient(circle at center, transparent 0 46px, rgba(30,58,95,.09) 46px 47px), radial-gradient(circle at center, rgba(53,103,163,.12) 0 34%, transparent 34.2%); border: 1.5px solid rgba(30,58,95,.14); mask-image: radial-gradient(circle at center, #000 0 58%, transparent 72%); }
.auth-form::after { width: 560px; height: 560px; bottom: -300px; left: -240px; background: repeating-radial-gradient(circle at center, transparent 0 38px, rgba(242,140,40,.13) 38px 39px); border: 2px solid rgba(242,140,40,.28); mask-image: radial-gradient(circle at center, #000 0 55%, transparent 71%); }
.auth-arc { position: absolute; z-index: -1; border-radius: 50%; pointer-events: none; }
.auth-arc-1 { width: 340px; height: 340px; top: -110px; right: -170px; border: 10px solid transparent; border-left-color: rgba(242,140,40,.55); border-top-color: rgba(242,140,40,.18); transform: rotate(-20deg); }
.auth-arc-2 { width: 180px; height: 180px; bottom: -40px; right: 7%; border: 1.5px dashed rgba(30,58,95,.2); }
.auth-arc-3 { width: 120px; height: 120px; top: 8%; left: 10%; background: radial-gradient(circle at 30% 30%, rgba(53,103,163,.22), rgba(53,103,163,0) 70%); }
.auth-panel { width: min(420px, 100%); animation: auth-in .45s cubic-bezier(.2,.7,.3,1) both; }
.auth-brand-mobile, .auth-copy-mobile { display: none; }
.auth-brand-mobile .brand-text strong { color: var(--text); }
.auth-brand-mobile .brand-text small { color: var(--muted); }
.auth-card { position: relative; overflow: hidden; padding: 38px 32px 32px; border: 1px solid rgba(255,255,255,.9); border-radius: 24px; background: rgba(255,255,255,.82); backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4); box-shadow: 0 1px 0 rgba(255,255,255,.9) inset, 0 30px 70px -24px rgba(15,32,55,.32), 0 10px 24px -12px rgba(15,32,55,.14); }
.auth-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: linear-gradient(90deg, var(--brand-700), var(--brand-500) 55%, var(--accent)); }
.auth-card::after { content: ''; position: absolute; top: -90px; right: -90px; width: 180px; height: 180px; border-radius: 50%; border: 1px solid rgba(30,58,95,.08); box-shadow: 0 0 0 22px rgba(30,58,95,.025), 0 0 0 44px rgba(30,58,95,.02); pointer-events: none; }
.auth-card > * { position: relative; }
.auth-card-head { margin-bottom: 26px; }
.auth-card h1 { font-size: 26px; letter-spacing: -.02em; }
.auth-card .lead { color: var(--muted); margin: 8px 0 0; font-size: 14px; }
.auth-error { margin-bottom: 18px; animation: auth-shake .4s ease; }
.input-icon { position: relative; }
.input-icon > .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--subtle); pointer-events: none; transition: color .15s; }
.input-icon .input { height: 46px; padding-left: 40px; padding-right: 44px; }
.input-icon:focus-within > .icon { color: var(--primary); }
.input-reveal { position: absolute; right: 5px; border: 0; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; background: none; color: var(--subtle); cursor: pointer; }
.input-reveal:hover { background: var(--surface-3); color: var(--text-2); }
.input-reveal[aria-pressed="true"] { color: var(--primary); }
.auth-caps { display: flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 12px; font-weight: 500; color: var(--warning-ink); }
.auth-caps[hidden] { display: none; }
.auth-submit { margin-top: 24px; height: 48px; font-size: 15px; box-shadow: 0 8px 20px -6px rgba(242,140,40,.55); transition: transform .15s, box-shadow .15s, background .15s; }
.auth-submit:hover { transform: translateY(-1px); box-shadow: 0 12px 24px -8px rgba(242,140,40,.6); }
.auth-submit .icon { transition: transform .15s; }
.auth-submit:hover .icon { transform: translateX(3px); }
.auth-note { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 20px; font-size: 12.5px; color: var(--muted); text-align: center; }
/* Pages d'erreur (templates/bundles/TwigBundle/Exception) : mêmes fonds que la connexion */
.error-page { min-height: 100vh; }
.error-panel { width: min(480px, 100%); }
.error-brand { justify-content: center; margin-bottom: 22px; text-decoration: none; }
.error-brand .brand-text strong { color: var(--text); }
.error-brand .brand-text small { color: var(--muted); }
.error-card { text-align: center; padding: 34px 32px 30px; }
.error-code { font-size: clamp(76px, 18vw, 112px); font-weight: 800; line-height: 1; letter-spacing: -.05em; background: linear-gradient(135deg, var(--brand-700), var(--brand-500) 55%, var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; font-variant-numeric: tabular-nums; }
.error-icon { display: inline-grid; place-items: center; width: 46px; height: 46px; margin: 14px 0 12px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-ink); }
.error-card h1 { font-size: 24px; letter-spacing: -.02em; }
.error-card .lead { color: var(--muted); margin: 10px auto 0; max-width: 360px; font-size: 14px; line-height: 1.6; }
.error-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 26px; }
.error-actions [hidden] { display: none; }
.error-ref { margin-top: 6px; font-size: 11.5px; color: var(--subtle); }
@media (max-width: 480px) { .error-card { padding: 28px 20px 24px; } .error-actions .btn { width: 100%; } }
@keyframes auth-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes auth-shake { 0%, 100% { transform: none; } 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
@media (prefers-reduced-motion: reduce) { .auth-panel, .auth-error { animation: none; } .auth-feature:hover, .auth-submit:hover { transform: none; } }

/* ---------- Print-ready preview wrapper on screen ---------- */
.kbd-hint { display: inline-flex; gap: 4px; align-items: center; font-size: 12px; color: var(--muted); }

/* ---------- Animations ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
@keyframes slideOut { to { opacity: 0; transform: translateX(30px); } }
@keyframes shrink { from { width: 100%; } to { width: 0; } }
@keyframes shimmer { to { background-position: -200% 0; } }
.reveal { animation: rise .45s cubic-bezier(.2,.8,.2,1) both; }
.reveal:nth-child(2) { animation-delay: .05s; } .reveal:nth-child(3) { animation-delay: .1s; } .reveal:nth-child(4) { animation-delay: .15s; } .reveal:nth-child(5) { animation-delay: .2s; }
.skeleton { border-radius: 6px; background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.lift { transition: transform .18s, box-shadow .18s, border-color .18s; }
.lift:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-main, .grid-dash { grid-template-columns: minmax(0, 1fr); }
  .sticky-side { position: static; }
}
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); width: 272px; }
  body.sidebar-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  body.sidebar-open::after { content: ''; position: fixed; inset: 0; z-index: 35; background: rgba(10,18,32,.5); }
  .main { margin-left: 0 !important; }
  .menu-toggle { display: inline-grid; }
  .topbar { padding: 0 16px; }
  .topbar-search span, .topbar-search kbd { display: none; }
  .topbar-search { width: 36px; padding: 0; justify-content: center; }
  .content { padding: 20px 16px; }
  .grid-3, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .pos { grid-template-columns: minmax(0, 1fr); height: auto; }
  .pos-cart { border-left: 0; border-top: 1px solid var(--border); }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-visual { display: none; }
  .auth-form { min-height: 100vh; }
  .auth-brand-mobile { display: flex; justify-content: center; margin-bottom: 24px; }
  .auth-copy-mobile { display: block; margin-top: 8px; text-align: center; color: var(--subtle); }
}
@media (max-width: 640px) {
  .grid-4, .grid-5 { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: auto; }
  .page-head { align-items: flex-start; }
  h1 { font-size: 21px; }
  .auth-form { padding: 32px 16px; align-items: flex-start; }
  .auth-card { padding: 30px 20px 24px; border-radius: 20px; }
  .auth-form::before { width: 520px; height: 520px; top: -300px; right: -280px; }
  .auth-form::after { width: 420px; height: 420px; bottom: -240px; left: -200px; }
  .auth-arc-1, .auth-arc-2 { display: none; }
  .breadcrumbs a, .breadcrumbs .sep { display: none; }
}
@media print {
  .sidebar, .topbar, .page-actions, .toasts { display: none !important; }
  .main { margin: 0 !important; }
}

/* ---------- Inventaire par comptage ---------- */
.count-input { width: 110px; text-align: right; font-family: var(--mono); font-weight: 600; }
.count-input.is-saved { border-color: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.count-input.is-saving { opacity: .6; }
.inv-row.is-counted td:first-child { box-shadow: inset 3px 0 0 var(--success); }
.inv-row.is-variance td:first-child { box-shadow: inset 3px 0 0 var(--warning); }
.inv-row.is-focus { background: var(--accent-soft); }
.inv-scan { display: flex; gap: 10px; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--border); background: var(--surface-2); flex-wrap: wrap; }
.inv-scan .input { flex: 1; min-width: 220px; }
.variance-pos { color: var(--success-ink); }
.variance-neg { color: var(--danger-ink); }
