/* AltiLead — from design/AltiLead.dc.html */
:root {
  --bg: #FAF8F8; --surface: #FFFFFF; --line: #ECE6E6; --line-strong: #DCD3D3; --hover: #F4F0F0;
  --text: #17141C; --muted: #655E6B; --brand: #3B2A6F; --accent: #5C3D99; --accent-ink: #4A2F82;
  --accent-tint: #EEE8F7; --on-accent: #FFFFFF; --warn: #FDBA31; --warn-ink: #7A5200;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131116; --surface: #1A171E; --line: #2A2530; --line-strong: #3A3341; --hover: #221E27;
    --text: #EEEAF1; --muted: #A49DAA; --brand: #D9CCF5; --accent: #B39AE8; --accent-ink: #CDBBF2;
    --accent-tint: #2B2340; --on-accent: #17112A; --warn-ink: #FDBA31;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: 'Archivo', system-ui, sans-serif; -webkit-font-smoothing: antialiased; background: var(--bg);
       color: var(--text); font-variant-numeric: tabular-nums; min-height: 100vh; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
.muted { color: var(--muted); }

/* header */
header { display: flex; align-items: center; gap: 16px; height: 52px; padding: 0 16px; border-bottom: 1px solid var(--line);
         background: var(--surface); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 16px; letter-spacing: -0.01em; color: var(--brand); }
.brand::before { content: ""; width: 9px; height: 9px; border-radius: 2px; background: #FDBA31; }
nav { display: flex; gap: 2px; height: 100%; }
nav a { display: flex; align-items: center; gap: 6px; height: 100%; padding: 0 10px; font-size: 13.5px; font-weight: 500;
        color: var(--muted); text-decoration: none; }
nav a.on { font-weight: 600; color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
nav a .count { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.last-fetch { margin-left: auto; font-size: 12px; color: var(--muted); }
.logout { border: 0; background: transparent; cursor: pointer; font-size: 12px; color: var(--muted); padding: 0; }

main { max-width: 1280px; margin: 0 auto; padding: 18px 20px 48px; display: flex; flex-direction: column; gap: 12px; }
main.narrow { max-width: 680px; gap: 28px; }

/* filters */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters input[type=search], .field { height: 32px; flex: 1 1 220px; max-width: 320px; padding: 0 10px; border: 1px solid var(--line-strong);
         border-radius: 6px; background: var(--surface); font-size: 13px; outline: none; }
select { height: 32px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); font-size: 12.5px; }
.seg { display: flex; border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; height: 32px; background: var(--surface); }
.seg label { display: flex; align-items: center; padding: 0 11px; cursor: pointer; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.seg input { display: none; }
.seg input:checked + span { font-weight: 600; color: var(--text); }
.seg label:has(input:checked) { background: var(--hover); }
.count-label { margin-left: auto; font-size: 12px; color: var(--muted); }

/* cards and list */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; min-width: 0; }
.grid { display: grid; grid-template-columns: 44px minmax(240px, 2fr) minmax(0, 1fr) 120px 128px 116px; gap: 12px;
        align-items: center; padding: 9px 16px; border-bottom: 1px solid var(--line); }
.grid.head { padding: 8px 16px; font-size: 12px; color: var(--muted); }
.row { cursor: pointer; background: var(--surface); }
.row:hover { background: var(--hover); }
.type { justify-self: start; font-size: 11px; font-weight: 600; letter-spacing: .03em; padding: 2px 6px; border: 1px solid var(--line-strong);
        border-radius: 4px; color: var(--muted); }
.objet { display: flex; align-items: center; gap: 8px; min-width: 0; }
.dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: transparent; }
.dot.new { background: var(--accent); }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.objet .text { font-size: 13.5px; }
.objet .text.new { font-weight: 600; }
/* the hovered row grows (all status buttons show): write the objet and the buyer in full */
.row:hover .ellipsis { white-space: normal; overflow: visible; }
.row:hover .objet { align-items: baseline; }
.tag { flex: none; white-space: nowrap; font-size: 11.5px; color: var(--muted); }
.who { min-width: 0; line-height: 1.3; }
.who .a { font-size: 13px; }
.who .p { font-size: 12px; color: var(--muted); }
.due { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.j { padding: 1px 6px; border-radius: 4px; font-weight: 500; }
.j.urgent { background: var(--warn); color: #1A1400; font-weight: 600; }
.due .d { font-size: 12px; color: var(--muted); }
.amount { text-align: right; font-size: 13px; }

/* status buttons */
.status { display: flex; gap: 2px; justify-content: flex-end; flex-wrap: wrap; }
.status button { display: none; align-items: center; height: 24px; padding: 0 8px; border-radius: 5px; cursor: pointer; font-size: 12px;
                 font-weight: 500; white-space: nowrap; background: transparent; color: var(--muted); border: 1px solid var(--line); }
.status.all button, .row:hover .status button, .status button.on { display: inline-flex; }
.status.big button { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 6px; }
.status button.on.s-nouveau { background: var(--accent-tint); color: var(--accent-ink); border-color: transparent; }
.status button.on.s-asuivre { background: transparent; color: var(--text); border-color: var(--line-strong); }
.status button.on.s-onrepond { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.status button.on.s-ignore { background: transparent; color: var(--muted); border-color: var(--line-strong); }
.chip { font-size: 11.5px; font-weight: 500; padding: 2px 7px; border-radius: 5px; border: 1px solid transparent; }
.chip.s-nouveau { background: var(--accent-tint); color: var(--accent-ink); }
.chip.s-asuivre { color: var(--text); border-color: var(--line-strong); }
.chip.s-onrepond { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.chip.s-ignore { color: var(--muted); border-color: var(--line-strong); }

.mobile-row { display: none; flex-direction: column; gap: 5px; padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.mobile-row .top { display: flex; gap: 8px; align-items: baseline; }
.mobile-row .top .type { font-size: 10.5px; padding: 1px 5px; flex: none; }
.mobile-row .top .dot { transform: translateY(-2px); }
.mobile-row .title { font-size: 14px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mobile-row .title.new { font-weight: 600; }
.mobile-row .sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mobile-row .line { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.mobile-row .line .est { margin-left: auto; }
.empty { padding: 22px 16px; font-size: 13px; color: var(--muted); }
.link-btn { align-self: flex-start; border: 0; background: transparent; padding: 0; cursor: pointer; font-size: 12px; color: var(--muted); }

/* fiche */
.fiche-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.back { font-size: 13px; color: var(--muted); }
.fiche-top .status { margin-left: auto; }
h1 { margin: 0; font-size: 21px; line-height: 1.3; font-weight: 600; letter-spacing: -0.01em; text-wrap: pretty; max-width: 900px; }
.fields { display: flex; flex-wrap: wrap; gap: 10px 28px; padding: 12px 0 14px; border-bottom: 1px solid var(--line); }
.fields > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.fields .k { font-size: 11.5px; color: var(--muted); }
.fields .v { display: flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 500; }
.fields .v span.u { border-radius: 3px; }
.fields .v span.u.urgent { background: var(--warn); color: #1A1400; padding: 0 5px; }
.fields .v span.u.verify { border-bottom: 1px dotted var(--warn); }
.verify-tag { font-size: 11px; font-weight: 500; color: var(--warn-ink); }
.verify-tag.line { margin-left: 8px; border-bottom: 1px dotted var(--warn); }
.sections { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; }
section.card { overflow: visible; }
.s-wide { flex: 1.7 1 520px; }
.s-side { flex: 1 1 320px; }
.s-full { flex: 1 1 100%; }
.s-stack { display: flex; flex-direction: column; gap: 14px; }
.fournir .checks { columns: 3 280px; column-gap: 0; }
.fournir .check-row { break-inside: avoid; }
.fournir .checks .g { break-after: avoid; }
.s-head { display: flex; align-items: baseline; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.s-head .n { font-size: 12px; color: var(--muted); }
h2 { margin: 0; font-size: 14.5px; font-weight: 600; }
.s-head .meta { margin-left: auto; font-size: 12px; color: var(--muted); }
.s-msg { padding: 18px 16px; font-size: 13px; color: var(--muted); }
.s-msg.scan { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; color: var(--text); }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 1.5; }
th { font-weight: 500; padding: 8px; color: var(--muted); font-size: 12px; text-align: left; }
td { padding: 10px 8px; border-top: 1px solid var(--line); vertical-align: top; }
th:first-child, td:first-child { padding-left: 16px; }
th:last-child, td:last-child { padding-right: 16px; }
.r { text-align: right; }
.min-500 { min-width: 500px; } .min-780 { min-width: 780px; } .min-920 { min-width: 920px; } .min-520 { min-width: 520px; }
td.lot { font-size: 12px; color: var(--muted); background: var(--bg); padding-top: 6px; padding-bottom: 6px; }
.totals { display: flex; flex-wrap: wrap; gap: 4px 20px; padding: 11px 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.totals strong { color: var(--text); font-weight: 600; }
.totals span span { color: var(--text); }
table.lines { border-top: 1px solid var(--line-strong); }
.cps { padding: 12px 16px 14px; border-top: 1px solid var(--line); }
.cps-head { font-size: 12.5px; font-weight: 600; margin-bottom: 8px; }
.cps-head .muted { font-weight: 400; }
.cps-list { display: flex; flex-wrap: wrap; gap: 6px; }
.cps-item { display: inline-flex; align-items: baseline; gap: 6px; padding: 3px 8px; border: 1px solid var(--line-strong); border-radius: 5px;
            font-size: 12.5px; background: var(--surface); }
.cps-item .tag { font-size: 11px; color: var(--muted); }
.cps-item.extra { border-color: var(--warn); }
.cps-item.extra .tag { color: var(--warn-ink); font-weight: 500; }
.cps-item[data-doc]:hover { background: var(--hover); }
.cps-formats { margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.cps-formats span { color: var(--text); }
.comps td.presta { min-width: 260px; max-width: 520px; }
.presta-text { max-height: 4.5em; overflow: hidden; }  /* about 3 lines, "Lire plus" shows the rest */
.presta-text.full { max-height: none; }
.presta-text span { display: block; font-size: 12px; }
.presta-text .objet { font-size: 13px; }
.presta-actions { display: flex; gap: 14px; margin-top: 4px; }
.presta-actions button { border: 0; background: transparent; padding: 0; cursor: pointer; font-size: 12px; color: var(--accent-ink); }
.presta-actions button:hover { text-decoration: underline; }
.presta-actions .more { color: var(--muted); }
.presta-actions .why { margin-left: auto; font-size: 11.5px; color: var(--muted); }
.nowrap { white-space: nowrap; }
.checks { padding: 6px 0 10px; }
.checks .g { padding: 8px 16px 2px; font-size: 12px; color: var(--muted); }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 5px 16px; cursor: pointer; font-size: 13px; line-height: 1.45;
         border: 0; background: transparent; width: 100%; text-align: left; }
.box { flex: none; width: 15px; height: 15px; margin-top: 2px; border-radius: 4px; border: 1px solid var(--line-strong);
       color: var(--on-accent); font-size: 11px; line-height: 13px; text-align: center; }
.check.done .box, .box.on { background: var(--accent); border-color: var(--accent); }
.check.done .label { color: var(--muted); text-decoration: line-through; }
.check-row { display: flex; align-items: flex-start; }
.check-row .check { flex: 1; min-width: 0; }
.src-link { flex: none; padding: 5px 16px 0 0; font-size: 11.5px; color: var(--muted); }
tr[data-doc]:hover td, .doc[data-doc]:hover { background: var(--hover); }
.doc { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 13px; }
.doc:first-of-type { border-top: 0; }
.doc .name { font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.doc .meta { font-size: 12px; color: var(--muted); }
.doc .note { font-size: 12px; font-weight: 500; color: var(--warn-ink); }
.doc a { margin-left: auto; font-size: 12.5px; }
textarea.notes { display: block; width: 100%; min-height: 96px; resize: vertical; border: 0; outline: none; background: transparent;
                 padding: 12px 16px; font-size: 13px; line-height: 1.5; }
.toast { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 20; padding: 6px 11px; border-radius: 6px;
         background: var(--text); color: var(--bg); font-size: 12px; white-space: nowrap; box-shadow: 0 4px 14px rgba(0,0,0,.18); display: none; }
.toast.on { display: block; }
[data-src] { cursor: default; }

/* prix */
.big-search { height: 38px; width: 100%; max-width: 560px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 6px;
              background: var(--surface); font-size: 14px; outline: none; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; }
.quick button { height: 26px; padding: 0 9px; border: 1px solid var(--line-strong); border-radius: 5px; background: transparent;
                cursor: pointer; font-size: 12px; color: var(--muted); }
.summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 20px; padding: 12px 16px; border-bottom: 1px solid var(--line);
           font-size: 12.5px; color: var(--muted); }
.summary h2 { color: var(--text); }
td.pu { font-weight: 600; }
.derived { font-size: 11px; color: var(--muted); font-weight: 400; }

/* réglages */
.settings-block { display: flex; flex-direction: column; gap: 10px; }
.kw { display: flex; flex-wrap: wrap; gap: 6px; }
.kw span { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 4px 0 10px; border: 1px solid var(--line-strong);
           border-radius: 6px; background: var(--surface); font-size: 13px; }
.kw button { border: 0; background: transparent; cursor: pointer; color: var(--muted); font-size: 14px; width: 20px; height: 20px; border-radius: 4px; }
.kw button:hover { background: var(--hover); }
.add { display: flex; gap: 6px; max-width: 420px; }
.add input { flex: 1; height: 32px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); font-size: 13px; outline: none; }
.btn { height: 32px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); cursor: pointer; font-size: 13px; }
.prov-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 2px 16px; }
.toggle { display: flex; align-items: center; gap: 10px; padding: 6px 0; cursor: pointer; font-size: 13.5px; border: 0; background: transparent; text-align: left; }
.people .toggle { width: 100%; padding: 10px 14px; gap: 12px; border-top: 1px solid var(--line); }
.people .toggle:first-child { border-top: 0; }
.people .email { margin-left: auto; font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.hint { font-size: 12.5px; color: var(--muted); }

/* login */
.login { max-width: 340px; margin: 12vh auto 0; padding: 24px; display: flex; flex-direction: column; gap: 12px; }
/* file preview */
dialog.preview { width: min(1100px, 100vw - 32px); height: calc(100vh - 32px); max-width: none; max-height: none; padding: 0;
                 border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); overflow: hidden; }
dialog.preview[open] { display: flex; flex-direction: column; }
dialog.preview::backdrop { background: rgba(0, 0, 0, .45); }
.pv-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.pv-title { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; font-size: 13.5px; }
.pv-title .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-title .meta { font-size: 12px; color: var(--muted); flex: none; }
.pv-btn { flex: none; height: 30px; display: flex; align-items: center; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 6px;
          background: var(--surface); font-size: 12.5px; color: var(--text); cursor: pointer; }
.pv-btn:hover { background: var(--hover); text-decoration: none; }
.pv-body { flex: 1; min-height: 0; overflow: auto; }
.pv-body.frame { overflow: hidden; }
.pv-body iframe { display: block; width: 100%; height: 100%; border: 0; background: #525659; }
.pv-pages { display: flex; flex-direction: column; gap: 8px; padding: 8px; background: #525659; }
.pv-pages img, .pv-image { display: block; width: 100%; height: auto; background: #fff; }
.pv-sheet { padding: 12px 14px 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.pv-table { width: auto; min-width: 100%; font-size: 12.5px; }
.pv-table td { padding: 4px 8px; border: 1px solid var(--line); white-space: pre-wrap; vertical-align: top; }
.pv-doc { margin: 0; padding: 14px 18px; font-size: 13px; line-height: 1.5; white-space: pre-wrap; font-family: inherit; }
.pv-doc p { margin: 0 0 8px; }
.pv-doc .pv-table { margin: 8px 0 12px; }
[data-doc], [data-listing] { cursor: pointer; }
.login input { height: 38px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); font-size: 14px; }
.login button { height: 38px; border: 0; border-radius: 6px; background: var(--accent); color: var(--on-accent); font-weight: 600; cursor: pointer; }
.login .err { font-size: 12.5px; color: var(--warn-ink); }

/* mobile */
@media (max-width: 899px) {
  main { padding: 14px 12px 40px; }
  .last-fetch { display: none; }
  .grid { display: none; }
  .mobile-row { display: flex; }
  .filters input[type=search] { max-width: 100%; }
  h1 { font-size: 18px; }
  header { gap: 8px; padding: 0 12px; }
  nav a { padding: 0 7px; }
  .s-head { flex-wrap: wrap; }
  .s-head h2 { white-space: nowrap; }
  .s-head .meta { margin-left: 0; flex-basis: 100%; overflow-wrap: anywhere; }
  dialog.preview { width: 100vw; height: 100vh; border: 0; border-radius: 0; }
}
