/* SellTag — charte stricte : #002048 (bleu nuit), #0078D0 (bleu vif), #C5C7C9 (gris clair), #FFFFFF.
   Les nuances sont des transparences de ces quatre couleurs, jamais d'autres teintes. */
:root {
  --navy: #002048; --blue: #0078D0; --gray: #C5C7C9; --white: #FFFFFF;
  --navy-80: rgba(0, 32, 72, .8); --navy-60: rgba(0, 32, 72, .62); --navy-12: rgba(0, 32, 72, .12); --navy-06: rgba(0, 32, 72, .055);
  --blue-12: rgba(0, 120, 208, .12); --blue-06: rgba(0, 120, 208, .06); --gray-30: rgba(197, 199, 201, .3); --gray-50: rgba(197, 199, 201, .55);
  --bg: #f6f7f7; /* = blanc + 15 % de gris clair */
  --radius: 10px; --radius-sm: 7px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --shadow: 0 1px 2px rgba(0, 32, 72, .06), 0 4px 16px rgba(0, 32, 72, .05);
  --side: 248px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--navy); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { color: var(--navy); margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0 0 10px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--navy-60); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Structure ---------- */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100%; }
.side { position: sticky; top: 0; height: 100vh; background: var(--white); border-right: 1px solid var(--gray-50); display: flex; flex-direction: column; padding: 18px 14px; }
.side .brand { display: flex; align-items: center; padding: 4px 8px 18px; }
.side .brand img { height: 34px; width: auto; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: var(--radius-sm); color: var(--navy-80); font-weight: 600; font-size: 14px; }
.nav a:hover { background: var(--navy-06); text-decoration: none; }
.nav a.active { background: var(--navy); color: var(--white); }
.nav a svg { width: 18px; height: 18px; flex: none; }
.side .foot { margin-top: auto; border-top: 1px solid var(--gray-50); padding-top: 12px; font-size: 13px; }
.env { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 7px; border-radius: 4px; border: 1px solid var(--blue); color: var(--blue); }
.main { min-width: 0; }
.topbar { display: none; }
.page { max-width: 1180px; margin: 0 auto; padding: 28px 32px 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .sub { color: var(--navy-60); margin-top: 4px; font-size: 14px; }
.tabbar { display: none; }

/* ---------- Composants ---------- */
.card { background: var(--white); border: 1px solid var(--navy-12); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head .hint { font-size: 13px; color: var(--navy-60); }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--navy); background: var(--navy); color: var(--white); font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; }
.btn:hover { opacity: .88; text-decoration: none; }
.btn.blue { background: var(--blue); border-color: var(--blue); }
.btn.ghost { background: var(--white); color: var(--navy); border-color: var(--gray); }
.btn.ghost:hover { background: var(--navy-06); }
.btn.link { background: none; border: none; color: var(--blue); padding: 4px 6px; min-height: 0; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn svg { width: 17px; height: 17px; }
.btn.sm { min-height: 32px; padding: 5px 11px; font-size: 13px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span.lbl { font-size: 13px; font-weight: 600; color: var(--navy-80); }
.field .help { font-size: 12px; color: var(--navy-60); }
.input, .select, .textarea { width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--gray); border-radius: var(--radius-sm); background: var(--white); color: var(--navy); }
.textarea { min-height: 84px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-12); }
.input[aria-invalid="true"] { border-color: var(--navy); box-shadow: 0 0 0 2px var(--navy-12); background: var(--navy-06); }
.input.ro { background: var(--gray-30); }
.select.compact { width: auto; min-height: 36px; padding: 6px 10px; }
.combo { display: grid; grid-template-columns: 1fr 120px; gap: 8px; }
.unit-input { position: relative; }
.unit-input .input { padding-right: 46px; }
.unit-input .u { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 13px; color: var(--navy-60); pointer-events: none; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--gray); border-radius: 999px; background: var(--white); cursor: pointer; font-size: 14px; user-select: none; min-height: 40px; }
.chip input { accent-color: var(--blue); width: 16px; height: 16px; margin: 0; }
.chip:has(input:checked) { border-color: var(--blue); background: var(--blue-06); color: var(--navy); font-weight: 600; }
.seg { display: inline-flex; border: 1px solid var(--gray); border-radius: var(--radius-sm); overflow: hidden; }
.seg button { border: 0; background: var(--white); padding: 7px 13px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--navy-80); min-height: 36px; }
.seg button + button { border-left: 1px solid var(--gray); }
.seg button.on { background: var(--navy); color: var(--white); }
.score { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.score button { min-height: 40px; border: 1px solid var(--gray); background: var(--white); border-radius: var(--radius-sm); font-weight: 700; cursor: pointer; }
.score button.on { background: var(--blue); border-color: var(--blue); color: var(--white); }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--navy-06); color: var(--navy-80); white-space: nowrap; }
.badge.blue { background: var(--blue-12); color: var(--navy); }
.badge.navy { background: var(--navy); color: var(--white); }
.badge.line { background: none; border: 1px solid var(--gray); }
/* Origine d'un champ repris de HubSpot */
.field > .src { align-self: flex-start; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--blue-12); color: var(--navy); white-space: nowrap; }
.field > .src.modified { background: none; border: 1px solid var(--gray); color: var(--navy-60); }
.sync-table td { vertical-align: top; }
.sync-table .old { color: var(--navy-60); text-decoration: line-through; }
.sync-table tr.conflict td:first-child { box-shadow: inset 3px 0 0 var(--navy); }
.contact-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 0; border-top: 1px solid var(--gray-50); }
.contact-pick:first-of-type { border-top: 0; }
.contact-pick .who { flex: 1; min-width: 180px; }
.modal.wide { max-width: 860px; width: calc(100vw - 32px); max-height: calc(100vh - 48px); overflow: auto; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gray); display: inline-block; }
.dot.blue { background: var(--blue); } .dot.navy { background: var(--navy); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: var(--white); border: 1px solid var(--navy-12); border-radius: var(--radius); padding: 14px 16px; }
.kpi .k { font-size: 12px; font-weight: 600; color: var(--navy-60); text-transform: uppercase; letter-spacing: .04em; }
.kpi .v { font-size: 24px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 12px; color: var(--navy-60); margin-top: 2px; }
.kpi.hl { background: var(--navy); border-color: var(--navy); color: var(--white); }
.kpi.hl .k, .kpi.hl .s { color: rgba(255, 255, 255, .72); }

.alerts { display: flex; flex-direction: column; gap: 8px; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14px; border: 1px solid var(--gray); background: var(--white); }
.alert svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.alert.bloquant, .alert.error { background: var(--navy); color: var(--white); border-color: var(--navy); }
.alert.warn { border-color: var(--blue); background: var(--blue-06); }
.alert.info { background: var(--navy-06); border-color: transparent; color: var(--navy-80); }
.alert.ok { border-color: var(--blue); }
.verdict { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--navy-12); }
.verdict .v-l { font-size: 18px; font-weight: 700; }
.verdict > svg { width: 28px; height: 28px; flex: none; }
svg { flex: none; }
.verdict.ok { background: var(--blue); color: var(--white); border-color: var(--blue); }
.verdict.arbitrer { background: var(--blue-06); border-color: var(--blue); }
.verdict.bloquant { background: var(--navy); color: var(--white); }
.verdict.none { background: var(--gray-30); }

table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--navy-60); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--gray); }
table.t td { padding: 10px; border-bottom: 1px solid var(--gray-50); vertical-align: middle; }
table.t td.r, table.t th.r { text-align: right; }
table.t tr.total td { font-weight: 700; border-top: 2px solid var(--navy); border-bottom: 0; }
table.t .input { min-height: 36px; padding: 6px 9px; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--gray-50); color: var(--navy); }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover { background: var(--blue-06); text-decoration: none; }
.list-item .t1 { font-weight: 700; }
.list-item .t2 { font-size: 13px; color: var(--navy-60); }
.empty { text-align: center; padding: 36px 16px; color: var(--navy-60); }

.steps { display: flex; gap: 4px; border-bottom: 1px solid var(--gray-50); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.steps a { display: flex; align-items: center; gap: 8px; padding: 12px 14px; font-weight: 600; font-size: 14px; color: var(--navy-60); border-bottom: 3px solid transparent; white-space: nowrap; }
.steps a:hover { color: var(--navy); text-decoration: none; }
.steps a.active { color: var(--navy); border-bottom-color: var(--blue); }
.steps .n { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-size: 12px; background: var(--navy-06); }
.steps a.active .n { background: var(--blue); color: var(--white); }
.steps a.done .n { background: var(--navy); color: var(--white); }

.dossier-head { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.save-state { font-size: 13px; color: var(--navy-60); display: inline-flex; align-items: center; gap: 6px; }
.section-title { display: flex; align-items: baseline; gap: 10px; margin: 6px 0 14px; }
.section-title .idx { font-size: 13px; font-weight: 700; color: var(--blue); }
.sticky-bar { position: sticky; bottom: 0; background: var(--white); border-top: 1px solid var(--gray-50); padding: 12px 0; margin-top: 18px; display: flex; gap: 10px; justify-content: flex-end; z-index: 5; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, .9fr); gap: 20px; align-items: start; }
.sticky-col { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; scrollbar-width: thin; }
.filters { display: grid; gap: 12px; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto; align-items: center; }
.searchrow { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr) auto; }
.bar { height: 8px; border-radius: 999px; background: var(--gray-30); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--blue); border-radius: 999px; }
.bar.over > i { background: var(--navy); }
.split-bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--gray-30); }
.split-bar i { display: block; height: 100%; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--navy-80); margin-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.r2-section { padding: 18px 0; border-bottom: 1px solid var(--gray-50); }
.r2-section:last-child { border-bottom: 0; }
.r2-section ul { margin: 6px 0 0; padding-left: 20px; }
.r2-section li { margin: 4px 0; }
details.more summary { cursor: pointer; color: var(--blue); font-weight: 600; font-size: 14px; }
.toast-zone { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast { background: var(--navy); color: var(--white); padding: 11px 16px; border-radius: var(--radius-sm); box-shadow: var(--shadow); font-size: 14px; max-width: 380px; }
.toast.blue { background: var(--blue); }
.modal-back { position: fixed; inset: 0; background: rgba(0, 32, 72, .45); display: grid; place-items: center; z-index: 40; padding: 16px; }
.modal { background: var(--white); border-radius: 12px; max-width: 560px; width: 100%; max-height: 90vh; overflow: auto; padding: 22px; box-shadow: 0 20px 60px rgba(0, 32, 72, .3); }
.modal h2 { margin-bottom: 10px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
pre.code { background: var(--navy-06); padding: 12px; border-radius: var(--radius-sm); font-size: 12px; overflow: auto; max-height: 260px; white-space: pre-wrap; word-break: break-word; }

/* ---------- Connexion ---------- */
.login { min-height: 100%; display: grid; grid-template-columns: 1fr 1fr; }
.login .art { background: var(--navy); color: var(--white); padding: 56px; display: flex; flex-direction: column; justify-content: flex-end; }
.login .art h2 { color: var(--white); font-size: 30px; line-height: 1.2; max-width: 440px; }
.login .art p { color: rgba(255, 255, 255, .72); max-width: 420px; margin-top: 12px; }
.login .art .line { width: 56px; height: 4px; background: var(--blue); border-radius: 2px; margin-bottom: 22px; }
.login .form { display: grid; place-items: center; padding: 32px; background: var(--white); }
.login form { width: 100%; max-width: 360px; }
.login form img { height: 46px; margin-bottom: 30px; }

/* ---------- Mobile et tablette ---------- */
@media (max-width: 1080px) {
  .two-col { grid-template-columns: 1fr; }
  .sticky-col { position: static; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  body { font-size: 16px; }
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .topbar { display: flex; position: sticky; top: 0; z-index: 20; align-items: center; justify-content: space-between; gap: 10px; background: var(--white); border-bottom: 1px solid var(--gray-50); padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); }
  .topbar img { height: 28px; }
  .page { padding: 18px 16px 110px; }
  h1 { font-size: 21px; }
  .g2, .g3, .g4, .filters { grid-template-columns: 1fr; }
  .sticky-col { max-height: none; overflow: visible; }
  .card { padding: 16px; }
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--white); border-top: 1px solid var(--gray-50); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 4px 8px; font-size: 11px; font-weight: 600; color: var(--navy-60); min-height: 56px; }
  .tabbar a.active { color: var(--blue); }
  .tabbar a:hover { text-decoration: none; }
  .tabbar svg { width: 22px; height: 22px; }
  .input, .select, .textarea, .select.compact { min-height: 48px; font-size: 16px; }
  .btn { min-height: 46px; }
  .sticky-bar { bottom: calc(56px + env(safe-area-inset-bottom)); padding: 10px 0; }
  .sticky-bar .btn { flex: 1; }
  .login { grid-template-columns: 1fr; }
  .login .art { display: none; }
  .combo { grid-template-columns: 1fr 112px; }
  .kpi .v { font-size: 20px; }
  .toast-zone { left: 16px; right: 16px; bottom: 76px; }
  table.t.stackable thead { display: none; }
  table.t.stackable tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; padding: 10px 0; border-bottom: 1px solid var(--gray-50); }
  table.t.stackable td { border: 0; padding: 2px 0; }
  table.t.stackable td::before { content: attr(data-l); display: block; font-size: 11px; font-weight: 700; color: var(--navy-60); text-transform: uppercase; }
  table.t.stackable td.full { grid-column: 1 / -1; }
}
