/* RUNDA V1 INLINE DESKTOP LAYOUT - 2026-05-14
   This file only overrides presentation for the desktop inline RUNDA V1 shell.
   Keep tier rules, REST wiring, uploads, modals, and planner logic in their existing files. */

@media (min-width: 821px) {
  body.runda-v1-inline-desktop-mode {
    overflow: auto;
  }

  body.runda-v1-inline-desktop-mode.runda-v1-modal-open {
    overflow: auto;
  }

  body.runda-v1-inline-desktop-mode.runda-explore-manager-open,
  body.runda-v1-inline-desktop-mode.runda-addspace-manager-open,
  body.runda-v1-inline-desktop-mode.scout-modal-open {
    overflow: hidden;
  }

  body.runda-v1-inline-desktop-mode .site-shell {
    width: 100%;
    margin: 0 auto 14px;
  }

  body.runda-v1-inline-desktop-mode .shell-header {
    margin-bottom: 0;
  }

  body.runda-v1-inline-desktop-mode .content-panel {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: #000000;
    box-shadow: none;
  }

  body.runda-v1-inline-desktop-mode .admin-hub-stage,
  body.runda-v1-inline-desktop-mode .dashboard-account-page {
    display: none !important;
  }

  .runda-v1-modal--inline-desktop {
    position: relative;
    inset: auto;
    z-index: 20;
    display: block !important;
    width: 100%;
    margin: 0 auto;
    padding: 0;
    background: #000000;
  }

  .runda-v1-modal--inline-desktop .runda-v1-modal__backdrop,
  .runda-v1-modal--inline-desktop .runda-v1-modal__close {
    display: none !important;
  }

  .runda-v1-modal--inline-desktop .runda-v1-modal__panel {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    transform-origin: center top;
    width: 100%;
    height: clamp(780px, calc(100dvh - 112px), 900px);
    min-height: 780px;
    margin: 0 auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: #000000;
    box-shadow: none;
  }

  .runda-v1-modal--inline-desktop .runda-v1-layout {
    grid-template-columns: minmax(0, 1fr) max-content;
    gap: 0;
  }

  .runda-v1-modal--inline-desktop:not(.workspace-mode-explore) .runda-v1-shell {
    border: 0;
    border-radius: 0;
    background: #000000;
    padding: clamp(8px, 0.7vw, 10px);
  }

  .runda-v1-modal--inline-desktop .runda-v1-shell--canvas {
    padding: 0;
  }

  .runda-v1-modal--inline-desktop .runda-v1-shell--workspace {
    --runda-v1-workspace-inline-padding: clamp(8px, 0.65vw, 10px);
    width: calc(var(--runda-v1-workspace-chip-row-width, 222px) + var(--runda-v1-workspace-inline-padding) + var(--runda-v1-workspace-inline-padding)) !important;
    max-width: calc(var(--runda-v1-workspace-chip-row-width, 222px) + var(--runda-v1-workspace-inline-padding) + var(--runda-v1-workspace-inline-padding)) !important;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    padding: clamp(8px, 0.65vw, 10px);
  }

  .runda-v1-modal--inline-desktop .runda-v1-canvas-wrap {
    border: 0;
    border-radius: 0;
    background: #000000;
  }

  .runda-v1-modal--inline-desktop .runda-v1-new-route-fab {
    left: 16px;
    top: auto;
    bottom: 16px;
  }

  .runda-v1-modal--inline-desktop .runda-v1-workspace-top {
    background: #000000;
  }

  /* Finder-style bottom rail: map owns the page, files/tools skim underneath. */
  body:is(.page-slug-home, .home, .front-page, .page-slug-dashboard) .runda-v1-modal--inline-desktop:not(.workspace-mode-explore):not(.workspace-mode-rundapath) .runda-v1-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) clamp(72px, 9vh, 92px);
    gap: 4px;
  }

  body:is(.page-slug-home, .home, .front-page, .page-slug-dashboard) .runda-v1-modal--inline-desktop:not(.workspace-mode-explore):not(.workspace-mode-rundapath) .runda-v1-shell--workspace {
    --runda-v1-workspace-chip-row-width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    align-items: stretch;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 0;
    gap: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 0;
    overflow: hidden;
  }

  body:is(.page-slug-home, .home, .front-page, .page-slug-dashboard) .runda-v1-modal--inline-desktop .runda-v1-route-snapshot-speed {
    display: none !important;
  }

  body:is(.page-slug-home, .home, .front-page, .page-slug-dashboard) .runda-v1-modal--inline-desktop:not(.workspace-mode-explore):not(.workspace-mode-rundapath) .runda-v1-workspace-top {
    position: static;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: 0;
  }

  .runda-v1-modal--inline-desktop .runda-v1-chip-row {
    gap: 6px;
  }

  body:is(.page-slug-home, .home, .front-page, .page-slug-dashboard) .runda-v1-modal--inline-desktop:not(.workspace-mode-explore):not(.workspace-mode-rundapath) .runda-v1-chip-row--icon-tree {
    flex-direction: row;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
  }

  body:is(.page-slug-home, .home, .front-page, .page-slug-dashboard) .runda-v1-modal--inline-desktop:not(.workspace-mode-explore):not(.workspace-mode-rundapath) .runda-v1-chip {
    width: 36px !important;
    min-width: 36px !important;
    height: 36px !important;
    min-height: 36px;
    border-radius: 10px;
    font-size: 0.68rem;
    letter-spacing: 0.1em;
  }

  body:is(.page-slug-home, .home, .front-page, .page-slug-dashboard) .runda-v1-modal--inline-desktop:not(.workspace-mode-explore):not(.workspace-mode-rundapath) .runda-v1-workspace-status {
    display: none !important;
  }

  body:is(.page-slug-home, .home, .front-page, .page-slug-dashboard) .runda-v1-modal--inline-desktop:not(.workspace-mode-explore):not(.workspace-mode-rundapath) .runda-v1-pane-wrap,
  body:is(.page-slug-home, .home, .front-page, .page-slug-dashboard) .runda-v1-modal--inline-desktop:not(.workspace-mode-explore):not(.workspace-mode-rundapath) .runda-v1-pane {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 0;
    height: 100%;
    overflow: hidden;
  }

  body:is(.page-slug-home, .home, .front-page, .page-slug-dashboard) .runda-v1-modal--inline-desktop:not(.workspace-mode-explore):not(.workspace-mode-rundapath) .runda-v1-pane {
    padding-right: 0;
  }

  body:is(.page-slug-home, .home, .front-page, .page-slug-dashboard) .runda-v1-modal--inline-desktop:not(.workspace-mode-explore):not(.workspace-mode-rundapath) .runda-v1-source-list {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: clamp(158px, 16vw, 218px);
    grid-template-columns: none;
    gap: 10px;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 2px 4px 0;
    scroll-snap-type: x proximity;
  }

  body:is(.page-slug-home, .home, .front-page, .page-slug-dashboard) .runda-v1-modal--inline-desktop:not(.workspace-mode-explore):not(.workspace-mode-rundapath) .runda-v1-source-card {
    align-content: start;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    scroll-snap-align: start;
  }

  body:is(.page-slug-home, .home, .front-page, .page-slug-dashboard) .runda-v1-modal--inline-desktop:not(.workspace-mode-explore):not(.workspace-mode-rundapath) .runda-v1-new-route-fab {
    right: 18px;
    left: auto;
    bottom: 18px;
  }

  body.page-slug-dashboard .runda-v1-modal--dashboard-rail:not(.workspace-mode-explore):not(.workspace-mode-rundapath) .runda-v1-new-route-fab {
    right: 12px !important;
    bottom: 12px !important;
    width: 40px !important;
    height: 40px !important;
    border-width: 1px !important;
    box-shadow: 0 0 0 5px rgba(255, 247, 239, 0.14) !important;
  }

  body.page-slug-dashboard .runda-v1-modal--dashboard-rail:not(.workspace-mode-explore):not(.workspace-mode-rundapath) .runda-v1-new-route-fab__icon {
    width: 17px !important;
    height: 17px !important;
  }

  body.page-slug-dashboard .runda-v1-modal--dashboard-rail:not(.workspace-mode-explore):not(.workspace-mode-rundapath) .runda-v1-layout {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: auto auto auto !important;
    align-content: start !important;
    overflow: visible !important;
    gap: 6px !important;
  }

  body.page-slug-dashboard .runda-v1-modal--dashboard-rail:not(.workspace-mode-explore):not(.workspace-mode-rundapath) .runda-v1-shell--canvas {
    grid-column: 1 !important;
    grid-row: 1 !important;
    min-height: 0 !important;
  }

  body.page-slug-dashboard .runda-v1-modal--dashboard-rail:not(.workspace-mode-explore):not(.workspace-mode-rundapath) .runda-v1-shell--workspace {
    display: none !important;
  }

  body.page-slug-dashboard .runda-v1-modal--dashboard-rail:not(.workspace-mode-explore):not(.workspace-mode-rundapath) .runda-v1-route-profile-module {
    grid-column: 1 !important;
    grid-row: 2 !important;
    display: grid !important;
    min-height: 0 !important;
  }

  body.page-slug-dashboard .runda-v1-modal--dashboard-rail:not(.workspace-mode-explore):not(.workspace-mode-rundapath) .runda-v1-route-profile-module__chart {
    min-height: 76px !important;
    height: clamp(76px, 8vh, 106px) !important;
  }

  body.page-slug-dashboard .runda-v1-modal--dashboard-rail:not(.workspace-mode-explore):not(.workspace-mode-rundapath) .runda-v1-map-library-shelf {
    grid-column: 1 !important;
    grid-row: 3 !important;
    display: grid !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    overflow: visible !important;
  }

  body.page-slug-dashboard .runda-v1-modal--dashboard-rail:not(.workspace-mode-explore):not(.workspace-mode-rundapath) .runda-v1-chip-row--icon-tree {
    justify-content: flex-start !important;
    width: auto !important;
    max-width: max-content !important;
  }

  body.page-slug-dashboard .runda-v1-modal--dashboard-rail:not(.workspace-mode-explore):not(.workspace-mode-rundapath) .runda-v1-chip--dashboard-mobile-only {
    display: none !important;
  }

  .runda-v1-modal--inline-desktop .runda-v1-pane {
    padding-right: 4px;
  }

  .runda-v1-modal--inline-desktop .runda-v1-source-list {
    gap: 8px;
  }

  .runda-v1-modal--inline-desktop .runda-v1-source-card {
    gap: 8px;
    padding: 8px;
    border-color: rgba(9, 125, 65, 0.55);
  }

  .runda-v1-modal--inline-desktop .runda-v1-source-card__summary,
  .runda-v1-modal--inline-desktop .runda-v1-source-card__open-surface {
    gap: 8px;
  }

  .runda-v1-modal--inline-desktop .runda-v1-source-card__preview-map,
  .runda-v1-modal--inline-desktop .runda-v1-source-card__preview-placeholder {
    height: clamp(54px, 6vh, 70px);
  }

  /* Source-card module host polish: match the planner left-rail panel treatment. */
  .runda-v1-modal--inline-desktop .runda-v1-module-host {
    gap: 6px;
  }

  .runda-v1-modal--inline-desktop .runda-v1-module-host .module-pane,
  .runda-v1-modal--inline-desktop .runda-v1-module-host .module-collapsible {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    box-sizing: border-box;
  }

  .runda-v1-modal--inline-desktop .runda-v1-module-host .module-collapsible > summary {
    min-height: 52px;
    padding: 9px 12px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 14px;
    background: #0a0a0a;
    color: #fff7ef;
    box-shadow: none;
  }

  .runda-v1-modal--inline-desktop .runda-v1-module-host .module-collapsible[open] > summary {
    margin-bottom: 6px;
  }

  .runda-v1-modal--inline-desktop .runda-v1-module-host .module-collapsible > summary h2 {
    font-size: 0.92rem;
    line-height: 1;
    letter-spacing: 0.055em;
  }
}

@media (min-width: 1500px) {
  .runda-v1-modal--inline-desktop .runda-v1-modal__panel {
    height: clamp(820px, calc(100dvh - 112px), 960px);
    min-height: 820px;
  }
}
