/* ============================================================
   DICTAVIS — Application (login + dashboard)
   Même charte que le site : navy + or, Space Grotesk + DM Sans
   ============================================================ */

:root {
  --navy: #1E3A5F;
  --navy-700: #16304f;
  --navy-800: #112742;
  --navy-900: #0f2136;
  --navy-ink: #0B1B2E;
  --gold: #A16207;
  --gold-bright: #C8912A;
  --gold-soft: #FBF3E1;
  --gold-line: #EAD9AE;

  --ink: #0F172A;
  --ink-700: #334155;
  --ink-500: #5A6B80;
  --ink-400: #7A899C;

  --bg: #F5F8FC;
  --bg-2: #EEF3F9;
  --surface: #FFFFFF;
  --surface-2: #FBFCFE;
  --border: #E4EAF1;
  --border-2: #D3DCE7;

  --success: #15803D;
  --success-soft: #E7F4EC;
  --danger: #DC2626;
  --danger-soft: #FCECEC;
  --warn: #B45309;
  --warn-soft: #FBF0E1;

  --sky: #2563EB;

  --r-xs: 8px;
  --r-sm: 10px;
  --r: 13px;
  --r-lg: 18px;
  --r-xl: 22px;
  --r-pill: 999px;

  --sh-xs: 0 1px 2px rgba(15,33,54,.06);
  --sh-sm: 0 2px 8px rgba(15,33,54,.07), 0 1px 2px rgba(15,33,54,.05);
  --sh: 0 12px 30px -12px rgba(15,33,54,.20), 0 2px 8px rgba(15,33,54,.05);
  --sh-lg: 0 30px 60px -22px rgba(15,33,54,.32), 0 8px 24px -12px rgba(15,33,54,.14);

  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-sans: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --sidebar-w: 252px;
  --topbar-h: 66px;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  font-size: 15px; line-height: 1.55; color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
ul, ol { list-style: none; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 5px; }

.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.85; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.ico--sm { width: 17px; height: 17px; }
.tnum { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ============================================================
   BOUTONS
   ============================================================ */
.btn {
  --h: 42px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--h); padding-inline: 18px;
  font-weight: 600; font-size: .93rem; letter-spacing: -.01em;
  border-radius: var(--r-sm); border: 1px solid transparent; white-space: nowrap;
  transition: transform .16s var(--ease), box-shadow .2s var(--ease), background-color .16s var(--ease), border-color .16s var(--ease), color .16s var(--ease);
}
.btn .ico { width: 18px; height: 18px; }
.btn:active { transform: translateY(1px); }
.btn--sm { --h: 36px; padding-inline: 13px; font-size: .88rem; }
.btn--lg { --h: 50px; padding-inline: 24px; font-size: 1rem; }
.btn--block { display: flex; width: 100%; }
.btn--primary { background: var(--navy); color: #fff; box-shadow: var(--sh-sm); }
.btn--primary:hover { background: var(--navy-700); box-shadow: var(--sh); }
.btn--gold { background: var(--gold); color: #fff; }
.btn--gold:hover { background: #8f560a; }
.btn--ghost { background: var(--surface); color: var(--ink-700); border-color: var(--border-2); }
.btn--ghost:hover { border-color: var(--navy); color: var(--navy); }
.btn--soft { background: var(--bg-2); color: var(--ink-700); }
.btn--soft:hover { background: #e3ebf4; color: var(--ink); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { background: #b91c1c; }
.btn--danger-ghost { background: var(--surface); color: var(--danger); border-color: #F0C9C9; }
.btn--danger-ghost:hover { background: var(--danger-soft); }

/* Boutons icône */
.iconbtn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r-xs); color: var(--ink-500); transition: background-color .15s var(--ease), color .15s var(--ease); }
.iconbtn:hover { background: var(--bg-2); color: var(--ink); }
.iconbtn--danger:hover { background: var(--danger-soft); color: var(--danger); }

/* Badges / pills */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--r-pill); font-size: .74rem; font-weight: 600; }
.badge--gold { background: var(--gold-soft); color: var(--gold); border: 1px solid var(--gold-line); }
.badge--demo { background: var(--warn-soft); color: var(--warn); border: 1px solid #EAD3B0; }
.badge--muted { background: var(--bg-2); color: var(--ink-500); }
.badge--best { background: var(--success-soft); color: var(--success); border: 1px solid #BEE3CB; }

/* ============================================================
   PAGE LOGIN
   ============================================================ */
.auth { min-height: 100dvh; display: grid; grid-template-columns: 1fr; }
@media (min-width: 900px) { .auth { grid-template-columns: 1.05fr 1fr; } }

.auth__brand {
  position: relative; overflow: hidden; display: none;
  padding: 48px; color: #fff;
  background: linear-gradient(165deg, var(--navy) 0%, var(--navy-900) 70%);
}
@media (min-width: 900px) { .auth__brand { display: flex; flex-direction: column; } }
.auth__brand-bg { position: absolute; inset: 0; z-index: 0; background: radial-gradient(60% 45% at 80% 12%, rgba(200,145,42,.22), transparent 66%); }
.auth__brand-bg::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px); background-size: 46px 46px; -webkit-mask-image: radial-gradient(70% 60% at 50% 40%, #000, transparent 80%); mask-image: radial-gradient(70% 60% at 50% 40%, #000, transparent 80%); }
.auth__brand > * { position: relative; z-index: 1; }
.auth__brand-top { display: flex; align-items: center; gap: 10px; }
.auth__quote { margin-top: auto; }
.auth__quote h2 { font-family: var(--font-display); font-weight: 500; font-size: clamp(1.5rem, 2.4vw, 2.1rem); line-height: 1.25; letter-spacing: -.02em; }
.auth__quote p { margin-top: 18px; color: rgba(233,240,248,.72); max-width: 42ch; }
.auth__points { margin-top: 30px; display: flex; flex-direction: column; gap: 12px; }
.auth__points li { display: flex; align-items: center; gap: 11px; color: rgba(233,240,248,.9); font-size: .96rem; }
.auth__points .ico { color: var(--gold-bright); width: 19px; height: 19px; }

.auth__main { display: flex; align-items: center; justify-content: center; padding: 32px 22px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card__brand { display: none; align-items: center; gap: 10px; margin-bottom: 28px; }
@media (max-width: 899px) { .auth-card__brand { display: flex; } }
.auth-card h1 { font-family: var(--font-display); font-weight: 600; font-size: 1.7rem; letter-spacing: -.02em; }
.auth-card__sub { margin-top: 6px; color: var(--ink-500); font-size: .96rem; }

.gbtn {
  display: flex; align-items: center; justify-content: center; gap: 11px;
  width: 100%; height: 48px; margin-top: 26px;
  background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r-sm);
  font-weight: 600; font-size: .95rem; color: var(--ink);
  transition: background-color .16s var(--ease), border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.gbtn:hover { background: var(--surface-2); border-color: var(--ink-400); box-shadow: var(--sh-xs); }
.gbtn svg { width: 19px; height: 19px; }

.auth-divider { display: flex; align-items: center; gap: 14px; margin: 22px 0; color: var(--ink-400); font-size: .82rem; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.field { margin-bottom: 16px; }
.field > label { display: block; font-size: .86rem; font-weight: 600; color: var(--ink-700); margin-bottom: 7px; }
.field__input { position: relative; display: flex; align-items: center; }
.input {
  width: 100%; height: 46px; padding: 0 14px;
  background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r-sm);
  font-size: .95rem; color: var(--ink);
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.input::placeholder { color: var(--ink-400); }
.input:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(30,58,95,.12); }
.input--pw { padding-right: 44px; }
.field__toggle { position: absolute; right: 6px; width: 34px; height: 34px; display: grid; place-items: center; color: var(--ink-400); border-radius: var(--r-xs); }
.field__toggle:hover { color: var(--ink-700); background: var(--bg-2); }
.field__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.link { color: var(--navy); font-weight: 600; font-size: .88rem; }
.link:hover { color: var(--gold); }

.auth-card form .btn { margin-top: 8px; }
.auth-legal { margin-top: 16px; font-size: .8rem; color: var(--ink-400); line-height: 1.5; }
.auth-legal a { color: var(--ink-500); text-decoration: underline; }
.auth-switch { margin-top: 26px; text-align: center; font-size: .92rem; color: var(--ink-500); }
.auth-switch button { color: var(--navy); font-weight: 700; }
.auth-switch button:hover { color: var(--gold); }
[data-signup-only] { display: none; }
.auth.mode-signup [data-signup-only] { display: block; }
.auth.mode-signup [data-login-only] { display: none; }

.auth-msg { margin-bottom: 16px; padding: 11px 14px; border-radius: var(--r-sm); font-size: .88rem; font-weight: 500; }
.auth-msg.is-err { background: var(--danger-soft); color: #b91c1c; border: 1px solid #F0C9C9; }
.auth-msg.is-ok { background: var(--success-soft); color: var(--success); border: 1px solid #BEE3CB; }

/* ============================================================
   APP SHELL
   ============================================================ */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100dvh; }

.sidebar {
  position: sticky; top: 0; align-self: start; height: 100dvh;
  display: flex; flex-direction: column; gap: 6px;
  padding: 20px 14px; color: #fff;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-900) 100%);
}
.sidebar__brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; }
.sidebar__brand .brand__name { font-family: var(--font-display); font-weight: 600; font-size: 1.24rem; letter-spacing: -.02em; }
.sidebar__label { padding: 12px 10px 6px; font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: rgba(233,240,248,.42); }
.nav-item {
  display: flex; align-items: center; gap: 12px; position: relative;
  padding: 10px 12px; border-radius: var(--r-sm);
  color: rgba(233,240,248,.78); font-weight: 500; font-size: .95rem;
  transition: background-color .15s var(--ease), color .15s var(--ease);
}
.nav-item .ico { width: 19px; height: 19px; opacity: .85; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.is-active { background: rgba(255,255,255,.10); color: #fff; }
.nav-item.is-active::before { content: ""; position: absolute; left: -14px; top: 50%; transform: translateY(-50%); width: 3px; height: 22px; border-radius: 0 3px 3px 0; background: var(--gold-bright); }
.nav-item.is-active .ico { opacity: 1; color: var(--gold-bright); }
.nav-item__badge { margin-left: auto; padding: 1px 8px; border-radius: var(--r-pill); background: rgba(200,145,42,.2); color: var(--gold-bright); font-size: .7rem; font-weight: 700; }
.sidebar__spacer { flex: 1; }
.sidebar__user { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--r-sm); background: rgba(255,255,255,.06); }
.sidebar__user .avatar { flex-shrink: 0; }
.sidebar__user-info { min-width: 0; line-height: 1.3; }
.sidebar__user-info strong { display: block; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__user-info span { font-size: .76rem; color: rgba(233,240,248,.6); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(150deg, var(--gold), #8f560a); color: #fff; font-family: var(--font-display); font-weight: 600; font-size: .9rem; }
.avatar--sm { width: 30px; height: 30px; font-size: .78rem; }

/* Main */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--topbar-h); display: flex; align-items: center; gap: 16px;
  padding: 0 clamp(18px, 3vw, 32px);
  background: rgba(245,248,252,.85); backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar__title { font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; letter-spacing: -.01em; }
.topbar__spacer { flex: 1; }
.burger { display: none; }

.view { padding: clamp(20px, 3vw, 34px) clamp(18px, 3vw, 32px) 64px; }
.view[hidden] { display: none; }
.view__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.view__head h2 { font-family: var(--font-display); font-weight: 600; font-size: 1.5rem; letter-spacing: -.02em; }
.view__head p { color: var(--ink-500); margin-top: 4px; font-size: .96rem; }
.view__actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ============================================================
   CARTES / STATS
   ============================================================ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-xs); }
.stat-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, 1fr); margin-bottom: 26px; }
@media (min-width: 760px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat { padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-xs); }
.stat__ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r); background: var(--bg-2); color: var(--navy); margin-bottom: 14px; }
.stat__ico--gold { background: var(--gold-soft); color: var(--gold); }
.stat__ico--green { background: var(--success-soft); color: var(--success); }
.stat__val { font-family: var(--font-display); font-weight: 700; font-size: 1.9rem; letter-spacing: -.02em; }
.stat__label { color: var(--ink-500); font-size: .9rem; margin-top: 2px; }

/* ============================================================
   TOOLBAR (recherche + filtres)
   ============================================================ */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.search { position: relative; flex: 1; min-width: 220px; max-width: 440px; }
.search .ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--ink-400); width: 18px; height: 18px; pointer-events: none; }
.search input { width: 100%; height: 44px; padding: 0 14px 0 40px; background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r-sm); font-size: .93rem; transition: border-color .16s var(--ease), box-shadow .16s var(--ease); }
.search input:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(30,58,95,.1); }
.select { height: 44px; padding: 0 34px 0 14px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237A899C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 16px; border: 1px solid var(--border-2); border-radius: var(--r-sm); font-size: .9rem; color: var(--ink-700); -webkit-appearance: none; appearance: none; }
.select:focus { outline: none; border-color: var(--navy); }

/* ============================================================
   TABLE CATALOGUE
   ============================================================ */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--sh-xs); }
table.data { width: 100%; border-collapse: collapse; min-width: 620px; }
.data thead th { text-align: left; padding: 14px 18px; font-size: .74rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-400); border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.data th.num, .data td.num { text-align: right; }
.data tbody td { padding: 14px 18px; border-bottom: 1px solid var(--border); font-size: .93rem; vertical-align: middle; }
.data tbody tr:last-child td { border-bottom: none; }
.data tbody tr { transition: background-color .12s var(--ease); }
.data tbody tr:hover { background: var(--surface-2); }
.data .desig { font-weight: 600; color: var(--ink); }
.data .cat { display: inline-flex; padding: 3px 10px; border-radius: var(--r-pill); background: var(--bg-2); color: var(--ink-500); font-size: .78rem; font-weight: 600; white-space: nowrap; }
.data .unit { color: var(--ink-500); }
.data .price { font-family: var(--font-display); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data .row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.data td.actions { width: 1%; white-space: nowrap; }

/* Empty state */
.empty { padding: 56px 24px; text-align: center; }
.empty__ico { display: grid; place-items: center; width: 58px; height: 58px; border-radius: 50%; background: var(--bg-2); color: var(--ink-400); margin: 0 auto 16px; }
.empty h3 { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; }
.empty p { color: var(--ink-500); margin: 6px auto 20px; max-width: 42ch; }

/* ============================================================
   MODAL
   ============================================================ */
.modal { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal.is-open { display: flex; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(11,27,46,.5); backdrop-filter: blur(3px); animation: fade .2s var(--ease); }
.modal__card { position: relative; width: 100%; max-width: 480px; background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--sh-lg); animation: pop .28s var(--ease-out); max-height: 92dvh; overflow-y: auto; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 22px 24px 0; }
.modal__head h3 { font-family: var(--font-display); font-weight: 600; font-size: 1.28rem; letter-spacing: -.01em; }
.modal__body { padding: 20px 24px; }
.modal__foot { display: flex; gap: 10px; justify-content: flex-end; padding: 8px 24px 24px; }
.form-row { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 460px) { .form-row { grid-template-columns: 1fr; } }
.input-affix { position: relative; display: flex; align-items: center; }
.input-affix .input { padding-right: 42px; }
.input-affix__suffix { position: absolute; right: 14px; color: var(--ink-400); font-size: .9rem; font-weight: 600; pointer-events: none; }
textarea.input { height: auto; padding: 12px 14px; resize: vertical; min-height: 78px; line-height: 1.5; }

/* ============================================================
   ÉDITEUR DE DEVIS
   ============================================================ */
.qpill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: var(--r-pill); font-size: .76rem; font-weight: 600; white-space: nowrap; }
.qpill[data-status="brouillon"] { background: var(--bg-2); color: var(--ink-500); }
.qpill[data-status="envoye"]    { background: var(--gold-soft); color: var(--gold); border: 1px solid var(--gold-line); }
.qpill[data-status="accepte"]   { background: var(--success-soft); color: var(--success); border: 1px solid #BEE3CB; }
.qpill[data-status="refuse"]    { background: var(--danger-soft); color: #b91c1c; border: 1px solid #F0C9C9; }
.qpill[data-status="expire"]    { background: var(--bg-2); color: var(--ink-400); }
.qpill[data-status="facture"]   { background: #E7ECF6; color: var(--navy); border: 1px solid #CBD8EC; }

.editor-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.editor-bar__title { display: flex; align-items: center; gap: 12px; }
.editor-bar__title strong { font-family: var(--font-display); font-weight: 600; font-size: 1.35rem; letter-spacing: -.01em; }
.editor-bar__actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }

.editor-grid { display: grid; grid-template-columns: 1fr; gap: 20px; align-items: start; }
@media (min-width: 1000px) { .editor-grid { grid-template-columns: minmax(0,1fr) 332px; } }
.editor-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.ed-card { padding: 22px; }
.ed-card__title { font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; letter-spacing: -.01em; margin-bottom: 16px; }
.ed-card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.ed-card__head .ed-card__title { margin-bottom: 0; }
.ed-line-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ed-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
@media (max-width: 520px) { .ed-fields { grid-template-columns: 1fr; } }

.lines-wrap { overflow-x: auto; }
table.lines { width: 100%; border-collapse: collapse; min-width: 560px; }
.lines thead th { text-align: left; padding: 0 10px 10px; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-400); }
.lines th.num { text-align: right; }
.lines tbody td { padding: 4px 6px; border-top: 1px solid var(--border); vertical-align: middle; }
.lines tbody tr:first-child td { border-top: none; }
.lin { width: 100%; height: 40px; padding: 0 10px; border: 1px solid transparent; border-radius: var(--r-xs); background: transparent; font-size: .92rem; color: var(--ink); transition: border-color .15s var(--ease), background-color .15s var(--ease), box-shadow .15s var(--ease); }
.lin:hover { background: var(--surface-2); }
.lin:focus { outline: none; border-color: var(--navy); background: #fff; box-shadow: 0 0 0 3px rgba(30,58,95,.1); }
.lin.num { text-align: right; font-variant-numeric: tabular-nums; }
.lin-desig { font-weight: 500; }
td.lin-desig-cell { min-width: 220px; }
select.lin { -webkit-appearance: none; appearance: none; padding-right: 24px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237A899C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 6px center; background-size: 14px; }
td.lin-qty-cell { width: 84px; } td.lin-unit-cell { width: 98px; } td.lin-pu-cell { width: 118px; }
.lin-total { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; padding-right: 12px !important; color: var(--ink); }
td.lin-rm { width: 42px; text-align: right; }
.lines-empty { padding: 26px; text-align: center; color: var(--ink-400); font-size: .92rem; border: 1px dashed var(--border-2); border-radius: var(--r); }

.editor-aside { position: sticky; top: calc(var(--topbar-h) + 20px); }
.ed-summary { padding: 22px; }
.ed-params { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.ed-totals { border-top: 1px solid var(--border); padding-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.ed-totals > div { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: .95rem; color: var(--ink-500); }
.ed-totals b { color: var(--ink-700); font-weight: 600; }
.ed-totals__ttc { margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--border); }
.ed-totals__ttc span { color: var(--ink); font-weight: 600; font-size: 1rem; }
.ed-totals__ttc b { font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; color: var(--navy); }
.ed-totals__acompte { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 10px 12px !important; margin-top: 6px; background: var(--gold-soft); border: 1px solid var(--gold-line); border-radius: var(--r-sm); }
.ed-totals__acompte span { color: var(--gold) !important; font-weight: 600; font-size: .82rem; }
.ed-totals__acompte b { color: var(--gold); }
.ed-summary .btn--block { margin-top: 18px; }
.ed-hint { margin-top: 12px; font-size: .78rem; color: var(--ink-400); line-height: 1.4; text-align: center; }

.data .qnum { font-family: var(--font-display); font-weight: 600; }
.data .qclient { font-weight: 600; color: var(--ink); }
.data .qchantier { color: var(--ink-500); max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data tbody tr.qrow { cursor: pointer; }

.modal__card--wide { max-width: 560px; }
.pick-list { display: flex; flex-direction: column; gap: 6px; max-height: 52vh; overflow-y: auto; }
.pick-item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 11px 12px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); transition: border-color .14s var(--ease), background-color .14s var(--ease); }
.pick-item:hover { border-color: var(--navy); background: var(--surface-2); }
.pick-item__main { min-width: 0; flex: 1; }
.pick-item__main strong { display: block; font-weight: 600; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-item__main span { font-size: .8rem; color: var(--ink-400); }
.pick-item__price { font-family: var(--font-display); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pick-item__add { color: var(--navy); display: inline-flex; }

/* Types de facture */
.itype { display: inline-flex; padding: 3px 10px; border-radius: var(--r-pill); font-size: .76rem; font-weight: 600; white-space: nowrap; }
.itype--acompte { background: var(--gold-soft); color: var(--gold); border: 1px solid var(--gold-line); }
.itype--solde { background: var(--success-soft); color: var(--success); border: 1px solid #BEE3CB; }
.itype--complete, .itype--directe { background: #E7ECF6; color: var(--navy); border: 1px solid #CBD8EC; }

/* ============================================================
   RÉGLAGES
   ============================================================ */
.settings { max-width: 780px; display: flex; flex-direction: column; gap: 18px; }
.set-card { padding: 22px; }
.set-card .ed-fields { margin-bottom: 0; }
.set-foot { display: flex; justify-content: flex-end; }
.logo-up { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.logo-preview { width: 132px; height: 84px; flex-shrink: 0; border: 1px dashed var(--border-2); border-radius: var(--r); display: grid; place-items: center; overflow: hidden; background: var(--surface-2); padding: 8px; }
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-preview span { color: var(--ink-400); font-size: .82rem; }
.logo-up__actions { min-width: 0; }

/* ============================================================
   COMPARATEUR
   ============================================================ */
.cmp-hero { padding: clamp(22px, 3vw, 30px); background: linear-gradient(160deg, var(--navy), var(--navy-900)); border-radius: var(--r-xl); color: #fff; margin-bottom: 24px; position: relative; overflow: hidden; }
.cmp-hero__glow { position: absolute; inset: 0; background: radial-gradient(50% 80% at 90% 0%, rgba(200,145,42,.25), transparent 60%); }
.cmp-hero > * { position: relative; z-index: 1; }
.cmp-hero h2 { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.3rem, 2.4vw, 1.7rem); letter-spacing: -.02em; }
.cmp-hero p { color: rgba(233,240,248,.76); margin-top: 6px; max-width: 60ch; font-size: .96rem; }
.cmp-search { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.cmp-search__field { position: relative; flex: 1; min-width: 240px; }
.cmp-search__field .ico { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--ink-400); pointer-events: none; }
.cmp-search__field input { width: 100%; height: 52px; padding: 0 16px 0 46px; border: 1px solid transparent; border-radius: var(--r-sm); background: #fff; color: var(--ink); font-size: 1rem; }
.cmp-search__field input:focus { outline: none; box-shadow: 0 0 0 3px rgba(200,145,42,.4); }
.cmp-suggest { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.cmp-suggest span { color: rgba(233,240,248,.6); font-size: .84rem; align-self: center; margin-right: 2px; }
.chip { padding: 6px 13px; border-radius: var(--r-pill); background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.16); color: #fff; font-size: .84rem; font-weight: 500; transition: background-color .15s var(--ease); }
.chip:hover { background: rgba(255,255,255,.2); }

.cmp-results { display: flex; flex-direction: column; gap: 16px; }
.cmp-note { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--warn-soft); border: 1px solid #EAD3B0; border-radius: var(--r-sm); color: #7c4a08; font-size: .86rem; margin-bottom: 20px; }
.cmp-note .ico { color: var(--warn); }

.prod { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-xs); overflow: hidden; }
.prod__head { display: flex; align-items: center; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.prod__thumb { display: grid; place-items: center; width: 52px; height: 52px; border-radius: var(--r); background: var(--bg-2); color: var(--navy); flex-shrink: 0; }
.prod__thumb .ico { width: 26px; height: 26px; }
.prod__info { min-width: 0; flex: 1; }
.prod__info h3 { font-family: var(--font-display); font-weight: 600; font-size: 1.06rem; letter-spacing: -.01em; }
.prod__info p { color: var(--ink-500); font-size: .86rem; margin-top: 2px; }
.prod__best { text-align: right; flex-shrink: 0; }
.prod__best small { display: block; color: var(--ink-400); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.prod__best b { font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; color: var(--success); font-variant-numeric: tabular-nums; }

.offers { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1px; background: var(--border); }
.offer { background: var(--surface); padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; transition: background-color .12s var(--ease); }
.offer:hover { background: var(--surface-2); }
.offer.is-best { background: var(--success-soft); }
.offer.is-best:hover { background: #ddf0e4; }
.offer__store { display: flex; align-items: center; gap: 7px; font-size: .8rem; font-weight: 600; color: var(--ink-700); }
.offer__logo { width: 18px; height: 18px; border-radius: 5px; flex-shrink: 0; }
.offer__price { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.offer__meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }
.offer__stock { font-size: .74rem; font-weight: 600; }
.offer__stock.ok { color: var(--success); }
.offer__stock.low { color: var(--warn); }
.offer__link { font-size: .76rem; color: var(--navy); font-weight: 600; }
.offer__link:hover { color: var(--gold); }
.prod__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; flex-wrap: wrap; }
.prod__foot small { color: var(--ink-400); font-size: .78rem; }

/* ============================================================
   TOAST
   ============================================================ */
.toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 10px; align-items: center; width: max-content; max-width: calc(100vw - 32px); }
.toast { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--navy-ink); color: #fff; border-radius: var(--r-sm); box-shadow: var(--sh-lg); font-size: .9rem; animation: toastIn .3s var(--ease-out); }
.toast__ico { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; }
.toast__ico.ok { background: var(--success); }
.toast__ico.info { background: var(--sky); }
.toast__ico svg { width: 13px; height: 13px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.toast button { color: var(--gold-bright); font-weight: 700; font-size: .88rem; padding-left: 4px; }
.toast button:hover { text-decoration: underline; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px); } }
.toast.is-out { animation: toastOut .25s var(--ease) forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px); } }

/* ============================================================
   RESPONSIVE — sidebar off-canvas
   ============================================================ */
.scrim { display: none; }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 60; width: 264px; height: 100dvh;
    transform: translateX(-100%); transition: transform .28s var(--ease);
    box-shadow: var(--sh-lg);
  }
  .app.nav-open .sidebar { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(11,27,46,.45); opacity: 0; visibility: hidden; transition: opacity .25s var(--ease), visibility .25s; }
  .app.nav-open .scrim { opacity: 1; visibility: visible; }
  .burger { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-xs); color: var(--ink-700); margin-left: -8px; }
  .burger:hover { background: var(--bg-2); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
