/* EWYB Chantiers — thème sombre monochrome, accent ambre */
:root {
  --bg: #0b0b0d;
  --bg-2: #101013;
  --panel: #141418;
  --panel-2: #1a1a1f;
  --panel-3: #222228;
  --line: #26262d;
  --line-2: #33333b;
  --text: #ecebe8;
  --text-2: #b9b8b4;
  --muted: #85848c;
  --faint: #5d5c64;
  --amber: #e0a03a;
  --amber-2: #f0b552;
  --amber-bg: rgba(224, 160, 58, .12);
  --amber-line: rgba(224, 160, 58, .35);
  --red: #e5534b;
  --red-bg: rgba(229, 83, 75, .12);
  --red-line: rgba(229, 83, 75, .4);
  --green: #57ab5a;
  --green-bg: rgba(87, 171, 90, .12);
  --blue: #6c9ef8;
  --blue-bg: rgba(108, 158, 248, .12);
  --radius: 10px;
  --radius-sm: 7px;
  --sans: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'DM Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --side: 248px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--amber); text-decoration: none; }
a:hover { color: var(--amber-2); }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 17px; }
h3 { font-size: 14px; }
p { margin: 0 0 .6em; }
.mono, .num { font-family: var(--mono); font-feature-settings: 'tnum'; }
.num { white-space: nowrap; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.xs { font-size: 11px; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.pos { color: var(--green); }
.neg { color: var(--red); }
.amber { color: var(--amber); }
.mt { margin-top: 18px; }
.mb { margin-bottom: 18px; }
.mt0 { margin-top: 0; }
.hide { display: none !important; }
.ico { width: 17px; height: 17px; flex: none; }

/* ---------- Sidebar */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--side); background: var(--bg-2); border-right: 1px solid var(--line); display: flex; flex-direction: column; z-index: 40; }
.brand { display: flex; align-items: center; gap: 11px; padding: 18px 18px 14px; color: var(--text); }
.brand:hover { color: var(--text); }
.brand-mark { width: 32px; height: 32px; border-radius: 8px; background: var(--amber); color: #15120b; display: grid; place-items: center; flex: none; }
.brand-mark .ico { width: 19px; height: 19px; stroke-width: 2.2; }
.brand-text { font-size: 15px; line-height: 1.15; }
.brand-text b { font-weight: 700; }
.brand-text small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar nav { flex: 1; overflow-y: auto; padding: 4px 10px 12px; }
.nav-group { margin-top: 14px; }
.nav-title { font: 500 10.5px var(--mono); text-transform: uppercase; letter-spacing: .09em; color: var(--faint); padding: 0 10px 6px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500; }
.nav-link:hover { background: var(--panel-2); color: var(--text); }
.nav-link.active { background: var(--amber-bg); color: var(--amber); box-shadow: inset 2px 0 0 var(--amber); }
.nav-link span { flex: 1; }
.nav-badge { font: normal 500 11px var(--mono); background: var(--red); color: #fff; border-radius: 99px; padding: 0 7px; line-height: 18px; }
.nav-back { display: flex; align-items: center; gap: 8px; padding: 6px 10px; color: var(--muted); font-size: 13px; }
.proj-switch { padding: 6px 4px 0; }
.proj-switch select { width: 100%; font-weight: 600; background: var(--panel-2); }
.side-user { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--panel-3); border: 1px solid var(--line-2); display: grid; place-items: center; font: 500 12px var(--mono); color: var(--amber); flex: none; }
.who { flex: 1; min-width: 0; line-height: 1.2; }
.who b { display: block; font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who small { color: var(--muted); font-size: 11px; }

/* ---------- Main */
.main { margin-left: var(--side); min-height: 100vh; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 18px 28px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: rgba(11, 11, 13, .88); backdrop-filter: blur(10px); z-index: 30; }
.titles { flex: 1; min-width: 0; }
.titles h1 { font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs { font-size: 12px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); }
.crumbs span { color: var(--faint); }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.burger { display: none; }
.content { padding: 22px 28px 60px; max-width: 1480px; width: 100%; }
.content.wide { max-width: none; }
.scrim { display: none; }

/* ---------- Flash */
.flash { margin: 14px 28px 0; padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--panel); }
.flash.ok { border-color: rgba(87,171,90,.4); background: var(--green-bg); }
.flash.bad { border-color: var(--red-line); background: var(--red-bg); }
.flash.warn { border-color: var(--amber-line); background: var(--amber-bg); }
.bare .flash, .bare-card .flash { margin: 0 0 14px; }

/* ---------- Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text); font: 500 13px var(--sans); cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--panel-3); color: var(--text); border-color: #45454f; }
.btn.primary { background: var(--amber); border-color: var(--amber); color: #17130a; font-weight: 600; }
.btn.primary:hover { background: var(--amber-2); border-color: var(--amber-2); color: #17130a; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--panel-2); color: var(--text); }
.btn.danger { color: var(--red); }
.btn.danger:hover { background: var(--red-bg); border-color: var(--red-line); color: var(--red); }
.btn.sm { padding: 5px 9px; font-size: 12px; }
.btn.sm .ico { width: 14px; height: 14px; }
.btn.lg { padding: 11px 18px; font-size: 14px; }
.btn.block { display: flex; width: 100%; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-sm); border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
form.inline { display: inline; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Forms */
input, select, textarea { font: 13.5px var(--sans); color: var(--text); background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 8px 10px; width: 100%; outline: none; transition: border-color .12s, box-shadow .12s; }
input:focus, select:focus, textarea:focus { border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-bg); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--amber); }
input[type=number], input.num { font-family: var(--mono); }
input[type=file] { padding: 6px; }
textarea { min-height: 80px; resize: vertical; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2385848c' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; padding-right: 28px; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--text-2); font-weight: 500; }
label.check { flex-direction: row; align-items: center; gap: 9px; font-size: 13.5px; color: var(--text); cursor: pointer; }
.hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.grid-2, .grid-3, .grid-4 { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-all { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 6px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 16px; margin: 0; }
legend { font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 0 6px; }

/* ---------- Cards / layout */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-width: 0; }
.card + .card { margin-top: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.card.flush .card-head { padding: 14px 18px 0; }
.card-head h3 { flex: 1; font-size: 14px; }
.card-actions { display: flex; gap: 6px; align-items: center; }
.cols { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.cols-12 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.cols-acct { grid-template-columns: minmax(0, 250px) minmax(0, 1fr); }
.cols > .card + .card { margin-top: 0; }
.section-gap { height: 16px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .grow { flex: 1; }
.toolbar input, .toolbar select { width: auto; min-width: 160px; }
.seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; display: inline-flex; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 3px; gap: 2px; }
.seg a, .seg button { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 5px; color: var(--text-2); font: 500 12.5px var(--sans); background: none; border: 0; cursor: pointer; }
.seg a.on, .seg button.on { background: var(--amber-bg); color: var(--amber); }
.seg a:hover, .seg button:hover { color: var(--text); }
.seg .ico { width: 15px; height: 15px; }

/* ---------- KPI */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.kpi .k-label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi .k-val { font: 500 22px/1.2 var(--mono); margin-top: 6px; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .k-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.kpi.accent { border-color: var(--amber-line); }
.kpi.bad { border-color: var(--red-line); background: linear-gradient(180deg, var(--red-bg), transparent 80%), var(--panel); }
.kpi.bad .k-val { color: var(--red); }

/* ---------- Hero chantier */
.hero { background: linear-gradient(135deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 22px; align-items: center; }
.hero .date { font-size: 12.5px; color: var(--muted); display: flex; gap: 10px; align-items: center; }
.hero h2 { font-size: 23px; margin: 6px 0 8px; }
.hero .meta { display: flex; gap: 16px; flex-wrap: wrap; color: var(--text-2); font-size: 13px; }
.hero .meta span { display: inline-flex; gap: 6px; align-items: center; }
.hero .meta .ico { width: 15px; height: 15px; color: var(--muted); }
.ring { width: 96px; height: 96px; position: relative; }
.ring svg { width: 96px; height: 96px; transform: rotate(-90deg); }
.ring b { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; font: 500 19px/1.1 var(--mono); }
.ring b small { font: 400 10px var(--sans); color: var(--muted); }

.loss { margin-top: 16px; border: 1px solid var(--red-line); background: linear-gradient(180deg, rgba(229,83,75,.16), rgba(229,83,75,.06)); border-radius: 12px; padding: 16px 18px; }
.loss .l-title { color: #ff8a83; font-weight: 600; font-size: 13.5px; display: flex; gap: 8px; align-items: center; }
.loss .l-amount { font: 500 34px/1.15 var(--mono); color: var(--red); margin: 4px 0; letter-spacing: -.03em; }
.loss.ok { border-color: rgba(87,171,90,.4); background: linear-gradient(180deg, rgba(87,171,90,.14), rgba(87,171,90,.04)); }
.loss.ok .l-title { color: #8fd18f; }
.loss.ok .l-amount { color: var(--green); }
.loss .l-line { font-size: 13px; color: var(--text-2); }

.alerts { display: flex; flex-direction: column; gap: 8px; }
.alert { display: flex; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--panel-2); font-size: 13px; }
.alert .ico { margin-top: 1px; }
.alert b { font-weight: 600; display: block; }
.alert.bad { border-color: var(--red-line); background: var(--red-bg); }
.alert.bad .ico { color: var(--red); }
.alert.warn { border-color: var(--amber-line); background: var(--amber-bg); }
.alert.warn .ico { color: var(--amber); }
.alert.info .ico { color: var(--blue); }
.pill-warn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--amber-line); background: var(--amber-bg); color: var(--amber); border-radius: 6px; padding: 3px 9px; font-size: 12.5px; margin-top: 8px; }

/* ---------- Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 18px 0 16px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 7px; align-items: center; }
.tabs a.on { color: var(--amber); border-color: var(--amber); }
.tabs a:hover { color: var(--text); }

/* ---------- Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--panel); }
.table td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover td { background: rgba(255,255,255,.015); }
.table tr.group td { background: var(--panel-2); font-weight: 600; color: var(--text); font-size: 12.5px; }
.table tr.total td { font-weight: 600; border-top: 1px solid var(--line-2); background: var(--panel-2); }
.table td.num, .table th.num { text-align: right; }
.table.compact td, .table.compact th { padding: 6px 9px; }
.table .actions { text-align: right; white-space: nowrap; }
.table a.row-link { color: var(--text); font-weight: 500; }
.table a.row-link:hover { color: var(--amber); }
.table input, .table select { padding: 5px 7px; font-size: 13px; }
.table tr.late td:first-child { box-shadow: inset 2px 0 0 var(--red); }
.table tfoot td { font-weight: 600; background: var(--panel-2); }
.card.flush .table th:first-child, .card.flush .table td:first-child { padding-left: 18px; }
.card.flush .table th:last-child, .card.flush .table td:last-child { padding-right: 18px; }
.sticky-head th { position: sticky; top: 0; z-index: 2; }

.badge { display: inline-flex; align-items: center; gap: 5px; font: 500 11.5px var(--sans); padding: 2px 8px; border-radius: 99px; background: var(--panel-3); color: var(--text-2); border: 1px solid var(--line-2); white-space: nowrap; }
.badge.ok { background: var(--green-bg); color: #8fd18f; border-color: rgba(87,171,90,.35); }
.badge.bad { background: var(--red-bg); color: #ff8a83; border-color: var(--red-line); }
.badge.warn { background: var(--amber-bg); color: var(--amber); border-color: var(--amber-line); }
.badge.info { background: var(--blue-bg); color: #9dbdfa; border-color: rgba(108,158,248,.35); }
.badge.mute { color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--muted); }

.pbar { display: inline-block; width: 80px; height: 6px; background: var(--panel-3); border-radius: 99px; overflow: hidden; vertical-align: middle; }
.pbar i { display: block; height: 100%; background: var(--amber); border-radius: 99px; }
.pbar.ok i { background: var(--green); }
.pbar.bad i { background: var(--red); }
.pbar.wide { width: 100%; }

/* Barres budget vs réel */
.bvr { display: grid; gap: 10px; }
.bvr-row { display: grid; grid-template-columns: 150px 1fr 110px; gap: 12px; align-items: center; font-size: 13px; }
.bvr-track { position: relative; height: 22px; background: var(--bg-2); border-radius: 5px; border: 1px solid var(--line); overflow: hidden; }
.bvr-budget { position: absolute; inset: 0 auto 0 0; background: repeating-linear-gradient(135deg, rgba(255,255,255,.06) 0 6px, transparent 6px 12px); border-right: 2px solid var(--text-2); }
.bvr-actual { position: absolute; left: 0; top: 5px; bottom: 5px; background: var(--amber); border-radius: 3px; }
.bvr-actual.over { background: var(--red); }

/* Graphique */
.chart { width: 100%; height: auto; display: block; }
.chart text { font: 10.5px var(--mono); fill: var(--muted); }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

/* ---------- Empty states */
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty h2 { color: var(--text); margin-bottom: 6px; }
.empty .btn { margin-top: 12px; }

/* ---------- Modal */
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line-2); border-radius: 14px; padding: 0; width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 40px); box-shadow: 0 30px 80px rgba(0,0,0,.6); }
dialog::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(2px); }
dialog .m-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
dialog .m-head h3 { flex: 1; font-size: 15px; }
dialog .m-body { padding: 18px 20px; overflow-y: auto; }
dialog .m-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); }
dialog.lg { width: min(900px, calc(100vw - 32px)); }

/* ---------- Gantt */
.gantt { display: grid; grid-template-columns: minmax(420px, 520px) 1fr; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.g-left { border-right: 1px solid var(--line); overflow: hidden; }
.g-right { overflow-x: auto; position: relative; }
.g-row { height: 36px; display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.g-head { height: 50px; position: sticky; top: 0; background: var(--panel-2); z-index: 3; }
.g-left .g-row { display: grid; grid-template-columns: minmax(0, 1fr) 70px 86px 86px; gap: 0; padding: 0 0 0 14px; font-size: 12.5px; }
.g-left .g-row > div { padding-right: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-left .g-head > div { font: 500 10.5px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.g-left .g-group { background: var(--panel-2); font-weight: 600; cursor: pointer; }
.g-left .g-task { cursor: pointer; }
.g-left .g-task:hover { background: rgba(255,255,255,.02); }
.g-left .g-task .tname { padding-left: 14px; }
.g-left .late .tname { color: #ff8a83; }
.g-right .g-row { position: relative; }
.g-group-band { background: var(--panel-2); }
.g-scale { display: flex; height: 50px; flex-direction: column; position: sticky; top: 0; background: var(--panel-2); z-index: 3; border-bottom: 1px solid var(--line); }
.g-months, .g-days { display: flex; height: 25px; }
.g-months div { border-right: 1px solid var(--line); font: 500 11px var(--mono); color: var(--text-2); padding: 5px 6px; white-space: nowrap; overflow: hidden; text-transform: capitalize; }
.g-days div { border-right: 1px solid var(--line); font: 10.5px var(--mono); color: var(--muted); text-align: center; padding-top: 5px; }
.g-days div.we { background: rgba(255,255,255,.025); }
.g-grid { position: absolute; inset: 50px 0 0 0; pointer-events: none; display: flex; }
.g-grid div { border-right: 1px solid rgba(255,255,255,.03); height: 100%; }
.g-grid div.we { background: rgba(255,255,255,.02); }
.g-today { position: absolute; top: 50px; bottom: 0; width: 2px; background: var(--red); opacity: .8; z-index: 2; pointer-events: none; }
.g-bar { position: absolute; top: 8px; height: 20px; border-radius: 5px; background: #2d4a7a; border: 1px solid #4a6fae; cursor: grab; overflow: hidden; z-index: 1; user-select: none; }
.g-bar .fill { position: absolute; inset: 0 auto 0 0; background: var(--blue); opacity: .85; }
.g-bar .lbl { position: relative; font-size: 11px; padding: 0 7px; line-height: 18px; white-space: nowrap; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.g-bar.done { background: #284a2c; border-color: #3f7a44; }
.g-bar.done .fill { background: var(--green); }
.g-bar.late { background: #5a2523; border-color: var(--red); }
.g-bar.late .fill { background: var(--red); }
.g-bar.ms { width: 16px !important; height: 16px; top: 10px; transform: rotate(45deg); border-radius: 3px; background: var(--amber); border-color: var(--amber); }
.g-bar .rh { position: absolute; right: 0; top: 0; bottom: 0; width: 7px; cursor: ew-resize; }
.g-base { position: absolute; top: 29px; height: 4px; background: var(--faint); border-radius: 2px; opacity: .8; }
.g-dragging { cursor: grabbing !important; opacity: .85; }
.g-sum { position: absolute; top: 14px; height: 8px; background: var(--text-2); border-radius: 2px; opacity: .5; }

/* ---------- Timesheet grid */
.ts input { width: 62px; text-align: center; font-family: var(--mono); padding: 5px 4px; }
.ts td.we, .ts th.we { background: rgba(255,255,255,.02); }
.ts td.tot { font-family: var(--mono); text-align: right; }

/* ---------- Todo */
.todo-item { display: flex; gap: 12px; align-items: flex-start; padding: 11px 16px; border-bottom: 1px solid var(--line); }
.todo-item:last-child { border-bottom: 0; }
.todo-item .t-main { flex: 1; min-width: 0; }
.todo-item .t-title { font-weight: 500; }
.todo-item.done .t-title { text-decoration: line-through; color: var(--muted); }
.todo-item .t-meta { font-size: 12px; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; margin-top: 2px; }
.chk { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--line-2); background: transparent; cursor: pointer; display: grid; place-items: center; color: transparent; flex: none; margin-top: 1px; padding: 0; }
.chk:hover { border-color: var(--amber); }
.chk.on { background: var(--amber); border-color: var(--amber); color: #17130a; }
.chk .ico { width: 13px; height: 13px; stroke-width: 3; }

/* ---------- Documents */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.doc { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.doc .thumb { height: 120px; background: var(--bg-2); display: grid; place-items: center; color: var(--faint); overflow: hidden; }
.doc .thumb img { width: 100%; height: 100%; object-fit: cover; }
.doc .thumb .ext { font: 500 18px var(--mono); color: var(--muted); }
.doc .d-body { padding: 9px 11px; font-size: 12.5px; flex: 1; }
.doc .d-body b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc .d-foot { display: flex; justify-content: space-between; align-items: center; padding: 0 6px 6px 11px; }

/* ---------- Journal */
.log { border-left: 2px solid var(--line-2); padding: 0 0 18px 18px; position: relative; }
.log::before { content: ''; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--amber); }
.log .l-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.log .l-head b { font-weight: 600; }

/* ---------- Bare pages */
body.bare { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(circle at 50% -20%, rgba(224,160,58,.13), transparent 55%), var(--bg); }
.bare-wrap { width: min(460px, calc(100vw - 32px)); padding: 40px 0; }
.bare-wrap:has(.wide) { width: min(640px, calc(100vw - 32px)); }
.bare-brand { display: flex; align-items: center; gap: 10px; justify-content: center; font-size: 17px; margin-bottom: 22px; }
.bare-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.bare-card h1 { font-size: 22px; }
.bare-card .btn .ico { width: 18px; height: 18px; }
.sep { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 12px; }
.sep::before, .sep::after { content: ''; flex: 1; height: 1px; background: var(--line); }
details summary { cursor: pointer; }
.wizard { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 6px; counter-reset: s; }
.wizard li { flex: 1; font-size: 11.5px; color: var(--faint); border-top: 3px solid var(--line-2); padding-top: 7px; counter-increment: s; }
.wizard li::before { content: counter(s) ' · '; font-family: var(--mono); }
.wizard li.done { color: var(--muted); border-color: var(--amber-line); }
.wizard li.cur { color: var(--amber); border-color: var(--amber); }

/* ---------- Document (devis / facture) écran */
.paper { background: #fbfaf7; color: #1d1c1a; border-radius: 6px; padding: 44px 48px; max-width: 900px; margin: 0 auto; font-size: 12.5px; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.paper h1 { font-size: 22px; letter-spacing: .02em; }
.paper .p-head { display: flex; justify-content: space-between; gap: 30px; margin-bottom: 26px; }
.paper .p-company b { font-size: 16px; }
.paper .p-client { border: 1px solid #ddd8cf; border-radius: 6px; padding: 12px 16px; min-width: 260px; }
.paper .p-meta { display: flex; gap: 26px; margin: 4px 0 20px; color: #555; flex-wrap: wrap; }
.paper .p-meta b { color: #1d1c1a; }
.paper table { width: 100%; border-collapse: collapse; }
.paper th { text-align: left; font: 600 10.5px var(--mono); text-transform: uppercase; letter-spacing: .05em; color: #6b675f; border-bottom: 1.5px solid #1d1c1a; padding: 6px 6px; }
.paper td { padding: 6px; border-bottom: 1px solid #e6e2da; vertical-align: top; }
.paper td.num, .paper th.num { text-align: right; font-family: var(--mono); white-space: nowrap; }
.paper tr.lot td { font-weight: 700; background: #f1eee7; }
.paper .p-totals { margin-left: auto; width: 330px; margin-top: 16px; }
.paper .p-totals td { border: 0; padding: 4px 6px; }
.paper .p-totals tr.grand td { border-top: 1.5px solid #1d1c1a; font-weight: 700; font-size: 14px; padding-top: 8px; }
.paper .p-foot { margin-top: 28px; font-size: 10.5px; color: #6b675f; border-top: 1px solid #e6e2da; padding-top: 12px; }
.paper .p-sign { display: flex; gap: 20px; margin-top: 26px; }
.paper .p-sign div { flex: 1; border: 1px dashed #c9c3b8; border-radius: 6px; height: 110px; padding: 10px; color: #6b675f; font-size: 11px; }
.paper .accent { color: #b97a14; }

@media print {
  @page { margin: 12mm; }
  body { background: #fff; }
  .sidebar, .topbar, .flash, .no-print, .scrim { display: none !important; }
  .main { margin: 0; }
  .content { padding: 0; max-width: none; }
  .paper { box-shadow: none; padding: 0; max-width: none; border-radius: 0; }
}

/* ---------- Responsive */
@media (max-width: 1100px) {
  .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-21, .cols-12 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 35; }
  .main { margin-left: 0; }
  .burger { display: inline-grid; }
  .topbar { padding: 12px 16px; flex-wrap: wrap; }
  .content { padding: 16px 16px 50px; }
  .flash { margin: 12px 16px 0; }
  .cols-2, .cols-3, .grid-3, .grid-4, .cols-acct { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .span-2, .span-3 { grid-column: auto; }
  .hero { grid-template-columns: 1fr; }
  .gantt { grid-template-columns: 1fr; }
  .g-left { display: none; }
  .bvr-row { grid-template-columns: 96px minmax(0,1fr) auto; }
  .bvr-row .faint { display: none; }
  .toolbar input, .toolbar select { min-width: 0; flex: 1 1 140px; }
  .seg a, .seg button { white-space: nowrap; }
  .paper { padding: 22px 18px; }
  .paper .p-head { flex-direction: column; }
}

/* Séries de graphiques (validées CVD sur fond sombre) */
:root { --s1: #c08327; --s2: #5a86d6; }
.tip { position: fixed; z-index: 100; pointer-events: none; background: var(--panel-3); border: 1px solid var(--line-2); border-radius: 7px; padding: 7px 10px; font-size: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.5); white-space: pre; }
.tip b { font-weight: 600; }
.chart .hit:hover ~ rect, .chart g.col:hover rect.bar { opacity: 1; }
.chart g.col rect.bar { opacity: .92; }
.chart g.col:hover rect.hitbox { fill: rgba(255,255,255,.04); }
.table td.name-col { min-width: 230px; }

/* ---------- Boutons de connexion aux chartes Google / Microsoft / Facebook */
.plogo { width: 16px; height: 16px; vertical-align: -3px; flex: none; }
.card-head h3 .plogo { width: 18px; height: 18px; }
label.check .hint { display: block; }
.pbtns { display: flex; flex-direction: column; gap: 10px; }
.pbtn { display: flex; align-items: center; justify-content: center; gap: 12px; height: 44px; padding: 0 16px; border-radius: 6px; text-decoration: none; font-size: 15px; transition: filter .12s, box-shadow .12s; position: relative; }
.pbtn:hover { filter: brightness(1.08); }
.pbtn:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.pbtn .plogo { width: 20px; height: 20px; flex: none; position: absolute; left: 14px; }
/* Google — thème sombre officiel (Roboto Medium, fond #131314, bordure #8E918F) */
.pbtn-google { background: #131314; color: #E3E3E3; border: 1px solid #8E918F; font: 500 14px 'Roboto', Arial, sans-serif; letter-spacing: .25px; border-radius: 20px; }
.pbtn-google:hover { color: #E3E3E3; background: #1f1f20; filter: none; }
/* Microsoft — thème sombre officiel (Segoe UI Semibold, fond #2F2F2F) */
.pbtn-microsoft { background: #2F2F2F; color: #FFFFFF; border: 1px solid #2F2F2F; font: 600 15px 'Segoe UI', 'Segoe UI Web (West European)', -apple-system, Helvetica, Arial, sans-serif; border-radius: 0; }
.pbtn-microsoft:hover { color: #fff; background: #3a3a3a; filter: none; }
/* Facebook — bleu officiel #1877F2, logo « f » blanc */
.pbtn-facebook { background: #1877F2; color: #FFFFFF; border: 1px solid #1877F2; font: 700 15px Helvetica, Arial, sans-serif; }
.pbtn-facebook:hover { color: #fff; }
.pbtn-facebook .plogo { width: 22px; height: 22px; }
/* Pastilles de comptes liés */
.idchip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px 3px 6px; border-radius: 99px; background: var(--panel-3); border: 1px solid var(--line-2); font-size: 12px; }
.idchip .plogo { width: 14px; height: 14px; position: static; }
.idchip.facebook { background: #1877F2; border-color: #1877F2; color: #fff; }
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar.lg { width: 72px; height: 72px; font-size: 22px; }
.subnav { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.subnav a { padding: 9px 13px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 7px; align-items: center; }
.subnav a.on { color: var(--amber); border-color: var(--amber); }
.subnav a:hover { color: var(--text); }
.subnav .ico { width: 15px; height: 15px; }
.kv { display: grid; grid-template-columns: 180px 1fr; gap: 8px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.copy { cursor: pointer; }
.copy:hover { color: var(--amber); }
.sess { display: flex; gap: 12px; align-items: center; padding: 11px 16px; border-bottom: 1px solid var(--line); }
.sess:last-child { border-bottom: 0; }
.sess .ico { width: 22px; height: 22px; color: var(--muted); }
.cols-tpl { grid-template-columns: minmax(0, 240px) minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .cols-tpl { grid-template-columns: 1fr; } }
