/* Prospector V2 — CSS consolidé */

:root {
  --bg: #f3f6fb;
  --panel: #ffffff;
  --panel-2: #fbfdff;
  --text: #101828;
  --muted: #667085;
  --muted-2: #8a95a6;
  --border: #dfe6f0;
  --border-strong: #cdd7e5;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eaf2ff;
  --focus: rgba(37,99,235,.22);
  --success: #16a34a;
  --success-soft: #e7f8ed;
  --warning: #f59e0b;
  --warning-soft: #fff4de;
  --danger: #ef4444;
  --danger-soft: #feecec;
  --orange: #f97316;
  --orange-soft: #ffedd5;
  --yellow: #eab308;
  --yellow-soft: #fef9c3;
  --red: #ef4444;
  --red-soft: #fee2e2;
  --violet: #7c3aed;
  --violet-soft: #f1edff;
  --cyan: #0891b2;
  --shadow: 0 18px 45px rgba(16,24,40,.055);
  --shadow-soft: 0 8px 22px rgba(16,24,40,.045);
  --radius: 22px;
  --radius-sm: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: linear-gradient(180deg, #f7f9fd 0%, #eef3fa 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  letter-spacing: -.005em;
}
a { color: inherit; text-decoration: none; }

/* ─── Sidebar ───────────────────────────────────────────────────────────── */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 260px;
  background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
  color: #dbe4f3;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  font-size: 18px;
  font-weight: 850;
  padding: 2px 4px;
  min-height: 48px;
}
.logo span, .brand-mark {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 13px;
  background: linear-gradient(135deg, #3b82f6, #0ea5e9);
  color: #fff;
  font-weight: 800;
  flex-shrink: 0;
}

.sidebar nav, .sidebar-bottom { display: flex; flex-direction: column; gap: 5px; }

.sidebar nav a, .sidebar-bottom a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 13px;
  border-radius: 14px;
  color: #cbd5e1;
  font-size: 14px;
  min-height: 42px;
  transition: background .15s, color .15s, transform .15s;
}
.sidebar nav a:hover, .sidebar nav a.active, .sidebar-bottom a:hover {
  background: rgba(59,130,246,.14);
  color: #fff;
  transform: translateX(1px);
}

/* Nav badges */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}
.nav-badge--urgent { background: #ef4444; color: #fff; }
.nav-badge--info   { background: rgba(59,130,246,.3); color: #93c5fd; }

.sidebar-bottom { margin-top: auto; }
.sidebar-bottom small { display: block; color: #94a3b8; padding: 10px 13px; font-size: 12px; }

/* ─── Main layout ───────────────────────────────────────────────────────── */

.main { margin-left: 260px; padding: 38px 44px 44px; max-width: 1660px; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 30px;
}
.topbar h1 { margin: 0; font-size: 32px; font-weight: 850; letter-spacing: -.045em; line-height: 1.08; }
.topbar p  { margin: 7px 0 0; color: var(--muted); font-size: 14px; }
.actions   { display: flex; gap: 10px; align-items: center; }

.main > section, .main > form, .main > .grid, .main > .pipeline-grid { margin-bottom: 34px; }
.main > section:last-child, .main > form:last-child { margin-bottom: 0; }

/* ─── Buttons ───────────────────────────────────────────────────────────── */

.btn, button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 16px;
  border: 0.5px solid #d9e2ef;
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  transition: transform .15s, box-shadow .15s, background .15s;
  box-shadow: 0 1px 0 rgba(16,24,40,.04);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(16,24,40,.09); }
.btn.primary   { background: linear-gradient(135deg,#2563eb,#1d4ed8); border-color: #1d4ed8; color: #fff; }
.btn.secondary { background: #edf4ff; border-color: #cfe0ff; color: #174ea6; }
.btn.ghost     { background: transparent; box-shadow: none; }
.btn.danger    { background: var(--danger-soft); color: #991b1b; border-color: #fca5a5; }
.btn.danger-confirm { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.small     { min-height: 34px; padding: 7px 11px; border-radius: 11px; font-size: 13px; }
.btn.tiny      { min-height: 28px; padding: 4px 8px; border-radius: 9px; font-size: 12px; }
.btn.full      { width: 100%; }

/* ─── Alerts ────────────────────────────────────────────────────────────── */

.alert {
  padding: 12px 14px;
  border-radius: 14px;
  margin: 0 0 16px;
  background: var(--success-soft);
  border: 1px solid #c7edd8;
  color: #14532d;
}
.alert.danger  { background: var(--danger-soft); border-color: #fecaca; color: #991b1b; }
.alert.warning { background: var(--warning-soft); border-color: #fcd34d; color: #92400e; }

/* ─── Cards / Grid ──────────────────────────────────────────────────────── */

.card, .metric, .hero-card, .pipe-col {
  background: rgba(255,255,255,.94);
  border: 1px solid rgba(210,219,231,.86);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card, .hero-card { padding: 28px; }
.metric            { padding: 22px 24px; }

.card h2, .hero-card h2 { margin: 0 0 18px; font-size: 20px; font-weight: 820; letter-spacing: -.025em; line-height: 1.2; }
.card h3 { margin: 26px 0 12px; font-size: 15px; font-weight: 800; color: #263446; }

.grid          { display: grid; gap: 28px; }
.grid.two      { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three    { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four, .cards-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ─── Metric cards ──────────────────────────────────────────────────────── */

.metric span   { display: block; color: var(--muted); font-size: 13px; }
.metric strong { display: block; margin-top: 5px; font-size: 27px; letter-spacing: -.04em; }
.metric small  { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }

.dashboard-metrics .metric { position: relative; overflow: hidden; }
.dashboard-metrics .metric:before { content: ""; position: absolute; inset: 0 auto 0 0; width: 6px; }
.metric.accent-blue   { background: linear-gradient(135deg,#fff,#eff6ff); }
.metric.accent-blue:before   { background: var(--primary); }
.metric.accent-orange { background: linear-gradient(135deg,#fff,#fff7ed); }
.metric.accent-orange:before { background: var(--orange); }
.metric.accent-yellow { background: linear-gradient(135deg,#fff,#fefce8); }
.metric.accent-yellow:before { background: var(--yellow); }
.metric.accent-red    { background: linear-gradient(135deg,#fff,#fff1f2); }
.metric.accent-red:before    { background: var(--red); }

/* ─── Hero card ─────────────────────────────────────────────────────────── */

.hero-card { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.hero-card p { margin: 2px 0 10px; color: var(--muted); }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.hero-actions .action-separator { width: 1px; height: 24px; background: var(--border); margin: 0 4px; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; }

/* ─── Status confirm inline ─────────────────────────────────────────────── */

.confirm-inline {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  font-size: 13px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.confirm-inline.show { display: flex; }

/* ─── Badges ────────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
  background: #eef2f7;
  color: #334155;
}
.badge.success { background: #dcfce7; color: #166534; }
.badge.warning { background: #fef3c7; color: #92400e; }
.badge.danger  { background: #fee2e2; color: #991b1b; }
.badge.neutral { background: #eef2f7; color: #334155; }

/* ─── Tables ────────────────────────────────────────────────────────────── */

.table-wrap { border: 1px solid #e6edf5; border-radius: 18px; overflow: auto; background: #fff; }

table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { text-align: left; border-bottom: 1px solid var(--border); padding: 15px 14px; vertical-align: top; }
th { color: #667085; font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .065em; }
td { color: #263446; }
tr:last-child td { border-bottom: 0; }
tfoot th { font-size: 14px; color: var(--text); text-transform: none; letter-spacing: 0; }
table tbody tr:hover td { background: #fbfdff; }

/* Priority dot in table */
.priority-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-right: 7px;
  margin-top: 5px;
}
.dot-red    { background: #ef4444; }
.dot-orange { background: #f97316; }
.dot-gray   { background: #94a3b8; }

.company-cell { display: flex; align-items: flex-start; gap: 2px; }

/* Overdue row */
.row-overdue td { background: #fff9f9 !important; }
.overdue-date   { color: #dc2626 !important; font-weight: 600; }

/* Count badge */
.count-limit-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding: 3px 8px;
  background: #fef3c7;
  border-radius: 999px;
  margin-left: 8px;
}

.prospects-legend { font-size: 12px; color: var(--muted); margin-top: 12px; display: flex; align-items: center; gap: 4px; }
.prospects-legend .priority-dot { margin: 0 4px 0 8px; }

/* ─── Section helpers ───────────────────────────────────────────────────── */

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.section-note { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.strong       { font-weight: 800; color: #0f172a; }
.strong small, td small, .line small, .todo small, .pipe-card span {
  display: block; color: var(--muted); font-size: 12px; margin-top: 3px;
}

/* ─── Forms ─────────────────────────────────────────────────────────────── */

label {
  display: block;
  margin-bottom: 18px;
  font-size: 12px;
  font-weight: 820;
  color: #344054;
  letter-spacing: -.005em;
}
input, select, textarea {
  width: 100%;
  min-height: 44px;
  margin-top: 7px;
  border: 1px solid var(--border-strong);
  border-radius: 15px;
  background: linear-gradient(180deg,#fff 0%,#fbfdff 100%);
  color: #101828;
  padding: 11px 14px;
  font: inherit;
  font-size: 14px;
  box-shadow: 0 1px 1px rgba(16,24,40,.025);
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 112px; line-height: 1.45; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--focus);
}
input::placeholder, textarea::placeholder { color: #9aa5b5; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M5 7.5L10 12.5L15 7.5' stroke='%23667085' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: calc(100% - 13px) center;
  background-size: 18px;
  padding-right: 42px;
}
input[type="date"], input[type="number"] { font-variant-numeric: tabular-nums; }
input[type="file"] { min-height: 48px; padding: 9px 12px; }

.inline, .check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-weight: 600;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid #e4e9f1;
  background: #fff;
  color: #344054;
}
.inline:hover, .check:hover { border-color: #c8d6e8; background: #f8fbff; }
.inline input, .check input { width: auto; min-height: 0; margin: 0; box-shadow: none; accent-color: var(--primary); }
.check-grid { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.danger-check { background: #fff8f8; border-color: #ffd0d0; color: #9f1d1d; }

.compact-form { display: grid; gap: 10px; }

.sticky-save {
  position: sticky;
  bottom: 18px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  background: rgba(245,248,252,.88);
  backdrop-filter: blur(16px);
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  margin-top: 6px;
}

.filters { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.filters input, .filters select { min-width: 190px; }

/* ─── Form sections ─────────────────────────────────────────────────────── */

.form, .ux-form { display: block; max-width: 1280px; }
.ux-form > section, .ux-form > details, .form > section, .form > details { margin: 0 0 36px !important; }

.form-card { padding: 30px 32px; overflow: hidden; }
.form-section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
  padding-bottom: 18px;
  margin-bottom: 24px;
  border-bottom: 1px solid #edf1f7;
}
.form-section-title h2 { margin: 0; font-size: 22px; font-weight: 860; letter-spacing: -.035em; line-height: 1.15; }

.section-chip {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--primary-soft);
  border: 1px solid #cfe0ff;
  color: #174ea6;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}
.section-chip.warning { background: var(--warning-soft); border-color: #ffd28a; color: #9a5b00; }

.essential-card { border-color: #cfe0ff; }
.action-focus { border-color: #ffd28a; background: linear-gradient(180deg,#fff 0%,#fff9ed 100%); }
.gonogo-card  { border-color: #d9d2ff; background: linear-gradient(180deg,#fff 0%,#fbf9ff 100%); }

.sub-panel { margin-top: 24px; padding: 18px 20px; border-radius: 18px; border: 1px solid #e2e8f0; background: #f8fbff; }
.sub-panel h3 { margin: 0 0 12px; font-size: 15px; }

.field-label { display: block; margin-bottom: 10px; font-size: 12px; font-weight: 850; color: #344054; }

.collapsible { padding: 0 !important; overflow: hidden; }
.collapsible summary {
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 24px 30px;
  cursor: pointer;
  font-weight: 900;
  background: linear-gradient(180deg,#fff 0%,#fbfdff 100%);
  border-radius: inherit;
}
.collapsible summary::-webkit-details-marker { display: none; }
.collapsible summary span { font-size: 19px; font-weight: 860; letter-spacing: -.025em; }
.collapsible summary small { display: block; color: var(--muted); font-weight: 600; font-size: 13px; margin-top: 5px; }
.collapsible summary:after { content: "+"; font-size: 22px; color: var(--primary); }
.collapsible[open] summary { border-bottom: 1px solid #edf1f7; }
.collapsible[open] summary:after { content: "–"; }
.collapsible > div, .collapsible > label, .collapsible > .check-grid { margin-left: 30px !important; margin-right: 30px !important; }
.collapsible > div:first-of-type { margin-top: 26px !important; }
.collapsible > :last-child { margin-bottom: 30px !important; }

/* ─── Segmented controls ────────────────────────────────────────────────── */

.segmented { display: grid !important; grid-template-columns: repeat(auto-fit,minmax(92px,1fr)); gap: 9px !important; }
.segmented.wide-seg { grid-template-columns: repeat(auto-fit,minmax(138px,1fr)); }
.segmented label { display: flex !important; min-width: 0; margin: 0 !important; padding: 0 !important; }
.segmented input[type="radio"] { position: absolute !important; opacity: 0 !important; pointer-events: none !important; width: 1px !important; height: 1px !important; clip-path: inset(50%) !important; }
.segmented span {
  width: 100%;
  min-height: 42px;
  display: flex !important;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border: 1px solid #d8e2ef;
  border-radius: 15px;
  background: #fff;
  color: #344054;
  font-size: 13px;
  font-weight: 850;
  text-align: center;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .15s;
}
.segmented span:hover { border-color: #b8c7dc; background: #f8fbff; transform: translateY(-1px); }
.segmented input[type="radio"]:checked + span {
  background: linear-gradient(135deg,#2563eb,#1d4ed8);
  border-color: #1d4ed8;
  color: #fff;
  box-shadow: 0 10px 22px rgba(37,99,235,.20);
}
.segmented.priority-seg label:nth-child(3) input:checked + span { background: linear-gradient(135deg,#f59e0b,#f97316); border-color: #f97316; }
.segmented.priority-seg label:nth-child(4) input:checked + span { background: linear-gradient(135deg,#ef4444,#dc2626); border-color: #dc2626; }
.segmented input[type="radio"]:focus-visible + span { box-shadow: 0 0 0 4px var(--focus); }

/* ─── Rating fields ─────────────────────────────────────────────────────── */

.rating-field { display: grid !important; grid-template-columns: repeat(6,1fr); gap: 7px; }
.rating-field label { display: flex !important; margin: 0 !important; }
.rating-field input[type="radio"] { position: absolute !important; opacity: 0 !important; pointer-events: none !important; width: 1px !important; height: 1px !important; clip-path: inset(50%) !important; }
.rating-field span { width: 100%; height: 36px; display: grid; place-items: center; border: 1px solid #d8e2ef; border-radius: 12px; background: #fff; font-weight: 900; cursor: pointer; transition: .15s; }
.rating-field input:checked + span { background: linear-gradient(135deg,#7c3aed,#5b21b6); border-color: #6d28d9; color: #fff; box-shadow: 0 9px 18px rgba(124,58,237,.18); }

.criteria-group { margin-top: 28px; padding: 22px; border-radius: 20px; border: 1px solid #e4e9f1; background: #fff; }
.criteria-group h3 { margin: 0 0 18px; font-size: 16px; font-weight: 860; }
.rating-row { display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 1px solid #e4e9f1; border-radius: 18px; background: linear-gradient(180deg,#fff,#fbfdff); }
.rating-row strong { font-size: 14px; line-height: 1.25; }
.rating-row small  { color: var(--muted); font-size: 12px; }

.score-badge { min-width: 150px; padding: 13px 16px; border-radius: 18px; background: #fff; border: 1px solid #d9d2ff; box-shadow: var(--shadow-soft); }
.score-badge span  { display: block; font-size: 12px; color: #6b7280; font-weight: 850; }
.score-badge strong { display: block; margin-top: 2px; color: #5b21b6; font-size: 26px; letter-spacing: -.04em; }

/* ─── Todo / lines ──────────────────────────────────────────────────────── */

.todo, .line { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 0; border-bottom: 1px solid var(--border); }
.todo:last-child, .line:last-child { border-bottom: 0; }
.line:hover { color: var(--primary); }

.todo-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 14px 0;
  padding: 16px 17px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 1px 0 rgba(16,24,40,.025);
}
.todo-card:hover { border-color: #bfdbfe; background: #f8fbff; }
.todo-card strong { display: block; margin-top: 4px; }
.todo-card small  { display: block; color: var(--muted); font-size: 12px; }
.todo-card .pill  { display: inline-flex; padding: 3px 8px; border-radius: 999px; background: var(--primary-soft); color: #1d4ed8; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.todo-card.tender .pill  { background: var(--orange-soft); color: #9a3412; }
.todo-card.prospect .pill { background: var(--violet-soft); color: #5b21b6; }
.todo-card.due .pill { background: #dcfce7; color: #166534; }
.todo-card.overdue { border-color: #fca5a5; background: #fff9f9; }
.chevron { color: var(--primary); font-weight: 900; font-size: 18px; }

.priority-line  { padding: 12px 14px; border-radius: 14px; border: 1px solid #fed7aa; background: #fff7ed; }
.inbound-line   { padding: 12px 14px; border-radius: 14px; border: 1px solid #fde68a; background: #fefce8; }
.deadline-line  { padding: 12px 14px; border-radius: 14px; border: 1px solid #fecaca; background: #fef2f2; }
.proposal-line  { padding: 12px 14px; border-radius: 14px; border: 1px solid #bfdbfe; background: #eff6ff; }

.empty-state { display: grid; gap: 4px; align-content: center; min-height: 140px; padding: 22px; border: 1px dashed #cbd5e1; border-radius: 20px; background: #f8fafc; color: var(--muted); }
.empty-state strong { color: #334155; }
.empty, .muted { color: var(--muted); }

/* ─── Progress bars ─────────────────────────────────────────────────────── */

.progress-row { display: grid; gap: 6px; margin-bottom: 13px; }
.progress-row > div:first-child { display: flex; justify-content: space-between; gap: 10px; }
.progress { height: 9px; border-radius: 999px; background: #eef2f7; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--primary); border-radius: inherit; transition: width .3s; }

/* ─── Pipeline ──────────────────────────────────────────────────────────── */

.pipeline-grid { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(275px,1fr); gap: 22px; overflow: auto; padding-bottom: 18px; }
.pipe-col      { padding: 18px; border-radius: var(--radius); }
.pipe-col h2   { font-size: 16px; margin: 0 0 3px; font-weight: 820; }
.pipe-meta     { display: block; color: var(--muted); font-size: 12px; margin-bottom: 10px; }

.pipe-card {
  display: block;
  background: #fbfdff;
  border: 1px solid #edf1f7;
  border-radius: 16px;
  margin-top: 8px;
  padding: 14px;
}
.pipe-card:hover { border-color: #bdd2ff; background: #f5f9ff; }
.pipe-card > a { display: block; color: inherit; text-decoration: none; }
.pipe-card strong { display: block; font-size: 13px; font-weight: 700; }
.pipe-card span, .pipe-card small { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.pipe-card--overdue { border-color: #fca5a5; background: #fff9f9; }

.pipe-stage-form { display: flex; gap: 6px; margin-top: 10px; }
.pipe-stage-form select { min-height: 32px; font-size: 12px; padding: 6px 8px; }
.pipe-more-link {
  display: block;
  text-align: center;
  margin-top: 8px;
  padding: 7px;
  border: 0.5px dashed var(--border);
  border-radius: 10px;
  font-size: 11px;
  color: var(--muted);
}
.pipe-more-link:hover { background: var(--primary-soft); color: var(--primary); border-color: #bfdbfe; }
.pipe-empty { color: var(--muted); font-size: 12px; text-align: center; padding: 12px 0; }

/* ─── Info grid (fiche détail) ──────────────────────────────────────────── */

.info-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.info-item { min-height: 64px; padding: 12px 14px; border: 1px solid #e4eaf3; border-radius: 16px; background: #fbfdff; }
.info-item span { display: block; color: var(--muted); font-size: 12px; font-weight: 800; margin-bottom: 4px; }
.info-item strong { display: block; font-size: 14px; font-weight: 760; color: var(--text); word-break: break-word; }
.text-panel { padding: 14px 16px; border: 1px solid #e4eaf3; border-radius: 16px; background: #fbfdff; min-height: 52px; color: #263446; }
.bool-chip { display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 999px; background: #f1f5f9; color: #64748b; font-size: 12px; font-weight: 850; border: 1px solid #e2e8f0; }
.bool-chip:before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #cbd5e1; }
.bool-chip.on { background: #ecfdf3; color: #166534; border-color: #bbf7d0; }
.bool-chip.on:before { background: #16a34a; }
.bool-grid { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 18px; }
.action-card { border-color: #fed7aa; background: linear-gradient(135deg,#fff,#fff7ed); }
.inbound-detail { border-color: #fde68a; background: linear-gradient(135deg,#fff,#fffdf1); }

.detail-hero { align-items: stretch; }
.detail-metrics .metric strong { font-size: 22px; line-height: 1.15; }
.detail-metrics .metric small  { display: block; margin-top: 8px; color: var(--muted); font-weight: 700; }

.timeline { display: grid; gap: 14px; max-height: 620px; overflow: auto; padding-right: 4px; }
.timeline article { border-left: 3px solid #dbeafe; padding: 0 0 0 12px; }
.timeline span  { display: block; color: var(--muted); font-size: 12px; }
.timeline strong { display: block; }
.timeline p { margin: 5px 0; }
.full-timeline { max-height: none; }

/* ─── Documents ─────────────────────────────────────────────────────────── */

.document-upload-form { padding: 16px; border: 1px dashed #cbd5e1; border-radius: 18px; background: #f8fafc; margin-bottom: 18px; }
.document-list { display: grid; gap: 10px; }
.document-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; border: 1px solid #e4eaf3; border-radius: 16px; background: #fff; }
.document-row a { display: block; min-width: 0; }
.document-row strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 620px; }
.document-row small  { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.upload-action { display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; }
.upload-action small { display: block; color: var(--muted); font-size: 12px; }

/* ─── Treasury weighted ─────────────────────────────────────────────────── */

.treasury-weighted { color: #16a34a; font-weight: 700; }
.coeff-cell { display: flex; flex-direction: column; gap: 4px; }
.mini-bar { height: 4px; border-radius: 2px; background: var(--border); overflow: hidden; width: 80px; }
.mini-bar-fill { height: 100%; border-radius: 2px; background: var(--primary); }

/* ─── Templates / interpolation ─────────────────────────────────────────── */

.var-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.var-chip {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 8px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 12px;
  font-family: ui-monospace, monospace;
  cursor: pointer;
  border: 1px solid #bfdbfe;
  transition: background .12s;
}
.var-chip:hover { background: #bfdbfe; }

.template-card { display: flex; flex-direction: column; gap: 12px; }
.tpl-header-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.tpl-content {
  font-size: 13px;
  color: #344054;
  line-height: 1.6;
  white-space: pre-wrap;
  background: #f8fbff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  max-height: 180px;
  overflow: hidden;
}
.tpl-actions { display: flex; gap: 8px; }

.tpl-interpolate { margin-top: 4px; }
.interp-form {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
}
.interp-title { font-size: 12px; font-weight: 800; color: #9a3412; margin-bottom: 12px; }
.interp-row { margin-bottom: 8px; }
.interp-row label { font-size: 12px; color: #9a3412; display: grid; gap: 4px; margin: 0; }
.interp-row input { min-height: 36px; font-size: 13px; margin: 0; border-color: #fcd34d; }
.interp-preview {
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  color: #344054;
  background: #fffbf7;
  border: 1px solid #fcd34d;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
  min-height: 80px;
}
.interp-btns { display: flex; gap: 8px; }

/* ─── Exports ───────────────────────────────────────────────────────────── */

.export-grid { display: flex; flex-wrap: wrap; gap: 12px; }

/* ─── Misc ──────────────────────────────────────────────────────────────── */

.narrow { max-width: 980px; }
.copybox { height: 220px; white-space: pre-wrap; font-family: inherit; line-height: 1.5; border-radius: 16px; background: #fbfdff; }
.small-input { max-width: 100px; }
.row-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inline-form  { display: inline-flex; margin: 0; }
.inline-card  { display: flex !important; align-items: center; min-height: 70px; padding: 15px; border: 1px solid #e4e9f1; border-radius: 16px; background: #fff; }
.form-controls { align-items: start; }

.gonogo-summary { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 18px; background: #f5f3ff; border: 1px solid #ddd6fe; margin-bottom: 16px; }
.gonogo-summary strong { font-size: 28px; color: #5b21b6; }
.criteria-mini-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
.criteria-mini-grid .info-item { min-height: 56px; }

.settings-warning { background: #fff7ed; border: 1px solid #fed7aa; border-radius: 14px; padding: 12px 14px; color: #9a3412; }

hr { border: 0; border-top: 1px solid var(--border); margin: 28px 0; }
.footer { color: var(--muted); font-size: 12px; text-align: center; margin: 46px 0 5px; }

/* ─── Logo settings ─────────────────────────────────────────────────────── */

.app-logo-img   { display: block; max-width: 185px; max-height: 58px; width: auto; height: auto; object-fit: contain; }
.login-logo-img { display: block; max-width: 240px; max-height: 95px; width: auto; height: auto; object-fit: contain; }
.logo-preview   { display: flex; align-items: center; min-height: 78px; padding: 18px; border: 1px dashed var(--border); border-radius: 18px; background: #f8fafc; }

/* ─── Login page ────────────────────────────────────────────────────────── */

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 18% 12%,#dbeafe 0%,rgba(219,234,254,0) 34%), linear-gradient(135deg,#f8fbff 0%,#eef3fa 100%);
}
.login-card {
  width: min(430px, calc(100vw - 30px));
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: 0 25px 80px rgba(17,24,39,.12);
  border-radius: 28px;
  padding: 38px;
}
.login-card h1   { margin: 18px 0 4px; }
.login-card p    { color: var(--muted); margin: 0 0 22px; }
.login-card .btn { width: 100%; }

/* ─── Responsive ────────────────────────────────────────────────────────── */

@media (max-width: 1100px) {
  .sidebar { position: static; width: auto; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .main { margin-left: 0; padding: 24px; }
  .grid.two, .grid.three, .grid.four, .cards-4 { grid-template-columns: 1fr; }
  .topbar, .hero-card { flex-direction: column; gap: 14px; }
  .pipeline-grid { grid-auto-flow: row; }
  .pipe-col { min-width: 0; }
  .form-section-title { flex-direction: column; align-items: flex-start; }
  .segmented, .segmented.wide-seg { grid-template-columns: repeat(auto-fit,minmax(120px,1fr)); }
  .info-grid, .criteria-mini-grid { grid-template-columns: 1fr; }
  .document-row { align-items: flex-start; flex-direction: column; }
  .document-row strong { max-width: 100%; }
}

@media (max-width: 640px) {
  .main { padding: 18px; }
  .card, .hero-card, .form-card { padding: 20px; }
  .topbar h1 { font-size: 24px; }
  .actions { grid-template-columns: 1fr 1fr; display: grid; }
  .segmented, .segmented.wide-seg { grid-template-columns: 1fr 1fr; }
  .filters { display: grid; }
  .filters input, .filters select { min-width: 0; }
  .collapsible summary { padding: 20px; }
  .hero-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
}

/* Référentiels paramètres */
.reference-card .section-head { margin-bottom: 18px; }
.reference-add-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
}
.reference-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.reference-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(248, 250, 252, .72);
}
.reference-edit-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
}
.reference-edit-form small {
  white-space: nowrap;
  color: var(--muted);
  font-weight: 700;
}
.reference-row button[disabled] {
  opacity: .45;
  cursor: not-allowed;
}
@media (max-width: 820px) {
  .reference-add-form,
  .reference-row,
  .reference-edit-form { grid-template-columns: 1fr; }
}

.copy-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 10px; }
.invite-link-box strong { display:block; margin-bottom: 6px; }
.setup-card { max-width: 620px; }
.setup-form hr { border:0; border-top:1px solid var(--border); margin:18px 0; }
.logo-mark { display:inline-flex;align-items:center;justify-content:center;width:42px;height:42px;border-radius:14px;background:linear-gradient(135deg,#2563eb,#0ea5e9);color:#fff;font-weight:800; }

/* ─── Assistant AO ChatGPT Plus ─────────────────────────────────────────── */
.ai-assistant-card .prompt-box,
.ai-import-form textarea {
  min-height: 220px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.55;
}
.ai-import-form {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.ai-note-card .step-list {
  margin: 0 0 18px 20px;
  color: var(--text);
  line-height: 1.65;
}
.ai-note-card .step-list li { margin: 7px 0; }
.ai-analysis-card .text-panel {
  min-height: 120px;
  max-height: 380px;
  overflow: auto;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}
.ai-analysis-card h3 {
  margin-top: 0;
  color: var(--text);
}
.ai-assistant-card .section-chip {
  background: #eef2ff;
  color: #3730a3;
}
