/* Portail AF Motors — couleurs et formes reprises de la maquette validée du 30/11 */
@font-face { font-family: 'Inter'; src: url('fonts/inter-latin.woff2') format('woff2'); font-weight: 400 700; font-display: swap; }
@font-face { font-family: 'Space Grotesk'; src: url('fonts/space-grotesk-latin.woff2') format('woff2'); font-weight: 500 700; font-display: swap; }

:root {
  --ink: #15181D; --ink-2: #22262D; --accent: #F2B705; --bg: #F3F4F6; --card: #fff;
  --line: #E5E7EB; --line-2: #D1D5DB; --muted: #4B5563; --soft: #6B7280;
  --red: #991B1B; --red-bg: #FEE2E2; --blue: #1E40AF; --blue-bg: #DBEAFE; --green: #166534; --green-bg: #DCFCE7;
  --amber: #92400E; --amber-bg: #FEF3C7; --grey: #374151; --grey-bg: #E5E7EB;
  --title: 'Space Grotesk', 'Inter', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.45; }
h1, h2 { margin: 0; }
h1 { font-family: var(--title); font-size: 32px; line-height: 1.15; }
h2 { font-size: 18px; }
p { margin: 0; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .6; cursor: default; }
:focus-visible { outline: 3px solid #2563EB; outline-offset: 2px; }
.muted { color: var(--muted); font-size: 13px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.ic { flex: none; vertical-align: -3px; }

/* ---------- boutons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 8px; border: 1px solid transparent; font-weight: 600; font-size: 14px; text-decoration: none; white-space: nowrap; }
.btn.dark { background: var(--ink); color: #fff; }
.btn.accent { background: var(--accent); color: var(--ink); }
.btn.ghost { background: #fff; border-color: var(--line-2); }
.btn.ghost-dark { background: transparent; border-color: #4B5563; color: #E5E7EB; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn.big { min-height: 56px; font-size: 17px; font-weight: 700; border-radius: 10px; width: 100%; }
.link { background: none; border: 0; padding: 6px 0; color: var(--amber); font-weight: 600; font-size: 13px; text-decoration: underline; min-height: 32px; }
.badge { display: inline-block; padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.grey { background: var(--grey-bg); color: var(--grey); } .badge.blue { background: var(--blue-bg); color: var(--blue); }
.badge.green { background: var(--green-bg); color: var(--green); } .badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.red { background: var(--red-bg); color: var(--red); }
.notice { display: flex; gap: 8px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; font-size: 14px; }
.notice.warn { background: var(--amber-bg); color: #78350F; }

/* ---------- bandeau de test, messages ---------- */
.test-banner { background: var(--accent); color: var(--ink); text-align: center; font-size: 13px; font-weight: 600; padding: 6px 12px; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: min(92vw, 520px); background: var(--ink); color: #fff; padding: 14px 18px; border-radius: 10px; font-weight: 600; font-size: 15px; box-shadow: 0 8px 24px rgba(0,0,0,.25); opacity: 0; pointer-events: none; transition: opacity .15s; z-index: 50; }
#toast.show { opacity: 1; }
#toast.error { background: var(--red); }

/* ---------- connexion ---------- */
.login { min-height: 100vh; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; }
.login-card { width: 100%; max-width: 420px; background: var(--card); border-radius: 12px; padding: 28px 24px; display: flex; flex-direction: column; gap: 18px; }
.login-card h1 { font-size: 26px; }
.logo { display: block; width: 140px; height: auto; filter: invert(1); }       /* logo noir → blanc sur fond sombre */
.logo.dark { filter: none; width: 150px; }
form#login { display: flex; flex-direction: column; gap: 14px; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; }
input, select { min-height: 52px; border-radius: 10px; border: 1px solid var(--line-2); padding: 0 14px; font-size: 16px; background: #fff; width: 100%; }
.demo { border-top: 1px solid var(--line); padding-top: 16px; display: flex; flex-direction: column; gap: 12px; font-size: 14px; color: var(--muted); }
.demo-roles { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- cadre bureau (gérant, magasinier) ---------- */
.desk { display: flex; min-height: 100vh; }
.side { flex: none; width: 250px; background: var(--ink); color: #fff; padding: 24px 16px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side-logo { padding: 0 8px 20px; }
.side-links { display: flex; flex-direction: column; gap: 6px; }
.side a { color: #E5E7EB; padding: 12px; border-radius: 8px; font-size: 15px; text-decoration: none; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.side a:hover { background: var(--ink-2); }
.side a.on { color: var(--ink); background: var(--accent); font-weight: 600; }
.tag { font-size: 11px; color: #9CA3AF; font-weight: 500; white-space: nowrap; }
.side a.on .tag { color: var(--ink); }
.side-user { margin-top: auto; padding: 12px; border-radius: 8px; background: var(--ink-2); font-size: 13px; color: #D1D5DB; display: flex; flex-direction: column; gap: 10px; }
.side-user b { color: #fff; }
.content { flex: 1; min-width: 0; padding: 32px; max-width: 1180px; }
.screen { display: flex; flex-direction: column; gap: 24px; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.page-head.narrow { margin-bottom: 24px; }
.kicker { font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.kicker a { text-decoration: none; font-weight: 600; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.tile { background: var(--card); border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.tile b { font-family: var(--title); font-size: 32px; line-height: 1.1; color: var(--ink); }
.tile.hot { box-shadow: inset 0 0 0 2px var(--accent); }
.hot-text { color: var(--amber); font-weight: 600; }
.card { background: var(--card); border-radius: 12px; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.more { font-size: 14px; font-weight: 600; color: var(--amber); }
.line { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--bg); font-size: 14px; }
.foot { font-size: 12px; color: var(--muted); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { min-height: 40px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line-2); background: #fff; font-weight: 600; font-size: 13px; }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.pickbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--amber-bg); border-radius: 10px; padding: 10px 14px; font-size: 14px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 820px; }
td, th { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: top; }
th { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
td.num { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.act { white-space: nowrap; text-align: right; }
td.act .link { display: block; margin-left: auto; }
tr.row-urgent { background: #FFFBEB; }
.late { color: var(--red); font-weight: 600; font-size: 13px; }
.pick { flex-direction: row; align-items: center; justify-content: flex-end; gap: 8px; font-size: 13px; min-height: 36px; cursor: pointer; }
.pick input { width: 22px; height: 22px; min-height: 0; padding: 0; accent-color: var(--ink); }
.overlay { position: fixed; inset: 0; background: rgba(21,24,29,.55); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 40; }
.dialog { background: #fff; border-radius: 12px; padding: 24px; width: 100%; max-width: 460px; display: flex; flex-direction: column; gap: 16px; max-height: 90vh; overflow-y: auto; }
.dlg-list { margin: 0; padding-left: 18px; font-size: 14px; display: flex; flex-direction: column; gap: 4px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
[hidden] { display: none !important; }

/* ---------- cadre téléphone (mécano, carrossier, peintre) ---------- */
.phone { max-width: 520px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.phone-head { background: var(--ink); color: #fff; padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 6px; }
.phone-head .logo { width: 96px; }
.phone-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.phone-head h1 { font-size: 26px; }
.phone-head p { color: #D1D5DB; font-size: 14px; }
.phone-body { padding: 16px; flex: 1; }

/* ---------- demande de pièce ---------- */
.screen-demande { max-width: 520px; }
.ask { display: flex; flex-direction: column; gap: 20px; }
fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
legend { padding: 0; margin-bottom: 8px; font-weight: 600; font-size: 16px; }
legend label { font-size: 16px; }
.choice { min-height: 56px; border-radius: 10px; border: 1px solid var(--line-2); background: #fff; font-weight: 600; font-size: 16px; text-align: left; padding: 8px 14px; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.choice small { font-weight: 500; font-size: 13px; color: var(--muted); }
.choice.on { border: 2px solid var(--ink); background: var(--amber-bg); padding: 7px 13px; }
.two { display: flex; gap: 8px; }
.pill { flex: 1; min-height: 56px; border-radius: 10px; border: 1px solid var(--line-2); background: #fff; font-weight: 600; font-size: 16px; }
.pill.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.pill.urgent.on { background: var(--red); border-color: var(--red); }
.send { display: flex; flex-direction: column; gap: 8px; }
.send small { font-size: 12px; color: var(--muted); text-align: center; }
.mine { margin-top: 28px; display: flex; flex-direction: column; gap: 4px; }
.mine h2 { margin-bottom: 6px; }
.mine-row { background: #fff; border-radius: 10px; padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 15px; margin-bottom: 6px; }
.mine-end { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }

/* ---------- petit écran : le menu passe en haut ---------- */
@media (max-width: 860px) {
  .desk { flex-direction: column; }
  .side { width: auto; height: auto; position: static; padding: 12px; gap: 10px; }
  .side-logo { padding: 0 4px; } .side-logo .logo { width: 84px; }
  .side-links { flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .side a { white-space: nowrap; padding: 10px 12px; }
  .side-user { margin-top: 0; flex-direction: row; justify-content: space-between; align-items: center; }
  .content { padding: 20px 16px; }
  h1 { font-size: 26px; }
}
