/* Honoraires et temps passé — démo Forge Labs. S'appuie sur ../_shared/demo.css et archi.css. */

:root { --good: #3b6b47; --bad: #a5470d; }
.kpi-value, .tt, .mini td, .dt td.r, .sv, .cv, .pv { font-variant-numeric: tabular-nums; }

.dash { max-width: 1320px; margin: 0 auto; padding: 24px var(--gutter) 40px; display: grid; gap: 20px; }
.dash > * { min-width: 0; }
.dash h1 { font-size: clamp(1.45rem, 2.6vw, 2.05rem); margin: 0 0 4px; }
.dash h2 { font-size: clamp(1.08rem, 1.5vw, 1.24rem); margin: 0 0 4px; letter-spacing: -.01em; }
.dash h3 { font-size: 1rem; }
.dash p { margin: 0; }

.dash-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; }
.dash-id { display: flex; align-items: center; gap: 14px; min-width: 0; }

.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; min-width: 0; max-width: 100%; }
.seg { border: 0; padding: 3px; margin: 0; display: inline-flex; flex-wrap: wrap; background: #fff; border-radius: 22px; box-shadow: inset 0 0 0 1px var(--line); min-width: 0; max-width: 100%; }
.seg legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: inline-flex; align-items: center; min-height: 38px; padding: 0 13px; border-radius: 999px; font-size: .88rem; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; transition: background .15s, color .15s; }
.seg input:checked + span { background: var(--slate-800); color: #fff; }
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 1px; }
.seg label:hover span { color: var(--slate-900); }
.seg label:hover input:checked + span { color: #fff; }
.seg-sm span { min-height: 34px; font-size: .82rem; padding: 0 11px; }
.btn-export { min-height: 44px; padding: .6em 1.1em; font-size: .92rem; background: #fff; color: var(--slate-900); border-color: var(--line); }
.btn-export:hover { border-color: var(--slate-800); }
.scope { margin-top: -6px !important; }
@media (max-width: 640px) {
  .controls { width: 100%; }
  .seg { width: 100%; }
  .seg label { flex: 1 1 auto; }
  .seg span { width: 100%; justify-content: center; padding: 0 10px; }
  .btn-export { width: 100%; }
}

.card { padding: clamp(16px, 2vw, 24px); border-radius: 16px; min-width: 0; box-shadow: 0 1px 2px rgba(20, 27, 33, .05), 0 8px 24px -14px rgba(20, 27, 33, .2); }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 8px 20px; margin-bottom: 14px; }
.card-head .small { max-width: 62ch; }
.row { display: grid; gap: 20px; min-width: 0; }
.row-top { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.col { display: grid; gap: 20px; min-width: 0; align-content: start; }
.col { display: grid; gap: 20px; min-width: 0; align-content: start; }
@media (max-width: 1080px) { .row-top { grid-template-columns: minmax(0, 1fr); } .c-ai { order: -1; } }
.scroller { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.scroller:focus-visible { outline: 3px solid var(--focus); }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1180px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; } }
@media (max-width: 640px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpi:first-child { grid-column: 1 / -1; } }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.kpi-label { font-size: .8rem; font-weight: 600; color: var(--muted); line-height: 1.25; }
.kpi-value { font: 700 clamp(1.3rem, 2vw, 1.7rem)/1.1 var(--font-display); color: var(--slate-900); letter-spacing: -.02em; white-space: nowrap; }
.kpi-value small { font-size: .55em; font-weight: 600; color: var(--muted); margin-left: 3px; letter-spacing: 0; }
.kpi-foot { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; font-size: .78rem; color: var(--muted); line-height: 1.3; }
.delta { display: inline-flex; align-items: center; font-weight: 700; font-size: .8rem; padding: 2px 7px; border-radius: 999px; white-space: nowrap; }
.delta.good { color: var(--good); background: var(--ok-100); }
.delta.bad { color: var(--bad); background: #f8e3d8; }
.delta.flat { color: var(--muted); background: var(--calque-100); }
@media (max-width: 420px) { .kpi { padding: 12px; } .kpi-value { font-size: 1.25rem; } .kpi-label { font-size: .76rem; } }

/* Graphique */
.legend { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .82rem; color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.chart svg { display: block; overflow: visible; }
.chart text { font-size: 12px; }
@media (max-width: 520px) { .chart text { font-size: 11px; } }
.chart text { font: 500 12px/1 var(--font-body); fill: #5d6870; }
.chart .gl { stroke: rgba(22, 29, 34, .08); }
.chart .baseline { stroke: rgba(22, 29, 34, .3); }
.chart .hit { fill: transparent; cursor: pointer; outline: none; }
.chart .hit:hover { fill: rgba(47, 62, 74, .07); }
.chart .hit:focus-visible { fill: rgba(208, 138, 46, .18); stroke: var(--focus); stroke-width: 2; }
.data-details { margin-top: 10px; font-size: .86rem; }
.data-details summary { cursor: pointer; color: var(--slate-800); font-weight: 600; padding: 6px 0; width: max-content; max-width: 100%; }
table.mini { border-collapse: collapse; width: 100%; min-width: 560px; margin-top: 6px; }
.mini th, .mini td { padding: 5px 8px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.mini th:first-child { text-align: left; }
.mini thead th { font-size: .76rem; color: var(--muted); }

/* Alertes */
.c-ai { background: var(--slate-900); color: var(--calque-100); border-color: transparent; display: flex; flex-direction: column; }
.c-ai h2 { color: #fff; margin-bottom: 14px !important; }
.ai-eyebrow { display: flex; align-items: center; gap: 6px; font-size: .74rem !important; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--verif-200); margin-bottom: 8px !important; }
.alerts { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.alert { background: rgba(255, 255, 255, .06); border: 1px solid rgba(239, 239, 234, .12); border-radius: 12px; padding: 12px 14px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 11px; }
.alert-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; grid-row: span 3; }
.alert.high .alert-dot { background: #f08a5d; box-shadow: 0 0 0 4px rgba(240, 138, 93, .22); }
.alert.mid .alert-dot { background: var(--verif-200); box-shadow: 0 0 0 4px rgba(255, 177, 92, .2); }
.alert.info .alert-dot { background: #9fb98a; box-shadow: 0 0 0 4px rgba(159, 185, 138, .2); }
.alert .sr-only { grid-column: 2; }
.alert-text { font-size: .92rem; line-height: 1.45; color: rgba(255, 255, 255, .9); grid-column: 2; }
.alert-text strong { color: #fff; }
.alert-action { font-size: .82rem; line-height: 1.4; color: rgba(239, 239, 234, .74); grid-column: 2; }
.alert-action b { color: var(--verif-200); }
.ai-foot { margin-top: auto !important; padding-top: 12px; color: rgba(239, 239, 234, .62); }

/* Infobulle */
.tt { position: fixed; z-index: 80; pointer-events: none; max-width: min(280px, calc(100vw - 24px)); background: var(--slate-950); color: var(--calque-100); border-radius: 10px; padding: 9px 12px; font-size: .82rem; line-height: 1.45; box-shadow: 0 10px 30px -8px rgba(0, 0, 0, .45); }
.tt b { display: block; color: #fff; margin-bottom: 2px; }
.tt .tl { display: flex; justify-content: space-between; gap: 14px; }
.tt .tl span:last-child { font-weight: 700; color: #fff; white-space: nowrap; }
.tt .tt-tot { border-top: 1px solid rgba(239, 239, 234, .2); margin-top: 3px; padding-top: 3px; }
.tt[hidden] { display: none; }

/* ---------- Spécifique agence d'architecture ---------- */
:root { --c-enc: #2f3e4a; --c-fac: #7f95a6; --c-af: #d9a531; --c-rest: #e4e3dc; --c-hp: #2f3e4a; --c-hb: #dcdfe0; --c-over: #c2571a; }
.sel { display: inline-flex; align-items: center; gap: 8px; font-size: .84rem; font-weight: 600; color: var(--muted); }
.sel select { font: inherit; font-weight: 600; color: var(--ink); min-height: 44px; padding: 0 12px; border-radius: 22px; border: 1px solid var(--line); background: #fff; }
@media (max-width: 640px) { .sel { width: 100%; } .sel select { flex: 1; min-width: 0; } }
.sw-enc { background: var(--c-enc); }
.sw-fac { background: var(--c-fac); }
.sw-af { background: repeating-linear-gradient(135deg, var(--c-af) 0 3px, #f0d58f 3px 6px); }
.sw-rest { background: var(--c-rest); box-shadow: inset 0 0 0 1px rgba(22, 29, 34, .12); }
.sw-hp { background: var(--c-hp); }
.sw-hb { background: var(--c-hb); }
.legend .mk { width: 3px; height: 14px; background: #1c262e; border-radius: 1px; display: inline-block; }
.chart .plabel { font: 600 12.5px/1 var(--font-body); fill: var(--ink); }
.chart .pval { font: 600 12px/1 var(--font-body); fill: #5d6870; }
.chart .pval.over { fill: var(--c-over); font-weight: 700; }
.chart .bar-over { fill: var(--c-over); }

/* Alertes : ligne de calcul */
.alert-calc { font-size: .8rem; line-height: 1.4; color: rgba(239, 239, 234, .78); grid-column: 2; font-variant-numeric: tabular-nums; background: rgba(0, 0, 0, .18); border-radius: 8px; padding: 6px 9px; margin-top: 2px; }
.alert-calc b { color: var(--verif-200); font-weight: 700; }

/* Pipeline */
.pipe-week { margin: 0 0 12px; padding: 10px 12px; border-radius: 12px; background: var(--warn-100); color: #6a2d06; font-size: .86rem; line-height: 1.4; border: 1px solid rgba(165, 71, 13, .3); }
.pipe-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pipe-list li { display: grid; grid-template-columns: 4.2em minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--calque-50); }
.pipe-list li.hot { border-color: rgba(194, 87, 26, .55); box-shadow: inset 4px 0 0 var(--c-over); }
.pd { grid-row: span 2; text-align: center; font: 700 1.05rem/1.05 var(--font-display); color: var(--slate-900); }
.pd small { display: block; font: 600 .7rem/1.2 var(--font-body); color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.pn { font-weight: 700; font-size: .9rem; color: var(--slate-900); line-height: 1.25; }
.pm { font-size: .78rem; color: var(--muted); grid-column: 2; line-height: 1.35; }
.pv2 { grid-row: span 2; text-align: right; font-size: .78rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.pv2 b { display: block; font-size: .92rem; color: var(--ink); }
.pst { display: inline-block; margin-top: 3px; padding: 2px 8px; border-radius: 999px; font-size: .7rem; font-weight: 700; }
.pst-a { background: var(--verif-100); color: #6b4705; }
.pst-r { background: var(--slate-100); color: var(--slate-800); }
.pst-au { background: var(--ok-100); color: #24462c; }
.pipe-sum { margin-top: 12px !important; font-size: .84rem; color: var(--muted); }
@media (max-width: 460px) {
  .pipe-list li { grid-template-columns: 3.6em minmax(0, 1fr); }
  .pv2 { grid-row: auto; grid-column: 2; text-align: left; }
  .pv2 b { display: inline; margin-right: 6px; }
}

/* Charge */
.legend-load { margin: 0; align-self: center; }
.l1 { background: #e7ece9; } .l2 { background: #b9c7d1; } .l3 { background: #6f889b; } .l4 { background: var(--c-over); }
table.load { border-collapse: separate; border-spacing: 3px; width: 100%; min-width: 640px; font-size: .82rem; }
.load th { font-weight: 700; color: var(--muted); font-size: .74rem; text-align: center; padding: 4px; white-space: nowrap; }
.load thead th small { display: block; font-weight: 500; }
.load tbody th { text-align: left; color: var(--slate-900); font-size: .84rem; position: sticky; left: 0; background: #fff; z-index: 1; padding-right: 10px; }
.load tbody th small { display: block; color: var(--muted); font-weight: 500; font-size: .72rem; }
.load td { text-align: center; border-radius: 6px; padding: 8px 2px; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 52px; }
.load td.l1 { color: #3c4a44; } .load td.l2 { color: #1f2a33; } .load td.l3 { color: #fff; } .load td.l4 { color: #fff; }
.load td.off { background: repeating-linear-gradient(135deg, #f1f1ee 0 5px, #e6e6e1 5px 10px); color: var(--muted); font-weight: 500; font-size: .72rem; }
.load td small { display: block; font-weight: 500; font-size: .68rem; opacity: .85; }
.load tfoot th, .load tfoot td { font-size: .76rem; color: var(--muted); font-weight: 600; background: none; }
.load tr.hl th { color: var(--c-over); }


/* Tableau de données (base) */
.tcount { color: var(--muted); align-self: center; }
.tscroll { border: 1px solid var(--line); border-radius: 12px; }
table.dt { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .88rem; }
.dt th, .dt td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.dt thead th { background: var(--calque-50); font-size: .76rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.dt thead th.c { text-align: center; }
.dt thead th abbr { text-decoration: none; cursor: help; border-bottom: 1px dotted currentColor; }
.dt .r { text-align: right; }
.dt td:first-child, .dt th:first-child { position: sticky; left: 0; background: #fff; z-index: 1; }
.dt thead th:first-child { background: var(--calque-50); }
.dt tbody tr:last-child td { border-bottom: 0; }
.empty { text-align: center; color: var(--muted); padding: 24px !important; }

/* Phases */
table.dt { min-width: 980px; }
.dt td.ph { text-align: center; min-width: 74px; }
.php { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; font-weight: 700; font-size: .8rem; font-variant-numeric: tabular-nums; }
.php i { display: block; width: 46px; height: 6px; border-radius: 99px; background: var(--calque-100); overflow: hidden; }
.php i b { display: block; height: 100%; background: var(--slate-800); }
.php.done { color: var(--muted); font-weight: 600; }
.php.done i b { background: #8fa3b2; }
.php.zero { color: #b6b9b9; font-weight: 500; }
.php.over { color: var(--c-over); }
.php.over i b { background: var(--c-over); }
.dt .money { white-space: nowrap; font-variant-numeric: tabular-nums; }
.tag-mo { display: inline-block; font-size: .7rem; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: var(--slate-100); color: var(--slate-800); margin-top: 3px; }
.tag-mo.prive { background: #efe9dc; color: #5a4a26; }
@media (max-width: 640px) {
  .c-phases .tscroll { border: 0; overflow: visible; }
  table.dt, .dt tbody, .dt tr, .dt td { display: block; min-width: 0; }
  table.dt { width: 100%; }
  .dt thead, .dt caption { display: none; }
  .dt tbody { display: grid; gap: 10px; }
  .dt tr { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 6px; border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #fff; }
  .dt td { padding: 0; border: 0; text-align: left !important; font-size: .84rem; }
  .dt td:first-child { position: static; background: none; grid-column: 1 / -1; }
  .dt td.ph { text-align: center !important; }
  .dt td[data-l]::before { content: attr(data-l); display: block; font-size: .68rem; font-weight: 700; color: var(--muted); margin-bottom: 2px; }
  .dt td.money { grid-column: span 2; }
  .php i { width: 100%; }
  .php { width: 100%; }
}
.scroller { position: relative; }
.load td, .load th { position: relative; }
.load tbody th { position: sticky; }

.c-ai { align-self: start; }
@media (min-width: 900px) { .pipe-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .pipe-list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.cn { display: block; font-weight: 600; color: var(--slate-900); line-height: 1.3; }
.fict-s { font-weight: 500; color: var(--muted); font-size: .76rem; }
.cs { display: block; font-size: .76rem; color: var(--muted); line-height: 1.35; margin-top: 2px; }
.dt td:first-child { min-width: 250px; }
@media (max-width: 640px) { .dt td:first-child { min-width: 0; } }
.dt td:first-child { min-width: 210px; }
.dt td.ph { min-width: 60px; padding-left: 6px; padding-right: 6px; }
.php i { width: 40px; }
@media (min-width: 641px) { .dt th, .dt td { padding-left: 9px; padding-right: 9px; } }
@media (min-width: 641px) { table.dt { min-width: 940px; } }
@media (max-width: 640px) { .dt td:first-child { min-width: 0; } .php i { width: 100%; } }
@media (max-width: 640px) { .kpi:last-child { grid-column: 1 / -1; } }
