/* =========================================================
   PHOENIX INVEST — Back-office (asset management)
   Charte PAM : brun profond, or, crème
   ========================================================= */

body.admin {
  background: var(--cream-100);
  padding-bottom: 0;
}

/* ---------- Coque ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }

.side {
  background: linear-gradient(178deg, var(--brown-950), #25120A 60%, #1E0E06);
  color: #F7EDE2;
  display: flex; flex-direction: column;
  padding: 22px 16px 18px;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
}
.side::-webkit-scrollbar { width: 6px; }
.side::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 3px; }

.side-brand { position: relative; display: flex; gap: 11px; align-items: center; padding: 0 6px 18px; margin-bottom: 8px; border-bottom: 1px solid rgba(246,231,200,.14); }
.side-brand .mark {
  width: 40px; height: 40px; border-radius: 10px; background: var(--cream); flex: none;
  display: grid; place-items: center; overflow: hidden;
  box-shadow: 0 4px 14px -6px rgba(0,0,0,.5);
}
.side-brand .mark img { width: 32px; height: 32px; object-fit: contain; }
.side-brand strong { display: block; font-size: 13.5px; letter-spacing: .01em; }
.side-brand em { display: block; font-style: normal; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: rgba(246,231,200,.55); margin-top: 2px; }

.side-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; }
.side-nav .grp {
  font-size: 10px; letter-spacing: .16em; text-transform: uppercase;
  color: rgba(246,231,200,.38); padding: 16px 10px 7px; font-weight: 600;
}
.side-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 9px;
  color: rgba(247,237,226,.78); font-size: 13px; text-decoration: none;
  transition: background .15s, color .15s;
  position: relative;
}
.side-link svg { opacity: .7; flex: none; }
.side-link:hover { background: rgba(246,231,200,.07); color: #fff; }
.side-link.active { background: rgba(205,160,67,.16); color: #FBF3E4; }
.side-link.active::before {
  content: ""; position: absolute; left: -16px; top: 9px; bottom: 9px; width: 3px;
  background: var(--gold); border-radius: 0 3px 3px 0;
}
.side-link.active svg { opacity: 1; color: var(--gold-300); }
.side-link .count {
  margin-left: auto; font-size: 10.5px; font-weight: 600;
  background: var(--terracotta); color: #fff; border-radius: 999px;
  padding: 1px 6px; min-width: 18px; text-align: center;
}
.side-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid rgba(246,231,200,.14); }
.side-user { display: flex; align-items: center; gap: 10px; padding: 6px; }
.side-user .av {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: rgba(205,160,67,.22); color: var(--gold-300);
  display: grid; place-items: center; font-size: 11.5px; font-weight: 600;
}
.side-user .nm { font-size: 12.5px; line-height: 1.3; }
.side-user .rl { font-size: 10.5px; color: rgba(246,231,200,.5); }
.side-demo { margin: 12px 6px 0; font-size: 10.5px; line-height: 1.45; color: rgba(246,231,200,.42); }
.side-demo b { color: var(--gold-300); font-weight: 600; }

/* ---------- Zone principale ---------- */
.main { min-width: 0; display: flex; flex-direction: column; }

.top {
  position: sticky; top: 0; z-index: 20;
  background: rgba(254,250,248,.88);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 0 30px;
  height: 66px;
  display: flex; align-items: center; gap: 18px;
}
.top .crumb { font-size: 12px; color: var(--muted); }
.top .crumb b { color: var(--ink); font-weight: 600; }
.top .spacer { flex: 1; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-soft); display: grid; place-items: center;
  cursor: pointer; position: relative; transition: .15s;
}
.icon-btn:hover { border-color: var(--brown-500); color: var(--brown); }
.icon-btn .dot-n {
  position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; border-radius: 8px;
  background: var(--terracotta); color: #fff; font-size: 9.5px; font-weight: 700;
  display: grid; place-items: center; padding: 0 4px; border: 2px solid var(--cream);
}
.who { display: flex; align-items: center; gap: 9px; padding-left: 12px; margin-left: 4px; border-left: 1px solid var(--line); }
.who .av { width: 30px; height: 30px; border-radius: 50%; background: var(--brown); color: var(--gold-100); display: grid; place-items: center; font-size: 11px; font-weight: 600; }
.who .nm { font-size: 12.5px; font-weight: 500; line-height: 1.2; }
.who .rl { font-size: 10.5px; color: var(--muted); }

.page { padding: 26px 30px 60px; max-width: 1380px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 27px; }
.page-head .sub { font-size: 13px; color: var(--muted); margin-top: 5px; }
.head-act { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 18px; }
.kpi {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 15px 16px 14px; position: relative; overflow: hidden;
}
.kpi::after {
  content: ""; position: absolute; inset: auto -20px -30px auto; width: 90px; height: 90px;
  border-radius: 50%; background: radial-gradient(circle, rgba(205,160,67,.10), transparent 70%);
}
.kpi .lb { font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.kpi .vl { font-family: var(--serif); font-size: 25px; font-weight: 600; margin: 6px 0 2px; letter-spacing: -.02em; }
.kpi .vl small { font-family: var(--sans); font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi .dl { font-size: 11.5px; display: flex; align-items: center; gap: 5px; color: var(--muted); }
.kpi .dl.up { color: var(--success); }
.kpi .dl.down { color: var(--danger); }

/* ---------- Panneaux ---------- */
.panels { display: grid; grid-template-columns: minmax(0,1.55fr) minmax(0,1fr); gap: 16px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); display: flex; flex-direction: column; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.panel-head h3 { font-family: var(--serif); font-size: 16px; font-weight: 600; }
.panel-head .acts { display: flex; gap: 6px; align-items: center; }
.panel-body { padding: 16px; flex: 1; min-width: 0; }
.panel-body.tight { padding: 0; }
.panel-foot { padding: 11px 16px; border-top: 1px solid var(--line-soft); font-size: 12px; }

/* ---------- Barres de répartition ---------- */
.bars { display: flex; flex-direction: column; gap: 13px; }
.bar-row .top-l { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 5px; }
.bar-row .top-l b { font-weight: 500; }
.bar-row .top-l span { color: var(--muted); font-variant-numeric: tabular-nums; }
.bar-track { height: 7px; border-radius: 4px; background: var(--cream-200); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--brown-600), var(--gold)); }

/* ---------- Liste d'alertes ---------- */
.alerts { display: flex; flex-direction: column; }
.alert-item { display: flex; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); text-decoration: none; color: inherit; }
.alert-item:last-child { border-bottom: 0; }
.alert-item:hover { background: var(--cream-50); }
.alert-item .sev { width: 3px; border-radius: 2px; flex: none; background: var(--line); }
.alert-item .sev.eleve { background: var(--danger); }
.alert-item .sev.moyen { background: var(--warn); }
.alert-item .sev.faible { background: var(--info); }
.alert-item .txt { min-width: 0; }
.alert-item .txt b { display: block; font-size: 12.5px; font-weight: 500; }
.alert-item .txt p { margin: 2px 0 0; font-size: 11.5px; color: var(--muted); line-height: 1.45; }
.alert-item .when { margin-left: auto; font-size: 10.5px; color: var(--muted-2); white-space: nowrap; }

/* ---------- Barre d'outils de table ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .search { flex: 1; min-width: 220px; max-width: 380px; }
.seg { display: inline-flex; background: var(--cream-100); border: 1px solid var(--line); padding: 3px; border-radius: var(--r-full); gap: 2px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button {
  border: 0; background: none; padding: 6px 12px; border-radius: var(--r-full);
  font: inherit; font-size: 12px; color: var(--ink-soft); cursor: pointer; white-space: nowrap;
}
.seg button.on { background: #fff; color: var(--brown); box-shadow: var(--sh-1); font-weight: 600; }

.tbl-card { background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.tbl-card .table-wrap { border-radius: 0; }
table.tbl th { background: var(--cream-50); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; }
table.tbl td { font-size: 12.5px; padding: 11px 12px; }
.ident-cell { display: flex; align-items: center; gap: 9px; }
.av-s { width: 27px; height: 27px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: 600; background: var(--cream-200); color: var(--brown); flex: none; }
.av-s.org { border-radius: 7px; }
.two-l { line-height: 1.25; }
.two-l b { display: block; font-weight: 500; font-size: 12.5px; }
.two-l span { font-size: 11px; color: var(--muted); }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-top: 1px solid var(--line-soft); font-size: 11.5px; color: var(--muted); }

/* ---------- Fiche détail ---------- */
.dgrid { display: grid; grid-template-columns: minmax(0,1.6fr) minmax(0,1fr); gap: 16px; align-items: start; }
.dl { display: grid; grid-template-columns: 128px minmax(0,1fr); gap: 9px 14px; font-size: 12.5px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 500; }
.timeline { position: relative; padding-left: 18px; }
.timeline::before { content: ""; position: absolute; left: 4px; top: 5px; bottom: 5px; width: 1px; background: var(--line); }
.tl-item { position: relative; padding-bottom: 15px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before { content: ""; position: absolute; left: -18px; top: 4px; width: 9px; height: 9px; border-radius: 50%; background: #fff; border: 2px solid var(--gold); }
.tl-item.done::before { background: var(--gold); }
.tl-item .t { font-size: 12px; font-weight: 500; }
.tl-item .d { font-size: 11px; color: var(--muted); }

/* ---------- Ligne d'ordre ---------- */
.steps { display: flex; gap: 0; align-items: center; margin: 6px 0 16px; }
.step { flex: 1; text-align: center; position: relative; font-size: 10.5px; color: var(--muted-2); }
.step::before { content: ""; position: absolute; top: 11px; left: -50%; width: 100%; height: 1px; background: var(--line); }
.step:first-child::before { display: none; }
.step .b { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line); background: #fff; margin: 0 auto 5px; display: grid; place-items: center; position: relative; z-index: 1; }
.step.done { color: var(--brown); }
.step.done .b { background: var(--brown); border-color: var(--brown); color: var(--gold-100); }
.step.done::before { background: var(--brown); }
.step.curr { color: var(--ink); font-weight: 600; }
.step.curr .b { border-color: var(--gold); background: var(--gold-100); color: var(--brown); }

/* ---------- Divers ---------- */
.note-box { background: var(--cream-100); border: 1px solid var(--line); border-left: 3px solid var(--gold); border-radius: 8px; padding: 11px 13px; font-size: 12px; color: var(--ink-soft); }
.note-box b { color: var(--ink); }
.mini-chart { width: 100%; display: block; overflow: visible; }
.hero-strip {
  background: linear-gradient(115deg, var(--brown-900), var(--brown-600) 62%, #7A4A22);
  color: var(--cream); border-radius: var(--r-lg); padding: 22px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 22px; flex-wrap: wrap;
  margin-bottom: 18px; position: relative; overflow: hidden;
}
.hero-strip::after {
  content: ""; position: absolute; right: -40px; top: -60px; width: 240px; height: 240px;
  border-radius: 50%; border: 1px solid rgba(246,231,200,.16);
  box-shadow: 0 0 0 40px rgba(246,231,200,.04), 0 0 0 80px rgba(246,231,200,.025);
}
.hero-strip h2 { font-family: var(--serif); font-size: 21px; font-weight: 600; color: #fff; }
.hero-strip p { margin: 5px 0 0; font-size: 12.5px; color: rgba(246,231,200,.72); max-width: 52ch; }
.hero-strip .btn.gold { flex: none; }

.doc-chip { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; background: #fff; }
.doc-chip .ic { width: 28px; height: 28px; border-radius: 7px; background: var(--cream-100); display: grid; place-items: center; color: var(--brown-600); flex: none; }
.doc-chip .meta { margin-left: auto; font-size: 10.5px; color: var(--muted); white-space: nowrap; }

.chk-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: 12.5px; }
.chk-row:last-child { border-bottom: 0; }
.chk-row .st { margin-top: 1px; flex: none; }
.chk-row .txt b { display: block; font-weight: 500; }
.chk-row .txt span { font-size: 11.5px; color: var(--muted); }

@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .panels { grid-template-columns: 1fr; }
  .dgrid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .only-mobile { display: block; }
  .no-mobile { display: none !important; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 248px; transform: translateX(-100%); transition: transform .22s ease; z-index: 60; }
  .side.open { transform: none; }
  .top { padding: 0 16px; }
  .page { padding: 20px 16px 60px; }
  .page-head h1 { font-size: 23px; }
  .who .nm, .who .rl, .top .crumb { display: none; }
  .scrim { position: fixed; inset: 0; background: rgba(30,14,6,.45); z-index: 50; }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi .vl { font-size: 20px; }
  .dl { grid-template-columns: 110px minmax(0,1fr); }
  .dgrid > *, .panels > *, .stack > * { min-width: 0; }
  .panel-body { overflow-x: auto; }
  .panel-body table { min-width: 560px; }
  .chk-row { align-items: flex-start; }
  .tabs, .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar, .seg::-webkit-scrollbar { display: none; }
}
