:root {
  --bg: #f8f9fb;
  --surface: #ffffff;
  --surface1: #fbfcfe;
  --surface2: #f1f4f8;
  --border: #e1e6ed;
  --border-strong: #cdd5df;
  --fg: #101828;
  --fg2: #475467;
  --fg3: #98a2b3;
  --accent: #175cd3;
  --accent2: #1043a1;
  --accent-bg: #eff4ff;
  --green: #067647;
  --green-bg: #ecfdf3;
  --orange: #b54708;
  --orange-bg: #fffaeb;
  --red: #b42318;
  --red-bg: #fef3f2;
  --purple: #5925dc;
  --purple-bg: #f4f3ff;
  --navy: #0a192f;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Code", Consolas, Menlo, monospace;
  --radius: 6px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-md: 0 4px 14px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .16);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 13px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
a { color: var(--accent); }

/* ---------------------------------------------------------------- top bar */
#topbar {
  height: 46px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 12px; gap: 12px;
  position: sticky; top: 0; z-index: 100;
}
.logo { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--fg); }
.logo-mark {
  width: 26px; height: 26px; border-radius: 7px; background: var(--navy);
  display: inline-flex; align-items: center; justify-content: center; color: #fff;
  font-weight: 800; font-size: 13px; letter-spacing: -.5px;
}
.logo-text { display: inline-flex; flex-direction: column; line-height: 1.1; }
.logo-name { font-size: 13.5px; font-weight: 800; letter-spacing: .2px; }
.logo-sub { font-size: 9px; font-weight: 600; letter-spacing: 1.6px; color: var(--fg3); text-transform: uppercase; }
.sep { width: 1px; height: 20px; background: var(--border); }
.topbar-nav { display: flex; align-items: center; gap: 4px; }
.topbar-link {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500;
  color: var(--fg2); text-decoration: none; padding: 6px 10px; border-radius: var(--radius);
}
.topbar-link:hover { background: var(--surface2); color: var(--accent); }
.topbar-link.active { background: var(--accent-bg); color: var(--accent); font-weight: 600; }
.topbar-link svg { width: 14px; height: 14px; }
.proj-name { font-size: 11.5px; color: var(--fg2); max-width: 380px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 0 1 auto; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px;
  flex-shrink: 0; }
.user-chip { display: flex; align-items: center; gap: 8px; font-size: 11.5px;
  color: var(--fg2); white-space: nowrap; flex-shrink: 0; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--accent-bg); color: var(--accent2);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 11px;
  border: 1px solid #d6e2fb;
}
.role-tag { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  background: var(--surface2); color: var(--fg2); padding: 2px 7px; border-radius: 10px;
  white-space: nowrap; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px;
  border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface);
  color: var(--fg); font: inherit; font-size: 12px; font-weight: 500; cursor: pointer;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface2); }
.btn svg { width: 14px; height: 14px; }
.btn.primary { background: var(--accent2); border-color: var(--accent2); color: #fff; }
.btn.primary:hover { background: #0c3688; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface2); }
.btn.small { height: 26px; padding: 0 8px; font-size: 11px; }
.btn.danger { background: var(--red-bg); border-color: #f4c7c3; color: var(--red); }
.btn.success { background: var(--green-bg); border-color: #b8e6cb; color: var(--green); }
.btn.warn { background: var(--orange-bg); border-color: #f7d9a9; color: var(--orange); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.block { width: 100%; justify-content: center; }

/* ---------------------------------------------------------------- layout */
.page { padding: 14px 16px 40px; max-width: 1680px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.page-head h1 { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.page-head h1 svg { width: 18px; height: 18px; color: var(--accent); }
.page-head .sub { font-size: 11.5px; color: var(--fg3); }
.page-head .actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.pv-tabs { display: flex; gap: 2px; background: var(--surface2); border-radius: 8px;
  padding: 2px; flex-shrink: 0; }
.pv-tab { border: 0; background: transparent; font: inherit; font-size: 12px; font-weight: 600;
  color: var(--fg2); padding: 5px 13px; border-radius: 6px; cursor: pointer;
  white-space: nowrap; flex-shrink: 0; }
.pv-tab.active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm); }

/* ------------------------------------------------------------------ KPIs */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 8px; }
.kpi-card {
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--border);
  border-radius: 8px; padding: 9px 11px; box-shadow: var(--shadow-sm);
}
.kpi-card.accent { border-left-color: var(--accent); }
.kpi-card.good { border-left-color: var(--green); }
.kpi-card.warn { border-left-color: var(--orange); }
.kpi-card.bad { border-left-color: var(--red); }
.kpi-card .label { font-size: 9px; text-transform: uppercase; color: var(--fg3); letter-spacing: .5px; font-weight: 700; }
.kpi-card .value { font-size: 19px; font-weight: 700; line-height: 1.15; margin-top: 2px; }
.kpi-card .value small { font-size: 11px; font-weight: 600; color: var(--fg3); margin-left: 2px; }
.kpi-card .sub { font-size: 10.5px; color: var(--fg2); margin-top: 2px; }
.kpi-card .sub b { color: var(--red); }
.kbar { height: 4px; border-radius: 2px; background: var(--surface2); overflow: hidden; margin-top: 5px; }
.kbar i { display: block; height: 100%; background: var(--accent); }

/* ----------------------------------------------------------------- panels */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.grid-3 { display: grid; grid-template-columns: 1.35fr 1fr; gap: 10px; margin-top: 10px; align-items: start; }
@media (max-width: 1100px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: var(--shadow-sm); overflow: hidden; align-self: start; }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.panel-head h2 { font-size: 12.5px; font-weight: 700; display: flex; align-items: center; gap: 7px; }
.panel-head h2 svg { width: 14px; height: 14px; color: var(--accent); }
.panel-head .h2-sub { font-size: 10.5px; color: var(--fg3); font-weight: 500; }
.panel-head .actions { margin-left: auto; display: flex; gap: 5px; }
.panel-body { padding: 12px; }
.panel-body.flush { padding: 0; }

/* ------------------------------------------------------------------ table */
table.tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
table.tbl th {
  text-align: left; font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  color: var(--fg3); padding: 7px 10px; border-bottom: 1px solid var(--border); background: var(--surface1);
  position: sticky; top: 0;
}
table.tbl td { padding: 7px 10px; border-bottom: 1px solid #f0f3f7; vertical-align: middle; }
table.tbl tbody tr:hover { background: var(--surface1); }
table.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-scroll { max-height: 420px; overflow: auto; }

/* ----------------------------------------------------------------- badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 10px;
  font-size: 10.5px; font-weight: 600; white-space: nowrap;
}
.badge.ok { background: var(--green-bg); color: var(--green); }
.badge.warn { background: var(--orange-bg); color: var(--orange); }
.badge.bad { background: var(--red-bg); color: var(--red); }
.badge.neutral { background: var(--surface2); color: var(--fg2); }
.badge.info { background: var(--accent-bg); color: var(--accent2); }
.badge.purple { background: var(--purple-bg); color: var(--purple); }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot.ok { background: var(--green); } .dot.warn { background: var(--orange); }
.dot.bad { background: var(--red); } .dot.neutral { background: var(--fg3); }

/* -------------------------------------------------------------- timeline */
.timeline { padding: 8px 12px 12px; }
.tl-scale { position: relative; height: 22px; font-size: 9.5px; color: var(--fg3);
  border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.tl-scale span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.tl-row { display: grid; grid-template-columns: 200px 1fr 64px; align-items: center; gap: 8px;
  padding: 4px 0; }
.tl-label { font-size: 11.5px; color: var(--fg2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-track { position: relative; height: 14px; background: var(--surface2); border-radius: 4px; }
.tl-bar { position: absolute; height: 14px; border-radius: 4px; background: var(--accent); opacity: .9; }
.tl-bar.lot { background: #4c7dd6; }
.tl-bar.late { background: var(--red); }
.tl-bar.at_risk { background: var(--orange); }
.tl-bar.done { background: var(--green); }
.tl-bar.inspection { background: var(--purple); border-radius: 7px; }
.today-line { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--red); opacity: .55; }
.tl-foot { font-size: 11px; color: var(--fg3); }
.tl-legend { display: inline-flex; gap: 10px; font-size: 9.5px; }
.tl-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 3px; }

/* ---------------------------------------------------------------- misc */
.muted { color: var(--fg3); }
.small { font-size: 11px; }
.mono { font-family: var(--mono); }
.right { text-align: right; }
.flex { display: flex; align-items: center; gap: 8px; }
.flex.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.pill { padding: 2px 8px; border-radius: 10px; background: var(--surface2); font-size: 10.5px; color: var(--fg2); }
.empty { padding: 22px; text-align: center; color: var(--fg3); font-size: 12px; }

/* login overlay */
.login-box { max-width: 340px; margin: 12vh auto; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-lg); padding: 22px; }
.login-box h2 { font-size: 15px; margin-bottom: 4px; }
.login-box p { font-size: 11.5px; color: var(--fg3); margin-bottom: 14px; }
.login-box label { display: block; font-size: 10.5px; font-weight: 600; color: var(--fg2);
  text-transform: uppercase; letter-spacing: .5px; margin: 10px 0 4px; }
input, select, textarea {
  width: 100%; padding: 7px 9px; border: 1px solid var(--border-strong); border-radius: var(--radius);
  font: inherit; font-size: 12.5px; color: var(--fg); background: #fff;
}
input[type="checkbox"], input[type="radio"] { width: auto; padding: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-bg); border-color: var(--accent); }
.login-error { color: var(--red); font-size: 11.5px; min-height: 16px; margin-top: 8px; }
.demo-users { margin-top: 14px; font-size: 10.5px; color: var(--fg3); line-height: 1.6;
  border-top: 1px dashed var(--border); padding-top: 10px; }
.demo-users code { font-family: var(--mono); color: var(--fg2); }

/* toast */
#toastWrap { position: fixed; right: 16px; bottom: 16px; z-index: 4000; display: flex;
  flex-direction: column; gap: 6px; }
.toast { background: var(--navy); color: #fff; padding: 8px 13px; border-radius: 8px; font-size: 12px;
  box-shadow: var(--shadow-lg); animation: tin .18s ease-out; max-width: 360px; }
.toast.err { background: var(--red); }
.toast.ok { background: var(--green); }
@keyframes tin { from { opacity: 0; transform: translateY(6px); } }

/* --------------------------------------------------- inspection (tablette) */
.ins-layout { display: grid; grid-template-columns: 320px 1fr; min-height: calc(100vh - 46px); }
@media (max-width: 980px) { .ins-layout { grid-template-columns: 1fr; } }
.ins-side { border-right: 1px solid var(--border); background: var(--surface); display: flex;
  flex-direction: column; }
.ins-side .filters { padding: 10px; border-bottom: 1px solid var(--border); display: flex;
  flex-direction: column; gap: 6px; }
.ins-list { flex: 1; overflow: auto; }
.ins-item { display: flex; gap: 9px; align-items: flex-start; padding: 9px 11px;
  border-bottom: 1px solid #f0f3f7; cursor: pointer; }
.ins-item:hover { background: var(--surface1); }
.ins-item.active { background: var(--accent-bg); box-shadow: inset 3px 0 0 var(--accent); }
.ins-item .t { font-size: 12px; font-weight: 600; line-height: 1.3; }
.ins-item .m { font-size: 10.5px; color: var(--fg3); }
.ins-item .st { margin-left: auto; }
.ins-detail { display: flex; flex-direction: column; min-width: 0; }
.ins-detail-head { padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface); }
.ins-detail-head h2 { font-size: 15px; font-weight: 700; }
.ins-detail-body { padding: 14px 16px 60px; overflow: auto; flex: 1; }
.section { margin-bottom: 16px; }
.section-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px;
  color: var(--fg3); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.section-title svg { width: 13px; height: 13px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 11px 13px; }
.card + .card { margin-top: 8px; }
.outcome-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
@media (max-width: 760px) { .outcome-grid { grid-template-columns: repeat(2, 1fr); } }
.outcome-btn {
  border: 1px solid var(--border-strong); background: #fff; border-radius: 8px; padding: 8px 6px;
  font: inherit; font-size: 11px; font-weight: 600; color: var(--fg2); cursor: pointer; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 52px;
  justify-content: center;
}
.outcome-btn .ico { font-size: 15px; line-height: 1; }
.outcome-btn:hover { background: var(--surface2); }
.outcome-btn.sel.conforme { background: var(--green-bg); border-color: var(--green); color: var(--green); }
.outcome-btn.sel.conforme_reserves { background: var(--orange-bg); border-color: var(--orange); color: var(--orange); }
.outcome-btn.sel.non_conforme { background: var(--red-bg); border-color: var(--red); color: var(--red); }
.outcome-btn.sel.non_inspecte { background: var(--surface2); border-color: var(--fg3); color: var(--fg2); }
.outcome-btn.sel.sans_objet { background: var(--purple-bg); border-color: var(--purple); color: var(--purple); }
textarea { min-height: 62px; resize: vertical; }
.row-inputs { display: grid; grid-template-columns: 1.6fr .8fr .8fr .7fr auto; gap: 6px; align-items: end; }
@media (max-width: 820px) { .row-inputs { grid-template-columns: 1fr 1fr; } }
.field label { display: block; font-size: 9.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .4px; color: var(--fg3); margin-bottom: 3px; }
.verdict-box { border-radius: 6px; padding: 6px 9px; font-size: 11.5px; font-weight: 600; }
.verdict-box.OK { background: var(--green-bg); color: var(--green); }
.verdict-box.WARN { background: var(--orange-bg); color: var(--orange); }
.verdict-box.NOK { background: var(--red-bg); color: var(--red); }
.dev-bar { position: relative; height: 8px; border-radius: 4px; background: var(--surface2);
  overflow: visible; margin: 6px 0 2px; }
.dev-band { position: absolute; top: 0; bottom: 0; background: rgba(6, 118, 71, .18); border-radius: 4px; }
.dev-mark { position: absolute; top: -2px; width: 2px; height: 12px; background: var(--fg); }
.dev-mark.bad { background: var(--red); height: 14px; top: -3px; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; }
.photo { position: relative; border-radius: 6px; overflow: hidden; border: 1px solid var(--border);
  aspect-ratio: 4/3; background: var(--surface2); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo .cap { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(10, 25, 47, .72);
  color: #fff; font-size: 9.5px; padding: 2px 5px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }
.photo .del { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: rgba(10, 25, 47, .7); color: #fff; border: 0; cursor: pointer; font-size: 12px; line-height: 20px; }
.photo-add { display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 1px dashed var(--border-strong); border-radius: 6px; aspect-ratio: 4/3; cursor: pointer;
  color: var(--fg3); font-size: 10.5px; gap: 4px; background: var(--surface1); }
.photo-add:hover { border-color: var(--accent); color: var(--accent); }
.photo-add svg { width: 20px; height: 20px; }
.plan-wrap { position: relative; border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
  background: #fff; }
.plan-wrap svg, .plan-wrap img { display: block; width: 100%; height: auto; }
.plan-dot { position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid #fff;
  background: var(--red); transform: translate(-50%, -50%); box-shadow: 0 1px 4px rgba(0, 0, 0, .35); }
.plan-dot.ok { background: var(--green); }
.plan-cross { position: absolute; width: 16px; height: 16px; transform: translate(-50%, -50%);
  pointer-events: none; }
.finding { border-left: 3px solid var(--red); background: var(--surface); border-radius: 6px;
  padding: 9px 11px; margin-bottom: 7px; }
.finding.majeure { border-left-color: var(--red); }
.finding.critique { border-left-color: #7a271a; background: #fffaf9; }
.finding.mineure { border-left-color: var(--orange); }
.finding.observation { border-left-color: var(--accent); }
.finding .fh { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--fg3); }
.finding .fd { font-size: 12.5px; margin: 4px 0 6px; }
.finding .fa { display: flex; gap: 5px; flex-wrap: wrap; }
.timeline-ev { font-size: 10.5px; color: var(--fg3); padding-left: 10px; border-left: 2px solid var(--border); margin-top: 5px; }
.print-only { display: none; }
@media print {
  #topbar, .ins-side, .actions, .no-print { display: none !important; }
  body { background: #fff; }
  .print-only { display: block; }
  .panel { border: 0; box-shadow: none; }
}

/* ---------------------------------------------- tablet comfort overrides */
@media (min-width: 760px) {
  .ins-detail-head h2 { font-size: 17px; }
  .ins-detail .small, .card .small { font-size: 12px; }
  .ins-item .t { font-size: 13px; }
  .ins-item .m { font-size: 11px; }
  .section-title { font-size: 11px; color: var(--fg2); }
  .field label { font-size: 10.5px; color: var(--fg2); }
  .muted { color: #667085; }
  .ins-detail-body { padding: 16px 20px 70px; }
}
.plan-wrap { max-height: 74vh; overflow: auto; background: #fff; }
.plan-wrap img { width: 100%; height: auto; }
.outcome-btn { min-height: 62px; font-size: 12px; }
.outcome-btn .ico { font-size: 18px; }
.ins-side .filters input, .ins-side .filters select { height: 34px; font-size: 13px; }

/* sticky section shortcuts on the inspection sheet */
.ins-detail-head { position: sticky; top: 46px; z-index: 40; }
.sheet-tabs { display: flex; gap: 4px; margin-top: 9px; overflow-x: auto; }
.sheet-tabs button {
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--fg2);
  font: inherit; font-size: 11.5px; font-weight: 600; padding: 5px 12px; border-radius: 14px;
  cursor: pointer; white-space: nowrap;
}
.sheet-tabs button:hover { background: var(--accent-bg); color: var(--accent); border-color: #b8cdf5; }
.section { scroll-margin-top: 130px; }


/* ------------------------------------------------------- planning / import */
.project-picker { height: 26px; padding: 0 8px; font-size: 11.5px; border-radius: 6px;
  border: 1px solid var(--border); background: #fff; color: var(--fg); max-width: 260px; }
.form-row { margin-bottom: 12px; }
.form-row > label { display: block; font-size: 11px; text-transform: uppercase;
  letter-spacing: .4px; color: var(--fg3); margin-bottom: 4px; font-weight: 600; }
.form-row input[type="text"], .form-row input[type="date"], .form-row input[type="number"],
.form-row select { width: 100%; height: 32px; padding: 0 9px; font-size: 12.5px;
  border: 1px solid var(--border); border-radius: 6px; background: #fff; color: var(--fg); }
.form-row label.check { display: flex; align-items: center; gap: 6px; text-transform: none;
  letter-spacing: 0; font-size: 12px; color: var(--fg2); margin-top: 8px; font-weight: 400; }
.import-preview { margin-top: 12px; font-size: 12px; }
.import-preview .msg { padding: 9px 12px; border-radius: 6px; margin-bottom: 10px; }
.import-preview .msg.ok { background: #e8f7ee; color: #0f6b3e; border: 1px solid #86c9a5; }
.import-preview .msg.warn { background: #fdf5e3; color: #8a5a00; border: 1px solid #e6c274; }
.import-preview .msg.err { background: #fdeaea; color: #9c1c1c; border: 1px solid #eda3a3; }
.import-preview .chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0 10px; }
.import-preview .chip { background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; padding: 2px 8px; font-size: 10.5px; color: var(--fg2); }
.import-preview table { width: 100%; border-collapse: collapse; font-size: 11px; }
.import-preview th { text-align: left; background: var(--surface2); padding: 5px 6px;
  border-bottom: 1px solid var(--border); font-weight: 600; color: var(--fg2); }
.import-preview td { padding: 4px 6px; border-bottom: 1px solid var(--border); }
.import-preview .scroll { max-height: 240px; overflow: auto; border: 1px solid var(--border);
  border-radius: 6px; }
.task-late { color: #b91c1c; font-weight: 600; }
.pill { display: inline-block; padding: 1px 7px; border-radius: 9px; font-size: 10px;
  font-weight: 600; }
.pill.a_faire { background: #eceff4; color: #47536b; }
.pill.en_cours { background: #e3eefc; color: #1d4e89; }
.pill.terminee { background: #e2f6ec; color: #0f6b3e; }
.pill.bloquee { background: #fdeaea; color: #9c1c1c; }
.pill.en_retard { background: #fdf0d9; color: #8a5a00; }
.pill.annulee { background: #f1f0f5; color: #6b6478; }

/* -------------------------------------------------------- barre d'export */
.export-bar { display: flex; align-items: center; gap: 10px; padding: 7px 12px;
  border-bottom: 1px solid var(--border); background: var(--surface2); }
.export-bar .check { display: flex; align-items: center; gap: 6px; font-size: 11.5px;
  color: var(--fg2); cursor: pointer; white-space: nowrap; flex-shrink: 0; }
.export-bar .btn { white-space: nowrap; flex-shrink: 0; }
.export-bar #exportLotsHint { white-space: nowrap; }
.export-bar .btn:disabled { opacity: .45; cursor: not-allowed; }
.lot-check { cursor: pointer; }

/* barre du haut : le logo ne se replie plus quand des onglets s'ajoutent (addons) ;
   c'est le nom du projet, deja tronque, qui cede la place */
.logo, .topbar-nav { flex-shrink: 0; }
.logo-text { white-space: nowrap; }
.project-picker { max-width: 220px; }
@media (max-width: 1350px) { #topbar .proj-name { display: none; } }

/* Navigation commune : etiquette du projet courant sur « Espace projet » */
.nav-tag { font: 600 9.5px/1 var(--mono); background: var(--surface2); color: var(--fg2); border: 1px solid var(--border);
  border-radius: 4px; padding: 2px 4px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-link.active .nav-tag { background: #fff; color: var(--accent); }
@media (max-width: 1280px) { .nav-tag { display: none; } }
/* Pilotage : onglets et projet sur une seconde ligne, sous la barre du haut */
.subbar { position: sticky; top: 46px; z-index: 90; display: flex; align-items: center; gap: 12px; padding: 6px 16px;
  background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.subbar .project-picker { max-width: 360px; height: 30px; font-size: 12.5px; font-weight: 600; }
.subbar-proj { font-size: 12.5px; font-weight: 600; color: var(--fg); max-width: 420px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; padding: 4px 10px; background: var(--surface1);
  border: 1px solid var(--border); border-radius: 6px; }
.subbar-label { font-size: 11px; color: var(--fg3); text-transform: uppercase; letter-spacing: .5px; }
.subbar .pv-tabs { margin-left: 8px; }

/* Pilotage : le projet est dans la sous-barre, inutile de le repeter dans la barre du haut */
body:has(#pilotSubbar) #topProjectName, body:has(#pilotSubbar) #topbar > .sep { display: none; }

/* ================= unified top bar (nav-unify) ================= */
#topbar { gap: 8px; }
.topbar-nav, .topbar-right { display: flex; align-items: center; }
.topbar-nav { gap: 2px; min-width: 0; overflow: hidden; }
.topbar-link { white-space: nowrap; }
.topbar-link .nav-tag { max-width: 96px; overflow: hidden; text-overflow: ellipsis; }

/* project picker inside the bar (single visible source of truth) */
.tb-proj { display: inline-flex; align-items: center; gap: 6px; max-width: 260px; min-width: 0; }
.tb-proj-label { font-size: 10px; font-weight: 700; letter-spacing: .6px; color: var(--fg3); text-transform: uppercase; flex-shrink: 0; }
.tb-proj select {
  font: inherit; font-size: 12px; font-weight: 600; color: var(--fg); background: var(--surface1);
  border: 1px solid var(--border); border-radius: 6px; padding: 4px 26px 4px 8px;
  max-width: 210px; min-width: 0; text-overflow: ellipsis; cursor: pointer;
  appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 7px center;
}
.tb-proj select:hover { border-color: var(--border-strong); }
.tb-proj .badge { font-size: 10.5px; font-weight: 600; color: var(--fg2); background: var(--surface2);
  border-radius: 4px; padding: 2px 6px; white-space: nowrap; }
@media (max-width: 1100px) { .tb-proj-label { display: none; } }
@media (max-width: 900px) { .tb-proj { max-width: 150px; } .tb-proj select { max-width: 150px; } }

/* "Outils" dropdown (Ressources / Connaissances / Aide / Admin) */
.nav-more { position: relative; }
.nav-more-btn {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500;
  color: var(--fg2); background: none; border: 0; padding: 6px 10px; border-radius: var(--radius);
  cursor: pointer; font-family: inherit;
}
.nav-more-btn:hover, .nav-more.open .nav-more-btn { background: var(--surface2); color: var(--accent); }
.nav-more-btn.active { background: var(--accent-bg); color: var(--accent); font-weight: 600; }
.nav-more-btn svg { width: 14px; height: 14px; }
.nav-more-menu {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 210px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-lg); padding: 6px;
  display: none; z-index: 120;
}
.nav-more.open .nav-more-menu { display: block; }
.nav-more-menu a {
  display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 6px;
  font-size: 12px; color: var(--fg2); text-decoration: none; white-space: nowrap;
}
.nav-more-menu a:hover { background: var(--surface2); color: var(--accent); }
.nav-more-menu a.active { background: var(--accent-bg); color: var(--accent); font-weight: 600; }
.nav-more-menu a svg { width: 14px; height: 14px; flex-shrink: 0; }
.nav-more-menu .nm-sep { height: 1px; background: var(--border); margin: 5px 4px; }
/* the floating assistant keeps working: the Outils menu just links to the same pages */

/* menu-outils-fix : le menu deroulant « Outils » depasse sous la barre ; il ne doit pas etre coupe */
.topbar-nav { overflow: visible; }
