/* HxDrawer (#102 L0.1) — einheitliche Drawer-Huelle (rechts einschiebend) + FAB-Cluster.
   Token-basiert mit Fallbacks (dark/light). Laedt nach den Komponenten-CSS, ueberschreibt gezielt. */

:root { --hx-drawer-w: 420px; }

.hx-drawer-root { position: static; }

/* Push statt Overlay (Marc 2026-06-24): der Drawer schiebt den Inhalt rueber, damit man bei
   offenem Drawer weiterarbeiten kann. Die Shell wird um die Drawer-Breite schmaler; der fixe
   Drawer fuellt den frei gewordenen Streifen rechts (uniform fuer alle Views, ohne Grid-Spalten). */
.shell { transition: margin-right .3s cubic-bezier(.2,.7,.2,1); }
body.hx-drawer-open .shell { margin-right: min(var(--hx-drawer-w, 420px), 96vw); }
body.hx-drawer-resizing .shell { transition: none; }
@media (max-width: 560px) { body.hx-drawer-open .shell { margin-right: 0; } }

/* ---- Panel ---------------------------------------------------------------- */
.hx-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 1090;
  width: min(var(--hx-drawer-w, 420px), 96vw);
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--surface, #161F2A), var(--surface-2, #1C2733));
  border-left: 1px solid var(--border, #26313E);
  box-shadow: -18px 0 48px -28px rgba(0,0,0,.6);
  transform: translateX(105%);
  transition: transform .3s cubic-bezier(.2,.7,.2,1);
}
.hx-drawer.show { transform: none; }
.hx-drawer[hidden] { display: none; }
@media (max-width: 560px) { .hx-drawer { width: 100vw; } }

/* ---- Breiten-Griff (linke Kante) ----------------------------------------- */
.hx-drawer-grip { position: absolute; left: -3px; top: 0; bottom: 0; width: 8px; cursor: col-resize; z-index: 5; }
.hx-drawer-grip:hover, .hx-drawer-grip.active {
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--gold, #C9A24B) 35%, transparent));
}
body.hx-drawer-resizing { cursor: col-resize; user-select: none; }
.hx-drawer.show { transition: transform .3s cubic-bezier(.2,.7,.2,1); }
body.hx-drawer-resizing .hx-drawer { transition: none; }

/* ---- Kopf (einheitlich: Icon + Titel + Schliessen) ------------------------ */
.hx-drawer-head {
  flex: 0 0 auto; display: flex; align-items: center; gap: 11px;
  padding: 0 14px; height: var(--topbar-h, 56px);
  border-bottom: 1px solid var(--border, #26313E);
}
.hx-drawer-ic {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(180deg, var(--gold-soft, #D9B86E), var(--bronze, #9C7A33)); color: var(--on-gold, #1a1206);
}
.hx-drawer-ic svg { width: 19px; height: 19px; }
.hx-drawer-ic:empty { display: none; }
.hx-drawer-title {
  flex: 1 1 auto; min-width: 0; font-family: var(--font-display, serif); font-weight: 600; font-size: 16px;
  color: var(--text, #F4F1EA); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hx-drawer-x {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--border-2, #313E4D);
  background: var(--surface, #161F2A); color: var(--mist, #AEB9C6); cursor: pointer; display: grid; place-items: center;
}
.hx-drawer-x:hover { color: var(--text, #F4F1EA); border-color: var(--gold, #C9A24B); }
.hx-drawer-x svg { width: 16px; height: 16px; }

/* ---- Body + Komponenten-Hosts -------------------------------------------- */
.hx-drawer-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.hx-drawer-host { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.hx-drawer-host[hidden] { display: none; }

/* Meridian: managt seinen eigenen Scroll (Nachrichtenliste), Host darf nicht scrollen. */
.hx-drawer-host[data-key="meridian"] { overflow: hidden; display: flex; flex-direction: column; }
.hx-drawer #asst {
  flex: 1 1 auto; min-height: 0; height: auto; border-left: 0; background: transparent;
}
/* Meridians eigene Toolbar (Kontext + Neu/Historie/Einstellungen) sitzt unter dem Drawer-Kopf. */
.hx-drawer #asst .asst-head { flex: 0 0 auto; }

/* DMS: die bestehende Dokumente-View stapelt im schmalen Drawer (mobiles DMS). */
.hx-drawer-host[data-key="dms"] .dms-drawer { display: flex; flex-direction: column; min-height: 100%; }
.hx-drawer-host[data-key="dms"] .facets { width: auto; border-right: 0; border-bottom: 1px solid var(--border, #26313E); }
.hx-drawer-host[data-key="dms"] .dmscenter { min-height: 0; }

/* Feedback: das Formular fliesst, der Host scrollt. */
.hx-drawer-host[data-key="feedback"] { padding: clamp(16px, 3vw, 22px); }

/* ---- FAB-Cluster (unten mittig): Feedback links, Meridian rechts ---------- */
.hx-fab {
  position: fixed; bottom: 18px; z-index: 250;
  display: inline-flex; align-items: center; gap: 9px;
  padding: 12px 18px; border-radius: 999px; cursor: pointer;
  font-family: var(--font-ui, sans-serif); font-size: 14px; font-weight: 600;
  color: var(--on-gold, #fff); text-shadow: 0 1px 2px rgba(0,0,0,.28); border: 1px solid var(--gold, #C9A24B);
  background: linear-gradient(180deg, var(--gold-soft, #D9B86E), var(--bronze, #9C7A33));
  box-shadow: 0 14px 30px -12px rgba(0,0,0,.55);
  transition: transform .15s, box-shadow .2s, filter .2s;
}
.hx-fab:hover { box-shadow: 0 18px 36px -12px rgba(0,0,0,.6); filter: brightness(1.04); }
.hx-fab svg { width: 18px; height: 18px; }
.hx-fab .hx-fab-label { white-space: nowrap; }
/* Meridian-FAB rechts neben die Mitte (Feedback-FAB sitzt spiegelbildlich links). */
.hx-fab.mer-fab { left: 50%; transform: translateX(7px); }
@media (max-width: 560px) { .hx-fab .hx-fab-label { display: none; } .hx-fab { padding: 13px; } }

/* Solange ein Drawer offen ist, brauchen wir die FABs nicht (X/ESC schliesst). */
body.hx-drawer-open .hx-fab, body.hx-drawer-open .fb-fab { display: none !important; }
