/* DANSIRA BUILD — feuille de style */
:root {
  --navy: #1B3A5C; --navy-2: #0F2338; --blue: #2E5F8A; --blue-2: #3A7CB5;
  --gold: #C9A84C; --gold-2: #E2B86A; --gold-ink: #7A6114;
  --ink: #1F2D3A; --ink-2: #4A5B6B; --muted: #7D8FA0;
  --bg: #F3F5F8; --surface: #FFFFFF; --line: #E2E8EF; --line-2: #EEF2F6;
  --green: #1A7A42; --green-bg: #E3F3EA; --orange: #B5620E; --orange-bg: #FCEEDC;
  --red: #A1281C; --red-bg: #FBE7E4; --blue-bg: #E4EEF7;
  --r: 8px; --r-lg: 12px;
  --shadow: 0 1px 2px rgba(16,35,56,.06), 0 4px 14px rgba(16,35,56,.05);
  --serif: "Book Antiqua", Palatino, "Palatino Linotype", Georgia, serif;
  --sans: "Segoe UI", Calibri, Candara, "Helvetica Neue", Arial, system-ui, sans-serif;
  --sidebar: 248px;
}
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 14px; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--sans); color: var(--ink); background: var(--bg); line-height: 1.5; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--serif); color: var(--navy); margin: 0; font-weight: 700; letter-spacing: -.005em; }
h1 { font-size: 1.75rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.02rem; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); } .small { font-size: .88rem; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

/* ---------- Coquille ---------- */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: var(--navy-2); color: #fff; display: flex; flex-direction: column; z-index: 40; }
.brand { display: block; font-family: var(--serif); font-weight: 700; font-size: 1.35rem; color: #fff; padding: 20px 20px 2px; letter-spacing: .02em; }
.brand:hover { text-decoration: none; }
.brand span { color: var(--gold); }
.brand.big { font-size: 2rem; padding: 0; }
.org { padding: 0 20px 14px; font-size: .82rem; color: rgba(255,255,255,.5); border-bottom: 1px solid rgba(255,255,255,.07); }
.sidebar nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.nav-section { font-size: .68rem; text-transform: uppercase; letter-spacing: .14em; color: rgba(255,255,255,.32); padding: 14px 20px 4px; font-weight: 700; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 8px 20px; color: rgba(255,255,255,.66); border-left: 3px solid transparent; font-size: .95rem; }
.nav-item:hover { background: rgba(255,255,255,.05); color: #fff; text-decoration: none; }
.nav-item.active { background: rgba(58,124,181,.28); color: #fff; border-left-color: var(--gold); }
.me { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.07); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--blue); display: grid; place-items: center; font-weight: 700; font-size: .8rem; }
.me-txt { flex: 1; min-width: 0; line-height: 1.25; }
.me-txt strong { display: block; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-txt small { color: rgba(255,255,255,.45); font-size: .74rem; }
.icon-btn { background: none; border: 0; color: inherit; cursor: pointer; padding: 6px; border-radius: 6px; opacity: .65; display: inline-grid; place-items: center; }
.icon-btn:hover { opacity: 1; background: rgba(127,127,127,.12); }
.main { margin-left: var(--sidebar); min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 30; height: 60px; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; padding: 0 28px; }
.menu-btn { display: none; color: var(--navy); }
.project-switch { display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: 0 4px 0 12px; max-width: 520px; flex: 1; }
.project-switch .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.project-switch select { border: 0; background: transparent; font: inherit; font-weight: 600; color: var(--navy); padding: 9px 4px; width: 100%; cursor: pointer; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.link-muted { color: var(--ink-2); font-size: .9rem; }
.content { padding: 28px; max-width: 1440px; }
.scrim { display: none; }

/* ---------- Éléments ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); margin-bottom: 22px; }
.card.narrow { max-width: 520px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 20px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.card-body { padding: 20px; }
.card-body.flush { padding: 0; overflow-x: auto; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.cols { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 22px; align-items: start; }
.stack > * + * { margin-top: 14px; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; box-shadow: var(--shadow); border-top: 3px solid var(--navy); }
.kpi.gold { border-top-color: var(--gold); } .kpi.green { border-top-color: var(--green); } .kpi.orange { border-top-color: var(--orange); } .kpi.red { border-top-color: var(--red); }
.kpi-label { font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.kpi-value { font-family: var(--serif); font-size: 1.9rem; font-weight: 700; color: var(--navy); line-height: 1.15; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: .95rem; color: var(--muted); font-family: var(--sans); font-weight: 600; }
.kpi-sub { font-size: .84rem; color: var(--ink-2); }

.btn { display: inline-flex; align-items: center; gap: 7px; font: inherit; font-weight: 600; font-size: .92rem; padding: 8px 15px; border-radius: var(--r); border: 1px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap; line-height: 1.3; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--navy); color: #fff; } .btn-primary:hover { background: var(--blue); }
.btn-gold { background: var(--gold); color: var(--navy-2); } .btn-gold:hover { background: var(--gold-2); }
.btn-ghost { background: var(--surface); color: var(--ink-2); border-color: var(--line); } .btn-ghost:hover { background: var(--bg); color: var(--navy); }
.btn-danger { background: var(--surface); color: var(--red); border-color: #EAC3BE; } .btn-danger:hover { background: var(--red-bg); }
.btn-sm { padding: 5px 10px; font-size: .84rem; }
.btn-block { width: 100%; justify-content: center; padding: 11px; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--blue-2); outline-offset: 2px; }

.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: .78rem; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: .05em; }
.field small { color: var(--muted); font-size: .8rem; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid #D3DCE5; border-radius: var(--r); padding: 9px 11px; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--blue-2); outline: none; }
textarea { min-height: 84px; resize: vertical; }
input[type=checkbox] { width: auto; accent-color: var(--navy); }
input[type=range] { padding: 0; accent-color: var(--navy); border: 0; }
.check { display: flex; align-items: center; gap: 8px; font-size: .92rem; cursor: pointer; }
.actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 6px; }
fieldset { border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; margin: 0; }
legend { font-family: var(--serif); font-weight: 700; color: var(--navy); padding: 0 6px; }
.trades { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 14px; }
.trades h4 { grid-column: 1 / -1; margin: 10px 0 0; font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); background: #F7F9FB; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 10px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.data tr:hover td { background: #FAFBFD; }
table.data tr.group td { background: #F3F6F9; font-weight: 700; color: var(--navy); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }
table.data tr.total td { background: var(--navy); color: #fff; font-weight: 700; }
table.data tr.alert td:first-child { box-shadow: inset 3px 0 0 var(--red); }
table.data tr.warn td:first-child { box-shadow: inset 3px 0 0 var(--gold); }
table.data th.num { text-align: right; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.pill-green { background: var(--green-bg); color: var(--green); }
.pill-blue { background: var(--blue-bg); color: var(--blue); }
.pill-gold { background: #F7EFD8; color: var(--gold-ink); }
.pill-gray { background: var(--line-2); color: var(--ink-2); }
.pill-red { background: var(--red-bg); color: var(--red); }
.pill-orange { background: var(--orange-bg); color: var(--orange); }

.bar { height: 8px; background: var(--line-2); border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 4px; background: var(--blue); }
.bar.ok > i { background: var(--green); } .bar.low > i { background: var(--gold); } .bar.none > i { background: transparent; }
.prog { margin-bottom: 12px; }
.prog-head { display: flex; justify-content: space-between; gap: 10px; font-size: .9rem; margin-bottom: 4px; }
.prog-head strong { font-variant-numeric: tabular-nums; }
.group-label { font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--navy); border-bottom: 2px solid var(--gold); padding-bottom: 4px; margin: 16px 0 10px; }
.group-label:first-child { margin-top: 0; }

.alert { display: flex; gap: 12px; padding: 11px 14px; border-radius: var(--r); border-left: 3px solid; margin-bottom: 10px; }
.alert.crit { background: var(--red-bg); border-color: var(--red); }
.alert.warn { background: var(--orange-bg); border-color: var(--orange); }
.alert.info { background: var(--blue-bg); border-color: var(--blue); }
.alert.ok { background: var(--green-bg); border-color: var(--green); }
.alert strong { display: block; color: var(--ink); }
.alert span { font-size: .88rem; color: var(--ink-2); }
.flash { padding: 11px 16px; border-radius: var(--r); margin-bottom: 18px; font-weight: 600; border: 1px solid; }
.flash-success { background: var(--green-bg); color: var(--green); border-color: #BFE0CC; }
.flash-error { background: var(--red-bg); color: var(--red); border-color: #EAC3BE; }
.flash-info { background: var(--blue-bg); color: var(--blue); border-color: #C6D9EA; }
.flash-secret { background: #FFF8E6; color: var(--gold-ink); border-color: #EAD9A6; }

.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty.big { padding: 80px 20px; }
.empty .code { font-family: var(--serif); font-size: 4rem; color: var(--gold); font-weight: 700; line-height: 1; }
.empty h1 { margin: 10px 0 6px; }
.empty .btn { margin-top: 18px; }

/* ---------- Cycle d'étages ---------- */
.phase-bar { position: relative; height: 22px; background: var(--line-2); border-radius: 4px; overflow: hidden; min-width: 78px; }
.phase-bar i { position: absolute; inset: 0 auto 0 0; }
.phase-bar b { position: relative; display: block; text-align: center; font-size: .78rem; line-height: 22px; font-variant-numeric: tabular-nums; }
.ph-coffrage i { background: #A9BCCD; } .ph-ferraillage i { background: #E2C984; } .ph-coulage i { background: #8DB4D8; } .ph-decoffrage i { background: #9CCDB0; }
.legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: .86rem; color: var(--ink-2); align-items: center; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.level { font-family: var(--serif); font-weight: 700; color: var(--navy); font-size: 1.02rem; }
.score { font-weight: 700; font-variant-numeric: tabular-nums; padding: 3px 10px; border-radius: 12px; display: inline-block; min-width: 54px; text-align: center; }
.score.done { background: var(--green-bg); color: var(--green); } .score.doing { background: var(--blue-bg); color: var(--blue); }
.score.todo { background: var(--line-2); color: var(--ink-2); } .score.blocked { background: var(--red-bg); color: var(--red); }
.recon { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.recon > div { background: var(--bg); border-radius: var(--r); padding: 14px 16px; border-left: 3px solid var(--blue); }
.recon .v { font-family: var(--serif); font-size: 1.6rem; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.slider-row { display: grid; grid-template-columns: 150px 1fr 56px; gap: 14px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.slider-row output { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; color: var(--navy); }
.total-box { background: linear-gradient(135deg, var(--navy), var(--blue)); color: #fff; border-radius: var(--r); padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }
.total-box output { font-family: var(--serif); font-size: 2rem; font-weight: 700; }

/* ---------- Protocole ---------- */
.phase { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); margin-bottom: 14px; overflow: hidden; box-shadow: var(--shadow); }
.phase > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 14px; padding: 14px 18px; }
.phase > summary::-webkit-details-marker { display: none; }
.phase-strip { width: 5px; align-self: stretch; border-radius: 3px; }
.phase-info { flex: 1; }
.phase-meta { font-size: .84rem; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; margin-top: 2px; }
.task { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 14px; padding: 12px 18px; border-top: 1px solid var(--line-2); align-items: start; }
.task.crit { box-shadow: inset 3px 0 0 #C0392B; }
.task.locked { opacity: .62; }
.task-code { font-weight: 700; font-size: .78rem; color: #fff; border-radius: 6px; padding: 4px 0; text-align: center; margin-top: 2px; }
.task-name { font-weight: 600; }
.task-meta { font-size: .82rem; color: var(--muted); margin-top: 3px; display: flex; gap: 12px; flex-wrap: wrap; }
.task form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.task form select { width: auto; padding: 5px 8px; font-size: .86rem; }
.task form input[type=number] { width: 72px; padding: 5px 8px; font-size: .86rem; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.filters a { padding: 6px 12px; border-radius: 20px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: .86rem; font-weight: 600; }
.filters a.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.filters a:hover { text-decoration: none; }

/* ---------- Projets ---------- */
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 18px; }
.proj { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.proj.current { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(201,168,76,.35); }
.proj-top { height: 5px; }
.proj-body { padding: 16px 18px; flex: 1; }
.proj-body h3 { font-size: 1.15rem; }
.kv { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line-2); font-size: .9rem; }
.kv span { color: var(--muted); }
.proj-foot { display: flex; gap: 8px; padding: 12px 18px; background: #F7F9FB; border-top: 1px solid var(--line-2); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 14px 20px; border-bottom: 1px solid var(--line-2); }
.timeline li:last-child { border-bottom: 0; }

/* ---------- Pages publiques ---------- */
.public-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.public-side { background: var(--navy-2); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: center; position: relative; }
.public-side::after { content: ""; position: absolute; inset: auto 0 0 0; height: 4px; background: linear-gradient(90deg, var(--navy), var(--gold), var(--blue)); }
.tagline { font-family: var(--serif); font-size: 1.45rem; line-height: 1.35; margin: 22px 0 26px; max-width: 30ch; color: rgba(255,255,255,.92); }
.selling { list-style: none; padding: 0; margin: 0; }
.selling li { padding: 9px 0 9px 26px; position: relative; color: rgba(255,255,255,.72); border-bottom: 1px solid rgba(255,255,255,.07); }
.selling li::before { content: ""; position: absolute; left: 0; top: 16px; width: 12px; height: 2px; background: var(--gold); }
.foot { margin-top: auto; padding-top: 40px; font-size: .84rem; color: rgba(255,255,255,.4); }
.public-main { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 460px; }
.auth-card h1 { font-size: 2rem; }
.auth-card .muted { margin: 6px 0 24px; }
.auth-alt { margin-top: 22px; color: var(--ink-2); text-align: center; }
.public-main .flash { width: 100%; max-width: 460px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .cols { grid-template-columns: 1fr; }
  .trades { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 35; }
  .main { margin-left: 0; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 0 14px; }
  .content { padding: 18px 14px; }
  .topbar-right .link-muted { display: none; }
  .grid-2, .grid-3, .recon { grid-template-columns: 1fr; }
  .public-wrap { grid-template-columns: 1fr; }
  .public-side { padding: 32px 24px; }
  .selling, .foot { display: none; }
  .tagline { margin-bottom: 0; font-size: 1.15rem; }
  .task { grid-template-columns: 44px 1fr; }
  .task form { grid-column: 1 / -1; justify-content: flex-start; }
  .slider-row { grid-template-columns: 1fr 56px; }
  .slider-row label { grid-column: 1 / -1; }
}
@media (max-width: 520px) { .kpis { grid-template-columns: 1fr; } .trades { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print { .sidebar, .topbar, .actions, .btn { display: none !important; } .main { margin: 0; } }
