/* Native dashboard preview — responsive layout inside the mock frame (container = preview width) */
.dash-preview {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  background: var(--bg);
  text-align: left;
  font-family: var(--font, 'Manrope'), system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  container-type: inline-size;
  container-name: preview;
}
.dash-preview .app {
  display: flex;
  min-height: 0 !important;
  width: 100%;
  max-width: 100%;
  height: 540px !important;
  max-height: min(540px, 70vh) !important;
  overflow: hidden !important;
  position: relative;
}
.dash-preview .amb {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.dash-preview .sb,
.dash-preview .main {
  position: relative;
  z-index: 1;
  min-width: 0;
}
.dash-preview .main {
  flex: 1;
  min-width: 0;
  min-height: 0 !important;
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.dash-preview .content-area {
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  display: flex;
  width: 100%;
  max-width: 100%;
}
.dash-preview .content {
  flex: 1;
  min-width: 0;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}
.dash-preview .content-in { max-width: 100%; margin: 0; min-width: 0; }
.dash-preview .embed-tabs { display: none; }
.dash-preview .cmdk-ov,
.dash-preview .scrim { display: none !important; }

/* Preview is browse-only — tab nav works, page controls do not */
.dash-preview .content-in.lp-readonly button,
.dash-preview .content-in.lp-readonly .toggle,
.dash-preview .content-in.lp-readonly input,
.dash-preview .content-in.lp-readonly select,
.dash-preview .content-in.lp-readonly textarea,
.dash-preview .content-in.lp-readonly a.btn,
.dash-preview .content-in.lp-readonly label.toggle-row {
  pointer-events: none !important;
  user-select: none;
  cursor: default;
}
.dash-preview .embed-tab,
.dash-preview .sb-nav a[data-lp-nav] {
  pointer-events: auto !important;
  cursor: pointer;
}
.dash-preview .content-in.lp-readonly .set-nav button {
  pointer-events: auto !important;
  cursor: pointer;
}
#heroMockFrame .modal-ov { display: none !important; }

/* Contain glows, charts, and card motion inside the mock frame */
.dash-preview .amb { display: none !important; }
.dash-preview .card,
.dash-preview .stat,
.dash-preview .lcard { overflow: hidden; }
.dash-preview .card-int,
.dash-preview .lcard { transform: none !important; }
.dash-preview .card-int:hover,
.dash-preview .lcard:hover { transform: none !important; box-shadow: none; }
.dash-preview .spark,
.dash-preview #areaChart,
.dash-preview #srcChart,
.dash-preview #donut,
.dash-preview .donut-wrap { overflow: hidden; max-width: 100%; position: relative; }
.dash-preview .spark svg,
.dash-preview #areaChart svg,
.dash-preview #srcChart svg,
.dash-preview #donut svg {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
}
.dash-preview .grid { align-items: stretch; }
.dash-preview .grid > .card { min-height: 0; }
.dash-preview .content-in { position: relative; z-index: 1; }
.dash-preview .badge { white-space: nowrap; flex-shrink: 0; max-width: 100%; }
.dash-preview .lcard .lc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.dash-preview .lcard .lc-actions .btn-sm {
  flex: 1 1 calc(33.333% - 4px);
  min-width: 0;
  justify-content: center;
  padding: 6px 5px;
  font-size: 0.68rem;
}
.dash-preview .lcard .lc-actions .btn-sm svg { width: 12px; height: 12px; }

.dash-preview .grid,
.dash-preview .card,
.dash-preview .stat,
.dash-preview .ph,
.dash-preview .toolbar,
.dash-preview .chart,
.dash-preview .tbl-wrap,
.dash-preview #areaChart,
.dash-preview #srcChart,
.dash-preview #donut {
  max-width: 100%;
  min-width: 0;
}
.dash-preview #dashPreviewContent.embed-out {
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
}
.dash-preview #dashPreviewContent.embed-in {
  animation: lpPageIn 0.28s var(--ease) both;
}
@keyframes lpPageIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ── Desktop preview (wide mock frame, matches real dashboard on PC) ── */
@container preview (min-width: 720px) {
  .dash-preview .app {
    height: 580px !important;
    max-height: min(580px, 72vh) !important;
  }
  .dash-preview .sb {
    display: flex !important;
    flex-direction: column;
    width: 220px;
    flex-shrink: 0;
    height: 100%;
    min-height: 0;
    padding: 14px 10px;
    position: relative;
    transform: none !important;
  }
  .dash-preview .sb-brand { padding: 0 6px 14px; }
  .dash-preview .sb-logo-wordmark { max-width: 132px !important; width: 132px !important; }
  .dash-preview .sb-nav a { padding: 8px 10px; font-size: 0.8rem; gap: 10px; }
  .dash-preview .sb-nav a svg { width: 17px; height: 17px; }
  .dash-preview .sb-foot { padding-top: 12px; margin-top: 6px; }
  .dash-preview .sb-user .ue { font-size: 0.74rem; }
  .dash-preview .feed { display: none !important; }
  .dash-preview .embed-tabs { display: none !important; }
  .dash-preview .tb-burger { display: none !important; }
  .dash-preview .tb-search {
    display: flex !important;
    margin-left: auto;
    width: min(200px, 34vw);
    padding: 6px 10px;
    font-size: 0.76rem;
  }
  .dash-preview .tb-search kbd { display: none; }
  .dash-preview .topbar {
    position: relative;
    flex-shrink: 0;
    z-index: 2;
    height: 52px;
    padding: 0 16px;
    gap: 10px;
  }
  .dash-preview .topbar h1 {
    font-size: 0.95rem;
    flex: none;
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
  }
  .dash-preview .tb-avatar {
    width: 32px;
    height: 32px;
    font-size: 0.72rem;
    flex-shrink: 0;
  }
  .dash-preview .content {
    padding: 16px 18px;
    overflow-y: auto;
  }
  .dash-preview .ph {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
  }
  .dash-preview .ph h2 { font-size: 1.25rem; }
  .dash-preview .ph p { font-size: 0.8rem; }
  .dash-preview .ph .row.gap12 {
    width: auto;
    flex-wrap: nowrap;
    align-self: center;
  }
  .dash-preview .grid { gap: 12px; width: 100%; }
  .dash-preview .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
  .dash-preview .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  .dash-preview .g2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .dash-preview .grid.g3 > .card,
  .dash-preview .grid.g4 > .card,
  .dash-preview .grid.g2 > .card {
    grid-column: auto !important;
    width: auto;
  }
  .dash-preview .span2 { grid-column: span 2 !important; }
  .dash-preview .stat {
    padding: 14px 14px 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    height: 100%;
  }
  .dash-preview .stat .st-v { font-size: 1.35rem; margin-top: 4px; }
  .dash-preview .stat .st-l { font-size: 0.62rem; }
  .dash-preview .stat .st-sub { margin-top: 12px; }
  .dash-preview .stat .spark {
    display: block;
    height: 36px;
    margin-top: auto;
    padding-top: 8px;
  }
  .dash-preview .stat .spark:empty { display: none; height: 0; margin: 0; padding: 0; }
  .dash-preview .card-head .sub { font-size: 0.76rem; }
  .dash-preview #areaChart svg,
  .dash-preview #srcChart svg {
    min-height: 100px;
    max-height: 150px;
  }
  .dash-preview #donut svg { max-height: 130px; }
  .dash-preview .set-wrap {
    display: grid;
    grid-template-columns: minmax(148px, 172px) minmax(0, 1fr);
    gap: 14px;
    align-items: start;
  }
  .dash-preview .set-nav {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 2px;
    padding: 0;
    border: none;
    background: rgba(7, 11, 22, 0.92);
    align-self: start;
    max-height: calc(100% - 4px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .dash-preview .set-nav .grp {
    display: block;
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--dim);
    padding: 10px 8px 3px;
  }
  .dash-preview .set-nav button {
    display: flex;
    align-items: center;
    width: 100%;
    flex: none;
    min-width: 0;
    padding: 7px 8px;
    font-size: 0.72rem;
    gap: 8px;
    border-radius: 9px;
  }
  .dash-preview .set-nav button span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .dash-preview #setBody { min-width: 0; }
  .dash-preview .cards { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

@container preview (min-width: 720px) and (max-width: 860px) {
  .dash-preview .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .dash-preview .g3 { grid-template-columns: minmax(0, 1fr) !important; }
  .dash-preview .span2 { grid-column: 1 / -1 !important; }
}

/* ── Mobile preview (narrow mock frame, matches real dashboard on phone) ── */
@container preview (max-width: 719px) {
  .dash-preview .sb,
  .dash-preview .feed,
  .dash-preview .tb-search,
  .dash-preview .tb-burger,
  .dash-preview .scrim { display: none !important; }
  .dash-preview .content { padding: 10px; }
  .dash-preview .topbar {
    position: relative;
    flex-shrink: 0;
    z-index: 2;
    height: 46px;
    padding: 0 10px;
    gap: 8px;
  }
  .dash-preview .topbar h1 {
    flex: 1;
    min-width: 0;
    font-size: 0.88rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .dash-preview .tb-avatar {
    width: 30px;
    height: 30px;
    font-size: 0.68rem;
    flex-shrink: 0;
  }
  .dash-preview .embed-tabs {
    display: flex !important;
    flex-direction: row;
    flex-wrap: nowrap;
    flex-shrink: 0;
    gap: 2px;
    padding: 5px 4px 7px;
    border-top: 1px solid var(--line);
    background: rgba(11, 17, 32, 0.98);
    overflow: hidden;
    width: 100%;
    max-width: 100%;
  }
  .dash-preview .embed-tab {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 2px;
    border: none;
    border-radius: 10px;
    background: none;
    color: var(--dim);
    font-family: inherit;
    font-size: 0.58rem;
    font-weight: 600;
    cursor: pointer;
  }
  .dash-preview .embed-tab svg { width: 17px; height: 17px; }
  .dash-preview .embed-tab.active {
    color: var(--gold-2);
    background: rgba(196, 162, 101, 0.14);
  }
  .dash-preview .ph {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 10px;
  }
  .dash-preview .ph .row.gap12 {
    width: 100%;
    flex-wrap: wrap;
    align-self: stretch;
    align-items: center;
    overflow: hidden;
  }
  .dash-preview .pulse-dot { flex-shrink: 0; overflow: hidden; contain: layout paint; }
  .dash-preview .ph h2 { font-size: 1.05rem; }
  .dash-preview .ph p { font-size: 0.72rem; }
  .dash-preview .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .dash-preview .g2,
  .dash-preview .g3 { grid-template-columns: minmax(0, 1fr) !important; }
  .dash-preview .grid.g3 > .card,
  .dash-preview .grid.g4 > .card,
  .dash-preview .grid.g2 > .card {
    grid-column: 1 / -1 !important;
    width: 100%;
  }
  .dash-preview .span2 { grid-column: 1 / -1 !important; }
  .dash-preview .grid { gap: 8px; width: 100%; }
  .dash-preview .stat {
    padding: 10px 10px 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    height: 100%;
  }
  .dash-preview .stat .st-v { font-size: 1.05rem; margin-top: 4px; }
  .dash-preview .stat .st-l { font-size: 0.58rem; }
  .dash-preview .stat .st-sub { margin-top: 10px; }
  .dash-preview .stat .spark {
    display: block;
    height: 36px;
    margin-top: auto;
    padding-top: 6px;
  }
  .dash-preview .stat .spark:empty { display: none; height: 0; margin: 0; padding: 0; }
  .dash-preview .card { min-width: 0; }
  .dash-preview .card-head .sub { font-size: 0.72rem; }
  .dash-preview #areaChart,
  .dash-preview #srcChart,
  .dash-preview #donut { padding: 0 4px 8px; }
  .dash-preview #areaChart svg,
  .dash-preview #srcChart svg {
    min-height: 120px;
    max-height: 160px;
  }
  .dash-preview #donut svg {
    max-height: 140px;
    width: auto;
    margin: 0 auto;
  }
  .dash-preview .legend { margin-top: 8px; }
  .dash-preview .tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .dash-preview .cards { grid-template-columns: 1fr; }
  .dash-preview .set-wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .dash-preview .set-nav {
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0;
    border: none;
    background: none;
    overflow: visible;
  }
  .dash-preview .set-nav .grp { width: 100%; font-size: 0.62rem; margin-top: 4px; }
  .dash-preview .set-nav button {
    flex: 1 1 calc(50% - 6px);
    min-width: 0;
    padding: 8px 10px;
    font-size: 0.72rem;
  }
}
