/* Baobab CRM : feuille de style de la demo (aucune dependance externe). */

/* ------------------------------------------------------------------ jetons */
:root {
  color-scheme: light;
  --bg: #f3f3f0;
  --surface: #fcfcfb;
  --surface-2: #f6f6f3;
  --sunken: #ecebe6;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #6b6964;
  --line: #e1e0d9;
  --border: rgba(11, 11, 11, .10);
  --border-strong: rgba(11, 11, 11, .20);
  --brand: #0e7c66;
  --brand-hover: #0b6855;
  --brand-ink: #0b6b58;
  --brand-soft: #e1f0ec;
  --on-brand: #ffffff;
  /* graphiques : serie 1 de la palette de reference (single series) */
  --series-1: #2a78d6;
  --series-track: #cde2fb;
  --axis: #c3c2b7;
  --grid: #e1e0d9;
  --tick: #898781;
  /* statuts : toujours accompagnes d'une icone et d'un libelle */
  --good: #0ca30c;
  --good-ink: #006300;
  --good-soft: #e3f4e3;
  --warn: #fab219;
  --serious: #ec835a;
  --serious-ink: #a4441c;
  --serious-soft: #fcebe3;
  --critical: #d03b3b;
  --critical-ink: #b52f2f;
  --critical-soft: #fbe6e6;
  --demo-bg: #16211d;
  --demo-ink: #dfe9e4;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 2px 8px rgba(0, 0, 0, .04);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .18);
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #222220;
    --sunken: #121211;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #a19f97;
    --line: #2c2c2a;
    --border: rgba(255, 255, 255, .10);
    --border-strong: rgba(255, 255, 255, .20);
    --brand: #12846d;
    --brand-hover: #169a80;
    --brand-ink: #5fd3b5;
    --brand-soft: rgba(95, 211, 181, .12);
    --series-1: #3987e5;
    --series-track: #184f95;
    --axis: #383835;
    --grid: #2c2c2a;
    --tick: #898781;
    --good-ink: #2fbf2f;
    --good-soft: rgba(12, 163, 12, .16);
    --serious-ink: #f09a77;
    --serious-soft: rgba(236, 131, 90, .14);
    --critical-ink: #f07a7a;
    --critical-soft: rgba(208, 59, 59, .18);
    --demo-bg: #0a1310;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, .6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #222220;
  --sunken: #121211;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --muted: #a19f97;
  --line: #2c2c2a;
  --border: rgba(255, 255, 255, .10);
  --border-strong: rgba(255, 255, 255, .20);
  --brand: #12846d;
  --brand-hover: #169a80;
  --brand-ink: #5fd3b5;
  --brand-soft: rgba(95, 211, 181, .12);
  --series-1: #3987e5;
  --series-track: #184f95;
  --axis: #383835;
  --grid: #2c2c2a;
  --tick: #898781;
  --good-ink: #2fbf2f;
  --good-soft: rgba(12, 163, 12, .16);
  --serious-ink: #f09a77;
  --serious-soft: rgba(236, 131, 90, .14);
  --critical-ink: #f07a7a;
  --critical-soft: rgba(208, 59, 59, .18);
  --demo-bg: #0a1310;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .6);
}

/* ------------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 14px/1.45 var(--font);
  color: var(--ink);
  background: var(--bg);
  overflow-x: hidden;
}
h1, h2, h3, p { margin: 0; }
a { color: var(--brand-ink); }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.ic {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------------- bandeau demo */
.demo-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 20px;
  background: var(--demo-bg); color: var(--demo-ink);
  font-size: 13px;
}
.demo-text { display: flex; gap: 10px; align-items: baseline; min-width: 0; }
.demo-text strong {
  flex: none; color: #fff;
  font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 8px; border: 1px solid rgba(255, 255, 255, .3); border-radius: 999px;
}
.demo-detail { opacity: .85; }
.demo-actions { display: flex; gap: 8px; flex: none; }
.demo-btn, .demo-cta {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 6px; font-size: 13px; white-space: nowrap;
  text-decoration: none; cursor: pointer;
}
.demo-btn { background: transparent; border: 1px solid rgba(255, 255, 255, .25); color: var(--demo-ink); }
.demo-btn:hover { background: rgba(255, 255, 255, .08); }
.demo-cta { background: #fff; color: #10201a; border: 1px solid #fff; font-weight: 600; }
.demo-cta:hover { background: #e6f2ee; }
.demo-bar .ic { width: 15px; height: 15px; }

/* ------------------------------------------------------------- squelette */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; align-self: flex-start;
  width: 236px; flex: none; height: 100vh;
  display: flex; flex-direction: column; gap: 20px;
  padding: 18px 14px;
  background: var(--surface); border-right: 1px solid var(--line);
}
/* Prolonge le fond de la barre laterale (sticky, haute de 100vh) sur toute la page. */
@media (min-width: 861px) {
  .app { background: linear-gradient(90deg, var(--surface) 0 235px, var(--line) 235px 236px, transparent 236px); }
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px; text-decoration: none; color: var(--ink); }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
  background: var(--brand); color: var(--on-brand);
}
.brand-mark svg { width: 24px; height: 24px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 15px; }
.brand-text small { color: var(--muted); font-size: 12px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  color: var(--ink-2); text-decoration: none; font-weight: 500;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand-ink); }
.nav-badge {
  margin-left: auto; min-width: 20px; padding: 1px 6px; border-radius: 999px;
  background: var(--critical); color: #fff; font-size: 11px; font-weight: 600; text-align: center;
}

.me {
  margin-top: auto; display: flex; align-items: center; gap: 10px;
  padding: 10px 8px 0; border-top: 1px solid var(--border);
}
.me-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.me-text small { color: var(--muted); font-size: 12px; }

.avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 24px; height: 24px; border-radius: 50%;
  font-size: 10px; font-weight: 700; letter-spacing: .02em;
  background: var(--sunken); color: var(--ink-2);
  border: 1px solid var(--border);
}
.avatar-lg { width: 34px; height: 34px; font-size: 12px; }
.avatar[data-user="as"] { background: #dbe9f8; color: #1c4f8c; }
.avatar[data-user="bd"] { background: #f5e3d3; color: #7a3f12; }
.avatar[data-user="cl"] { background: #e6e1f5; color: #4a3aa7; }
:root[data-theme="dark"] .avatar[data-user] { background: var(--surface-2); color: var(--ink); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .avatar[data-user] { background: var(--surface-2); color: var(--ink); }
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 28px 6px;
}
.topbar h1 { font-size: 22px; font-weight: 650; letter-spacing: -.01em; }
.topbar-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex: none; }
#content { padding: 14px 28px 28px; flex: 1; }
.foot { padding: 14px 28px 24px; color: var(--muted); font-size: 12px; }

/* --------------------------------------------------------------- boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 8px;
  border: 1px solid transparent; cursor: pointer; font-weight: 600; white-space: nowrap;
}
.btn .ic { width: 16px; height: 16px; }
.btn-primary { background: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-hover); }
.btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--ink); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-good { background: var(--good-soft); color: var(--good-ink); border-color: transparent; }
.btn-bad { background: var(--critical-soft); color: var(--critical-ink); border-color: transparent; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px;
  border-radius: 8px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.link { font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.link:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- filtres */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.filters-hint { color: var(--muted); font-size: 13px; }
.search {
  display: flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 10px; min-width: 280px;
  border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface);
  color: var(--muted);
}
.search:focus-within { border-color: var(--brand); }
.search .ic { width: 16px; height: 16px; }
.search input { border: 0; outline: 0; background: transparent; flex: 1; min-width: 0; color: var(--ink); }
select {
  height: 36px; padding: 0 32px 0 10px; border-radius: 8px;
  border: 1px solid var(--border-strong); background-color: var(--surface);
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23898781' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 14px;
  cursor: pointer;
}
.segmented {
  display: inline-flex; padding: 3px; gap: 2px; border-radius: 9px;
  background: var(--sunken); border: 1px solid var(--border);
}
.segmented button {
  border: 0; background: transparent; padding: 6px 12px; border-radius: 7px;
  color: var(--ink-2); font-weight: 500; cursor: pointer; white-space: nowrap;
}
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.segmented .count { color: var(--muted); font-variant-numeric: tabular-nums; margin-left: 2px; }
.segmented button[data-tab="retard"] .count.has { color: var(--critical-ink); font-weight: 700; }

/* ----------------------------------------------------- tuiles et panneaux */
.tiles { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.tile, .panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.tile { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.tile-label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.tile-value { font-size: 26px; font-weight: 650; letter-spacing: -.015em; line-height: 1.15; }
.tile-value.hero { font-size: 34px; }
.tile-value small { font-size: 14px; font-weight: 500; color: var(--ink-2); margin-left: 4px; }
.tile-foot { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.tile-foot .ic { width: 15px; height: 15px; }
.tile-foot.is-bad { color: var(--critical-ink); }
.tile-foot.is-good { color: var(--good-ink); }
.meter { height: 6px; border-radius: 999px; background: var(--series-track); overflow: hidden; margin-top: 2px; }
.meter span { display: block; height: 100%; border-radius: 999px; background: var(--series-1); width: 0; transition: width .4s ease; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.panel { padding: 16px 18px; min-width: 0; }
.panel-flush { padding: 0; overflow: hidden; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.panel-head h2 { font-size: 15px; font-weight: 650; }
.panel-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* -------------------------------------------------------------- graphiques */
.chart { position: relative; min-height: 220px; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .ref-line { stroke: var(--ink-2); stroke-width: 1; opacity: .55; shape-rendering: crispEdges; }
.chart .tick { fill: var(--tick); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .cat { fill: var(--ink-2); font-size: 12px; }
.chart .val { fill: var(--ink); font-size: 12px; font-weight: 600; }
.chart tspan.tick { font-weight: 400; }
.chart .ref-label { fill: var(--ink-2); font-size: 11px; }
.chart .bar { fill: var(--series-1); transition: opacity .15s; }
.chart .hit { fill: transparent; cursor: default; outline: none; }
.chart .mark:hover .bar, .chart .mark:focus-within .bar, .chart .mark.is-active .bar { opacity: .78; }
.chart .mark .hit:focus-visible { stroke: var(--brand); stroke-width: 2; }

.data-table { margin-top: 8px; font-size: 13px; }
.data-table summary { cursor: pointer; color: var(--muted); font-size: 12.5px; width: max-content; }
.data-table table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.data-table th, .data-table td { padding: 5px 4px; border-bottom: 1px solid var(--line); text-align: left; }
.data-table th { font-weight: 600; color: var(--ink-2); }
.data-table .num { text-align: right; }

.tooltip {
  position: fixed; z-index: 60; pointer-events: none;
  min-width: 140px; padding: 8px 10px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg);
  font-size: 12.5px;
}
.tooltip .tt-value { font-size: 15px; font-weight: 700; display: block; }
.tooltip .tt-label { color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.tooltip .tt-key { width: 12px; height: 2px; background: var(--series-1); border-radius: 1px; }
.tooltip .tt-extra { color: var(--muted); display: block; margin-top: 2px; }

/* ------------------------------------------------------- listes (accueil) */
.task-list, .deal-list { list-style: none; margin: 0; padding: 0; }
.task {
  display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: 10px;
  padding: 9px 2px; border-top: 1px solid var(--line);
}
.task:first-child { border-top: 0; }
.task input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; margin: 0; }
.task-type {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--border);
}
.task-type .ic { width: 16px; height: 16px; }
.task-main { min-width: 0; }
.task-title { font-weight: 550; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-meta { color: var(--muted); font-size: 12.5px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-meta button { all: unset; cursor: pointer; color: var(--brand-ink); }
.task-meta button:hover { text-decoration: underline; }
.task-side { display: flex; align-items: center; gap: 8px; }
.task.is-done .task-title { text-decoration: line-through; color: var(--muted); }
.due { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.due .ic { width: 14px; height: 14px; }
.due.is-late { color: var(--critical-ink); font-weight: 600; }

.deal-list li + li { border-top: 1px solid var(--line); }
.deal-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center;
  width: 100%; padding: 9px 6px; border: 0; border-radius: 6px;
  background: none; color: inherit; text-align: left; cursor: pointer;
}
.deal-row:hover { background: var(--surface-2); }
.deal-row .t { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deal-row .s { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deal-row .a { font-weight: 650; justify-self: end; font-variant-numeric: tabular-nums; }
.deal-row .p { font-size: 12.5px; color: var(--ink-2); justify-self: end; }

/* --------------------------------------------------------------- pipeline */
.board {
  display: grid; grid-template-columns: repeat(4, minmax(180px, 1fr)) minmax(180px, .9fr);
  gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start;
  scroll-snap-type: x proximity;
}
.col {
  display: flex; flex-direction: column; min-height: 420px;
  background: var(--sunken); border: 1px solid var(--border); border-radius: var(--radius);
  scroll-snap-align: start;
}
.col-stack { display: flex; flex-direction: column; gap: 12px; min-width: 0; scroll-snap-align: start; }
.col-closed { min-height: 0; }
.col-closed .col-body { min-height: 64px; }
.col-head { padding: 10px 12px 8px; border-bottom: 1px solid var(--border); }
.col-title { display: flex; align-items: center; gap: 6px; font-weight: 650; font-size: 13.5px; }
.col-title .ic { width: 16px; height: 16px; }
.col-title .is-good { color: var(--good-ink); }
.col-title .is-bad { color: var(--critical-ink); }
.col-count {
  margin-left: auto; font-size: 12px; font-weight: 600; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 0 7px;
}
.col-total { font-size: 12.5px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.col-body { padding: 8px; display: flex; flex-direction: column; gap: 8px; flex: 1; border-radius: 0 0 var(--radius) var(--radius); transition: background .12s; }
.col.is-over .col-body { background: var(--brand-soft); outline: 2px dashed var(--brand); outline-offset: -4px; }
.col-empty { color: var(--muted); font-size: 12.5px; text-align: center; padding: 18px 6px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 11px; box-shadow: var(--shadow); cursor: grab;
  display: flex; flex-direction: column; gap: 4px;
}
.card:hover { border-color: var(--border-strong); }
.card.is-dragging { opacity: .45; }
.card-title { font-weight: 600; line-height: 1.3; }
.card-co { color: var(--ink-2); font-size: 12.5px; }
.card-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; margin-top: 4px; }
.card-amt { font-weight: 650; font-variant-numeric: tabular-nums; margin-right: auto; white-space: nowrap; }
.card .due, .card .status-pill { white-space: nowrap; }
.card-reason { font-size: 12px; color: var(--muted); }
.card-compact { padding: 8px 10px; gap: 2px; }
.card-compact .card-title, .card-compact .card-co { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-compact .card-foot { flex-wrap: nowrap; margin-top: 2px; }
.card-meta { font-size: 12px; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- clients */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-2);
  text-transform: uppercase; letter-spacing: .04em;
  padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover td { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .co-name { font-weight: 600; display: block; }
.table .sub { color: var(--muted); font-size: 12.5px; display: block; }
.table .num { text-align: right; }
.tag {
  display: inline-block; font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 5px;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--border);
}
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* ------------------------------------------------------------ fiche laterale */
dialog { color: var(--ink); }
.sheet {
  margin: 0 0 0 auto; height: 100%; max-height: 100%; width: min(520px, 100vw); max-width: 100vw;
  padding: 0; border: 0; border-left: 1px solid var(--border);
  background: var(--surface); box-shadow: var(--shadow-lg);
}
.sheet[open] { animation: slide-in .2s ease-out; }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet::backdrop, .modal::backdrop { background: rgba(10, 12, 11, .45); }
.sheet-inner { display: flex; flex-direction: column; min-height: 100%; }
.sheet-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--border); display: flex; gap: 12px; align-items: flex-start; }
.sheet-head h2 { font-size: 18px; font-weight: 650; line-height: 1.3; }
.sheet-head .sub { color: var(--ink-2); margin-top: 2px; }
.sheet-head .icon-btn { margin-left: auto; flex: none; }
.sheet-section { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.sheet-section h3 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 10px; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin: 0; }
.facts div { min-width: 0; }
.facts dt { font-size: 12px; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-weight: 550; overflow-wrap: anywhere; }
.facts .big { font-size: 20px; font-weight: 700; }
.stage-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.stage-picker button {
  border: 1px solid var(--border-strong); background: var(--surface); border-radius: 999px;
  padding: 4px 11px; font-size: 13px; cursor: pointer; color: var(--ink-2);
}
.stage-picker button:hover { border-color: var(--brand); color: var(--ink); }
.stage-picker button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); font-weight: 600; }
.close-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: center; }
.close-actions select { height: 30px; font-size: 13px; }
.status-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; }
.status-pill .ic { width: 14px; height: 14px; }
.status-pill.is-good { background: var(--good-soft); color: var(--good-ink); }
.status-pill.is-bad { background: var(--critical-soft); color: var(--critical-ink); }
.contact-card { display: flex; align-items: center; gap: 12px; }
.contact-card .avatar { width: 40px; height: 40px; font-size: 13px; }
.contact-card .who { flex: 1; min-width: 0; }
.contact-card .who strong { display: block; }
.contact-card .who span { color: var(--muted); font-size: 12.5px; }
.contact-card .icon-btn[disabled] { opacity: .5; cursor: not-allowed; }

.note-form { display: flex; gap: 8px; margin-bottom: 14px; }
.note-form input {
  flex: 1; min-width: 0; height: 36px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface);
}
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 13px; top: 6px; bottom: 6px; width: 1px; background: var(--line); }
.tl { display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 6px 0; position: relative; }
.tl-icon {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border-strong); color: var(--ink-2);
}
.tl-icon .ic { width: 14px; height: 14px; }
.tl-text { padding-top: 4px; }
.tl-meta { color: var(--muted); font-size: 12px; margin-top: 1px; }
.sheet-list { list-style: none; margin: 0; padding: 0; }

/* ------------------------------------------------------------------ modales */
.modal {
  width: min(540px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--border);
  border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-lg);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 6px; }
.modal-head h2 { font-size: 17px; font-weight: 650; }
.modal-body { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; padding: 12px 20px 4px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field input, .field select {
  height: 38px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--border-strong); background-color: var(--surface); width: 100%;
}
.field select { padding-right: 32px; }
.field input:focus, .field select:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: transparent; }
.form-error { grid-column: 1 / -1; color: var(--critical-ink); font-size: 13px; font-weight: 550; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 20px 18px; }

/* ------------------------------------------------------------------- toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 70; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast {
  display: flex; align-items: center; gap: 8px;
  background: var(--ink); color: var(--surface); padding: 10px 14px; border-radius: 9px;
  box-shadow: var(--shadow-lg); font-size: 13.5px; font-weight: 500; max-width: 360px;
  animation: toast-in .2s ease-out;
}
.toast .ic { width: 16px; height: 16px; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ------------------------------------------------------- barre mobile */
.tabbar { display: none; }

/* ------------------------------------------------------------- responsive */
@media (max-width: 1180px) {
  .tiles { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 980px) {
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar { display: none; }
  .app { min-height: auto; }
  .topbar { padding: 14px 16px 4px; }
  .topbar h1 { font-size: 19px; }
  #content { padding: 12px 16px 16px; }
  .foot { padding: 4px 16px 92px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(4, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: var(--surface); border-top: 1px solid var(--border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a {
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 4px 0; font-size: 11px; font-weight: 500; color: var(--muted); text-decoration: none;
  }
  .tabbar a[aria-current="page"] { color: var(--brand-ink); }
  .tabbar .ic { width: 22px; height: 22px; }
  .tabbar .nav-badge { position: absolute; top: 0; left: 50%; margin: 0 0 0 6px; }
  .demo-bar { padding: 8px 16px; flex-wrap: wrap; }
  .demo-detail { display: none; }
  .board { grid-template-columns: repeat(5, 80vw); scroll-snap-type: x mandatory; }
  .search { min-width: 0; flex: 1 1 100%; }
  .filters-hint { display: none; }
  .toasts { left: 16px; right: 16px; bottom: 84px; align-items: stretch; }
  .toast { max-width: none; }
}
@media (max-width: 720px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; }
  .table tr { padding: 10px 14px; border-bottom: 1px solid var(--line); }
  .table tbody tr:last-child { border-bottom: 0; }
  .table td { padding: 2px 0; border: 0; text-align: left; }
  .table td.num { text-align: left; }
  .table td[data-label]::before { content: attr(data-label) " : "; color: var(--muted); font-size: 12.5px; }
  .table td.is-empty { display: none; }
  .table td:first-child { margin-bottom: 4px; }
  .table .co-name { display: inline; margin-right: 6px; }
  .table .sub { display: inline; }
  .table .sub::before { content: " · "; }
  .table tbody tr:hover td { background: transparent; }
}
@media (max-width: 560px) {
  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile-hero, .tile:last-child { grid-column: 1 / -1; }
  .tile { padding: 14px; }
  .tile-value { font-size: 22px; }
  .tile-value.hero { font-size: 30px; }
  .topbar-actions .btn span { display: none; }
  .topbar-actions .btn { width: 36px; padding: 0; }
  .demo-actions { width: 100%; }
  .demo-cta { flex: 1; justify-content: center; }
  .modal-body { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr 1fr; }
  .segmented { width: 100%; overflow-x: auto; }
  .task { grid-template-columns: auto auto 1fr; }
  .task-side { grid-column: 3; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
