/* FYLO Explorer — hosted inside the website. All DuVay overrides are SCOPED to
   `.explorer` so nothing bleeds into the marketing pages once this stylesheet is
   loaded (it stays in <head> across SPA navigation). */

/* Square corners + orange brand accent, only inside the Explorer subtree.
   Custom properties inherit, so descendant DuVay components pick these up. */
.explorer {
    --w-radius: 0;
    --w-radius-sm: 0;
    --w-radius-md: 0;
    --w-radius-lg: 0;
    --w-radius-xl: 0;
    --w-radius-pill: 0;
    --w-radius-circle: 0;
    --w-primary: #f89b4b;
    --w-on-primary: #000;
}

/* …except chips (pill). */
.explorer .w-chip {
    border-radius: 999px;
}

/* All DuVay buttons in the Explorer: rounded corners like the FX avatar; filled
   buttons get the orange fill + black text from the tokens above; outlined get an
   orange border to match. */
.explorer .w-btn {
    border-radius: 7px;
}

.explorer .w-btn-outlined {
    border-color: #f89b4b;
}

.explorer-theme-btn {
    border-radius: 7px;
}

/* the root chip doubles as the "switch root" control */
.explorer-root-chip {
    cursor: pointer;
}

.explorer-write-status {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.65rem;
    border: 1px solid rgba(56, 142, 60, 0.5);
    border-radius: 999px;
    color: #2e7d32;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
}

html[w-theme='dark'] .explorer-write-status {
    color: #81c784;
}

/* Route host: the Explorer is full-screen (the site nav is folded into its own
   bar, and the shell header is hidden on this route). */
.explorer-route {
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* Site nav folded into the Explorer's own bar. */
.explorer-avatar {
    text-decoration: none;
}

.explorer-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Pick-screen intro: what the Explorer is. */
.explorer-intro {
    max-width: 42rem;
    margin: 0 auto 1.75rem;
    text-align: center;
}

.explorer-intro h1 {
    margin: 0 0 0.5rem;
    font-size: 1.6rem;
}

.explorer-intro-lead {
    margin: 0 auto;
    max-width: 36rem;
    opacity: 0.82;
    line-height: 1.6;
}

.explorer-intro-features {
    list-style: none;
    padding: 0;
    margin: 1.1rem auto 0;
    max-width: 34rem;
    display: grid;
    gap: 0.4rem;
    text-align: left;
}

.explorer-intro-features li {
    position: relative;
    padding-left: 1.25rem;
    opacity: 0.85;
    line-height: 1.5;
}

.explorer-intro-features li::before {
    content: '›';
    position: absolute;
    left: 0;
    color: #f89b4b;
    font-weight: 700;
}

.explorer-shell {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* The Tac component wrapper sits between the shell and .explorer as a plain
   block; make it a full-height flex column so the pane dividers reach the
   bottom of the viewport instead of stopping at content height. */
.explorer-shell > * {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.explorer {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

/* --- App bar --- */

.explorer-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    padding: 0.6rem 1rem;
    padding-left: calc(1rem + env(safe-area-inset-left));
    padding-right: calc(1rem + env(safe-area-inset-right));
    border-bottom: 1px solid rgba(128, 128, 128, 0.25);
}

.explorer-bar .spacer {
    flex: 1;
}

/* FX brand avatar: an orange circle with the initials (replaces the wordmark).
   Hand-rolled — DuVay's w-avatar paints its circle in a shadow node that host
   CSS / bg-color don't reliably reach in this theme. */
.explorer-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 7px;
    background: #f89b4b;
    color: #000;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

/* --- Busy indicator: 2px indeterminate bar under the app bar --- */

.explorer-progress {
    height: 2px;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
    opacity: 0;
    transition: opacity 120ms ease;
}

.explorer-progress--on {
    opacity: 1;
}

.explorer-progress--on::before {
    content: '';
    position: absolute;
    inset: 0;
    width: 40%;
    background: currentColor;
    animation: explorer-progress-slide 1s linear infinite;
}

@keyframes explorer-progress-slide {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(250%);
    }
}

/* --- Alerts --- */

.explorer-alert {
    position: relative;
    margin: 0.5rem 1rem 0;
}

.explorer-alert-dismiss {
    position: absolute;
    top: 0.35rem;
    right: 0.35rem;
}

/* --- Firestore-style path bar --- */

/* the path bar and the (file-collection) Upload button share one row; the
   topbar owns the divider so the button lines up with the crumbs. */
.explorer-topbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(128, 128, 128, 0.25);
    padding-right: calc(1rem + env(safe-area-inset-right));
}

.explorer-topbar .explorer-topbar-action {
    flex-shrink: 0;
    margin-left: auto; /* pin to the right end of the bar */
    white-space: nowrap;
}

.explorer-crumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.1rem;
    min-width: 0; /* let long paths ellipsize instead of shoving the button off */
    flex: 1;
    padding: 0.4rem 1rem;
    padding-left: calc(1rem + env(safe-area-inset-left));
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.8rem;
    min-height: 2rem;
    box-sizing: border-box;
}

.explorer-crumb {
    all: unset;
    cursor: pointer;
    padding: 0.15rem 0.4rem;
    opacity: 0.75;
    max-width: 16rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.explorer-crumb:hover {
    background: rgba(128, 128, 128, 0.15);
    opacity: 1;
}

.explorer-crumb.is-leaf {
    cursor: default;
    opacity: 1;
    font-weight: 600;
    color: #f89b4b;
}

.explorer-crumb.is-leaf:hover {
    background: none;
}

html[w-theme='light'] .explorer-crumb.is-leaf {
    color: #8a4600;
}

.explorer-crumb:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 1px;
}

.explorer-crumb-sep {
    opacity: 0.4;
}

.explorer-crumbs > .explorer-crumb-sep:last-child {
    display: none;
}

/* --- Panes --- */

.explorer-body {
    display: grid;
    grid-template-columns: minmax(200px, 240px) minmax(320px, 1fr); /* 2 panes until a doc is shown */
    flex: 1;
    min-height: 0;
    position: relative; /* anchors the pane resize grips */
    /* columns keep their min width and the strip scrolls sideways when they
       would otherwise be squeezed out of view; panes own their vertical scroll */
    overflow-x: auto;
    overflow-y: hidden;
}

/* Pane resize grips (collections view): full-height overlays sitting on a track
   boundary. Their left edge is derived from the same --w-* vars that size the
   tracks, so they stay glued to the boundary as it moves. */
.explorer-pane-grip {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 0.6rem;
    margin-left: -0.3rem;
    cursor: col-resize;
    touch-action: none;
    z-index: 5;
    display: none; /* revealed per-view/state in the desktop media query below */
}

.explorer-pane-grip::after {
    content: '';
    position: absolute;
    inset: 0 auto 0 50%;
    width: 2px;
    background: transparent;
    transition: background 120ms ease;
}

.explorer-pane-grip:hover::after {
    background: #f89b4b;
}

.explorer-pane-grip:focus-visible::after,
.explorer-col-grip:focus-visible::after {
    background: currentColor;
}

.explorer-body.show-doc {
    grid-template-columns: minmax(200px, 240px) minmax(280px, 360px) minmax(360px, 1fr);
}

/* the document pane only exists once there's something to inspect */
.explorer-body:not(.show-doc) > section[aria-label='Document'] {
    display: none;
}

/* the schema + metadata + versions panes only exist for a selected document in
   the collections view; revealed by the desktop v-docs.show-doc rule below */
.explorer-body > section[aria-label='Schema'],
.explorer-body > section[aria-label='Metadata'],
.explorer-body > section[aria-label='Versions'] {
    display: none;
}

.explorer-pane {
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    border-right: 1px solid rgba(128, 128, 128, 0.25);
    padding: 0.75rem;
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
    min-width: 0;
}

.explorer-pane:last-child {
    border-right: none;
}

.explorer-pane h3 {
    margin: 1rem 0 0.75rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.9;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* only the pane's leading header pins while scrolling */
.explorer-pane h3:first-child,
.explorer-pane .explorer-back + h3 {
    position: sticky;
    top: -0.75rem;
    z-index: 1;
    margin: -0.75rem -0.75rem 0.75rem;
    padding: 0.85rem 0.75rem 0.5rem;
    backdrop-filter: blur(8px);
    background: rgba(127, 127, 127, 0.08);
}

.explorer-hint {
    font-size: 0.85rem;
    opacity: 0.7;
    line-height: 1.5;
}

/* --- Lists --- */

.explorer-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.explorer-list li {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    min-width: 0;
}

.explorer-list button {
    flex: 1;
    min-width: 0;
    text-align: left;
    justify-content: flex-start;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* edit/delete icons on a document row — hidden until the row is hovered/focused */
.explorer-list button.explorer-row-act {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.35rem;
    cursor: pointer;
    color: inherit;
    opacity: 0;
    transition:
        opacity 120ms ease,
        color 120ms ease;
}

.explorer-list li:hover .explorer-row-act,
.explorer-row-act:focus-visible {
    opacity: 0.6;
}

.explorer-list li:hover .explorer-row-act:hover,
.explorer-row-act:focus-visible {
    opacity: 1;
}

.explorer-list li:hover .explorer-row-del:hover,
.explorer-row-del:focus-visible {
    color: #e26057; /* delete red */
}

/* --- Firestore-style panel rows --- */

.explorer-row {
    all: unset;
    box-sizing: border-box;
    display: block;
    flex: 1;
    min-width: 0;
    cursor: pointer;
    padding: 0.45rem 0.6rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: background 120ms ease;
}

.explorer-row:hover {
    background: rgba(128, 128, 128, 0.12);
}

.explorer-row:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.explorer-row.is-selected {
    background: rgba(248, 155, 75, 0.16);
    box-shadow: inset 3px 0 0 #f89b4b;
    color: #f89b4b;
    font-weight: 600;
}

html[w-theme='light'] .explorer-row.is-selected {
    color: #8a4600;
    box-shadow: inset 3px 0 0 #8a4600;
}

/* --- Finder-style Miller columns (file collections) --- */

/* the pane hosting a column strip becomes a vertical flex so the strip
   fills the remaining height (Chromium-only app, :has is safe) */
.explorer-pane:has(.explorer-columns) {
    display: flex;
    flex-direction: column;
}

.explorer-columns {
    display: flex;
    flex-direction: row; /* explicit: columns sit side by side, never stacked */
    align-items: stretch;
    flex: 1;
    min-width: 0; /* scroll the strip internally; never force the pane wider */
    min-height: 12rem;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
}

.explorer-col {
    flex: 0 0 200px; /* never shrink: columns keep their width and scroll instead */
    width: 200px;
    box-sizing: border-box;
    min-width: 0; /* let the preview shrink; its <pre> scrolls, not the strip */
    position: relative; /* anchors the resize grip */
    border-right: 1px solid rgba(128, 128, 128, 0.25);
    padding: 0.25rem 0.4rem 0.25rem 0;
    margin-right: 0.4rem;
    display: flex;
    flex-direction: column;
    scroll-snap-align: start;
}

/* the column's scroll lives on the body so the grip stays put while scrolling */
.explorer-col-body {
    flex: 1;
    min-height: 0;
    overflow-x: hidden; /* wide previews scroll inside their own <pre>, not here */
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

/* drag-to-resize handle straddling the column's right edge */
.explorer-col-grip {
    position: absolute;
    top: 0;
    bottom: 0;
    right: -0.3rem;
    width: 0.6rem;
    cursor: col-resize;
    touch-action: none;
    z-index: 1;
}

.explorer-col-grip::after {
    content: '';
    position: absolute;
    inset: 0 auto 0 50%;
    width: 2px;
    background: transparent;
    transition: background 120ms ease;
}

.explorer-col-grip:hover::after {
    background: #f89b4b;
}

.explorer-col .explorer-row {
    flex: none;
    width: 100%;
}

/* the selected file's preview: takes the lion's share of the strip's free
   width (min 320px so it scrolls into view rather than squashing) */
.explorer-col--preview {
    flex: 20 1 320px;
    padding-left: 0.6rem;
    padding-right: 0.4rem;
}

/* file metadata: a fixed-width column (resizable via its grip). */
.explorer-col--meta {
    flex: 0 0 240px;
    padding-left: 0.6rem;
}

/* file version history: the last column — grows to sit flush at the right. */
.explorer-col--fversions {
    flex: 1 1 240px;
    padding-left: 0.6rem;
}

/* a collapsed Miller column: hide its body/grip, show only the vertical label */
.explorer-col.is-collapsed {
    padding-left: 0;
    padding-right: 0;
    overflow: hidden;
}

.explorer-col.is-collapsed .explorer-col-body,
.explorer-col.is-collapsed .explorer-col-grip {
    display: none;
}

.explorer-preview-media {
    max-width: 100%;
    max-height: 62vh;
    display: block;
}

.explorer-col--preview audio {
    width: 100%;
}

.explorer-preview-frame {
    width: 100%;
    height: 62vh;
    border: 1px solid rgba(128, 128, 128, 0.3);
    background: #fff; /* PDFs/HTML expect a light backdrop */
}

.explorer-preview-text {
    max-height: 62vh;
    overflow: auto;
}

/* highlight.js paints its own colors; keep our pre padding/scroll and let its
   theme set the code background. */
.explorer-preview-text.hljs,
.explorer-preview-text .hljs {
    padding: 1rem;
}

.explorer-preview-text code {
    font: inherit;
}

/* File metadata (the browser-readable subset) under the preview. */
.explorer-meta {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.2rem 0.75rem;
    margin: 0.75rem 0;
    font-size: 0.8rem;
}

.explorer-meta dt {
    opacity: 0.6;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.72rem;
    align-self: center;
}

.explorer-meta dd {
    margin: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    overflow-wrap: anywhere;
}

.explorer-row--split {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.explorer-row--split .row-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* File/folder rows: a VS Code–style icon beside the name (buckets browser). */
.row-label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
}

.ex-ficon {
    flex: 0 0 auto;
    width: 1rem;
    height: 1rem;
    display: block;
}

.explorer-row--split .row-chev {
    opacity: 0.5;
    flex-shrink: 0;
}

/* On a phone the Miller strip becomes a full-width horizontal pager: one level
   per screen, snapping as you drill in (scrollColumnsEnd reveals the newest).
   The aux columns don't collapse here — `!important` beats the inline width that
   colStyle() sets for the collapsed state, and their content is shown. */
@media (max-width: 760px) {
    .explorer-columns {
        scroll-snap-type: x mandatory;
    }
    .explorer-col,
    .explorer-col--preview,
    .explorer-col--meta,
    .explorer-col--fversions,
    .explorer-col.is-collapsed {
        flex: 0 0 100% !important;
        width: 100% !important;
        scroll-snap-align: start;
    }
    .explorer-col.is-collapsed {
        padding: 0.25rem 0.4rem 0.25rem 0;
        overflow: visible;
    }
    .explorer-col.is-collapsed .explorer-col-body {
        display: flex;
    }
}

/* --- Firestore-style change flashes --- */

@keyframes explorer-flash-added {
    0% {
        background: rgba(103, 194, 124, 0.45);
    }
    100% {
        background: transparent;
    }
}

@keyframes explorer-flash-updated {
    0% {
        background: rgba(248, 155, 75, 0.5);
    }
    100% {
        background: transparent;
    }
}

.explorer-row.flash-added,
.explorer-json.flash-added {
    animation: explorer-flash-added 1.3s ease-out;
}

.explorer-row.flash-updated,
.explorer-json.flash-updated {
    animation: explorer-flash-updated 1.3s ease-out;
}

.explorer-row.flash-deleted,
.explorer-json.flash-deleted {
    background: rgba(226, 96, 87, 0.35);
    text-decoration: line-through;
    transition: opacity 380ms ease;
    opacity: 0.45;
}

/* --- JSON editor: keys/punctuation static, only the values are <input>s --- */

.explorer-jsonedit {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.85rem;
    background: rgba(128, 128, 128, 0.08);
    padding: 0.75rem;
    margin: 0.5rem 0;
    overflow-x: auto;
}

.jsonedit-line {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    padding-left: 1.25rem; /* JSON indent */
    line-height: 1.9;
}

.jsonedit-key {
    opacity: 0.7;
    white-space: nowrap;
}

.jsonedit-punct {
    opacity: 0.55;
}

.jsonedit-lit {
    opacity: 0.85;
}

/* width follows the `size` attribute (char count of the value), so the field
   grows and shrinks with the text instead of filling the line */
.jsonedit-input {
    flex: 0 0 auto;
    width: auto;
    min-width: 1ch;
    max-width: 100%;
    box-sizing: content-box;
    min-height: 0; /* drop DuVay's control height so the field hugs the text */
    height: auto;
    padding: 0.1rem 0.2rem;
    line-height: 1.3;
    font-family: inherit;
    font-size: inherit;
}

/* selected rows flash over their accent tint */
.explorer-row.is-selected.flash-added,
.explorer-row.is-selected.flash-updated {
    box-shadow: inset 3px 0 0 #f89b4b;
}

@media (prefers-reduced-motion: reduce) {
    .explorer-row.flash-added,
    .explorer-row.flash-updated,
    .explorer-json.flash-added,
    .explorer-json.flash-updated {
        animation-duration: 0.01s;
    }
}

/* --- Toolbars, filter, editor --- */

.explorer-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.explorer-filter input {
    flex: 1;
    min-width: 10rem;
}

/* Search field: a filter input with a trailing magnifier icon (no button) and
   the result count sitting after it. */
.explorer-search {
    position: relative;
    flex: 1;
    min-width: 10rem;
    display: flex;
}

.explorer-search-input {
    flex: 1;
    min-width: 0;
    padding-right: 2rem;
}

.explorer-search-icon {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(128, 128, 128, 0.7);
    transition: color 120ms ease;
}

.explorer-search-icon:hover {
    color: #f89b4b;
}

.explorer-count {
    align-self: center;
    font-size: 0.8rem;
    opacity: 0.65;
    white-space: nowrap;
}

/* full-width Download button under the file metadata */
.explorer-download {
    display: flex;
    width: 100%;
    box-sizing: border-box;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* full-width Run button under the SQL editor */
.explorer-run {
    display: block;
    width: 100%;
    margin-bottom: 0.75rem;
    flex-shrink: 0;
}

/* --- Overview + Export/Import tools --- */

.explorer-overview,
.explorer-tool {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    overflow: auto;
}

.explorer-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(6rem, 1fr));
    gap: 0.75rem;
}

.explorer-stat {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.85rem 1rem;
    background: rgba(127, 127, 127, 0.08);
    border: 1px solid rgba(128, 128, 128, 0.25);
    border-radius: 8px;
}

.explorer-stat-num {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1;
}

.explorer-stat-label {
    font-size: 0.8rem;
    opacity: 0.7;
}

.explorer-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.explorer-table th,
.explorer-table td {
    text-align: left;
    padding: 0.45rem 0.6rem;
    border-bottom: 1px solid rgba(128, 128, 128, 0.25);
}

.explorer-table th {
    font-weight: 600;
    opacity: 0.7;
}

.explorer-table .explorer-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Aggregate write-activity graph at the top of the Overview. */
.explorer-chart-block {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.explorer-chart-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    font-weight: 600;
}

.explorer-chart {
    width: 100%;
    height: 72px;
    display: block;
    background: rgba(127, 127, 127, 0.08);
    border: 1px solid rgba(128, 128, 128, 0.25);
    border-radius: 8px;
}

.explorer-chart rect {
    fill: #f89b4b;
    transition: fill 120ms ease;
}

.explorer-chart rect:hover {
    fill: #e07d2c;
}

.explorer-chart-axis {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    opacity: 0.6;
}

/* Write-cadence sparkline: a normalized polyline scaled by the cell. */
.explorer-spark-cell {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
}

.explorer-spark {
    width: 72px;
    height: 20px;
    display: block;
}

.explorer-spark polyline {
    fill: none;
    stroke: #f89b4b;
    stroke-width: 1.5;
    stroke-linejoin: round;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
}

.explorer-tool-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.explorer-tool-section h4 {
    margin: 0;
    font-size: 1rem;
}

.explorer-tool-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
}

.explorer-tool-row .w-input {
    flex: 1 1 12rem;
    min-width: 0;
}

.explorer-note {
    margin: 0;
    padding: 0.6rem 0.8rem;
    background: rgba(248, 155, 75, 0.16);
    border-radius: 8px;
    font-size: 0.9rem;
}

/* SQL editor fills the pane's height: the textarea grows to the bottom with the
   Run button pinned beneath it. */
.explorer-body.v-sql > section[aria-label='Documents'] {
    display: flex;
    flex-direction: column;
}

.explorer-body.v-sql .explorer-sql {
    flex: 1;
    min-height: 6rem;
}

/* SQL editor and the text-file editor: a highlighted <pre> behind a transparent
   <textarea>. Both share identical text metrics so the colored glyphs sit
   exactly under the caret. */
.explorer-sql,
.explorer-fileedit {
    position: relative;
    display: flex;
    margin-bottom: 0.5rem;
}

/* the file editor fills the preview column, with Save pinned beneath it */
.explorer-fileedit {
    flex: 1;
    min-height: 8rem;
}

.explorer-sql-hl,
.explorer-sql-input,
.explorer-fileedit-hl,
.explorer-fileedit-input {
    margin: 0;
    box-sizing: border-box;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    padding: 0.6rem 0.7rem;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
    tab-size: 4;
}

.explorer-sql-hl,
.explorer-fileedit-hl {
    position: absolute;
    inset: 0;
    overflow: auto;
    pointer-events: none;
    border: 1px solid transparent; /* match the textarea's border box */
}

/* Code preview + SQL console: a line-number gutter beside a horizontally-
   scrolling, non-wrapping code area, so line numbers stay aligned with source. */
.explorer-fileedit-code,
.explorer-sql-code {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}

.explorer-fileedit-hl,
.explorer-fileedit-input,
.explorer-sql-hl,
.explorer-sql-input {
    white-space: pre;
    word-break: normal;
    overflow-wrap: normal;
}

.explorer-fileedit-gutter,
.explorer-sql-gutter {
    margin: 0;
    box-sizing: border-box;
    flex: 0 0 auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    padding: 0.6rem 0.5rem;
    text-align: right;
    white-space: pre;
    overflow: hidden;
    user-select: none;
    color: rgba(128, 128, 128, 0.65);
    background: rgba(127, 127, 127, 0.06);
    border-right: 1px solid rgba(128, 128, 128, 0.25);
}

/* SQL autocomplete: a floating suggestion list anchored at the editor's
   bottom-left; each row shows a kind badge (kw/table/col) and the completion. */
.explorer-sql-suggest {
    position: absolute;
    z-index: 6;
    margin: 0;
    padding: 0.25rem;
    list-style: none;
    max-height: 12rem;
    overflow: auto;
    min-width: 12rem;
    background: var(--w-color-surface, #1b1e24);
    border: 1px solid rgba(128, 128, 128, 0.35);
    border-radius: 6px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.explorer-sql-suggest-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.3rem 0.5rem;
    border: none;
    border-radius: 4px;
    background: none;
    cursor: pointer;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.8rem;
    color: inherit;
    text-align: left;
}

.explorer-sql-suggest-item:hover {
    background: rgba(248, 155, 75, 0.16);
}

.explorer-sql-suggest-kind {
    flex: 0 0 auto;
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    opacity: 0.55;
    width: 2.6rem;
}

/* The WHERE filter shares the SQL console's suggestions, anchored below the
   single-line input rather than at the editor caret. */
.explorer-filter-suggest {
    top: calc(100% + 0.25rem);
    right: 0;
    left: 0;
    min-width: 0;
}

/* Diagnostics overlay: wavy underlines painted over flagged tokens. The layer
   never intercepts pointer events (the textarea handles hover for tooltips);
   the inner wrapper is translated on scroll to track the code. */
.explorer-fileedit-diags {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 3;
}

.explorer-fileedit-diags-inner {
    position: absolute;
    top: 0;
    left: 0;
}

.explorer-squiggle {
    position: absolute;
    height: 4px;
    /* Only the underline is interactive (for the native title tooltip); the rest
       of the layer passes clicks through to the textarea. */
    pointer-events: auto;
    cursor: help;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='6' height='4'%3E%3Cpath d='M0 3 Q1.5 0 3 3 T6 3' fill='none' stroke='%23e05252' stroke-width='1'/%3E%3C/svg%3E")
        repeat-x;
}

.explorer-sql-hl code,
.explorer-fileedit-hl code {
    font: inherit;
}

/* The textarea is deliberately transparent so this layer supplies the visible
   syntax colours. highlight.js ships a dark palette, therefore give the SQL
   editor a complete, high-contrast palette for both site themes rather than
   inheriting the page foreground/background. */
.explorer-sql-hl.hljs {
    color: #c9d1d9;
    background: #0d1117;
    color-scheme: dark;
}

html[w-theme='light'] .explorer-sql-hl.hljs {
    color: #24292f;
    background: #f6f8fa;
    color-scheme: light;
}

html[w-theme='light'] .explorer-sql-hl .hljs-doctag,
html[w-theme='light'] .explorer-sql-hl .hljs-keyword,
html[w-theme='light'] .explorer-sql-hl .hljs-meta .hljs-keyword,
html[w-theme='light'] .explorer-sql-hl .hljs-template-tag,
html[w-theme='light'] .explorer-sql-hl .hljs-template-variable,
html[w-theme='light'] .explorer-sql-hl .hljs-type,
html[w-theme='light'] .explorer-sql-hl .hljs-variable.language_ {
    color: #cf222e;
}

html[w-theme='light'] .explorer-sql-hl .hljs-title,
html[w-theme='light'] .explorer-sql-hl .hljs-title.class_,
html[w-theme='light'] .explorer-sql-hl .hljs-title.class_.inherited__,
html[w-theme='light'] .explorer-sql-hl .hljs-title.function_ {
    color: #8250df;
}

html[w-theme='light'] .explorer-sql-hl .hljs-attr,
html[w-theme='light'] .explorer-sql-hl .hljs-attribute,
html[w-theme='light'] .explorer-sql-hl .hljs-literal,
html[w-theme='light'] .explorer-sql-hl .hljs-meta,
html[w-theme='light'] .explorer-sql-hl .hljs-number,
html[w-theme='light'] .explorer-sql-hl .hljs-operator,
html[w-theme='light'] .explorer-sql-hl .hljs-selector-attr,
html[w-theme='light'] .explorer-sql-hl .hljs-selector-class,
html[w-theme='light'] .explorer-sql-hl .hljs-selector-id,
html[w-theme='light'] .explorer-sql-hl .hljs-variable {
    color: #0550ae;
}

html[w-theme='light'] .explorer-sql-hl .hljs-meta .hljs-string,
html[w-theme='light'] .explorer-sql-hl .hljs-regexp,
html[w-theme='light'] .explorer-sql-hl .hljs-string {
    color: #0a3069;
}

html[w-theme='light'] .explorer-sql-hl .hljs-built_in,
html[w-theme='light'] .explorer-sql-hl .hljs-symbol,
html[w-theme='light'] .explorer-sql-hl .hljs-bullet {
    color: #953800;
}

html[w-theme='light'] .explorer-sql-hl .hljs-code,
html[w-theme='light'] .explorer-sql-hl .hljs-comment,
html[w-theme='light'] .explorer-sql-hl .hljs-formula {
    color: #57606a;
}

html[w-theme='light'] .explorer-sql-hl .hljs-name,
html[w-theme='light'] .explorer-sql-hl .hljs-quote,
html[w-theme='light'] .explorer-sql-hl .hljs-selector-pseudo,
html[w-theme='light'] .explorer-sql-hl .hljs-selector-tag {
    color: #116329;
}

html[w-theme='light'] .explorer-sql-hl .hljs-subst,
html[w-theme='light'] .explorer-sql-hl .hljs-emphasis,
html[w-theme='light'] .explorer-sql-hl .hljs-strong {
    color: #24292f;
}

html[w-theme='light'] .explorer-sql-hl .hljs-section {
    color: #0550ae;
}

.explorer-sql-input,
.explorer-fileedit-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    resize: none;
    background: transparent;
    color: transparent;
    -webkit-text-fill-color: transparent;
    caret-color: #f89b4b;
}

/* SQL input must remain readable even when a browser composites the native
   textarea above the highlight layer. The file editor still uses the fully
   transparent overlay, but SQL favours reliable contrast over that layering
   trick. */
.explorer-sql-input {
    color: #c9d1d9;
    -webkit-text-fill-color: #c9d1d9;
}

html[w-theme='light'] .explorer-sql-input {
    color: #24292f;
    -webkit-text-fill-color: #24292f;
}

.explorer-sql-input::placeholder,
.explorer-fileedit-input::placeholder {
    color: rgba(128, 128, 128, 0.6);
    -webkit-text-fill-color: rgba(128, 128, 128, 0.6);
}

/* read-only mode: no caret, and a not-allowed cursor signals the disabled state */
.explorer-fileedit-input:disabled {
    caret-color: transparent;
    cursor: not-allowed;
}

/* the SQL Rows pane only exists once a row-shaped result has rows */
.explorer-body:not(.has-rows) > section[aria-label='Rows'] {
    display: none;
}

.explorer-editor {
    width: 100%;
    min-height: 14rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.85rem;
    box-sizing: border-box;
    margin-bottom: 0.5rem;
    resize: vertical;
}

.explorer-json {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.85rem;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
    padding: 1rem;
    background: rgba(128, 128, 128, 0.08);
    overflow-x: auto;
}

.explorer-empty-result {
    padding: 1rem;
    border: 1px dashed rgba(128, 128, 128, 0.45);
    border-radius: 8px;
    background: rgba(128, 128, 128, 0.08);
}

.explorer-empty-result h3,
.explorer-empty-result p {
    margin: 0;
}

.explorer-empty-result p {
    margin-top: 0.3rem;
    color: var(--w-text-subtle);
}

.explorer-deleted-id {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.8rem;
    opacity: 0.75;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.explorer-upload input[type='file'] {
    display: none;
}

.explorer-image {
    max-width: 100%;
    max-height: 50vh;
    display: block;
}

/* --- Collapsible aux columns (schema / metadata / versions) --- */

.explorer-pane--aux {
    position: relative;
}

.explorer-pane--aux.is-collapsed {
    padding: 0;
    overflow: hidden;
}

.is-collapsed .explorer-aux-content {
    display: none;
}

/* expanded: a small collapse chevron in the top-right corner */
.explorer-collapse {
    all: unset;
    box-sizing: border-box;
    position: absolute;
    top: 0.55rem;
    right: 0.4rem;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 5px;
    cursor: pointer;
    opacity: 0.5;
    transition:
        opacity 120ms ease,
        background 120ms ease;
}

.explorer-collapse:hover,
.explorer-collapse:focus-visible {
    opacity: 1;
    background: rgba(128, 128, 128, 0.16);
}

.explorer-collapse-icon {
    font-size: 1.1rem;
    line-height: 1;
}

.explorer-collapse-vlabel {
    display: none;
}

/* collapsed: the whole pane becomes the vertical-label tab, label centered */
.is-collapsed .explorer-collapse {
    inset: 0;
    width: auto;
    height: auto;
    border-radius: 0;
    align-items: center;
    justify-content: center;
    opacity: 0.85;
}

.is-collapsed .explorer-collapse-icon {
    display: none;
}

.is-collapsed .explorer-collapse-vlabel {
    display: block;
    writing-mode: vertical-rl;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.85;
}

/* --- Version history list --- */

.explorer-versions {
    list-style: none;
    margin: 0.25rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.explorer-version {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.5rem;
    border: 1px solid rgba(128, 128, 128, 0.2);
    border-radius: 6px;
}

.explorer-version-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.explorer-version-msg {
    font-size: 0.82rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.explorer-version-at {
    font-size: 0.72rem;
    opacity: 0.6;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.explorer-version-cur {
    flex-shrink: 0;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #f89b4b;
    opacity: 0.9;
}

html[w-theme='light'] .explorer-version-cur {
    color: #8a4600;
    opacity: 1;
}

/* --- Delete confirmation dialog --- */

.explorer-confirm {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.5);
}

.explorer-confirm-card {
    width: 100%;
    max-width: 26rem;
    padding: 1.25rem;
    border-radius: 10px; /* the global reset zeroes w-card's radius */
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.explorer-confirm-title {
    margin: 0 0 0.5rem;
    font-size: 1rem;
}

.explorer-confirm-body {
    margin: 0 0 1.25rem;
    font-size: 0.88rem;
    line-height: 1.55;
    opacity: 0.85;
}

.explorer-confirm-body code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    overflow-wrap: anywhere;
}

.explorer-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.explorer-confirm-del {
    background: #e26057;
    border-color: #e26057;
    color: #fff;
}

/* --- Center screens (pick / unsupported) --- */

.explorer-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex: 1;
    text-align: center;
    padding: 2rem 1.25rem;
}

.explorer-center p {
    max-width: 44rem;
    line-height: 1.6;
}

/* --- Focus visibility (keyboard a11y) --- */

.explorer button:focus-visible,
.explorer input:focus-visible,
.explorer textarea:focus-visible,
.explorer a:focus-visible,
.explorer [role='separator']:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* --- Back buttons exist only in the single-pane (mobile) layout --- */

.explorer-back {
    display: none !important;
}

/* file collections: give the Miller-column strip the lion's share so the two
   most common levels sit fully in view; deeper levels scroll (Finder-style) */
@media (min-width: 761px) {
    .explorer-body.has-columns {
        grid-template-columns: minmax(160px, 200px) minmax(360px, 1fr);
    }
    .explorer-body.has-columns.show-doc {
        grid-template-columns: minmax(160px, 200px) minmax(440px, 1fr) minmax(240px, 360px);
    }

    /* SQL console: sidebar | editor | rows | result. Sidebar and editor widths
       are drag-set via --ex-sidebar-w / --ex-editor-w (default to the original
       sizing); the editor and rows each stay ≤ ~1/3, the result fills the rest. */
    .explorer-body.v-sql {
        grid-template-columns: var(--ex-sidebar-w, 220px) minmax(280px, 33%);
    }
    .explorer-body.v-sql.show-doc:not(.has-rows) {
        grid-template-columns: var(--ex-sidebar-w, 220px) var(--ex-editor-w, 360px) minmax(
                320px,
                1fr
            );
    }
    .explorer-body.v-sql.has-rows {
        grid-template-columns: var(--ex-sidebar-w, 220px) var(--ex-editor-w, 360px) minmax(
                200px,
                30%
            );
    }
    .explorer-body.v-sql.has-rows.show-doc {
        grid-template-columns:
            var(--ex-sidebar-w, 220px) var(--ex-editor-w, 360px)
            minmax(180px, 24%) minmax(300px, 1fr);
    }

    /* Document collection: the TTID list is at most ~1/3 of the width; the
       rest is empty until a document is selected, then it holds the detail.
       --ex-sidebar-w / --ex-list-w are set by dragging the pane grips (default to the
       original sizing); the detail pane fills whatever remains. */
    .explorer-body.v-docs {
        grid-template-columns: var(--ex-sidebar-w, 200px) minmax(240px, 34%);
    }
    /* selected document: sidebar | list | document | schema | metadata | versions.
       The Document pane is the 1fr filler that absorbs resizes, so the aux
       columns to its right never get cut off; they collapse to a thin strip
       (--ex-*-w set to a small value by bodyStyle). */
    .explorer-body.v-docs.show-doc {
        grid-template-columns:
            var(--ex-sidebar-w, 200px) var(--ex-list-w, 220px)
            minmax(240px, 1fr)
            var(--ex-schema-w, 240px) var(--ex-metadata-w, 200px) var(--ex-versions-w, 220px);
    }
    .explorer-body.v-docs.show-doc > section[aria-label='Schema'],
    .explorer-body.v-docs.show-doc > section[aria-label='Metadata'],
    .explorer-body.v-docs.show-doc > section[aria-label='Versions'] {
        display: block;
    }

    /* Reveal the pane grips only in the collections/document view; their left
       edge tracks the same --w-* vars that size the grid columns. */
    .explorer-body.v-docs > .explorer-pane-grip--sidebar {
        display: block;
        left: var(--ex-sidebar-w, 200px);
    }
    .explorer-body.v-docs.show-doc > .explorer-pane-grip--list {
        display: block;
        left: calc(var(--ex-sidebar-w, 200px) + var(--ex-list-w, 220px));
    }
    /* aux grips sit on the LEFT edge of their pane, positioned from the RIGHT
       (the Document filler between them is dynamic); dragging resizes that pane. */
    .explorer-body.v-docs.show-doc > .explorer-pane-grip--schema,
    .explorer-body.v-docs.show-doc > .explorer-pane-grip--metadata,
    .explorer-body.v-docs.show-doc > .explorer-pane-grip--versions {
        display: block;
        left: auto;
        margin-left: 0;
        margin-right: -0.3rem;
    }
    .explorer-body.v-docs.show-doc > .explorer-pane-grip--schema {
        right: calc(
            var(--ex-versions-w, 220px) + var(--ex-metadata-w, 200px) + var(--ex-schema-w, 240px)
        );
    }
    .explorer-body.v-docs.show-doc > .explorer-pane-grip--metadata {
        right: calc(var(--ex-versions-w, 220px) + var(--ex-metadata-w, 200px));
    }
    .explorer-body.v-docs.show-doc > .explorer-pane-grip--versions {
        right: var(--ex-versions-w, 220px);
    }
    /* a collapsed column can't be dragged — hide its grip */
    .explorer-body:has(section[aria-label='Schema'].is-collapsed) > .explorer-pane-grip--schema,
    .explorer-body:has(section[aria-label='Metadata'].is-collapsed) > .explorer-pane-grip--metadata,
    .explorer-body:has(section[aria-label='Versions'].is-collapsed)
        > .explorer-pane-grip--versions {
        display: none;
    }

    /* SQL console grips: sidebar always, editor only once a column sits to its
       right (rows or result) so the boundary is meaningful. */
    .explorer-body.v-sql > .explorer-pane-grip--sidebar {
        display: block;
        left: var(--ex-sidebar-w, 220px);
    }
    .explorer-body.v-sql.has-rows > .explorer-pane-grip--editor,
    .explorer-body.v-sql.show-doc > .explorer-pane-grip--editor {
        display: block;
        left: calc(var(--ex-sidebar-w, 220px) + var(--ex-editor-w, 360px));
    }
}

/* --- Tablet: tighter columns --- */

@media (min-width: 761px) and (max-width: 1100px) {
    .explorer-body.show-doc {
        grid-template-columns: minmax(160px, 200px) minmax(220px, 280px) minmax(300px, 1fr);
    }
}

/* --- Mobile: one thing at a time, panes stack and the body scrolls --- */

@media (max-width: 760px) {
    /* drop the grid — show panes as full-width blocks that stack vertically */
    .explorer-body {
        display: block;
        overflow-x: hidden;
        overflow-y: auto;
    }
    .explorer-pane {
        display: none;
        height: auto;
        min-width: 0;
        overflow: visible;
        border-right: none;
    }

    /* aux columns can't collapse on a phone — always show their full content */
    .explorer-pane--aux.is-collapsed {
        padding: 0.75rem;
        overflow: visible;
    }
    .explorer-pane--aux.is-collapsed .explorer-aux-content {
        display: block;
    }
    .explorer-collapse,
    .explorer-pane-grip,
    .explorer-col-grip {
        display: none !important;
    }

    .explorer-back {
        display: inline-flex !important;
        margin-bottom: 0.5rem;
    }

    /* which pane(s) show for each single-pane state */
    .explorer-body.m-collections > nav.explorer-pane {
        display: block;
    }
    .explorer-body.m-docs > section[aria-label='Documents'] {
        display: block;
    }
    /* a selected document stacks its detail: JSON + schema + metadata + versions */
    .explorer-body.m-doc > section[aria-label='Document'],
    .explorer-body.m-doc > section[aria-label='Schema'],
    .explorer-body.m-doc > section[aria-label='Metadata'],
    .explorer-body.m-doc > section[aria-label='Versions'] {
        display: block;
    }
    /* SQL: editor, rows, and result stacked */
    .explorer-body.m-sql > section {
        display: block;
    }
    .explorer-body.m-sql .explorer-sql {
        min-height: 11rem;
    }
    /* Overview / Export-Import tools: single stacked pane */
    .explorer-body.m-tool > section[aria-label='Documents'] {
        display: block;
    }

    /* the Miller strip (file browser) keeps its own horizontal scroll */
    .explorer-pane:has(.explorer-columns) {
        min-height: 60vh;
    }

    /* WCAG-sized touch targets across app bars, panes, tools and editors. */
    .explorer button,
    .explorer a,
    .explorer input,
    .explorer select,
    .explorer label.explorer-upload,
    .explorer-root-chip {
        min-height: 44px;
        min-width: 44px;
    }

    .explorer-avatar,
    .explorer-theme-btn,
    .explorer-search-icon,
    .explorer-alert-dismiss,
    .explorer-row-act {
        min-width: 44px;
    }

    .explorer-avatar {
        width: 44px;
        height: 44px;
    }

    .explorer-bar {
        position: sticky;
        top: 0;
        z-index: 2;
    }

    /* keep the app bar / topbar buttons from overflowing on narrow phones */
    .explorer-bar {
        gap: 0.4rem 0.5rem;
    }
    .explorer-topbar {
        flex-wrap: wrap;
    }
}

/* A desktop browser can have a compact CSS viewport because of zoom, a narrow
   side-by-side window, or display scaling. Keep SQL's collection sidebar for a
   mouse/trackpad in that middle range; the one-pane view and its back button
   remain reserved for touch-first devices. Extra result panes scroll sideways
   rather than being squeezed or hidden. */
@media (min-width: 601px) and (max-width: 760px) and (hover: hover) and (pointer: fine) {
    .explorer-body.m-sql {
        display: grid;
        grid-template-columns: minmax(180px, 200px) minmax(320px, 1fr);
        overflow-x: auto;
        overflow-y: hidden;
    }

    .explorer-body.m-sql > nav.explorer-pane,
    .explorer-body.m-sql > section[aria-label='Documents'] {
        display: flex;
    }

    .explorer-body.m-sql > section[aria-label='Documents'] {
        flex-direction: column;
    }

    .explorer-body.m-sql > section[aria-label='Rows'],
    .explorer-body.m-sql > section[aria-label='Document'] {
        display: none;
    }

    .explorer-body.m-sql.has-rows {
        grid-template-columns: minmax(180px, 200px) minmax(280px, 1fr) minmax(180px, 240px);
    }

    .explorer-body.m-sql.show-doc:not(.has-rows) {
        grid-template-columns: minmax(180px, 200px) minmax(280px, 1fr) minmax(280px, 1fr);
    }

    .explorer-body.m-sql.has-rows.show-doc {
        grid-template-columns: minmax(180px, 200px) minmax(280px, 1fr) minmax(180px, 240px) minmax(
                280px,
                1fr
            );
    }

    .explorer-body.m-sql.has-rows > section[aria-label='Rows'],
    .explorer-body.m-sql.show-doc > section[aria-label='Document'] {
        display: block;
    }

    .explorer-body.m-sql .explorer-pane {
        overflow: auto;
        border-right: 1px solid rgba(128, 128, 128, 0.25);
    }

    .explorer-body.m-sql .explorer-back {
        display: none !important;
    }
}

/* --- Motion preferences --- */

@media (prefers-reduced-motion: reduce) {
    .explorer-progress--on::before {
        animation: none;
        width: 100%;
        opacity: 0.4;
    }
}
