/* ================================================================
   ClinAssure Layout Override — locked three-column cockpit
   Modelled on the LMS three-column layout:
     left rail (title + hr + scroll) |
     centre panel (title + hr + scroll) |
     right inspector (title + hr + scroll)
   Navbar and tabs stay constant. Cockpit fills remaining height.
   ================================================================ */

/* ── Page fills the content area as a flex column ────────────── */
body.if-shell-ready .if-content > .clin-page {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

/* ── Compact sections above the cockpit ──────────────────────── */
body.if-shell-ready .if-content > .clin-page > .hero.platform-hero {
  flex-shrink: 0;
  padding: 12px 20px 8px;
  border-bottom: 1px solid color-mix(in srgb, var(--if-rule) 60%, transparent);
}

body.if-shell-ready .if-content > .clin-page > .hero.platform-hero h1 {
  font-size: clamp(18px, 1.75vw, 28px) !important;
  line-height: 1.1 !important;
}

body.if-shell-ready .if-content > .clin-page > .hero.platform-hero .lead {
  font-size: 12.5px !important;
  line-height: 1.45 !important;
  margin-top: 4px;
  max-width: 100% !important;
}

body.if-shell-ready .if-content > .clin-page > .landing-metric-strip {
  flex-shrink: 0;
  padding: 6px 20px;
  margin: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--if-rule) 60%, transparent);
}

body.if-shell-ready .if-content > .clin-page > .landing-controls {
  flex-shrink: 0;
  padding: 6px 20px;
  margin: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--if-rule) 60%, transparent);
}

body.if-shell-ready .if-content > .clin-page > .landing-tabs {
  flex-shrink: 0;
  margin: 0;
  padding: 0 20px;
  border-bottom: 1px solid var(--if-rule);
}

/* ── Cockpit: flex 1, fills remaining height ─────────────────── */
body.if-shell-ready .if-content > .clin-page .landing-cockpit {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  margin: 0;
  border-radius: 0;
  border: 0;
  padding: 12px 16px 16px;
  gap: 12px;
  box-shadow: none;
  background: transparent;
}

/* ── Three columns: each is a flex column ────────────────────── */
body.if-shell-ready .if-content > .clin-page .landing-rail,
body.if-shell-ready .if-content > .clin-page .landing-panel,
body.if-shell-ready .if-content > .clin-page .landing-inspector {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

/* ── Column header: stays locked at top ──────────────────────── */
/* Rail label */
body.if-shell-ready .if-content > .clin-page .landing-rail > .landing-rail-label {
  flex-shrink: 0;
  padding-bottom: 8px;
  margin-bottom: 0;
  border-bottom: 1px solid var(--if-rule);
  font-size: 9px;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--if-ink-3);
}

/* Inspector label */
body.if-shell-ready .if-content > .clin-page .landing-inspector > .landing-rail-label {
  flex-shrink: 0;
  padding-bottom: 8px;
  margin-bottom: 0;
  border-bottom: 1px solid var(--if-rule);
  font-size: 9px;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--if-ink-3);
}

/* Panel head — keep the existing border-bottom, just ensure no shrink */
body.if-shell-ready .if-content > .clin-page .landing-panel-head {
  flex-shrink: 0;
}

/* ── Rail list: scrolls within the rail column ───────────────── */
body.if-shell-ready .if-content > .clin-page .landing-rail-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin-top: 8px;
}

/* ── Panel content areas: scroll within the panel column ─────── */
body.if-shell-ready .if-content > .clin-page .route-panel,
body.if-shell-ready .if-content > .clin-page .clin-panel,
body.if-shell-ready .if-content > .clin-page .project-panel,
body.if-shell-ready .if-content > .clin-page .framework-panel {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* Keep hidden panels invisible */
body.if-shell-ready .if-content > .clin-page .route-panel[hidden],
body.if-shell-ready .if-content > .clin-page .clin-panel[hidden],
body.if-shell-ready .if-content > .clin-page .project-panel[hidden],
body.if-shell-ready .if-content > .clin-page .framework-panel[hidden] {
  display: none !important;
  flex: none;
}

/* ── Inspector scroll wrapper ────────────────────────────────── */
body.if-shell-ready .if-content > .clin-page .inspector-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  gap: 10px;
  align-content: start;
  padding-top: 10px;
}

body.if-shell-ready .if-content > .clin-page .inspector-scroll h2 {
  margin: 0;
}

body.if-shell-ready .if-content > .clin-page .inspector-scroll > .landing-output-list {
  margin-top: 0;
}

/* ── Remove non-functional controls row ──────────────────────── */
body.if-shell-ready .if-content > .clin-page > .landing-controls {
  display: none;
}

/* ── Hide pagehead — hero already shows the page title ──────── */
body.if-shell-ready .if-screen > .if-pagehead {
  display: none;
}

/* ── Hide verbose lead paragraph — keeps kicker + h1 only ───── */
body.if-shell-ready .if-content > .clin-page > .hero.platform-hero .lead {
  display: none;
}

/* ── Metric strip: single compact row ────────────────────────── */
body.if-shell-ready .if-content > .clin-page > .landing-metric-strip {
  padding: 4px 20px;
  border-bottom: 1px solid color-mix(in srgb, var(--if-rule) 50%, transparent);
}

body.if-shell-ready .if-content > .clin-page .landing-metric {
  padding: 5px 10px;
}

body.if-shell-ready .if-content > .clin-page .landing-metric b {
  font-size: 18px;
}

body.if-shell-ready .if-content > .clin-page .landing-metric small {
  font-size: 8.5px;
}

body.if-shell-ready .if-content > .clin-page .landing-metric span {
  font-size: 9.5px;
}

/* ── Tab bar compact ─────────────────────────────────────────── */
body.if-shell-ready .if-content > .clin-page .landing-tab {
  min-height: 34px !important;
  font-size: 10.5px !important;
  padding: 0 12px !important;
}

/* ================================================================
   FULL-CANVAS MODE — sidebar becomes slide-over drawer
   Sidebar leaves the grid. Main content fills 100% width.
   Hamburger always visible. Drawer slides in from left.
   ================================================================ */

/* Collapse sidebar column so main fills full width */
body.if-shell-ready .if-shell {
  grid-template-columns: 1fr;
}

/* Sidebar becomes a fixed overlay drawer, hidden off-screen by default */
body.if-shell-ready .if-sidebar {
  position: fixed;
  inset-block: 0;
  left: 0;
  width: 264px;
  height: 100%;
  z-index: 300;
  transform: translateX(-100%);
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

/* Drawer slides in when nav is open */
body.if-shell-ready .if-shell.if-nav-open .if-sidebar {
  transform: translateX(0);
}

/* Backdrop: semi-transparent overlay behind open drawer */
body.if-shell-ready .if-nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: 299;
  background: oklch(0% 0 0 / 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s;
  display: block;
}

body.if-shell-ready .if-shell.if-nav-open .if-nav-backdrop {
  opacity: 1;
  pointer-events: auto;
}

/* Hamburger always visible */
body.if-shell-ready .if-nav-toggle {
  display: flex !important;
}

/* Pillbar: a touch of left padding so text doesn't crowd the hamburger */
body.if-shell-ready .if-pillbar {
  padding-left: 14px;
}

/* Wider cockpit proportions now that we have full canvas */
body.if-shell-ready .if-content > .clin-page .landing-cockpit {
  grid-template-columns: minmax(190px, 0.38fr) minmax(0, 1.6fr) minmax(260px, 0.62fr);
}

/* ── Responsive: revert to normal scroll below 1120px ────────── */
@media (max-width: 1120px) {
  body.if-shell-ready .if-content > .clin-page {
    height: auto;
    overflow: visible;
  }

  body.if-shell-ready .if-content > .clin-page .landing-cockpit {
    flex: none;
    overflow: visible;
    height: auto;
    margin: 12px 14px 18px;
  }

  body.if-shell-ready .if-content > .clin-page .landing-rail,
  body.if-shell-ready .if-content > .clin-page .landing-panel,
  body.if-shell-ready .if-content > .clin-page .landing-inspector {
    overflow: visible;
  }

  body.if-shell-ready .if-content > .clin-page .landing-rail-list,
  body.if-shell-ready .if-content > .clin-page .route-panel,
  body.if-shell-ready .if-content > .clin-page .clin-panel,
  body.if-shell-ready .if-content > .clin-page .project-panel,
  body.if-shell-ready .if-content > .clin-page .framework-panel,
  body.if-shell-ready .if-content > .clin-page .inspector-scroll {
    overflow: visible;
    flex: none;
    min-height: 0;
  }

  body.if-shell-ready .if-content > .clin-page > .hero.platform-hero {
    padding: 14px 14px 10px;
    border-bottom: none;
  }

  body.if-shell-ready .if-content > .clin-page > .hero.platform-hero h1 {
    font-size: clamp(22px, 4vw, 34px) !important;
  }
}
