/* ERP proaiserve – feuille de style unique (couleurs reprises du site proaiserve.com) */
:root {
  --bg: #f4f6f9; --surface: #ffffff; --surface-2: #f8fafc; --fg: #172033; --muted: #5d6a80; --line: #dde3ec;
  --accent: #1d4ed8; --accent-hover: #1e40af; --accent-soft: #e8eefc;
  --ok: #1f8a5a; --ok-soft: #e1f4ea; --warn: #b06a10; --warn-soft: #fdf1df; --bad: #c23b3b; --bad-soft: #fbe5e5;
  --claude: #b5562f; --claude-soft: #f9e9e1;
  --c1: #1d4ed8; --c2: #1f9e8f; --c3: #d07a1f; --c4: #8a5cc7;
  --side: #14213d; --side-fg: #c9d3e6; --side-act: #ffffff;
  --f-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-head: "Space Grotesk", system-ui, sans-serif;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font-family: var(--f-body); font-size: 15px; line-height: 1.45; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--f-head); font-weight: 600; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: 28px; } h2 { font-size: 19px; } h3 { font-size: 16px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

/* Mise en page */
.app { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-fg); padding: 18px 14px; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: #fff; }
.brand img { width: 34px; height: 34px; background: #fff; border-radius: 8px; padding: 3px; }
.brand b { font-family: var(--f-head); font-size: 18px; display: block; line-height: 1.1; }
.brand small { font-size: 12px; color: var(--side-fg); }
.side h4 { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: #8693ab; margin: 16px 10px 6px; font-weight: 500; }
.side a { display: flex; align-items: center; gap: 10px; color: var(--side-fg); padding: 8px 10px; border-radius: 8px; font-size: 14.5px; }
.side a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.side a.act { background: rgba(255,255,255,.1); color: var(--side-act); font-weight: 500; }
.side a::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .55; }
.side .cpt { margin-left: auto; background: var(--accent); color: #fff; font-size: 11.5px; border-radius: 10px; padding: 1px 7px; }
.side .cpt.warn { background: var(--claude); }
.side .who { margin-top: auto; border-top: 1px solid rgba(255,255,255,.1); padding: 14px 8px 0; font-size: 13px; }
.side .who b { color: #fff; display: block; }
.main { min-width: 0; }
.top { display: flex; gap: 12px; align-items: center; padding: 12px 28px; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5; }
.top form { flex: 1; max-width: 480px; }
.top input[type=search] { width: 100%; background: var(--surface-2); }
.top .spacer { flex: 1; }
.content { padding: 26px 28px 60px; max-width: 1400px; }
.page-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; justify-content: space-between; margin-bottom: 18px; }
.page-head p { margin: 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn.burger { display: none; }
.card-head h2 a { font-size: inherit; color: inherit; }

/* Cartes et grilles */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.card + .card { margin-top: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.card-head a, .card-head span { font-size: 13px; color: var(--muted); }
.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)); }
.g-2-1 { grid-template-columns: 2fr 1fr; }
.g-1-2 { grid-template-columns: 1fr 2fr; }
.grid > .card + .card { margin-top: 0; }
.kpi .lbl { color: var(--muted); font-size: 13.5px; }
.kpi .val { font-family: var(--f-head); font-size: 30px; font-weight: 600; margin: 6px 0 4px; font-variant-numeric: tabular-nums; }
.kpi .val.bad { color: var(--bad); }
.kpi .sub { font-size: 13px; color: var(--muted); }
.kpi a { color: inherit; }
.stack > * + * { margin-top: 16px; }

/* Tableaux */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600;
  padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
.table-wrap { overflow-x: auto; }
tfoot td { font-weight: 600; }

/* Badges */
.badge { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 20px; padding: 2px 10px; white-space: nowrap;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.info { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.claude { background: var(--claude-soft); color: var(--claude); border-color: transparent; }

/* Boutons et formulaires */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--fg);
  font: 500 14px var(--f-body); padding: 8px 14px; border-radius: 8px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { color: var(--bad); border-color: var(--bad-soft); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn[disabled], .btn.disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea { font: inherit; color: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
  background: var(--surface); width: 100%; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--accent); }
textarea { min-height: 80px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 13.5px; font-weight: 500; margin-bottom: 4px; }
.field .help { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.field .err, .errorlist { color: var(--bad); font-size: 13px; margin: 3px 0 0; padding: 0; list-style: none; }
.field.check label { display: flex; gap: 8px; align-items: center; }
.form-actions { display: flex; gap: 10px; margin-top: 18px; }
.inline-form { display: inline; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters a { padding: 6px 12px; border-radius: 20px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); font-size: 13.5px; }
.filters a.act { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Messages */
.messages { list-style: none; padding: 0; margin: 0 0 16px; }
.messages li { padding: 10px 14px; border-radius: 8px; margin-bottom: 8px; background: var(--accent-soft); color: var(--accent); }
.messages li.success { background: var(--ok-soft); color: var(--ok); }
.messages li.error { background: var(--bad-soft); color: var(--bad); }
.messages li.warning { background: var(--warn-soft); color: var(--warn); }
.alert { padding: 12px 14px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); margin-bottom: 14px; }
.alert.bad { background: var(--bad-soft); color: var(--bad); }
.alert.info { background: var(--accent-soft); color: var(--accent); }

/* Barres */
.bar { height: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; min-width: 60px; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 6px; }
.bar.ok > span { background: var(--ok); } .bar.bad > span { background: var(--bad); } .bar.warn > span { background: var(--c3); }
.hbars .row { display: grid; grid-template-columns: 130px 1fr 110px; gap: 10px; align-items: center; padding: 5px 0; font-size: 14px; }
.chart { display: flex; align-items: flex-end; gap: 8px; height: 200px; padding-top: 10px; position: relative; border-bottom: 1px solid var(--line); }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.chart .col span { width: 70%; max-width: 34px; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; }
.chart .col.courant span { background: #6d9cf0; }
.chart .obj { position: absolute; left: 0; right: 0; border-top: 2px dashed var(--c3); }
.chart .obj em { position: absolute; right: 0; top: -18px; font-size: 12px; color: var(--c3); font-style: normal; }
.chart-x { display: flex; gap: 8px; font-size: 12px; color: var(--muted); }
.chart-x span { flex: 1; text-align: center; }
.stackbar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--surface-2); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }

/* Pipeline (kanban) */
.kanban { display: grid; grid-template-columns: repeat(6, minmax(200px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.kcol { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-height: 300px; }
.kcol.over { outline: 2px dashed var(--accent); }
.kcol h3 { font-size: 14px; display: flex; justify-content: space-between; }
.kcol .tot { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 8px; cursor: grab; font-size: 13.5px; }
.kcard b { display: block; }
.kcard .m { display: flex; justify-content: space-between; color: var(--muted); font-size: 12.5px; margin-top: 4px; }

/* Démarche : étapes */
.etape { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 14px 16px; display: grid;
  grid-template-columns: 36px 1fr auto; gap: 12px; align-items: start; }
.etape + .etape { margin-top: 10px; }
.etape .rond { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-weight: 600; font-size: 14px; color: var(--muted); }
.etape.validee .rond, .etape.non_souscrite .rond { background: var(--ok); border-color: var(--ok); color: #fff; }
.etape.en_cours { border: 2px solid var(--c3); }
.etape.en_cours .rond { border-color: var(--c3); color: var(--c3); }
.etape.a_revalider .rond { border-color: var(--bad); color: var(--bad); }
.etape.verrouillee { background: var(--surface-2); }
.etape.verrouillee .titre { color: var(--muted); }
.etape .titre { font-weight: 600; }
.etape .points { list-style: none; padding: 0; margin: 12px 0; }
.etape .points li { padding: 6px 0; }
.etape .points label { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.etape .points input { margin-top: 3px; width: 17px; height: 17px; }
.proj-list a { display: block; border: 1px solid transparent; border-radius: 8px; padding: 10px 12px; color: var(--fg); }
.proj-list a:hover { background: var(--surface-2); text-decoration: none; }
.proj-list a.act { border-color: var(--accent); background: var(--accent-soft); }

/* Tâches */
.tache { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tache:last-child { border-bottom: 0; }
.tache.faite .t { text-decoration: line-through; color: var(--muted); }
.tache .t { font-weight: 500; }
.tache .meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; margin-top: 2px; }
.tache button.coche { width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--line); background: var(--surface); cursor: pointer; padding: 0; }
.tache button.coche:hover { border-color: var(--ok); }
.tache.faite button.coche { background: var(--ok); border-color: var(--ok); }
.prio-1 { color: var(--bad); font-weight: 600; }

/* Lignes de devis / factures */
.lignes input, .lignes textarea, .lignes select { padding: 6px 8px; font-size: 14px; }
.lignes textarea { min-height: 38px; }
.lignes td { padding: 6px 4px; }
.lignes .del { color: var(--bad); }
.totaux { margin-left: auto; width: 340px; max-width: 100%; }
.totaux td { padding: 6px 10px; }
.totaux tr.ttc td { font-size: 17px; font-weight: 700; border-top: 2px solid var(--fg); }

/* Connexion */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: 100%; max-width: 400px; }
.login img { width: 200px; display: block; margin: 0 auto 18px; }

dl.infos { display: grid; grid-template-columns: 170px 1fr; gap: 6px 14px; margin: 0; font-size: 14px; }
dl.infos dt { color: var(--muted); }
dl.infos dd { margin: 0; white-space: pre-line; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.timeline li:last-child { border-bottom: 0; }
dialog { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; max-width: 440px; width: calc(100% - 32px); }
dialog::backdrop { background: rgba(10, 15, 25, .45); }

@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3, .g-2-1, .g-1-2 { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 20; width: 260px; left: -270px; transition: left .2s; }
  .side.open { left: 0; }
  .btn.burger { display: inline-flex; }
  .top .masquer-mobile, .top .spacer { display: none; }
  .top { padding: 10px 16px; }
  .content { padding: 18px 16px 50px; }
  .g2, .g4, .form-grid { grid-template-columns: 1fr; }
  .hbars .row { grid-template-columns: 100px 1fr 90px; }
  dl.infos { grid-template-columns: 1fr; }
  dl.infos dt { margin-top: 6px; }
}
