/* =====================================================================
   BOS Shell — self-contained chrome. No Tailwind, no external deps.
   Theme by setting the --bos-* custom properties (BosShell does this from
   its parameters; you can also override them in your own CSS).
   Tints use color-mix() so any brand colour works (Chrome 111+, Safari 16.2+,
   Firefox 113+).
   ===================================================================== */
.bos-shell {
  --bos-brand: #4f46e5;
  --bos-brand-dark: #4338ca;
  --bos-sidebar-bg: #f3f4f5;
  --bos-sidebar-w: 16rem;
  --bos-rail-border: #d1d5db;
  --bos-font-family: inherit;
  --bos-tagline-size: 9px;

  font-family: var(--bos-font-family);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
}
@media (min-width: 1024px) {
  .bos-shell { flex-direction: row; }
}

/* ---- Mobile backdrop ---- */
.bos-shell__backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(15, 23, 42, 0.4);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.bos-shell__backdrop[hidden] { display: none; }
@media (min-width: 1024px) {
  .bos-shell__backdrop { display: none !important; }
}

/* ---- Collapsible rail ---- */
.bos-rail {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  width: var(--bos-sidebar-w);
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  background: var(--bos-sidebar-bg);
  transform: translateX(-100%);
  transition: transform 0.3s ease, width 0.3s ease, min-width 0.3s ease;
}
.bos-rail--mobile-open { transform: translateX(0); }

@media (min-width: 1024px) {
  .bos-rail {
    position: sticky;
    top: 0;
    align-self: flex-start;
    /* dvh, not vh. On a landscape tablet Chrome's 100vh is the layout viewport
       behind the URL bar, taller than what you can see. This rail also sets
       overflow: hidden, so the footer (theme + sign out) was painted below the
       visible edge and looked like it had vanished. */
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    min-width: var(--bos-sidebar-w);
    flex-shrink: 0;
    transform: translateX(0);
    border-right: 1.5px solid var(--bos-rail-border);
    overflow: hidden;
    /* Padding on the nav and footer is inside this width. Content-box made those
       children 1.5rem wider than the rail, and overflow-x: hidden sliced the
       trailing icons (info, external) off the right edge. */
    box-sizing: border-box;
  }
  /* Keep children at full WIDTH so content clips instead of reflowing mid-collapse.
     flex-shrink: 0 on every child also forbade the NAV from shrinking in HEIGHT,
     which on a short tablet viewport shoved the footer off the bottom. */
  .bos-rail > * {
    box-sizing: border-box;
    width: var(--bos-sidebar-w);
    min-width: var(--bos-sidebar-w);
  }
  .bos-shell.is-collapsed .bos-rail {
    width: 0;
    min-width: 0;
    transform: translateX(-100%);
    border-right-width: 0;
  }
  .bos-shell.is-collapsed.is-hover-open .bos-rail {
    width: var(--bos-sidebar-w);
    min-width: var(--bos-sidebar-w);
    transform: translateX(0);
    border-right: 1.5px solid #cbd5e1;
    box-shadow: 4px 0 20px rgba(15, 23, 42, 0.12);
  }
}

/* ---- Rail header / brand ---- */
.bos-rail__header {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1.25rem;
  flex-shrink: 0;
  height: 7.5rem;
  min-height: 7.5rem;
  max-height: 7.5rem;
  overflow: hidden;
  box-sizing: border-box;
}
.bos-rail__brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
  width: 100%;
  max-width: var(--bos-sidebar-w);
  overflow: hidden;
}
.bos-rail__logo {
  height: 2.5rem;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}
.bos-rail__tagline {
  display: block;
  width: 100%;
  max-width: var(--bos-sidebar-w);
  margin-top: 0.5rem;
  font-size: var(--bos-tagline-size);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  line-height: 1.25;
  height: 1.25em;
  flex-shrink: 0;
}

/* ---- Rail nav / footer ---- */
.bos-rail__nav {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 0.75rem 1rem;
}
.bos-rail__nav > * + * { margin-top: 0.25rem; }
.bos-rail__footer {
  margin-top: auto;
  flex-shrink: 0;
  box-sizing: border-box;
  padding: 0.75rem;
  padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(226, 232, 240, 0.6);
}

/* ---- Mobile close button ---- */
.bos-rail__close {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 2rem;
  width: 2rem;
  border: 0;
  background: transparent;
  border-radius: 0.5rem;
  color: #64748b;
  cursor: pointer;
}
.bos-rail__close:hover { background: #e2e8f0; color: #1e293b; }
@media (min-width: 1024px) {
  .bos-rail__close { display: none; }
}

/* ---- Pin button (desktop) ---- */
.bos-rail__pin {
  position: absolute;
  right: 0.5rem;
  top: 0.5rem;
  z-index: 10;
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #64748b;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease,
    box-shadow 0.2s ease, transform 0.2s ease;
  padding: 0;
  overflow: hidden;
}
.bos-rail__pin .bos-pin-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.bos-pin-icon--keep { opacity: 1; transform: scale(1); }
.bos-pin-icon--close { opacity: 0; transform: scale(0.72); }
.bos-rail__pin[aria-pressed="true"] .bos-pin-icon--keep { opacity: 0; transform: scale(0.72); }
.bos-rail__pin[aria-pressed="true"] .bos-pin-icon--close { opacity: 1; transform: scale(1); }
@media (min-width: 1024px) {
  .bos-shell.is-hover-open .bos-rail__pin,
  .bos-shell:not(.is-collapsed) .bos-rail__pin { display: inline-flex; }
}
.bos-rail__pin:hover {
  color: var(--bos-brand-dark);
  border-color: color-mix(in srgb, var(--bos-brand) 45%, transparent);
  background: color-mix(in srgb, var(--bos-brand) 8%, #ffffff);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--bos-brand) 18%, transparent);
}
.bos-rail__pin[aria-pressed="true"] {
  color: var(--bos-brand-dark);
  background: color-mix(in srgb, var(--bos-brand) 12%, #ffffff);
  border-color: color-mix(in srgb, var(--bos-brand) 55%, transparent);
}
.bos-rail__pin:active { transform: scale(0.96); }
@media (max-width: 1023px) {
  .bos-rail__pin { display: none !important; }
}

/* ---- Hover trigger strip: DISABLED 2026-09-10 ----
 *
 * This was a transparent 48px strip covering the FULL HEIGHT of the left edge at z-index 9999,
 * shown whenever the rail was collapsed. Entering it slid the rail open.
 *
 * In this app the content area is somebody else's tool in an iframe, and tools put their own
 * navigation exactly where this strip was: reaching for VaultWarden's sidebar opened our rail over
 * it and pushed the page. Directus and Excalidraw have controls at that edge too, so it was one bug
 * with three victims.
 *
 * Neutralised here as well as unbound in bos-shell.js, so a stale copy of the markup cannot put an
 * invisible click-eater back over a customer-facing tool. The rail still opens: .bos-drawer-toggle
 * below is a visible tab at the left edge on desktop and it opens the rail on click.
 *
 * Kept as a rule rather than deleted with the element so that this explanation sits where the next
 * person looks, which is the CSS, not the git history.
 */
.bos-shell__hover-trigger { display: none !important; pointer-events: none !important; }

/* ---- Drawer-tab toggle (desktop) ---- */
.bos-drawer-toggle {
  position: fixed;
  top: 50%;
  left: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 5.5rem;
  border-radius: 0 14px 14px 0;
  background: linear-gradient(180deg, var(--bos-brand) 0%, var(--bos-brand-dark) 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.38);
  border-left: none;
  box-shadow: 2px 0 12px color-mix(in srgb, var(--bos-brand) 34%, transparent),
    4px 0 18px rgba(15, 23, 42, 0.1);
  color: #ffffff;
  transform: translateY(-50%);
  opacity: 1;
  visibility: visible;
  transition: left 0.3s ease, opacity 0.12s ease, visibility 0s linear 0s;
  padding: 0;
  overflow: visible;
  cursor: pointer;
  touch-action: manipulation;
}
@media (min-width: 1024px) {
  .bos-drawer-toggle { display: flex; }
}
/* Invisible expanded hit target around the narrow tab */
.bos-drawer-toggle::before {
  content: "";
  position: absolute;
  top: -1.25rem;
  right: -1.25rem;
  bottom: -1.25rem;
  left: -0.5rem;
}
.bos-shell.is-collapsed.is-hover-open .bos-drawer-toggle::before {
  left: -16rem;
  right: -1.25rem;
  top: -2rem;
  bottom: -2rem;
}
.bos-drawer-toggle:hover {
  background: linear-gradient(180deg, color-mix(in srgb, var(--bos-brand) 82%, #ffffff) 0%, var(--bos-brand) 100%);
  box-shadow: 2px 0 14px color-mix(in srgb, var(--bos-brand) 42%, transparent),
    5px 0 20px rgba(15, 23, 42, 0.14);
}
.bos-shell.is-collapsed:not(.is-hover-open) .bos-drawer-toggle:hover { transform: translateY(-50%) translateX(1px); }
.bos-shell.is-collapsed.is-hover-open .bos-drawer-toggle:hover { transform: translateY(-50%); }
.bos-drawer-toggle:active { transform: translateY(-50%) scale(0.97); }

.bos-shell.is-collapsed:not(.is-hover-open) .bos-drawer-toggle {
  left: 0;
  transition: opacity 0.12s ease, visibility 0s linear 0s, left 0s;
}
.bos-shell.is-collapsed.is-hover-open .bos-drawer-toggle {
  left: var(--bos-sidebar-w);
  transition: left 0.3s ease, opacity 0.12s ease, visibility 0s linear 0s;
}
.bos-shell:not(.is-collapsed) .bos-drawer-toggle {
  pointer-events: none;
  cursor: default;
  left: var(--bos-sidebar-w);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.08s ease, visibility 0s linear 0.08s, left 0s;
}
@media (max-width: 1023px) {
  .bos-drawer-toggle { display: none !important; }
}

.bos-drawer-grip {
  position: absolute;
  top: 0.85rem;
  left: 50%;
  width: 0.625rem;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  pointer-events: none;
}
.bos-drawer-grip-line {
  display: block;
  height: 2px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.72);
}
.bos-toggle-icon {
  position: absolute;
  bottom: 0.8rem;
  left: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.bos-toggle-icon svg { display: block; stroke-width: 2.5; }
.bos-toggle-icon--idle { opacity: 1; transform: translateX(-50%) scale(1); }
.bos-toggle-icon--preview { opacity: 0; transform: translateX(-50%) scale(0.55); }
.bos-shell.is-collapsed.is-hover-open .bos-drawer-toggle .bos-toggle-icon--idle {
  opacity: 0;
  transform: translateX(-50%) scale(0.55);
}
.bos-shell.is-collapsed.is-hover-open .bos-drawer-toggle .bos-toggle-icon--preview {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

/* ---- Nested (two-rail) layout: outer platform rail + inner app nav ---- */
.bos-host {
  display: flex;
  flex: 1 1 0%;
  min-width: 0;
  flex-direction: column;
}
@media (min-width: 1024px) {
  .bos-host { flex-direction: row; }
}
.bos-inner-rail {
  position: fixed;
  inset-block: 0;
  left: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  width: var(--bos-sidebar-w);
  background: var(--bos-sidebar-bg);
  transform: translateX(-100%);
  transition: transform 0.3s ease;
}
.bos-inner-rail--mobile-open { transform: translateX(0); }
@media (min-width: 1024px) {
  .bos-inner-rail {
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    min-width: var(--bos-sidebar-w);
    flex-shrink: 0;
    transform: translateX(0);
    border-right: 1.5px solid var(--bos-rail-border);
    overflow: hidden;
  }
}
.bos-inner-rail .bos-rail__nav { padding-top: 1.25rem; }
.bos-inner-rail__close {
  position: absolute;
  right: 0.75rem;
  top: 0.75rem;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 2rem;
  width: 2rem;
  border: 0;
  background: transparent;
  border-radius: 0.5rem;
  color: #64748b;
  cursor: pointer;
}
.bos-inner-rail__close:hover { background: #e2e8f0; color: #1e293b; }
@media (min-width: 1024px) {
  .bos-inner-rail__close { display: none; }
}

/* Two-rail: outer rail is a platform switcher — small hover tab, and its hover
   preview must NOT bridge across the inner rail / content. */
@media (min-width: 1024px) {
  .bos-shell.has-inner.is-collapsed .bos-shell__hover-trigger {
    top: 50%;
    bottom: auto;
    height: 5.5rem;
    width: 1.75rem;
    transform: translateY(-50%);
  }
}
.bos-shell.has-inner .bos-drawer-toggle::before,
.bos-shell.has-inner.is-collapsed.is-hover-open .bos-drawer-toggle::before {
  left: -0.5rem;
  right: -1.25rem;
  top: -1.25rem;
  bottom: -1.25rem;
}

/* ---- Content area ---- */
.bos-content {
  display: flex;
  flex-direction: column;
  flex: 1 1 0%;
  min-width: 0;
  position: relative;
  z-index: 1;
}
.bos-content__topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1rem;
}
.bos-hamburger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2.5rem;
  width: 2.5rem;
  margin: 0.5rem 0;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
}
@media (min-width: 1024px) {
  .bos-hamburger { display: none; }
}
.bos-content__main {
  min-width: 0;
  flex: 1;
  padding: 1.5rem 1rem;
  animation: bos-fade-in-up 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@media (min-width: 640px) { .bos-content__main { padding: 1.5rem; } }
@media (min-width: 1024px) { .bos-content__main { padding: 2rem; } }

@keyframes bos-fade-in-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
