:root {
    color-scheme: dark;
    --surface-page: var(--ds-bg);
    --surface-navigation: var(--ds-bg-inset);
    --surface-panel: var(--ds-surface-1);
    --surface-raised: var(--ds-surface-2);
    --surface-hover: var(--ds-hover);
    --surface-selected: #162a23;
    --border-subtle: #24242d;
    --border-default: #2f2f3a;
    --border-strong: #42424e;
    --text-primary: var(--ds-text-1);
    --text-secondary: var(--ds-text-2);
    --text-muted: #7a7a85;
    --text-disabled: #55555f;
    --accent: var(--ds-success);
    --accent-hover: var(--ds-success-hover);
    --accent-soft: var(--ds-success-soft);
    --danger: var(--ds-danger);
    --danger-soft: #2d1c1f;
    --warning: var(--ds-warning);
    --warning-soft: #2b231a;
    --info: var(--ds-info);
    --info-soft: #1b2530;
    --purple: #9b86b8;
    --purple-soft: #26202f;
    --focus-ring: var(--ds-focus);
    --font-sans: var(--ds-font-sans);
    --font-mono: var(--ds-font-mono);
    --radius-sm: var(--ds-radius-1);
    --radius-md: var(--ds-radius-2);
    --radius-lg: var(--ds-radius-2);
    --control-height: 36px;
    --navigation-width: 60px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    scrollbar-width: thin;
}

html {
    height: 100%;
    background: var(--surface-page);
    font-size: 16px;
}

body {
    margin: 0;
    color: var(--text-primary);
    background: var(--surface-page);
    font: 13px/1.45 var(--font-sans);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

button,
input {
    color: inherit;
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
    z-index: 3;
    outline: 0;
    box-shadow: var(--focus-ring);
}

button:disabled,
input:disabled,
[aria-disabled="true"] {
    cursor: not-allowed;
    color: var(--text-disabled);
    opacity: .65;
}

::selection {
    color: var(--surface-page);
    background: var(--accent-hover);
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    border: 3px solid transparent;
    border-radius: 999px;
    background: var(--border-strong);
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
    background-clip: padding-box;
}

kbd,
code {
    font-family: var(--font-mono);
}

kbd {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 1px 5px;
    color: var(--text-muted);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    background: var(--surface-raised);
    font-size: 10px;
    line-height: 1;
    white-space: nowrap;
}

body.dump-editor-page {
    display: grid;
    grid-template-rows: minmax(0, 1fr) 28px;
    width: 100%;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
}

.dump-editor-shell,
.explorer,
.workspace {
    min-width: 0;
    min-height: 0;
}

.dump-editor-shell {
    overflow: hidden;
}

.explorer {
    position: relative;
    display: grid;
    grid-template-columns: var(--navigation-width) minmax(0, 1fr);
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--surface-page);
}

/* Global navigation / NavigationItem */
.global-navigation {
    position: relative;
    z-index: 30;
    display: flex;
    align-items: center;
    flex-direction: column;
    min-height: 0;
    padding: 8px;
    border-right: 1px solid var(--border-subtle);
    background: var(--surface-navigation);
}

.navigation-brand,
.navigation-item {
    position: relative;
    display: grid;
    place-items: center;
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    color: var(--text-muted);
    border: 0;
    border-radius: var(--radius-md);
    background: transparent;
    text-decoration: none;
    cursor: pointer;
}

.navigation-brand {
    margin-bottom: 14px;
    color: var(--surface-page);
    background: transparent;
}

.navigation-brand::before {
    content: "";
    position: absolute;
    right: -7px;
    bottom: -8px;
    left: -7px;
    height: 1px;
    background: var(--border-subtle);
}

.navigation-brand .brand-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    color: var(--surface-page);
    border-radius: 8px;
    background: #f5f5f7;
    font-size: 16px;
}

.navigation-brand:hover {
    color: var(--surface-page);
    background: transparent;
}

.navigation-brand:hover .brand-icon {
    background: #ffffff;
}

.navigation-primary,
.navigation-secondary {
    display: flex;
    align-items: center;
    flex-direction: column;
    gap: 4px;
}

.navigation-secondary {
    margin-top: auto;
}

.navigation-item:hover {
    color: var(--text-primary);
    background: var(--surface-hover);
}

.navigation-item:active,
.icon-button:active,
.toolbar-button:active,
.load-more:active {
    color: var(--text-primary);
    background: var(--ds-pressed);
}

.navigation-item.active {
    color: var(--accent-hover);
    background: var(--accent-soft);
}

.navigation-item.active::before {
    content: "";
    position: absolute;
    left: -8px;
    width: 2px;
    height: 20px;
    border-radius: 0 2px 2px 0;
    background: var(--accent);
}

.navigation-item>span {
    font-size: 15px;
    line-height: 1;
}

/* Tooltip */
.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 7px);
    left: 50%;
    z-index: 100;
    width: max-content;
    max-width: 220px;
    padding: 6px 8px;
    color: var(--text-primary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    background: var(--ds-hover);
    box-shadow: 0 4px 14px #0007;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.25;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -3px);
    transition: opacity 100ms ease, transform 100ms ease;
}

.tooltip:hover::after,
.tooltip:focus-visible::after {
    opacity: 1;
    transform: translate(-50%, 0);
}

.global-navigation .tooltip::after {
    top: 50%;
    left: calc(100% + 10px);
    transform: translate(-3px, -50%);
}

.global-navigation .tooltip:hover::after,
.global-navigation .tooltip:focus-visible::after {
    transform: translate(0, -50%);
}

/* Main three-area layout */
.workspace {
    --nav-width: 360px;
    display: grid;
    grid-template-columns: minmax(280px, var(--nav-width)) 4px minmax(0, 1fr);
    height: 100%;
    overflow: hidden;
}

.results {
    grid-column: 1;
    display: flex;
    min-width: 0;
    min-height: 0;
    flex-direction: column;
    border-right: 1px solid var(--border-subtle);
    background: var(--surface-panel);
}

.panel-splitter,
.outline-splitter {
    position: relative;
    z-index: 8;
    width: 4px;
    min-width: 4px;
    cursor: col-resize;
    touch-action: none;
    background: var(--surface-page);
}

.panel-splitter {
    grid-column: 2;
}

.panel-splitter::after,
.outline-splitter::after {
    content: "";
    position: absolute;
    inset: 0 -3px;
}

.panel-splitter:hover,
.panel-splitter:focus-visible,
.outline-splitter:hover,
.outline-splitter:focus-visible {
    background: var(--accent);
    box-shadow: none;
}

.detail {
    grid-column: 3;
    display: flex;
    min-width: 0;
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
    background: var(--surface-page);
}

.results-collapsed .workspace {
    grid-template-columns: 0 0 minmax(0, 1fr);
}

.results-collapsed .results {
    visibility: hidden;
    overflow: hidden;
    border: 0;
}

.results-collapsed .panel-splitter {
    visibility: hidden;
    width: 0;
    min-width: 0;
}

/* Result toolbar / SearchInput / SegmentedControl */
.result-toolbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    gap: 12px;
    padding: 14px 14px 12px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--surface-panel);
}

.editor-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    color: var(--surface-page);
    border-radius: 7px;
    background: #f5f5f7;
    font-size: 13px;
}

.editor-brand>div {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.editor-brand strong {
    overflow: hidden;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.editor-brand small {
    color: var(--text-muted);
    font-size: 10px;
    letter-spacing: .02em;
}

.search-input {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
}

.search-input input {
    width: 100%;
    height: var(--control-height);
    padding: 0 62px 0 34px;
    color: var(--text-primary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    outline: 0;
    background: var(--surface-page);
    font-size: 12px;
}

.search-input input::placeholder {
    color: var(--text-muted);
}

.search-input input:hover {
    border-color: var(--border-strong);
}

.search-input input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-soft);
}

.search-input>kbd {
    position: absolute;
    right: 8px;
    pointer-events: none;
}

.search-icon {
    position: absolute;
    left: 12px;
    z-index: 1;
    width: 12px;
    height: 12px;
    border: 1.5px solid var(--text-muted);
    border-radius: 50%;
    pointer-events: none;
}

.search-icon::after {
    content: "";
    position: absolute;
    right: -4px;
    bottom: -3px;
    width: 5px;
    height: 1.5px;
    background: var(--text-muted);
    transform: rotate(45deg);
    transform-origin: left center;
}

.result-toolbar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.result-count {
    overflow: hidden;
    color: var(--text-muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.segmented-control {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    border-radius: var(--radius-md);
    background: var(--surface-raised);
}

.segmented-control button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: var(--control-height);
    min-width: 44px;
    padding: 0 9px;
    color: var(--text-muted);
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    cursor: pointer;
    font-size: 11px;
    font-weight: 550;
    white-space: nowrap;
}

.segmented-control button:hover {
    color: var(--text-secondary);
    background: var(--surface-hover);
}

.segmented-control button:active {
    color: var(--text-primary);
    background: var(--ds-pressed);
}

.segmented-control button.active,
.segmented-control button[aria-selected="true"] {
    color: var(--text-primary);
    background: var(--ds-pressed);
}

.segmented-control button.active::before {
    content: "";
    width: 5px;
    height: 5px;
    margin-right: 6px;
    border-radius: 50%;
    background: var(--accent);
}

/* SymbolListItem */
.list {
    min-height: 0;
    flex: 1;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

.symbol-item {
    position: relative;
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    width: 100%;
    min-height: 50px;
    padding: 7px 12px;
    color: var(--text-secondary);
    border: 0;
    border-bottom: 1px solid var(--border-subtle);
    border-radius: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.symbol-item:hover {
    background: var(--surface-hover);
}

.symbol-item:active {
    background: var(--ds-pressed);
}

.symbol-item.active {
    color: var(--text-primary);
    background: var(--surface-selected);
}

.symbol-item.active::before {
    content: "";
    position: absolute;
    top: 8px;
    bottom: 8px;
    left: 0;
    width: 2px;
    border-radius: 0 2px 2px 0;
    background: var(--accent);
}

.symbol-item.keyboard-active:not(.active) {
    background: var(--surface-hover);
    box-shadow: inset 0 0 0 1px var(--border-strong);
}

.symbol-icon,
.member-gutter {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    color: var(--accent-hover);
    border-radius: var(--radius-sm);
    background: var(--accent-soft);
    font: 700 10px/1 var(--font-mono);
}

.enum-icon {
    color: var(--info);
    background: var(--info-soft);
}

.symbol-copy {
    display: block;
    min-width: 0;
}

.item-title,
.item-path {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item-title {
    color: inherit;
    font-size: 12px;
    font-weight: 600;
}

.item-path {
    margin-top: 1px;
    color: var(--text-muted);
    font: 10px/1.4 var(--font-mono);
}

.symbol-stats {
    color: var(--text-muted);
    font: 9px/1 var(--font-mono);
    white-space: nowrap;
}

.load-more {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: calc(100% - 24px);
    min-height: 38px;
    margin: 12px;
    padding: 0 10px;
    color: var(--text-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background: var(--surface-raised);
    cursor: pointer;
    font-size: 11px;
}

.load-more:hover {
    color: var(--text-primary);
    border-color: var(--border-strong);
    background: var(--surface-hover);
}

.load-more span {
    color: var(--text-muted);
    font: 9px/1 var(--font-mono);
}

/* ClassHeader / Breadcrumbs / IconButton */
.detail-head {
    flex: 0 0 auto;
    padding: 20px 24px 18px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--surface-panel);
}

.editor-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 10px;
    color: var(--text-muted);
    font-size: 11px;
}

.editor-breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
}

.editor-breadcrumb a:hover {
    color: var(--text-primary);
}

.breadcrumb-separator {
    color: var(--text-disabled);
}

.detail-title-line {
    display: flex;
    align-items: flex-start;
    /* justify-content: space-between; */
    gap: 20px;
}

.detail-title-copy {
    min-width: 0;
}

.detail-title-line h1 {
    margin: 0;
    overflow-wrap: anywhere;
    color: var(--text-primary);
    font-size: clamp(22px, 2.1vw, 28px);
    font-weight: 680;
    line-height: 1.2;
    letter-spacing: -.025em;
}

.full-name {
    margin-top: 5px;
    overflow: hidden;
    color: var(--text-muted);
    font: 11px/1.5 var(--font-mono);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-metadata {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 12px;
    margin-top: 12px;
}

.type-badge,
.property-badge,
.inheritance {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 2px 7px;
    border-radius: var(--radius-sm);
    font-size: 10px;
    font-weight: 600;
    line-height: 1.2;
}

.type-badge {
    color: var(--accent-hover);
    background: var(--accent-soft);
    text-transform: uppercase;
    letter-spacing: .06em;
}

.inheritance {
    color: var(--text-muted);
    background: var(--surface-raised);
}

.inheritance a,
.api-link {
    color: var(--info);
    text-decoration: none;
}

.inheritance a:hover,
.api-link:hover {
    color: #98b5d5;
    text-decoration: underline;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.icon-button,
.toolbar-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: var(--control-height);
    min-width: var(--control-height);
    padding: 0 10px;
    color: var(--text-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background: var(--surface-raised);
    cursor: pointer;
}

.icon-button:hover,
.toolbar-button:hover {
    color: var(--text-primary);
    border-color: var(--border-strong);
    background: var(--surface-hover);
}

.icon-button>span {
    font: 15px/1 var(--font-mono);
}

/* Toolbar */
.editor-tools {
    position: relative;
    z-index: 12;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    min-height: 56px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--surface-panel);
}

.member-search {
    min-width: 160px;
    max-width: 320px;
    flex: 1;
}

.member-search input {
    padding-right: 42px;
}

.member-search>kbd {
    right: 8px;
}

.member-tabs {
    flex: 0 0 auto;
}

.member-tabs button span {
    margin-left: 5px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 9px;
}

.member-count {
    margin-right: auto;
    color: var(--text-muted);
    font-size: 10px;
    white-space: nowrap;
}

.enum-toolbar-summary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: var(--control-height);
    margin-right: auto;
    padding: 0 10px 0 7px;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    background: var(--surface-raised);
    font-size: 11px;
    white-space: nowrap;
}

.enum-toolbar-summary strong {
    color: var(--text-primary);
    font: 600 10px/1 var(--font-mono);
}

.enum-summary-icon {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    color: var(--info);
    border-radius: var(--radius-sm);
    background: var(--info-soft);
    font: 700 9px/1 var(--font-mono);
}

.toolbar-button {
    gap: 7px;
    min-width: 36px;
    font-size: 11px;
    white-space: nowrap;
}

.toolbar-button .button-icon {
    color: var(--text-muted);
    font: 14px/1 var(--font-mono);
}

.editor-tools .tooltip::after {
    right: 0;
    left: auto;
    transform: translateY(-3px);
}

.editor-tools .tooltip:hover::after,
.editor-tools .tooltip:focus-visible::after {
    transform: translateY(0);
}

.download-icon {
    position: relative;
    display: inline-block;
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
    border-bottom: 1.5px solid currentColor;
}

.download-icon::before {
    content: "";
    position: absolute;
    top: 0;
    left: 6px;
    width: 2px;
    height: 8px;
    border-radius: 1px;
    background: currentColor;
}

.download-icon::after {
    content: "";
    position: absolute;
    top: 4px;
    left: 4px;
    width: 5px;
    height: 5px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
}

/* OutlinePanel */
.editor-layout {
    --outline-width: 210px;
    position: relative;
    display: grid;
    grid-template-columns: minmax(150px, var(--outline-width)) 4px minmax(0, 1fr);
    min-width: 0;
    min-height: 0;
    flex: 1;
}

.member-outline {
    grid-column: 1;
    min-width: 0;
    min-height: 0;
    padding: 10px 8px 24px;
    overflow: auto;
    border-right: 1px solid var(--border-subtle);
    background: var(--surface-panel);
    scrollbar-width: thin;
}

.outline-splitter {
    grid-column: 2;
}

.editor-main {
    grid-column: 3;
    min-width: 0;
    min-height: 0;
    padding: 0 16px 32px;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

.outline-heading {
    position: sticky;
    top: -10px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 34px;
    padding: 8px 7px 6px;
    color: var(--text-muted);
    background: var(--surface-panel);
    font-size: 10px;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.outline-heading span {
    font: 9px/1 var(--font-mono);
}

.outline-group+.outline-group {
    margin-top: 8px;
}

.outline-item {
    position: relative;
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr) auto;
    align-items: center;
    gap: 5px;
    min-height: 36px;
    padding: 5px 7px;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    text-decoration: none;
    font: 10px/1.4 var(--font-mono);
}

.outline-item:hover {
    color: var(--text-primary);
    background: var(--surface-hover);
    text-decoration: none;
}

.outline-item.active {
    color: var(--text-primary);
    background: var(--surface-selected);
}

.outline-item.active::before {
    content: "";
    position: absolute;
    top: 7px;
    bottom: 7px;
    left: 0;
    width: 2px;
    background: var(--accent);
}

.outline-item-icon {
    color: var(--accent);
    text-align: center;
}

.outline-item[data-outline-kind="function"] .outline-item-icon {
    color: var(--purple);
}

.outline-item[data-outline-kind="value"] .outline-item-icon {
    color: var(--info);
}

.outline-item-name {
    overflow: hidden;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.outline-item-meta {
    color: var(--text-disabled);
    font-size: 9px;
}

.outline-empty {
    padding: 12px 7px;
    color: var(--text-muted);
    font-size: 11px;
}

.outline-collapsed .editor-layout {
    grid-template-columns: 0 0 minmax(0, 1fr);
}

.outline-collapsed .member-outline,
.outline-collapsed .outline-splitter {
    visibility: hidden;
    width: 0;
    min-width: 0;
    padding: 0;
    border: 0;
}

/* MemberRow / PropertyBadge */
.member-row {
    position: relative;
    min-width: 0;
    border-bottom: 1px solid var(--border-subtle);
    scroll-margin: 16px;
}

.field-row {
    display: grid;
    grid-template-columns: 28px minmax(150px, 1.2fr) minmax(110px, .85fr) 74px minmax(100px, auto) minmax(80px, auto) 36px;
    grid-template-areas: "icon name type offset property technical link";
    align-items: center;
    gap: 10px;
    min-height: 58px;
    padding: 8px 4px;
}

.member-row:hover {
    background: #ffffff04;
}

.member-row[hidden],
.outline-item[hidden],
.outline-group[hidden] {
    display: none !important;
}

.member-gutter {
    grid-area: icon;
    width: 22px;
    height: 22px;
}

.function-row .member-gutter {
    color: var(--purple);
    background: var(--purple-soft);
}

.member-identity {
    grid-area: name;
    min-width: 0;
}

.member-identity strong {
    display: block;
    overflow: hidden;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.member-identity small {
    display: block;
    overflow: hidden;
    margin-top: 2px;
    color: var(--text-muted);
    font: 9px/1.4 var(--font-mono);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.member-type {
    grid-area: type;
    min-width: 0;
    overflow: hidden;
    color: var(--text-secondary);
    font: 10px/1.45 var(--font-mono);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.member-offset {
    grid-area: offset;
    color: var(--text-secondary);
    font: 10px/1 var(--font-mono);
    white-space: nowrap;
}

.member-technical {
    grid-area: technical;
    color: var(--text-muted);
    font: 9px/1.4 var(--font-mono);
    white-space: nowrap;
}

.property-badge {
    grid-area: property;
    justify-self: start;
    max-width: 100%;
    overflow: hidden;
    color: var(--text-secondary);
    background: var(--surface-raised);
    font: 500 9px/1.2 var(--font-mono);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.property-badge[data-category="boolean"] {
    color: var(--warning);
    background: var(--warning-soft);
}

.property-badge[data-category="reference"] {
    color: var(--info);
    background: var(--info-soft);
}

.property-badge[data-category="collection"] {
    color: var(--purple);
    background: var(--purple-soft);
}

.property-badge[data-category="numeric"] {
    color: var(--accent-hover);
    background: var(--accent-soft);
}

.member-anchor {
    grid-area: link;
    display: grid;
    place-items: center;
    align-self: center;
    width: 36px;
    height: 36px;
    color: var(--text-disabled);
    border-radius: var(--radius-sm);
    text-decoration: none;
    font: 12px/1 var(--font-mono);
}

.member-anchor:hover {
    color: var(--text-primary);
    background: var(--surface-hover);
    text-decoration: none;
}

.function-row {
    display: block;
}

.function-row>summary {
    display: grid;
    grid-template-columns: 28px minmax(180px, 1fr) auto 80px 36px;
    grid-template-areas: "icon name property technical link";
    align-items: center;
    gap: 10px;
    min-height: 58px;
    padding: 8px 4px;
    cursor: pointer;
    list-style: none;
}

.function-row>summary::-webkit-details-marker {
    display: none;
}

.function-row>summary::before {
    content: "›";
    position: absolute;
    top: 19px;
    left: -9px;
    color: var(--text-muted);
    font: 16px/1 var(--font-mono);
    transition: transform 120ms ease;
}

.function-row[open]>summary::before {
    transform: rotate(90deg);
}

.function-label {
    grid-area: property;
    color: var(--purple);
    background: var(--purple-soft);
}

.function-arity {
    grid-area: technical;
    color: var(--text-muted);
    font: 10px/1 var(--font-mono);
    text-align: right;
    white-space: nowrap;
}

.function-body {
    margin: 0 32px 12px 32px;
    border-left: 1px solid var(--border-default);
    background: var(--surface-panel);
}

.argument-row {
    display: grid;
    grid-template-columns: minmax(110px, .8fr) minmax(120px, 1fr) 70px minmax(100px, auto) minmax(70px, auto);
    align-items: center;
    gap: 10px;
    min-height: 38px;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-subtle);
}

.argument-row:last-child {
    border-bottom: 0;
}

.argument-name {
    overflow: hidden;
    color: var(--text-primary);
    font: 10px/1.4 var(--font-mono);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.argument-type,
.argument-offset,
.argument-technical {
    overflow: hidden;
    color: var(--text-muted);
    font: 9px/1.4 var(--font-mono);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.empty-args {
    display: block;
    padding: 12px;
    color: var(--text-muted);
    font-size: 11px;
}

.link-focus {
    background: var(--surface-selected) !important;
    box-shadow: inset 2px 0 var(--accent);
}

/* Enum members */
.enum-editor {
    display: block;
    width: 100%;
    max-width: none;
    padding: 0 16px 32px;
}

.enum-list-header {
    position: sticky;
    top: 0;
    z-index: 4;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 140px 140px 44px;
    grid-template-areas: "name id hex link";
    align-items: center;
    min-height: 38px;
    padding: 0 2px 0 12px;
    border-bottom: 1px solid var(--border-default);
    background: var(--surface-page);
    color: var(--text-muted);
    font-size: 9px;
    font-weight: 650;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.enum-list-header>span:nth-child(1) {
    grid-area: name;
}

.enum-list-header>span:nth-child(2) {
    grid-area: id;
}

.enum-list-header>span:nth-child(3) {
    grid-area: hex;
}

.enum-list-header>span:nth-child(4) {
    grid-area: link;
}

.enum-value {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 140px 140px 44px;
    grid-template-areas: "name id hex link";
    align-items: center;
    min-height: 46px;
    padding: 4px 2px 4px 12px;
    border: 0;
    border-bottom: 1px solid var(--border-subtle);
    border-radius: 0;
    background: transparent;
}

.enum-value:hover {
    border-color: var(--border-subtle);
    background: #ffffff04;
}

.enum-index {
    grid-area: id;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    justify-self: start;
    min-width: 52px;
    height: 26px;
    padding: 0 8px;
    color: var(--info);
    border-radius: 999px;
    background: var(--info-soft);
    font: 10px/1 var(--font-mono);
    text-align: center;
}

.enum-hex {
    grid-area: hex;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    justify-self: start;
    min-width: 72px;
    height: 26px;
    padding: 0 8px;
    color: var(--text-muted);
    border-radius: 999px;
    background: var(--surface-hover);
    font: 9px/1 var(--font-mono);
    text-align: center;
}

.enum-name {
    grid-area: name;
    overflow: hidden;
    color: var(--text-primary);
    font: 550 12px/1.4 var(--font-mono);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.enum-link-cell {
    grid-area: link;
    display: flex;
    justify-self: end;
}

.enum-value .member-anchor {
    grid-area: auto;
    border-radius: 50%;
    opacity: .32;
}

.enum-value:hover .member-anchor,
.enum-value:focus-within .member-anchor,
.enum-value.link-focus .member-anchor {
    opacity: 1;
}

.enum-value.link-focus {
    border-color: var(--border-subtle);
    box-shadow: inset 2px 0 var(--accent);
}

/* EmptyState / LoadingState / ErrorState */
.empty-state,
.loading-state,
.error-state {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 220px;
    flex: 1;
    flex-direction: column;
    padding: 32px;
    color: var(--text-muted);
    text-align: center;
}

.empty-state.compact,
.error-state.compact {
    min-height: 160px;
}

.state-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    margin-bottom: 12px;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    background: var(--surface-raised);
    font: 16px/1 var(--font-mono);
}

.error-state .state-icon {
    color: var(--danger);
    background: var(--danger-soft);
}

.empty-state strong,
.error-state strong {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
}

.empty-state p,
.error-state p {
    max-width: 340px;
    margin: 5px 0 0;
    color: var(--text-muted);
    font-size: 11px;
}

.state-hint {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 16px;
    color: var(--text-muted);
    font-size: 10px;
}

.loading-state {
    min-height: 150px;
    gap: 10px;
    font-size: 11px;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-default);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Shortcut popover */
.shortcut-panel {
    position: absolute;
    z-index: 60;
    bottom: 12px;
    left: calc(var(--navigation-width) + 10px);
    width: min(280px, calc(100vw - var(--navigation-width) - 24px));
    padding: 12px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    background: var(--ds-surface-3);
    box-shadow: 0 14px 36px #0009;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(6px);
    transition: opacity 120ms ease, transform 120ms ease, visibility 0s linear 120ms;
}

.shortcut-panel.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
    transition: opacity 120ms ease, transform 120ms ease;
}

.shortcut-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.shortcut-panel-head strong {
    font-size: 12px;
    font-weight: 650;
}

.shortcut-panel .icon-button {
    width: 30px;
    min-width: 30px;
    height: 30px;
    padding: 0;
}

.shortcut-panel dl {
    margin: 0;
}

.shortcut-panel dl>div {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    align-items: center;
    min-height: 34px;
    border-top: 1px solid var(--border-subtle);
}

.shortcut-panel dt,
.shortcut-panel dd {
    margin: 0;
}

.shortcut-panel dt {
    display: flex;
    gap: 4px;
}

.shortcut-panel dd {
    color: var(--text-secondary);
    font-size: 11px;
}

/* Status footer */
.generation-notice {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    height: 28px;
    padding: 0 12px 0 12px;
    overflow: hidden;
    color: var(--text-muted);
    border-top: 1px solid var(--border-subtle);
    background: var(--surface-navigation);
    font: 9px/1 var(--font-mono);
    white-space: nowrap;
}

.generation-notice>span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-dot {
    width: 6px;
    height: 6px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--accent);
}

.generation-source {
    margin-left: auto;
}

.is-resizing,
.is-resizing * {
    cursor: col-resize !important;
    user-select: none !important;
}

/* Responsive: hide secondary data first */
@media (max-width: 1280px) {
    .field-row {
        grid-template-columns: 28px minmax(150px, 1.2fr) minmax(100px, .8fr) 70px minmax(100px, auto) 36px;
        grid-template-areas: "icon name type offset property link";
    }

    .field-row>.member-technical {
        display: none;
    }

    .argument-row {
        grid-template-columns: minmax(100px, .8fr) minmax(110px, 1fr) 65px minmax(90px, auto);
    }

    .argument-technical {
        display: none;
    }
}

/* Outline becomes a drawer before the three panes get cramped */
@media (max-width: 1100px) {
    .editor-layout,
    .outline-collapsed .editor-layout {
        grid-template-columns: 0 0 minmax(0, 1fr);
    }

    .member-outline,
    .outline-collapsed .member-outline {
        position: absolute;
        inset: 0 auto 0 0;
        z-index: 20;
        display: block;
        visibility: hidden;
        width: min(280px, 82%);
        min-width: 0;
        padding: 10px 8px 24px;
        border: 0;
        border-right: 1px solid var(--border-default);
        box-shadow: 14px 0 34px #0009;
        opacity: 0;
        transform: translateX(-100%);
        transition: opacity 120ms ease, transform 120ms ease, visibility 120ms;
    }

    .outline-open .member-outline {
        visibility: visible;
        opacity: 1;
        transform: translateX(0);
    }

    .outline-splitter,
    .outline-collapsed .outline-splitter {
        display: none;
    }

    .editor-main {
        grid-column: 3;
    }

    .toolbar-button .button-label {
        display: none;
    }
}

@media (max-width: 900px) {
    .workspace {
        --nav-width: 310px;
        grid-template-columns: minmax(260px, var(--nav-width)) 4px minmax(0, 1fr);
    }

    .detail-head {
        padding: 18px;
    }

    .editor-tools {
        flex-wrap: wrap;
    }

    .member-search {
        max-width: none;
        flex-basis: calc(100% - 44px);
        order: -2;
    }

    .outline-toggle {
        order: -1;
    }

    .member-count {
        display: none;
    }

    .enum-list-header,
    .enum-value {
        grid-template-columns: minmax(0, 1fr) 96px 96px 40px;
    }

    .field-row {
        grid-template-columns: 26px minmax(0, 1fr) auto 36px;
        grid-template-areas:
            "icon name offset link"
            "icon type property link"
            "icon technical technical link";
        gap: 4px 9px;
        padding-block: 9px;
    }

    .field-row>.member-technical {
        display: block;
    }

    .function-row>summary {
        grid-template-columns: 26px minmax(0, 1fr) auto 36px;
        grid-template-areas:
            "icon name technical link"
            "icon property technical link";
        gap: 4px 9px;
    }

    .function-body {
        margin-right: 8px;
        margin-left: 28px;
    }

    .argument-row {
        grid-template-columns: minmax(90px, .8fr) minmax(100px, 1fr) 58px;
    }

    .argument-row>.property-badge,
    .argument-technical {
        display: none;
    }
}

/* Small windows show one working pane at a time */
@media (max-width: 720px) {
    :root {
        --navigation-width: 56px;
    }

    .global-navigation {
        padding-inline: 6px;
    }

    .navigation-brand,
    .navigation-item {
        width: 40px;
        min-width: 40px;
    }

    .workspace,
    .results-collapsed .workspace {
        position: relative;
        display: block;
    }

    .results {
        position: absolute;
        inset: 0 auto 0 0;
        z-index: 25;
        visibility: visible;
        width: min(360px, 100%);
        border-right: 1px solid var(--border-default);
        box-shadow: 16px 0 38px #000a;
        opacity: 1;
        transform: translateX(0);
        transition: opacity 120ms ease, transform 120ms ease, visibility 120ms;
    }

    .results-collapsed .results {
        visibility: hidden;
        width: min(360px, 100%);
        border-right: 1px solid var(--border-default);
        opacity: 0;
        transform: translateX(-100%);
    }

    .panel-splitter {
        display: none;
    }

    .detail {
        width: 100%;
        height: 100%;
    }

    .detail-title-line h1 {
        font-size: 21px;
    }

    .detail-head {
        padding: 16px;
    }

    .full-name {
        white-space: normal;
    }

    .editor-tools {
        padding: 8px 10px;
    }

    .member-tabs {
        overflow-x: auto;
    }

    .member-tabs button {
        min-width: auto;
    }

    .editor-main {
        padding-inline: 10px;
    }

    .generation-notice {
        padding-left: 66px;
    }

    .generation-source {
        display: none;
    }
}

@media (max-width: 520px) {
    .editor-tools {
        gap: 6px;
    }

    .member-tabs {
        order: 2;
        width: 100%;
    }

    .member-tabs button {
        flex: 1;
    }

    .toolbar-button:not(.outline-toggle) {
        order: 1;
    }

    .enum-list-header,
    .enum-value {
        grid-template-columns: minmax(0, 1fr) 76px 40px;
        grid-template-areas: "name id link";
    }

    .enum-list-header>span:nth-child(3),
    .enum-hex {
        display: none;
    }

    .header-metadata {
        align-items: flex-start;
        flex-direction: column;
    }

    .inheritance {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .argument-row {
        grid-template-columns: 1fr;
        gap: 2px;
        padding-block: 8px;
    }

    .argument-offset {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}

@media (forced-colors: active) {
    .navigation-item.active::before,
    .symbol-item.active::before,
    .outline-item.active::before {
        background: Highlight;
    }

    .symbol-item.active,
    .outline-item.active {
        outline: 1px solid Highlight;
    }
}
