/* FieldTrace — app-specific component styles.
   Theme tokens live in theme.css. */

/* Topbar */

.topbar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px clamp(10px, 2vw, 18px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 36px;
    padding: 3px 6px 3px 4px;
    border-radius: var(--radius-md);
    font-weight: 500;
    letter-spacing: 0;
    color: var(--text-primary);
    transition: background var(--ease-fast), color var(--ease-fast);
}

.brand:hover {
    background: var(--surface-hover);
}

.brand__suite-mark {
    width: 30px;
    height: 30px;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--surface-island);
    color: var(--text-primary);
    box-shadow: 0 1px 2px color-mix(in oklab, #000 18%, transparent);
    font-family: var(--font-mono);
    font-size: 17px;
    font-weight: 500;
    line-height: 1;
}

.brand__suite,
.brand__name {
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font-ui-title);
}

.brand__suite {
    color: var(--text-primary);
}

.brand__sep {
    font-size: 13px;
}

.brand__sep,
.brand__name {
    color: var(--text-secondary);
}

.brand:hover .brand__suite,
.brand:hover .brand__name {
    color: var(--text-primary);
}

.topbar__actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.theme-toggle {
    padding: 8px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
}
.theme-toggle:hover { color: var(--text-primary); }

.topbar-help {
    height: 32px;
    padding: 0 11px;
}

.palette-control {
    height: 32px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-inset);
    color: var(--text-secondary);
    position: relative;
}

.palette-control:focus-within {
    border-color: var(--accent);
}

.palette-toggle__swatches {
    display: inline-grid;
    grid-template-columns: repeat(3, 8px);
    gap: 3px;
}

.palette-toggle__swatches span {
    width: 8px;
    height: 14px;
    border-radius: 2px;
    background: hsl(190, 48%, 48%);
}

.palette-toggle__swatches span:nth-child(2) {
    background: hsl(222, 46%, 50%);
}

.palette-toggle__swatches span:nth-child(3) {
    background: hsl(275, 42%, 52%);
}

.palette-select {
    height: 30px;
    min-width: 118px;
    padding: 0 22px 0 0;
    border: 0;
    outline: 0;
    background:
        linear-gradient(45deg, transparent 50%, currentColor 50%) right 8px center / 5px 5px no-repeat,
        linear-gradient(135deg, currentColor 50%, transparent 50%) right 3px center / 5px 5px no-repeat;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.palette-select:hover,
.palette-select:focus {
    color: var(--text-primary);
}

.palette-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 40;
    width: 210px;
    padding: 6px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    background: var(--surface-island);
    box-shadow: var(--shadow-panel);
}

.palette-option {
    width: 100%;
    display: grid;
    grid-template-columns: 42px 1fr;
    align-items: center;
    gap: 10px;
    padding: 7px 8px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-align: left;
}

.palette-option:hover,
.palette-option.is-selected {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.palette-option.is-selected {
    box-shadow: inset 0 0 0 1px var(--border);
}

.palette-option__swatches {
    display: inline-grid;
    grid-template-columns: repeat(3, 11px);
    gap: 3px;
}

.palette-option__swatches span {
    width: 11px;
    height: 16px;
    border-radius: 2px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.14);
}

.palette-option__name {
    font-size: 12.5px;
    font-weight: 600;
}

[data-palette="fieldtrace"] .palette-toggle__swatches span:nth-child(1) { background: hsl(190, 48%, 48%); }
[data-palette="fieldtrace"] .palette-toggle__swatches span:nth-child(2) { background: hsl(222, 46%, 50%); }
[data-palette="fieldtrace"] .palette-toggle__swatches span:nth-child(3) { background: hsl(275, 42%, 52%); }
[data-palette="skyblue"] .palette-toggle__swatches span:nth-child(1) { background: hsl(199, 88%, 74%); }
[data-palette="skyblue"] .palette-toggle__swatches span:nth-child(2) { background: hsl(204, 82%, 58%); }
[data-palette="skyblue"] .palette-toggle__swatches span:nth-child(3) { background: hsl(214, 70%, 45%); }
[data-palette="classic"] .palette-toggle__swatches span:nth-child(1) { background: hsl(48, 82%, 55%); }
[data-palette="classic"] .palette-toggle__swatches span:nth-child(2) { background: hsl(28, 78%, 51%); }
[data-palette="classic"] .palette-toggle__swatches span:nth-child(3) { background: hsl(8, 70%, 48%); }
[data-palette="module"] .palette-toggle__swatches span:nth-child(1) { background: hsl(168, 48%, 44%); }
[data-palette="module"] .palette-toggle__swatches span:nth-child(2) { background: hsl(204, 48%, 48%); }
[data-palette="module"] .palette-toggle__swatches span:nth-child(3) { background: hsl(44, 56%, 48%); }
[data-palette="balatro"] .palette-toggle__swatches span:nth-child(1) { background: hsl(358, 76%, 50%); }
[data-palette="balatro"] .palette-toggle__swatches span:nth-child(2) { background: hsl(52, 82%, 50%); }
[data-palette="balatro"] .palette-toggle__swatches span:nth-child(3) { background: hsl(226, 72%, 54%); }
[data-palette="lights"] .palette-toggle__swatches span:nth-child(1) { background: hsl(220, 8%, 92%); }
[data-palette="lights"] .palette-toggle__swatches span:nth-child(2) { background: hsl(220, 7%, 82%); }
[data-palette="lights"] .palette-toggle__swatches span:nth-child(3) { background: hsl(220, 6%, 72%); }
[data-palette="darks"] .palette-toggle__swatches span:nth-child(1) { background: hsl(220, 10%, 18%); }
[data-palette="darks"] .palette-toggle__swatches span:nth-child(2) { background: hsl(220, 9%, 28%); }
[data-palette="darks"] .palette-toggle__swatches span:nth-child(3) { background: hsl(220, 8%, 38%); }
[data-palette="neon"] .palette-toggle__swatches span:nth-child(1) { background: hsl(174, 76%, 48%); }
[data-palette="neon"] .palette-toggle__swatches span:nth-child(2) { background: hsl(258, 72%, 58%); }
[data-palette="neon"] .palette-toggle__swatches span:nth-child(3) { background: hsl(316, 74%, 54%); }

/* Landing */

.landing {
    padding-top: 48px;
}

.landing__title {
    margin: 12px 0 18px;
}

.landing__lede {
    max-width: 640px;
    margin-bottom: 36px;
}

.featurelist {
    list-style: none;
    padding: 0;
    margin: 32px 0 0;
    display: grid;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 14px;
}

.featurelist li {
    display: flex;
    align-items: center;
    gap: 12px;
}

.featurelist__check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--accent-muted);
    color: var(--accent);
    flex-shrink: 0;
}

.featurelist__check svg {
    width: 12px;
    height: 12px;
}

.featurelist .mono {
    font-size: 13px;
    background: var(--surface-inset);
    border: 1px solid var(--border);
    padding: 1px 6px;
    border-radius: var(--radius-sm);
}

/* Drop zone (in landing) */

.dropzone {
    width: 100%;
    margin-top: 12px;
    padding: 40px 32px;
    display: flex;
    align-items: center;
    gap: 24px;
    text-align: left;
    background: color-mix(in oklab, var(--surface-island) 70%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: border-color var(--ease), background var(--ease), transform var(--ease);
    color: var(--text-primary);
}

.dropzone:hover {
    border-color: var(--accent);
    background: color-mix(in oklab, var(--surface-island) 85%, transparent);
}

.dropzone:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

.dropzone__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: var(--radius-lg);
    background: var(--accent-muted);
    color: var(--accent);
    flex-shrink: 0;
}

.dropzone__icon svg {
    width: 36px;
    height: 36px;
}

.dropzone__text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.dropzone__title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.dropzone__sub {
    font-size: 13.5px;
    color: var(--text-secondary);
}

/* Window-wide drop overlay */

.drop-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--scrim);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
}

.drop-overlay.is-active {
    opacity: 1;
    pointer-events: auto;
}

.drop-overlay__panel {
    padding: 56px 64px;
    text-align: center;
    background: var(--surface-island);
    border: 2px dashed var(--accent);
    border-radius: var(--radius-xl);
    color: var(--text-primary);
    box-shadow: var(--shadow-card-hover);
}

.drop-overlay__icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    color: var(--accent);
}

.drop-overlay__title {
    font-size: 22px;
    font-weight: 600;
    margin: 0 0 6px;
}

.drop-overlay__sub {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

/* Help modal */

.has-modal {
    overflow: hidden;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: grid;
    place-items: center;
    padding: 20px;
}

.modal[hidden] {
    display: none;
}

[hidden] {
    display: none !important;
}

.modal__backdrop {
    position: absolute;
    inset: 0;
    background: color-mix(in oklab, #000 64%, transparent);
    backdrop-filter: blur(8px);
}

.modal__panel {
    position: relative;
    width: min(860px, calc(100vw - 32px));
    max-height: min(760px, calc(100vh - 32px));
    overflow: auto;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    background: var(--surface-raised);
    box-shadow: var(--shadow-panel);
}

.modal__header {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 22px 16px;
    border-bottom: 1px solid var(--border);
    background: color-mix(in oklab, var(--surface-raised) 94%, transparent);
    backdrop-filter: blur(8px);
}

.modal__title {
    margin: 4px 0 0;
    font-size: 22px;
    line-height: 1.15;
    color: var(--text-primary);
}

.modal__close {
    width: 34px;
    height: 34px;
    padding: 0;
    justify-content: center;
    font-size: 22px;
    line-height: 1;
}

.trace-help {
    padding: 18px 22px 22px;
}

.trace-help__steps {
    margin: 0;
    padding-left: 24px;
    display: grid;
    gap: 16px;
}

.trace-help__steps li::marker {
    color: var(--accent);
    font-weight: 700;
}

.trace-help__steps span {
    color: var(--text-secondary);
    font-size: 13.5px;
    line-height: 1.5;
}

.trace-builder {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: color-mix(in oklab, var(--surface-inset) 78%, transparent);
}

.trace-builder label {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.trace-builder label span {
    font-size: 10px;
    font-weight: 650;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.trace-builder input,
.trace-builder select {
    width: 100%;
    min-width: 0;
    height: 34px;
    padding: 0 9px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-base);
    color: var(--text-primary);
    font: 12px var(--font-mono);
}

.trace-builder select {
    font-family: var(--font-ui);
}

.trace-builder input:focus,
.trace-builder select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-muted);
}

.trace-builder__hint {
    margin: 8px 0 0;
    color: var(--text-muted);
    font-size: 12.5px;
    line-height: 1.45;
}

.command-row {
    margin-top: 8px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
    gap: 8px;
}

.command-row code {
    display: block;
    min-width: 0;
    overflow-x: auto;
    padding: 10px 11px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-inset);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.45;
    white-space: nowrap;
}

.command-copy {
    width: 66px;
    padding: 0 10px;
    justify-content: center;
}

.command-copy:disabled {
    opacity: 0.8;
}

.command-row--plain {
    grid-template-columns: 1fr;
}

@media (max-width: 760px) {
    .trace-builder {
        grid-template-columns: 1fr;
    }
}

/* Loading */

.loading {
    padding-top: 48px;
}

.progress {
    margin-top: 24px;
    height: 8px;
    background: var(--surface-inset);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    overflow: hidden;
}

.progress__bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    transition: width 0.18s ease;
}

/* Results */

/* The results view is data-dense; it earns the whole viewport, not just the
   landing-page reading column. main gets `is-wide` class while results are visible. */
main.app.is-wide {
    max-width: none;
    width: 100%;
    margin: 0;
    padding-left: clamp(20px, 3vw, 40px);
    padding-right: clamp(20px, 3vw, 40px);
}
/* Topbar inner stays a sensible width so the brand + actions don't drift to
   opposite ends of an ultra-wide screen. */
body:has(main.app.is-wide) .topbar__inner {
    max-width: none;
    padding-left: clamp(10px, 2vw, 24px);
    padding-right: clamp(10px, 2vw, 24px);
}

.results {
    padding-top: 32px;
}

.results__header {
    margin-bottom: 24px;
}

.results__actions {
    margin-top: 16px;
}

.stat-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin: 0 0 24px;
}

.stat {
    background: color-mix(in oklab, var(--surface-island) 88%, transparent);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    position: relative;
}

.stat__value {
    font-family: var(--font-mono);
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat__label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-top: 4px;
}

.stat[data-tooltip],
.kv-row[data-tooltip] {
    cursor: help;
}

.stat[data-tooltip]:hover,
.stat[data-tooltip]:focus-visible,
.kv-row[data-tooltip]:hover,
.kv-row[data-tooltip]:focus-visible {
    z-index: 45;
}

.stat[data-tooltip]::after,
.kv-row[data-tooltip]::after {
    content: none;
    position: absolute;
    z-index: 40;
    width: min(260px, 76vw);
    padding: 9px 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    background: var(--surface-elevated);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    font-size: 12px;
    line-height: 1.45;
    letter-spacing: 0;
    text-transform: none;
    white-space: normal;
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px);
    transition: opacity 120ms ease, transform 120ms ease;
}

.stat[data-tooltip]::after {
    left: min(100%, 180px);
    top: 50%;
    transform: translate(10px, calc(-50% + 4px));
}

.kv-row[data-tooltip]::after {
    left: 160px;
    bottom: calc(100% + 8px);
}

.stat[data-tooltip]:hover::after,
.stat[data-tooltip]:focus-visible::after,
.kv-row[data-tooltip]:hover::after,
.kv-row[data-tooltip]:focus-visible::after {
    opacity: 1;
}

.stat[data-tooltip]:hover::after,
.stat[data-tooltip]:focus-visible::after {
    transform: translate(10px, -50%);
}

.trace-rail--left .stat[data-tooltip]::after {
    left: 10px;
    top: calc(100% + 8px);
    width: min(220px, calc(100vw - 32px));
    transform: translateY(4px);
}

.trace-rail--left .stat[data-tooltip]:hover::after,
.trace-rail--left .stat[data-tooltip]:focus-visible::after {
    transform: translateY(0);
}

.kv-row[data-tooltip]:hover::after,
.kv-row[data-tooltip]:focus-visible::after {
    transform: translateY(0);
}

.stat:focus-visible,
.kv-row:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.result-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.result-card {
    padding: 22px 24px;
}

.result-card--full {
    grid-column: 1 / -1;
}

.result-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 16px;
}

.result-card__tools {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.search {
    background: var(--surface-inset);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 6px 10px;
    font-size: 13px;
    color: var(--text-primary);
    width: 240px;
    transition: border-color var(--ease), background var(--ease);
}

.search::placeholder {
    color: var(--text-muted);
}

.search:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--surface-base);
}

/* Key-value grid (trace metadata) */

.kv-grid {
    display: grid;
    gap: 0;
}

.kv-row {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
    position: relative;
}

.kv-row:last-child {
    border-bottom: 0;
}

.kv-row__key {
    color: var(--text-secondary);
}

.kv-row__val {
    color: var(--text-primary);
    word-break: break-word;
    font-size: 13px;
}

/* Block table */

.block-table {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.block-row {
    display: grid;
    grid-template-columns: 1.6fr 0.7fr 0.9fr 1fr;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
    align-items: center;
}

.block-row:last-child { border-bottom: 0; }

.block-row--head {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding-bottom: 8px;
}

.block-row__name {
    color: var(--text-primary);
    font-weight: 500;
}

.block-row__count,
.block-row__bytes {
    color: var(--text-secondary);
    font-size: 12.5px;
    text-align: right;
}

.block-row__bar {
    height: 6px;
    background: var(--surface-inset);
    border-radius: var(--radius-pill);
    overflow: hidden;
}

.block-row__bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: inherit;
    transition: width 0.3s ease;
}

/* Flame graph (centerpiece) */

.flame-card {
    padding: 22px 24px 18px;
    margin-bottom: 16px;
}

.flame-card__header {
    align-items: flex-start;
    margin-bottom: 12px;
}

.flame-card__sub {
    margin: 4px 0 0;
    font-size: 12.5px;
    color: var(--text-secondary);
    max-width: 640px;
}

.flame-card__tools {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.flame-search {
    width: 200px;
    height: 30px;
    padding: 4px 10px;
    font-size: 12.5px;
}
.flame-thread {
    height: 30px;
    padding: 4px 8px;
    font-size: 12.5px;
    font-family: var(--font-mono);
    max-width: 240px;
}

.scope-search {
    width: 100%;
    margin-bottom: 8px;
}

.scope-summary {
    margin-top: 8px;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: color-mix(in oklab, var(--surface-inset) 82%, transparent);
}

.scope-summary__title {
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 650;
    line-height: 1.25;
}

.scope-summary__meta {
    margin-top: 4px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 10.5px;
    line-height: 1.35;
    word-break: break-word;
}

.flame-mode {
    display: inline-flex;
    align-items: stretch;
    height: 30px;
    background: var(--surface-inset);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 2px;
    gap: 2px;
}
.flame-mode__btn {
    appearance: none;
    background: transparent;
    border: 0;
    padding: 0 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: calc(var(--radius-md) - 2px);
    cursor: pointer;
    transition: background var(--ease-fast), color var(--ease-fast);
    font-family: var(--font-ui);
}
.flame-mode__btn:hover {
    color: var(--text-primary);
}
.flame-mode__btn.is-active {
    background: var(--accent-muted);
    color: var(--accent);
}

.flame-brush-chip {
    cursor: pointer;
    background: var(--accent-muted);
    color: var(--accent);
    border: 1px solid var(--accent-muted);
    font-family: var(--font-mono);
    transition: background var(--ease-fast), color var(--ease-fast);
}
.flame-brush-chip:hover {
    background: var(--accent);
    color: #fff;
}

.flame-crumbs {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 10px;
    min-height: 24px;
}

.flame-crumb {
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--text-secondary);
    background: var(--surface-inset);
    border: 1px solid var(--border);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--ease-fast), color var(--ease-fast);
}
.flame-crumb:hover {
    color: var(--text-primary);
    background: var(--surface-hover);
}
.flame-crumb.is-current {
    color: var(--accent);
    background: var(--accent-muted);
    border-color: var(--accent-muted);
}

.flame-crumb__sep {
    color: var(--text-muted);
    font-size: 11px;
}

.flame-canvas-wrap {
    background: var(--surface-inset);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow-x: hidden;
    overflow-y: scroll;
    scrollbar-gutter: stable;
    /* Take a generous chunk of viewport so the flame graph is the centerpiece. */
    height: clamp(360px, 70vh, 900px);
    /* Keep ctrl+wheel zoom from scrolling the page. */
    overscroll-behavior: contain;
    position: relative;
}

#time-chart-wrap {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.time-overview-wrap {
    flex: 0 0 78px;
    height: 78px;
    border-top: 1px solid var(--border);
    background: var(--surface-inset);
    cursor: crosshair;
}

#time-overview-canvas,
#time-chart-canvas {
    display: block;
    width: 100%;
}

#flame-canvas {
    display: block;
    width: 100%;
    cursor: default;
}

.flame-zoom-hint {
    font-size: 10.5px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    padding: 6px 0 0;
    letter-spacing: 0.02em;
}

.flame-mode {
    display: inline-flex;
    background: var(--surface-inset);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 2px;
}
.flame-mode__btn {
    font-size: 11.5px;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    transition: background var(--ease-fast), color var(--ease-fast);
}
.flame-mode__btn:hover {
    color: var(--text-primary);
}
.flame-mode__btn.is-active {
    background: var(--accent-muted);
    color: var(--accent);
}

.flame-tooltip {
    position: fixed;
    z-index: 200;
    display: none;
    pointer-events: none;
    background: var(--surface-island);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    padding: 8px 10px;
    box-shadow: var(--shadow-panel);
    font-size: 11.5px;
    min-width: 180px;
    max-width: 360px;
}

.flame-tip__row {
    display: flex;
    gap: 10px;
    align-items: baseline;
    padding: 2px 0;
}

.flame-tip__k {
    flex-shrink: 0;
    width: 50px;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.08em;
}

.flame-tip__v {
    color: var(--text-primary);
    font-family: var(--font-mono);
    word-break: break-all;
}

.help-tooltip {
    color: var(--text-primary);
    font-size: 12px;
    line-height: 1.45;
    max-width: 260px;
}

/* Sandwich view (per-function table + callers/callees panel) */

.sandwich-card {
    padding: 22px 24px 18px;
    margin-bottom: 16px;
}

.sandwich-card__header {
    align-items: flex-start;
    margin-bottom: 12px;
}

.sandwich-card__sub {
    margin: 4px 0 0;
    font-size: 12.5px;
    color: var(--text-secondary);
    max-width: 640px;
}

.sandwich-card__tools {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.sandwich-table {
    display: flex;
    flex-direction: column;
    background: var(--surface-inset);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    min-height: 0;
}

.sandwich-tbody {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    max-height: 480px;
    overflow-y: auto;
}

.sandwich-row {
    display: grid;
    grid-template-columns: minmax(0, 2.6fr) 110px 100px minmax(140px, 1fr);
    gap: 12px;
    align-items: center;
    padding: 7px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 12.5px;
    cursor: pointer;
    transition: background var(--ease-fast);
}
.sandwich-row:last-child { border-bottom: 0; }
.sandwich-row:hover { background: var(--surface-hover); }
.sandwich-row.is-selected { background: var(--accent-muted); }
.sandwich-row.is-selected .sandwich-row__name { color: var(--accent); }

.sandwich-row--head {
    position: sticky;
    top: 0;
    z-index: 1;
    background: color-mix(in oklab, var(--surface-island) 88%, transparent);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    cursor: default;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-strong);
}

.sandwich-row--head > div {
    position: relative;
    cursor: pointer;
    user-select: none;
    transition: color var(--ease-fast);
    font-family: inherit;
    color: inherit;
    text-align: left;
    font-size: inherit;
}
.sandwich-row--head > div:hover { color: var(--text-primary); }

.sandwich-row--head > div[data-tooltip],
.sandwich-mini__header[data-tooltip],
.frame-stat[data-tooltip],
.sandwich-mini-row[data-tooltip] {
    cursor: help;
    position: relative;
}

.sandwich-row--head > div[data-tooltip]::before,
.sandwich-mini__header[data-tooltip]::before,
.frame-stat[data-tooltip]::before,
.sandwich-mini-row[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    z-index: 80;
    left: 0;
    bottom: calc(100% + 8px);
    width: min(300px, 72vw);
    padding: 9px 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    background: var(--surface-elevated);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    font-family: var(--font-ui);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.45;
    letter-spacing: 0;
    text-transform: none;
    white-space: normal;
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px);
    transition: opacity 120ms ease, transform 120ms ease;
}

.sandwich-row--head > div[data-tooltip]:hover::before,
.sandwich-row--head > div[data-tooltip]:focus-visible::before,
.sandwich-mini__header[data-tooltip]:hover::before,
.sandwich-mini__header[data-tooltip]:focus-visible::before,
.frame-stat[data-tooltip]:hover::before,
.frame-stat[data-tooltip]:focus-visible::before,
.sandwich-mini-row[data-tooltip]:hover::before,
.sandwich-mini-row[data-tooltip]:focus-visible::before {
    opacity: 1;
    transform: translateY(0);
}

.trace-rail--right .frame-stat[data-tooltip]::before,
.trace-rail--right .sandwich-mini__header[data-tooltip]::before,
.trace-rail--right .sandwich-mini-row[data-tooltip]::before {
    left: auto;
    right: 0;
}

.sandwich-row--head > div::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 6px;
    vertical-align: middle;
    opacity: 0;
}
.sandwich-row--head > div.is-asc::after {
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 5px solid currentColor;
    opacity: 1;
}
.sandwich-row--head > div.is-desc::after {
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
    opacity: 1;
}

.sandwich-row__name {
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.sandwich-row__hex {
    color: var(--text-muted);
    font-style: italic;
}

.sandwich-row__num {
    font-family: var(--font-mono);
    color: var(--text-secondary);
    text-align: right;
    font-size: 12px;
}

.sandwich-row__pct {
    display: grid;
    grid-template-columns: 1fr 50px;
    gap: 8px;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--text-secondary);
}

.sandwich-row__bar {
    height: 5px;
    background: var(--surface-base);
    border-radius: var(--radius-pill);
    overflow: hidden;
}

.sandwich-row__bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: inherit;
}

.sandwich-panel {
    margin-top: 16px;
    background: var(--surface-inset);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
}

.sandwich-panel__header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.sandwich-panel__eyebrow {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    flex-shrink: 0;
}

.sandwich-panel__label {
    color: var(--text-primary);
    font-size: 12.5px;
    word-break: break-all;
}

.frame-inspector__stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.frame-inspector__note {
    grid-column: 1 / -1;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: color-mix(in oklab, var(--surface-island) 55%, transparent);
    color: var(--text-secondary);
    font-size: 11.5px;
    line-height: 1.4;
}

.frame-stat {
    min-width: 0;
    background: var(--surface-inset);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 8px 10px;
}

.frame-stat__k {
    color: var(--text-muted);
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.frame-stat__v {
    margin-top: 4px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.frame-stat__sub {
    margin-top: 2px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 10.5px;
    white-space: nowrap;
}

.sandwich-panel__split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.sandwich-mini {
    background: color-mix(in oklab, var(--surface-island) 60%, transparent);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.sandwich-mini__header {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    background: var(--surface-base);
}

.sandwich-mini__body {
    display: flex;
    flex-direction: column;
    max-height: 260px;
    overflow-y: auto;
}

.sandwich-mini-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 80px 70px;
    gap: 10px;
    align-items: center;
    padding: 6px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    cursor: pointer;
    transition: background var(--ease-fast);
}
.sandwich-mini-row:last-child { border-bottom: 0; }
.sandwich-mini-row:hover { background: var(--surface-hover); }

.sandwich-mini-row__name {
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.sandwich-mini-row__num {
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--text-secondary);
    text-align: right;
}

.sandwich-mini-row__bar {
    height: 4px;
    background: var(--surface-inset);
    border-radius: var(--radius-pill);
    overflow: hidden;
}

.sandwich-mini-row__bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: inherit;
}

.empty-state--mini {
    padding: 14px;
    font-size: 12px;
}

.sandwich-search { width: 220px; }

@media (max-width: 720px) {
    .sandwich-row {
        grid-template-columns: minmax(0, 1.6fr) 70px 70px;
    }
    .sandwich-row > .sandwich-row__pct { display: none; }
    .sandwich-panel__split { grid-template-columns: 1fr; }
}

/* Stacks card */

.stack-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.stack-summary__cell {
    background: var(--surface-inset);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
}

.stack-summary__value {
    font-family: var(--font-mono);
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.stack-summary__label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-top: 4px;
}

.depth-hist {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.depth-hist__title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.depth-row {
    display: grid;
    grid-template-columns: 40px 1fr 60px;
    gap: 12px;
    align-items: center;
    font-size: 12px;
}

.depth-row__label {
    font-family: var(--font-mono);
    color: var(--text-secondary);
    text-align: right;
}

.depth-row__bar {
    height: 8px;
    background: var(--surface-inset);
    border-radius: var(--radius-pill);
    overflow: hidden;
}

.depth-row__bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: inherit;
}

.depth-row__count {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-secondary);
    text-align: right;
}

/* Event log */

.provider-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.event-log-note {
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-raised);
    color: var(--text-secondary);
    font-size: 12px;
}

.event-log {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: auto;
    background: var(--surface-inset);
}

.event-log-row {
    display: grid;
    grid-template-columns: 82px minmax(280px, 1fr) 100px 72px 72px 90px;
    gap: 12px;
    align-items: center;
    min-width: 820px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
}

.event-log-row:last-child {
    border-bottom: 0;
}

.event-log-row:hover {
    background: var(--surface-hover);
}

.event-log-row--head {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--surface-raised);
    color: var(--text-muted);
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.event-log-row__event {
    min-width: 0;
}

.event-log-row__event > div:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
    font-weight: 600;
}

/* Provider/event definition styles retained for future definition views. */

.provider {
    background: var(--surface-inset);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.provider__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    background: color-mix(in oklab, var(--surface-island) 60%, transparent);
}

.provider__name {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-primary);
    word-break: break-all;
}

.provider__count {
    flex-shrink: 0;
}

.event-list {
    display: flex;
    flex-direction: column;
}

.event-row {
    display: grid;
    grid-template-columns: 60px 1fr auto auto auto;
    gap: 12px;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.event-row:last-child {
    border-bottom: 0;
}

.event-row__id {
    font-family: var(--font-mono);
    font-size: 11.5px;
    text-align: right;
    color: var(--text-muted);
}

.event-row__name {
    color: var(--text-primary);
    font-weight: 500;
    word-break: break-word;
}

.event-row__name .event-row__nameless {
    color: var(--text-muted);
    font-style: italic;
    font-weight: 400;
}

.event-row__meta {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.level-pill {
    display: inline-flex;
    align-items: center;
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    background: var(--surface-hover);
    color: var(--text-secondary);
    white-space: nowrap;
}

.level-pill--critical { background: rgba(239, 68, 68, 0.15);  color: #f87171; }
.level-pill--error    { background: rgba(239, 68, 68, 0.12);  color: #f87171; }
.level-pill--warning  { background: rgba(234, 179, 8, 0.15);  color: #facc15; }
.level-pill--info     { background: var(--accent-muted);      color: var(--accent); }
.level-pill--verbose  { background: var(--surface-hover);     color: var(--text-muted); }

.empty-state {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 13.5px;
}

/* Roadmap */

.roadmap {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 12px;
}

.roadmap__item {
    display: grid;
    grid-template-columns: 24px 1fr;
    gap: 14px;
    align-items: flex-start;
    padding: 12px 14px;
    background: var(--surface-inset);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: border-color var(--ease), background var(--ease);
}

.roadmap__dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--border-strong);
    margin-top: 2px;
}

.roadmap__item.is-done {
    background: var(--accent-soft);
    border-color: var(--accent-muted);
}

.roadmap__item.is-done .roadmap__dot {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: inset 0 0 0 3px var(--surface-island);
}

.roadmap__title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
    margin-bottom: 2px;
}

.roadmap__sub {
    font-size: 12.5px;
    color: var(--text-secondary);
}

/* Error view */

.error-view {
    padding-top: 48px;
}

.error-detail {
    margin: 16px 0;
    padding: 16px;
    background: var(--surface-inset);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 12.5px;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 200px;
    overflow: auto;
}

/* Footer */

.app__footer {
    padding: 32px 0;
    border-top: 1px solid var(--border);
    margin-top: 56px;
    text-align: center;
}

/* Responsive */

@media (max-width: 720px) {
    .result-grid {
        grid-template-columns: 1fr;
    }

    .dropzone {
        flex-direction: column;
        text-align: center;
        padding: 32px 24px;
    }

    .kv-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .block-row {
        grid-template-columns: 1fr 0.6fr 0.8fr;
    }

    .block-row__bar { display: none; }
}

/* Trace workspace --------------------------------------------------------- */

body:has(#view-results:not([hidden])) {
    overflow: hidden;
}

body:has(#view-results:not([hidden])) .app__footer {
    display: none;
}

body:has(#view-results:not([hidden])) .topbar {
    position: fixed;
    inset: 0 0 auto 0;
    height: 52px;
    background: var(--surface-base);
    border-bottom-color: var(--border);
}

body:has(#view-results:not([hidden])) .topbar__inner {
    padding-top: 10px;
    padding-bottom: 10px;
}

main.app.is-wide {
    padding: 0;
}

.results {
    position: fixed;
    inset: 52px 0 0;
    padding: 0;
}

.trace-shell {
    height: 100%;
    display: grid;
    grid-template-rows: 76px 1fr;
    background: var(--surface-base);
}

.trace-header {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) auto auto;
    align-items: center;
    gap: 18px;
    padding: 10px 20px 12px;
    border-bottom: 1px solid var(--border-strong);
    background: color-mix(in oklab, var(--surface-base) 94%, var(--surface-raised));
    box-shadow: 0 1px 0 color-mix(in oklab, var(--surface-inset) 90%, transparent);
    min-width: 0;
}

.trace-header__main {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, max-content) auto;
    column-gap: 12px;
    row-gap: 3px;
    align-items: baseline;
}

.trace-header__main .t-eyebrow {
    grid-column: 1 / -1;
    margin: 0;
}

.trace-title {
    margin: 0;
    font-size: 19px;
    line-height: 1.15;
    font-weight: 650;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.trace-sub {
    margin: 0;
    font-size: 12.5px;
    line-height: 1.25;
    color: var(--text-secondary);
    white-space: nowrap;
}

.trace-tabs {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-inset);
}

.trace-tab {
    height: 30px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    color: var(--text-secondary);
    transition: background var(--ease-fast), color var(--ease-fast);
}

.trace-tab:hover {
    color: var(--text-primary);
    background: var(--surface-hover);
}

.trace-tab.is-active {
    color: var(--text-primary);
    background: var(--surface-raised);
    box-shadow: inset 0 0 0 1px var(--border);
}

.trace-reset {
    height: 32px;
    padding: 0 12px;
}

.trace-workspace {
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr) 340px;
    gap: 0;
}

.trace-rail {
    min-height: 0;
    overflow: auto;
    background: var(--surface-raised);
}

.trace-rail--left {
    border-right: 1px solid var(--border);
}

.trace-rail--right {
    border-left: 1px solid var(--border);
}

.rail-panel {
    padding: 14px;
    border-bottom: 1px solid var(--border);
}

.rail-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.rail-panel--detail {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.trace-main {
    min-width: 0;
    height: 100%;
    min-height: 0;
    display: block;
    background: var(--surface-base);
}

.trace-page {
    min-width: 0;
    height: 100%;
    min-height: 0;
    display: none;
    padding: 14px;
    overflow: hidden;
}

.trace-page.is-active {
    display: flex;
    flex-direction: column;
}

.overview-summary {
    padding: 12px;
}

.overview-summary {
    display: grid;
    gap: 8px;
}

.overview-summary .frame-stat {
    background: var(--surface-inset);
}

.rail-spark-stack {
    display: grid;
    gap: 10px;
    padding: 0 12px 10px;
}

.rail-spark {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-inset);
    overflow: hidden;
}

.rail-spark__header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 10px 0;
}

.rail-spark__value {
    color: var(--text-secondary);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.rail-spark__chart {
    height: 96px;
    padding: 8px 10px 10px;
}

.rail-spark__caption {
    margin: -2px 10px 10px;
    color: var(--text-muted);
    font-size: 10.5px;
    line-height: 1.35;
}

.rail-spark__svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
}

.rail-spark__grid {
    stroke: color-mix(in oklab, var(--border) 70%, transparent);
    stroke-width: 1;
}

.rail-spark__axis {
    fill: var(--text-muted);
    font-size: 10px;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.rail-spark__axis--y,
.rail-spark__axis--end {
    text-anchor: end;
}

.rail-spark__axis--unit {
    text-anchor: end;
    font-size: 9px;
    opacity: 0.75;
}

.rail-spark__area {
    fill: color-mix(in oklab, var(--accent) 22%, transparent);
}

.rail-spark__line {
    fill: none;
    stroke: var(--accent);
    stroke-width: 2.25;
    stroke-linecap: round;
    stroke-linejoin: round;
}


.page-toolbar {
    min-height: 50px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    background: var(--surface-raised);
}

.trace-page .flame-card__sub,
.trace-page .sandwich-card__sub {
    max-width: 820px;
}

.stat-strip {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 0;
}

.stat {
    border-radius: var(--radius-md);
    padding: 10px 11px;
    background: var(--surface-inset);
}

.stat__value {
    font-size: 17px;
}

.stat__label {
    font-size: 9.5px;
    color: var(--text-secondary);
}

.trace-shell .t-eyebrow,
.trace-shell .trace-tab,
.trace-shell .btn--ghost {
    color: var(--text-secondary);
}

.trace-shell .t-eyebrow {
    opacity: 0.95;
}

.trace-rail .search,
.flame-thread {
    width: 100%;
    max-width: none;
}

.flame-crumbs {
    margin: 0;
    padding: 8px 10px;
    min-height: 38px;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    background: var(--surface-raised);
}

.flame-canvas-wrap {
    flex: 1;
    height: auto;
    min-height: 0;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    border-top: 0;
}

.trace-page.is-split .flame-canvas-wrap {
    border-radius: 0;
}

.trace-page.is-split #flame-canvas-wrap {
    flex: 0 0 var(--flame-split-size, 58%);
}

.trace-page.is-split #time-chart-wrap {
    flex: 1 1 0;
}

.flame-splitter {
    flex: 0 0 18px;
    min-height: 18px;
    border: 1px solid var(--border);
    border-left: 0;
    border-right: 0;
    background:
        linear-gradient(90deg, transparent, var(--border), transparent) center / 120px 1px no-repeat,
        var(--surface-raised);
    cursor: row-resize;
    touch-action: none;
}

.flame-splitter:hover,
.flame-splitter.is-dragging {
    background:
        linear-gradient(90deg, transparent, var(--accent), transparent) center / 160px 1px no-repeat,
        var(--surface-hover);
}

.trace-page.is-split #time-chart-wrap {
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    border-top: 0;
}

body.is-resizing-flame {
    cursor: row-resize;
    user-select: none;
}

.flame-card__tools,
.sandwich-card__tools,
.result-card__tools {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.flame-search {
    width: 210px;
}

.sandwich-card {
    margin: 0;
    padding: 14px;
}

.sandwich-table {
    flex: 1;
    min-height: 0;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    border-top: 0;
}

.sandwich-tbody {
    max-height: none;
    min-height: 0;
}

.trace-rail .sandwich-panel {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    min-height: 0;
}

.trace-rail .sandwich-panel__header {
    display: block;
    padding: 0 0 10px;
}

.trace-rail .sandwich-panel__split {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.trace-rail .sandwich-mini__body {
    max-height: 230px;
}

.timeline-page {
    gap: 14px;
}

.timeline-focus {
    flex: 1;
    min-height: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background:
        linear-gradient(180deg, color-mix(in oklab, var(--surface-raised) 84%, transparent), var(--surface-inset));
    padding: 18px;
}

.timeline-focus__title {
    font-size: 18px;
    font-weight: 650;
    margin-bottom: 16px;
}

.timeline-focus__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.timeline-focus__grid > div {
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-raised);
}

.timeline-focus__k,
.timeline-focus__v {
    display: block;
}

.timeline-focus__k {
    font-size: 10px;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.timeline-focus__v {
    margin-top: 6px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-primary);
}

#page-events {
    gap: 0;
}

#page-events .provider-list {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: 12px;
    border: 1px solid var(--border);
    border-top: 0;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    background: var(--surface-inset);
}

.inventory-grid {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    overflow: auto;
}

.inventory-panel {
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-raised);
}

.inventory-panel--wide {
    grid-column: 1 / -1;
}

.card:hover {
    transform: none;
    box-shadow: none;
}

@media (max-width: 1180px) {
    body:has(#view-results:not([hidden])) {
        overflow: auto;
    }

    .results {
        position: static;
        padding-top: 52px;
    }

    .trace-shell {
        height: auto;
        min-height: calc(100vh - 52px);
    }

    .trace-header,
    .trace-workspace {
        grid-template-columns: 1fr;
    }

    .trace-tabs {
        justify-self: start;
        overflow-x: auto;
        max-width: 100%;
    }

    .trace-rail--right {
        display: none;
    }

    .trace-main {
        min-height: 760px;
    }
}
