/* STANSIA - back-office operateur : habillage du dossier de passation STANSIA-admin-handoff (sidebar sombre collee, topbar collee qui s'eleve au scroll,
   contenu beige, pastilles de statut a 5 variantes). Tout est limite a .adm : l'espace client n'est pas touche. Aucun style en ligne (CSP). */
.adm {
  --sidebar: #171320; --sidebar-border: rgba(255, 255, 255, 0.06);
  --sidebar-text: #F7F3EC; --sidebar-muted: #938BA8; --sidebar-faint: #716A86;
  --bg: #EFE6D3; --card: #FBF7EE;
  --border: rgba(26, 18, 40, 0.07); --divider: rgba(26, 18, 40, 0.08); --divider-soft: rgba(26, 18, 40, 0.06);
  --text: #1E1830; --muted: #655D78; --faint: #948C9E; --faint2: #7A7289; --faint3: #8A8295;
  --coral: #E8734A; --coral-text: #C2572E; --coral-wash: rgba(232, 115, 74, 0.1); --coral-wash-soft: rgba(232, 115, 74, 0.06);
  --success: #3A9D5C; --success-wash: rgba(58, 157, 92, 0.12);
  --info: #4472C4; --info-wash: rgba(68, 114, 196, 0.12);
  --warn: #C2721F; --warn-wash: rgba(194, 114, 31, 0.13);
  --danger: #B5433E; --danger-wash: rgba(181, 67, 62, 0.13);
  --navy: #22314F; --navy-light: #F4A57A;
  display: flex; align-items: flex-start; min-height: 100vh; width: 100%;
  background: var(--bg); color: var(--text); color-scheme: light;
  font-family: "IBM Plex Sans", system-ui, sans-serif; font-size: 14px; line-height: 1.5;
}
.adm *, .adm *::before, .adm *::after { box-sizing: border-box; }
.adm a { color: inherit; text-decoration: none; }
.adm h1, .adm h2, .adm h3 { margin: 0; font-family: "Space Grotesk", system-ui, sans-serif; letter-spacing: -0.01em; color: var(--text); }
.adm .num { font-family: "IBM Plex Mono", ui-monospace, monospace; font-feature-settings: "tnum"; }
.adm .link { color: var(--coral-text); }
.adm .link:hover { text-decoration: underline; text-underline-offset: 3px; }
.adm .cell-muted { color: var(--faint2); }

/* ---------- sidebar collee, pleine hauteur ---------- */
.adm .sidebar { position: sticky; top: 0; align-self: flex-start; height: 100vh; width: 258px; min-width: 258px; background: var(--sidebar); border-right: 1px solid var(--sidebar-border); padding: 30px 0 20px; display: flex; flex-direction: column; overflow-y: auto; }
.adm .sb-logo { display: flex; align-items: center; gap: 10px; padding: 0 24px 26px; }
.adm .sb-logo svg { width: 24px; height: 24px; }
.adm .sb-logo span { font-family: "Space Grotesk", system-ui, sans-serif; font-weight: 700; font-size: 18px; letter-spacing: -0.01em; color: var(--sidebar-text); }
.adm .sb-section { font-size: 11.5px; color: var(--sidebar-faint); padding: 0 24px 8px; }
.adm .sb-nav { display: flex; flex-direction: column; }
.adm .sb-item { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 24px; font-size: 13.5px; color: var(--sidebar-muted); }
.adm .sb-item:hover { color: var(--sidebar-text); }
.adm .sb-item svg { width: 17px; height: 17px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.adm .sb-item .cnt { margin-left: auto; min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px; background: var(--coral); color: #171320; font-size: 10px; font-weight: 600; display: flex; align-items: center; justify-content: center; font-family: "IBM Plex Mono", monospace; }
.adm .sb-item.active { color: var(--sidebar-text); font-weight: 600; }
.adm .sb-item.active::before { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px; border-radius: 0 3px 3px 0; background: var(--coral); }
.adm .sb-foot { margin-top: auto; padding: 16px 24px 2px; }
.adm .sb-foot span { display: block; font-size: 11px; color: var(--sidebar-faint); }
.adm .sb-foot a { color: var(--sidebar-muted); }
.adm .sb-foot a:hover { color: var(--sidebar-text); }

/* ---------- colonne principale ---------- */
.adm .main-col { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; }

/* ---------- topbar collee, s'eleve au scroll ---------- */
.adm .optopbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 48px; background: var(--bg); border-bottom: 1px solid transparent; transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease; }
.adm .optopbar.scrolled { background: rgba(239, 230, 211, 0.86); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom-color: var(--divider); box-shadow: 0 6px 20px rgba(26, 18, 40, 0.055); }
.adm .tb-search { display: flex; align-items: center; gap: 9px; padding: 8px 14px; border-radius: 10px; background: var(--card); border: 1px solid var(--border); font-size: 13px; color: var(--faint2); width: 320px; max-width: 40vw; }
.adm .tb-search svg { width: 14px; height: 14px; flex-shrink: 0; fill: none; stroke: var(--faint); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.adm .tb-search input { border: none; background: transparent; outline: none; font-family: inherit; font-size: 13px; color: var(--text); width: 100%; min-height: 0; padding: 0; }
.adm .tb-search input::placeholder { color: var(--faint2); }
.adm .tb-search .kbd { margin-left: auto; font-family: "IBM Plex Mono", monospace; font-size: 10.5px; color: var(--faint); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; flex-shrink: 0; }
.adm .tb-right { display: flex; align-items: center; gap: 8px; }
.adm .tb-icon-btn { position: relative; width: 36px; height: 36px; border-radius: 10px; background: var(--card); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.adm .tb-icon-btn svg { width: 16px; height: 16px; fill: none; stroke: #3D3650; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.adm .tb-icon-btn .badge { position: absolute; top: -4px; right: -4px; min-width: 15px; height: 15px; padding: 0 4px; border-radius: 8px; background: var(--coral); color: #fff; font-size: 9.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; border: 1.5px solid var(--bg); font-family: "IBM Plex Mono", monospace; }
.adm .tb-div { width: 1px; height: 22px; background: var(--divider); margin: 0 2px; }
.adm .tb-profile { position: relative; display: flex; align-items: center; gap: 9px; padding: 5px 10px 5px 5px; border-radius: 10px; background: var(--card); border: 1px solid var(--border); cursor: pointer; font: inherit; color: inherit; text-align: left; }
.adm .tb-avatar { width: 27px; height: 27px; border-radius: 50%; background: var(--navy); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--navy-light); flex-shrink: 0; }
.adm .tb-profile .who { display: flex; flex-direction: column; line-height: 1.25; }
.adm .tb-profile .who b { font-size: 12.5px; font-weight: 600; color: var(--text); max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm .tb-profile .who small { font-size: 10.5px; color: var(--faint2); }
.adm .tb-profile > svg { width: 12px; height: 12px; fill: none; stroke: var(--faint); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.adm .tb-menu { position: absolute; top: calc(100% + 8px); right: 0; width: 220px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 28px rgba(26, 18, 40, 0.12); padding: 6px; display: none; z-index: 30; }
.adm .tb-menu.open { display: block; }
.adm .tb-menu a, .adm .tb-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 8px; font: inherit; font-size: 13px; color: var(--text); background: none; border: 0; cursor: pointer; text-align: left; }
.adm .tb-menu a:hover, .adm .tb-menu button:hover { background: rgba(26, 18, 40, 0.04); }
.adm .tb-menu .sep { height: 1px; background: var(--divider-soft); margin: 5px 2px; }
.adm .tb-menu .danger { color: #973833; }
.adm .tb-menu svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- corps ---------- */
.adm .main { padding: 8px 48px 48px; display: flex; flex-direction: column; gap: 22px; max-width: 1260px; width: 100%; }
.adm .crumb { font-size: 13px; color: var(--faint); margin-bottom: 5px; }
.adm .h1 { font-size: 29px; font-weight: 700; }
.adm .subtext { font-size: 13px; color: var(--faint2); max-width: 640px; line-height: 1.55; margin: 0; }
.adm .back { font-size: 13px; }

.adm .stat-strip { display: flex; background: var(--card); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; flex-wrap: wrap; }
.adm .stat { flex: 1; min-width: 150px; display: flex; align-items: center; gap: 13px; padding: 18px 22px; }
.adm .stat svg { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: var(--faint3); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.adm .stat--ok svg { stroke: var(--success); } .adm .stat--warn svg { stroke: var(--warn); } .adm .stat--bad svg { stroke: var(--danger); } .adm .stat--coral svg { stroke: var(--coral); }
.adm .stat .v { font-size: 21px; font-weight: 600; }
.adm .stat .l { font-size: 11.5px; color: var(--faint); margin-top: 1px; }
.adm .stat-div { width: 1px; background: var(--divider); margin: 14px 0; }

.adm .card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; }
.adm .card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--divider-soft); }
.adm .card-title { font-size: 15px; font-weight: 700; }
.adm .card-pad { padding: 4px 22px 18px; }
.adm .card-body { padding: 16px 22px 20px; }
.adm .card-meta { font-size: 12px; color: var(--faint2); }

.adm .toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.adm .fld-input, .adm .toolbar input, .adm .toolbar select { display: flex; align-items: center; padding: 9px 14px; border-radius: 10px; background: var(--card); border: 1px solid var(--border); font: inherit; font-size: 13px; color: var(--text); outline: none; min-height: 0; }
.adm .toolbar input[type="search"] { flex-grow: 1; min-width: 220px; }
.adm .toolbar select { cursor: pointer; }
.adm .btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 18px; border-radius: 10px; border: none; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; min-height: 0; }
.adm .btn[disabled] { opacity: .5; cursor: not-allowed; }
.adm .btn-primary { background: var(--coral); color: #fff; }
.adm .btn-primary:hover { background: #d9663e; }
.adm .btn-ghost { background: var(--card); border: 1px solid var(--border); color: var(--text); font-weight: 400; }
.adm .btn-small { padding: 7px 14px; font-size: 12.5px; }
.adm .segpills { display: flex; gap: 8px; }
.adm .segpill { padding: 7px 16px; border-radius: 9px; font-size: 13px; color: var(--muted); background: transparent; border: 1px solid var(--border); }
.adm .segpill.active { background: var(--coral); color: #fff; border-color: var(--coral); font-weight: 600; }

/* ---------- tableaux ---------- */
.adm .tablewrap { overflow-x: auto; }
.adm table { width: 100%; border-collapse: collapse; }
.adm thead th { text-align: left; font-size: 11.5px; font-weight: 500; color: var(--faint); padding: 14px 10px 10px; white-space: nowrap; }
.adm thead th:first-child, .adm tbody td:first-child { padding-left: 0; }
.adm tbody td { padding: 13px 10px; font-size: 13px; border-top: 1px solid var(--divider-soft); vertical-align: middle; overflow-wrap: anywhere; }
.adm tbody tr:hover td { background: rgba(26, 18, 40, 0.018); }
.adm .chip { width: 30px; height: 30px; border-radius: 50%; background: rgba(26, 18, 40, 0.06); display: flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 700; color: var(--faint3); flex-shrink: 0; }
.adm .name-row { display: flex; align-items: center; gap: 11px; }
.adm .name-row .link { font-weight: 500; }
.adm .pager { display: flex; justify-content: flex-end; align-items: center; gap: 12px; padding-top: 14px; font-size: 12px; color: var(--faint2); }

/* ---------- pastilles de statut ---------- */
.adm .pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 8px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.adm .pill .dot { width: 6px; height: 6px; border-radius: 50%; }
.adm .pill-success { background: var(--success-wash); color: #2B7A48; } .adm .pill-success .dot { background: var(--success); }
.adm .pill-neutral { background: rgba(26, 18, 40, 0.055); color: var(--muted); } .adm .pill-neutral .dot { background: var(--faint3); }
.adm .pill-warn { background: var(--warn-wash); color: #9C5C18; } .adm .pill-warn .dot { background: var(--warn); }
.adm .pill-danger { background: var(--danger-wash); color: #973833; } .adm .pill-danger .dot { background: var(--danger); }
.adm .pill-info { background: var(--info-wash); color: #3A5FA3; } .adm .pill-info .dot { background: var(--info); }

/* ---------- formulaires, notes, vide ---------- */
.adm .resolve-input, .adm .adm-input { flex-grow: 1; min-width: 180px; padding: 8px 12px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg); font: inherit; font-size: 12.5px; color: var(--text); outline: none; min-height: 0; }
.adm .resolve-input::placeholder, .adm .adm-input::placeholder { color: var(--faint); }
.adm textarea.adm-input { min-height: 56px; resize: vertical; }
.adm .resolve { display: flex; gap: 8px; flex-wrap: wrap; min-width: 260px; }
.adm .empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 34px 20px; color: var(--faint2); font-size: 13px; }
.adm .note { display: flex; align-items: flex-start; gap: 10px; padding: 13px 16px; border-radius: 12px; background: var(--coral-wash-soft); border: 1px solid rgba(232, 115, 74, 0.18); font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.adm .note--bad { background: var(--danger-wash); border-color: rgba(181, 67, 62, 0.3); color: #973833; }
.adm .note--ok { background: var(--success-wash); border-color: rgba(58, 157, 92, 0.3); color: #2B7A48; }
.adm .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.adm .fld { display: grid; gap: 4px; padding: 12px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--border); }
.adm .fld .k { font-size: 11.5px; color: var(--faint); }
.adm .fld .v { font-size: 13.5px; overflow-wrap: anywhere; }
.adm .actions { display: grid; gap: 14px; }
.adm .action { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.adm .action strong { min-width: 70px; font-size: 13px; }
.adm .turns { display: grid; gap: 8px; }
.adm .turn { display: grid; gap: 2px; padding: 10px 14px; border-radius: 12px; background: var(--bg); overflow-wrap: anywhere; }
.adm .turn--agent { background: rgba(34, 49, 79, 0.08); }
.adm .turn__who { font-size: 11.5px; color: var(--faint2); }
.adm .prewrap { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.adm .rowflex { display: flex; flex-wrap: wrap; gap: 24px; align-items: center; }
.adm .stack { display: flex; flex-direction: column; gap: 22px; }

/* ---------- petits ecrans : la sidebar devient une barre horizontale ---------- */
@media (max-width: 900px) {
  .adm { flex-direction: column; align-items: stretch; }
  .adm .sidebar { position: static; height: auto; width: 100%; min-width: 0; flex-direction: row; align-items: center; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--sidebar-border); gap: 6px; overflow-x: auto; overflow-y: hidden; }
  .adm .sb-logo { padding: 0 12px 0 0; } .adm .sb-section, .adm .sb-foot { display: none; }
  .adm .sb-nav { flex-direction: row; }
  .adm .sb-item { padding: 8px 12px; white-space: nowrap; } .adm .sb-item.active::before { display: none; }
  .adm .sb-item.active { background: rgba(255, 255, 255, 0.07); border-radius: 8px; }
  .adm .optopbar { padding: 12px 18px; } .adm .tb-search { width: auto; flex: 1; max-width: none; } .adm .tb-search .kbd, .adm .tb-profile .who, .adm .tb-profile > svg { display: none; }
  .adm .main { padding: 8px 18px 40px; }
  .adm .card-pad { padding: 4px 14px 14px; }
}

.adm .pinshow { font-size: 24px; font-weight: 600; letter-spacing: .25em; padding: 4px 12px; border-radius: 10px; background: var(--card); border: 1px dashed var(--coral); }
.adm .adm-input[type="date"], .adm select.adm-input { flex-grow: 0; min-width: 150px; }
