:root {
    --bg-canvas: #f4ecda;
    --bg-canvas-strong: #eadbc0;
    --bg-elevated: #fff9ee;
    --bg-overlay: rgba(38, 26, 20, 0.44);
    --surface-1: rgba(255, 250, 240, 0.82);
    --surface-2: rgba(255, 255, 255, 0.72);
    --surface-3: rgba(255, 252, 244, 0.75);
    --surface-tooling: rgba(247, 239, 225, 0.65);
    --text-primary: #261a14;
    --text-secondary: #5a4c41;
    --text-tertiary: #7b6243;
    --text-on-accent: #fff8ef;
    --border-subtle: rgba(111, 87, 59, 0.12);
    --border-default: rgba(111, 87, 59, 0.18);
    --border-strong: rgba(111, 87, 59, 0.28);
    --focus-ring: rgba(184, 121, 59, 0.35);
    --focus-border: rgba(184, 121, 59, 0.45);
    --shadow-1: 0 18px 40px rgba(41, 22, 11, 0.12);
    --shadow-2: 0 28px 60px rgba(41, 22, 11, 0.24);
    --accent-1: #f7ead8;
    --accent-2: #e7c89e;
    --accent-3: #c38a4d;
    --accent-4: #b8793b;
    --accent-5: #8f5a2f;
    --success-1: #e8f1e3;
    --success-2: #bad0ab;
    --success-3: #668a53;
    --warning-1: #fff2df;
    --warning-2: #f0bf7f;
    --warning-3: #b8793b;
    --danger-1: #f7e2de;
    --danger-2: #d9897d;
    --danger-3: #8d2b1e;
    --info-1: #e5eef4;
    --info-2: #9fb8c8;
    --info-3: #4f7086;
    --bg-radial-glow: rgba(240, 223, 185, 0.55);
    --bg-canvas-end: #e2d3b7;
    --surface-card: rgba(255, 255, 255, 0.72);
    --surface-card-strong: rgba(255, 255, 255, 0.85);
    --surface-inline: rgba(255, 250, 240, 0.72);
    --surface-input: rgba(255, 252, 247, 0.92);
    --surface-input-hover: rgba(255, 248, 236, 0.98);
    --surface-subtle-accent: rgba(255, 250, 242, 0.84);
    --surface-chip: rgba(238, 223, 193, 0.65);
    --surface-callout: rgba(255, 247, 230, 0.76);
    --surface-raised: var(--surface-2);
    --surface-elevated: var(--surface-card-strong);
    --surface-card-subtle: color-mix(in srgb, var(--surface-card) 82%, var(--surface-1));
    --surface-table-header: color-mix(in srgb, var(--surface-card-strong) 94%, var(--accent-1));
    --surface-table-cell: color-mix(in srgb, var(--surface-card-strong) 90%, var(--bg-elevated));
    --surface-table-cell-strong: color-mix(in srgb, var(--surface-card-strong) 96%, var(--surface-2));
    --surface-code: #2a1d17;
    --text-code: #f9ecd2;
    --surface-danger-strong: #7e2c22;
    --surface-danger-banner: #682e24;
    --text-on-danger: #fff7ee;
    --field-label-color: #75562f;
    --link-hover: #6e4320;
    --button-secondary-bg: rgba(255, 248, 236, 0.9);
    --button-secondary-bg-hover: rgba(250, 236, 210, 0.95);
    --button-secondary-text: #6a4b28;
    --button-secondary-border: rgba(127, 96, 55, 0.18);
    --text-strong: var(--text-primary);
    --text-muted: var(--text-secondary);
    --text-soft: var(--text-tertiary);
    --success-4: color-mix(in srgb, var(--success-3) 72%, var(--text-primary));
    --success-5: color-mix(in srgb, var(--success-3) 88%, var(--text-primary));
    --warning-4: color-mix(in srgb, var(--warning-3) 72%, var(--text-primary));
    --warning-5: color-mix(in srgb, var(--warning-3) 88%, var(--text-primary));
    --danger-4: color-mix(in srgb, var(--danger-3) 72%, var(--text-primary));
    --danger-5: color-mix(in srgb, var(--danger-3) 88%, var(--text-primary));
    --info-4: color-mix(in srgb, var(--info-3) 72%, var(--text-primary));
    --info-5: color-mix(in srgb, var(--info-3) 88%, var(--text-primary));
    --shadow-strong: rgba(41, 22, 11, 0.34);
    --selection-1: rgba(13, 148, 136, 0.04);
    --selection-2: rgba(13, 148, 136, 0.06);
    --selection-3: rgba(13, 148, 136, 0.12);
    --selection-4: rgba(13, 148, 136, 0.16);
    --selection-5: rgba(13, 148, 136, 0.35);
    --selection-6: rgba(13, 148, 136, 0.62);
    --control-height: 3rem;
    --font-display: "Macondo", Georgia, serif;
    --font-body: "IBM Plex Sans", "Segoe UI", sans-serif;
    --font-ui: "IBM Plex Sans", "Segoe UI", sans-serif;
    --font-mono: "IBM Plex Mono", Consolas, "Courier New", monospace;

    /* Temporary compatibility aliases while existing page styles are migrated. */
    --paper: var(--bg-canvas);
    --paper-strong: var(--bg-elevated);
    --ink: var(--text-primary);
    --ink-strong: var(--text-primary);
    --ink-soft: var(--text-secondary);
    --ink-faint: var(--text-tertiary);
    --accent: var(--accent-5);
    --accent-strong: var(--accent-4);
    --panel: var(--surface-1);
    --line: var(--border-default);
    --shadow: var(--shadow-1);
}

:root,
:root[data-theme="light"] {
    color-scheme: light;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg-canvas: #161412;
    --bg-canvas-strong: #0f0d0c;
    --bg-elevated: #201c19;
    --bg-overlay: rgba(5, 5, 6, 0.68);
    --surface-1: rgba(33, 28, 25, 0.88);
    --surface-2: rgba(40, 34, 30, 0.9);
    --surface-3: rgba(49, 41, 36, 0.92);
    --surface-tooling: rgba(27, 31, 37, 0.92);
    --text-primary: #f3eadf;
    --text-secondary: #cab8a7;
    --text-tertiary: #a28d7d;
    --text-on-accent: #fff6ec;
    --border-subtle: rgba(209, 188, 163, 0.12);
    --border-default: rgba(209, 188, 163, 0.2);
    --border-strong: rgba(209, 188, 163, 0.32);
    --focus-ring: rgba(237, 181, 109, 0.38);
    --focus-border: rgba(237, 181, 109, 0.52);
    --shadow-1: 0 18px 40px rgba(0, 0, 0, 0.3);
    --shadow-2: 0 28px 60px rgba(0, 0, 0, 0.42);
    --accent-1: #36271d;
    --accent-2: #6e4b2f;
    --accent-3: #a06c39;
    --accent-4: #c98c4b;
    --accent-5: #edb56d;
    --success-1: #1d2a22;
    --success-2: #476653;
    --success-3: #88b58b;
    --warning-1: #36281b;
    --warning-2: #8a6436;
    --warning-3: #e3b063;
    --danger-1: #351d1a;
    --danger-2: #92524d;
    --danger-3: #e29b90;
    --info-1: #18252f;
    --info-2: #45677d;
    --info-3: #9ec0d5;
    --bg-radial-glow: rgba(237, 181, 109, 0.12);
    --bg-canvas-end: #090807;
    --surface-card: rgba(32, 28, 25, 0.9);
    --surface-card-strong: rgba(24, 21, 19, 0.94);
    --surface-inline: rgba(40, 34, 30, 0.9);
    --surface-input: rgba(29, 25, 22, 0.94);
    --surface-input-hover: rgba(39, 33, 29, 0.98);
    --surface-subtle-accent: rgba(48, 39, 32, 0.84);
    --surface-chip: rgba(78, 62, 46, 0.76);
    --surface-callout: rgba(56, 42, 28, 0.8);
    --surface-code: #120d0a;
    --text-code: #f5dcc2;
    --surface-danger-strong: #9b4133;
    --surface-danger-banner: #7c362b;
    --text-on-danger: #fff7ee;
    --field-label-color: #d2b28b;
    --link-hover: #f5c487;
    --button-secondary-bg: rgba(40, 34, 30, 0.94);
    --button-secondary-bg-hover: rgba(52, 44, 38, 0.98);
    --button-secondary-text: #f0ddc8;
    --button-secondary-border: rgba(209, 188, 163, 0.2);
    --shadow-strong: rgba(0, 0, 0, 0.62);
    --selection-1: rgba(86, 207, 195, 0.08);
    --selection-2: rgba(86, 207, 195, 0.12);
    --selection-3: rgba(86, 207, 195, 0.18);
    --selection-4: rgba(86, 207, 195, 0.24);
    --selection-5: rgba(111, 225, 214, 0.46);
    --selection-6: rgba(111, 225, 214, 0.78);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]),
    :root[data-theme="system"] {
        color-scheme: dark;
        --bg-canvas: #161412;
        --bg-canvas-strong: #0f0d0c;
        --bg-elevated: #201c19;
        --bg-overlay: rgba(5, 5, 6, 0.68);
        --surface-1: rgba(33, 28, 25, 0.88);
        --surface-2: rgba(40, 34, 30, 0.9);
        --surface-3: rgba(49, 41, 36, 0.92);
        --surface-tooling: rgba(27, 31, 37, 0.92);
        --text-primary: #f3eadf;
        --text-secondary: #cab8a7;
        --text-tertiary: #a28d7d;
        --text-on-accent: #fff6ec;
        --border-subtle: rgba(209, 188, 163, 0.12);
        --border-default: rgba(209, 188, 163, 0.2);
        --border-strong: rgba(209, 188, 163, 0.32);
        --focus-ring: rgba(237, 181, 109, 0.38);
        --focus-border: rgba(237, 181, 109, 0.52);
        --shadow-1: 0 18px 40px rgba(0, 0, 0, 0.3);
        --shadow-2: 0 28px 60px rgba(0, 0, 0, 0.42);
        --accent-1: #36271d;
        --accent-2: #6e4b2f;
        --accent-3: #a06c39;
        --accent-4: #c98c4b;
        --accent-5: #edb56d;
        --success-1: #1d2a22;
        --success-2: #476653;
        --success-3: #88b58b;
        --warning-1: #36281b;
        --warning-2: #8a6436;
        --warning-3: #e3b063;
        --danger-1: #351d1a;
        --danger-2: #92524d;
        --danger-3: #e29b90;
        --info-1: #18252f;
        --info-2: #45677d;
        --info-3: #9ec0d5;
        --bg-radial-glow: rgba(237, 181, 109, 0.12);
        --bg-canvas-end: #090807;
        --surface-card: rgba(32, 28, 25, 0.9);
        --surface-card-strong: rgba(24, 21, 19, 0.94);
        --surface-inline: rgba(40, 34, 30, 0.9);
        --surface-input: rgba(29, 25, 22, 0.94);
        --surface-input-hover: rgba(39, 33, 29, 0.98);
        --surface-subtle-accent: rgba(48, 39, 32, 0.84);
        --surface-chip: rgba(78, 62, 46, 0.76);
        --surface-callout: rgba(56, 42, 28, 0.8);
        --surface-code: #120d0a;
        --text-code: #f5dcc2;
        --surface-danger-strong: #9b4133;
        --surface-danger-banner: #7c362b;
        --text-on-danger: #fff7ee;
        --field-label-color: #d2b28b;
        --link-hover: #f5c487;
        --button-secondary-bg: rgba(40, 34, 30, 0.94);
        --button-secondary-bg-hover: rgba(52, 44, 38, 0.98);
        --button-secondary-text: #f0ddc8;
        --button-secondary-border: rgba(209, 188, 163, 0.2);
        --shadow-strong: rgba(0, 0, 0, 0.62);
        --selection-1: rgba(86, 207, 195, 0.08);
        --selection-2: rgba(86, 207, 195, 0.12);
        --selection-3: rgba(86, 207, 195, 0.18);
        --selection-4: rgba(86, 207, 195, 0.24);
        --selection-5: rgba(111, 225, 214, 0.46);
        --selection-6: rgba(111, 225, 214, 0.78);
    }
}

html, body {
    min-height: 100%;
    background:
        radial-gradient(circle at top, var(--bg-radial-glow), transparent 28%),
        linear-gradient(180deg, var(--bg-canvas-strong) 0%, var(--bg-canvas) 38%, var(--bg-canvas-end) 100%);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-weight: 400;
}

html {
    scroll-padding-top: calc(var(--shell-header-height, 5.75rem) + 1rem);
}

body {
    margin: 0;
}

html.critical-editor-scroll-locked,
body.critical-editor-scroll-locked {
    overflow: hidden;
}

body.critical-editor-scroll-locked {
    overscroll-behavior: none;
}

h1,
h2,
h3,
h4,
h5,
h6,
.panel-title {
    font-family: var(--font-display);
    font-weight: 600;
}

label,
button,
summary,
th,
.eyebrow,
.detail-label,
.branch-condition,
.critical-branch-condition,
.effect-stack h5,
.tag,
.stat-pill,
.chip,
.affix-badge,
.table-list-title,
.legend-label {
    font-family: var(--font-ui);
    font-weight: 500;
}

strong,
b {
    font-weight: 400;
}

a, .btn-link {
    color: var(--accent-5);
}

a:hover {
    color: var(--link-hover);
}

button,
input,
select,
textarea {
    font: inherit;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--control-height);
}

code,
pre,
.code-block {
    font-family: var(--font-mono);
}

.play-page,
.play-layout,
.play-panel,
.play-panel-header,
.play-panel-copy,
.play-result-dock,
.play-result-card,
.play-result-heading,
.play-result-actions {
    display: grid;
    gap: 1rem;
}

.play-page {
    gap: 1.25rem;
}

.play-result-eyebrow {
    margin: 0;
    color: var(--accent-strong);
    font-family: var(--font-ui);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.play-title {
    margin: 0;
    font-size: clamp(2.1rem, 4vw, 3.4rem);
    line-height: 1;
    max-width: 17ch;
}

.play-summary,
.play-action-hint,
.play-result-note {
    margin: 0;
    color: var(--text-secondary);
}

.play-layout {
    grid-template-columns: minmax(0, 1.7fr) minmax(19rem, 1fr);
    align-items: start;
}

.play-panel {
    align-content: start;
    min-width: 0;
}

.play-panel-header {
    gap: 0.5rem;
}

.play-panel-copy {
    gap: 0.35rem;
}

.play-form-grid {
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
}

.play-form-grid-primary {
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
}

.play-action-row {
    justify-content: space-between;
}

.play-result-dock {
    padding-top: 0.1rem;
}

.play-result-card {
    gap: 1rem;
}

.play-result-heading {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 0.75rem;
}

.play-result-heading h3,
.play-result-heading h4 {
    margin: 0;
}

.play-result-actions {
    align-items: center;
    justify-items: end;
}

.play-action-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--control-height);
    padding: 0.72rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--button-secondary-border);
    background: var(--button-secondary-bg);
    color: var(--button-secondary-text);
    text-decoration: none;
    white-space: nowrap;
}

.play-action-link:hover {
    background: var(--button-secondary-bg-hover);
    color: var(--button-secondary-text);
}

.play-callout {
    display: grid;
    gap: 0.85rem;
}

.dashboard-grid {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.panel {
    border: 1px solid var(--border-default);
    border-radius: 24px;
    background: var(--surface-1);
    box-shadow: var(--shadow-1);
}

.panel {
    padding: 1.35rem;
}

.tooling-surface {
    background: color-mix(in srgb, var(--surface-tooling) 88%, var(--bg-elevated));
    border-color: color-mix(in srgb, var(--info-2) 28%, var(--border-default));
}

.tooling-surface .panel-title,
.tooling-surface h1,
.tooling-surface h2,
.tooling-surface h3 {
    color: color-mix(in srgb, var(--info-3) 46%, var(--text-primary));
}

.tool-page-frame,
.tool-page-body,
.tool-page-heading,
.tool-page-actions,
.tools-hub-grid,
.tool-link-card,
.tool-link-card-body,
.tool-link-card-header,
.tool-link-card-title-row,
.tool-link-card-meta,
.api-reference-groups,
.api-reference-group,
.api-reference-group-header,
.api-endpoint-card,
.api-endpoint-card-header {
    display: grid;
    gap: 1rem;
}

.tool-page-header {
    display: flex;
    gap: 1rem;
    align-items: start;
    justify-content: space-between;
    flex-wrap: wrap;
}

.tool-page-eyebrow {
    color: color-mix(in srgb, var(--info-3) 55%, var(--text-secondary));
    font-family: var(--font-ui);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.tool-page-summary,
.tool-link-card-summary {
    color: var(--text-secondary);
    max-width: 62ch;
}

.tool-page-actions {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    justify-content: end;
    align-items: center;
}

.tools-hub-grid {
    grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
}

.tool-link-card {
    padding: 1.1rem 1.15rem;
    border-radius: 20px;
    border: 1px solid color-mix(in srgb, var(--info-2) 24%, var(--border-default));
    background: linear-gradient(180deg, color-mix(in srgb, var(--surface-2) 86%, var(--surface-tooling)), color-mix(in srgb, var(--surface-1) 92%, var(--surface-tooling)));
    box-shadow: var(--shadow-1);
}

.tool-link-card-title {
    margin: 0;
    font-size: 1.15rem;
}

.tool-link-card-meta {
    gap: 0.4rem;
    color: var(--text-secondary);
}

.tool-link-card-actions {
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.api-reference-group-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

.api-endpoint-card {
    align-content: start;
}

.api-endpoint-card-header {
    gap: 0.45rem;
}

.api-endpoint-card-header .panel-title {
    margin-bottom: 0;
}

.api-endpoint-card-header code {
    color: color-mix(in srgb, var(--info-3) 55%, var(--text-primary));
    font-size: 0.92rem;
}

.panel-title {
    margin: 0 0 0.35rem;
    font-size: 1.4rem;
}

.panel-copy,
.muted {
    color: var(--text-secondary);
}

.lookup-form {
    display: grid;
    gap: 0.95rem;
}

.form-grid {
    display: grid;
    gap: 0.95rem;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    align-items: start;
}

.field-shell {
    display: grid;
    gap: 0.35rem;
    align-content: start;
}

.roll-input-row {
    display: flex;
    gap: 0.55rem;
    align-items: stretch;
}

.roll-input-row .input-shell {
    flex: 1 1 auto;
}

.field-shell label {
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--field-label-color);
}

.input-shell {
    width: 100%;
    min-height: var(--control-height);
    border-radius: 14px;
    border: 1px solid var(--button-secondary-border);
    background: var(--surface-input);
    padding: 0.8rem 0.9rem;
    color: var(--text-primary);
    box-sizing: border-box;
    line-height: 1.25;
}

input.input-shell,
select.input-shell {
    height: var(--control-height);
}

.input-shell:focus,
.input-shell:focus-visible {
    outline: 2px solid var(--focus-ring);
    border-color: var(--focus-border);
    outline-offset: 1px;
}

.action-row {
    display: flex;
    gap: 0.8rem;
    align-items: center;
    flex-wrap: wrap;
}

.btn-ritual {
    border: none;
    border-radius: 999px;
    min-height: var(--control-height);
    padding: 0.8rem 1.15rem;
    background: linear-gradient(135deg, var(--accent-4), var(--accent-5));
    color: var(--text-on-accent);
    letter-spacing: 0.04em;
    box-shadow: 0 10px 18px color-mix(in srgb, var(--accent-5) 24%, transparent);
}

.btn-ritual:hover {
    background: linear-gradient(135deg, color-mix(in srgb, var(--accent-4) 88%, var(--accent-2)), var(--accent-5));
}

.btn-ritual:focus-visible,
.roll-button:focus-visible,
.play-action-link:focus-visible,
.shell-omnibox-close:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

.roll-button {
    flex: 0 0 auto;
    min-width: 4.5rem;
    min-height: var(--control-height);
    border-radius: 14px;
    border: 1px solid var(--button-secondary-border);
    background: var(--button-secondary-bg);
    color: var(--button-secondary-text);
    padding: 0.8rem 0.95rem;
}

.roll-button:hover {
    background: var(--button-secondary-bg-hover);
}

.lookup-roll-note {
    margin: 0;
    font-size: 0.88rem;
}

.lookup-roll-note.is-warning {
    color: var(--danger-5);
}

.tag-row {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.tag {
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--accent-4) 24%, var(--border-subtle));
    padding: 0.4rem 0.7rem;
    background: var(--surface-subtle-accent);
    color: var(--text-primary);
    font-size: 0.82rem;
}

.result-shell {
    margin-top: 1rem;
    display: grid;
    gap: 0.85rem;
}

.result-card {
    border-radius: 20px;
    padding: 1rem;
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    min-width: 0;
}

.result-card h3,
.result-card h4 {
    margin-top: 0;
    margin-bottom: 0.45rem;
}

.detail-grid {
    display: grid;
    gap: 0.7rem;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    margin-bottom: 0.9rem;
}

.detail-item {
    display: grid;
    gap: 0.15rem;
    padding: 0.65rem 0.75rem;
    border-radius: 14px;
    background: var(--surface-inline);
    border: 1px solid var(--border-subtle);
}

.detail-label {
    color: var(--field-label-color);
    font-size: 0.76rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.result-stats {
    display: flex;
    gap: 0.7rem;
    flex-wrap: wrap;
    margin-bottom: 0.8rem;
}

.stat-pill {
    border-radius: 999px;
    padding: 0.35rem 0.65rem;
    background: var(--surface-chip);
    color: var(--text-primary);
    font-size: 0.85rem;
}

.callout {
    margin-top: 0.9rem;
    padding: 0.85rem 0.95rem;
    border-radius: 16px;
    background: var(--surface-callout);
    border: 1px solid color-mix(in srgb, var(--warning-4) 26%, var(--border-subtle));
    color: var(--text-primary);
}

.branch-list {
    display: grid;
    gap: 0.75rem;
}

.branch-card {
    padding: 0.8rem 0.85rem;
    border-radius: 14px;
    background: color-mix(in srgb, var(--surface-inline) 92%, var(--surface-card));
    border: 1px solid var(--border-subtle);
}

.branch-condition {
    font-size: 0.82rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--field-label-color);
}

.branch-copy,
.branch-affix {
    margin-top: 0.55rem;
    margin-bottom: 0;
}

@media (max-width: 900px) {
    .play-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .play-title {
        max-width: none;
    }

    .play-result-heading {
        grid-template-columns: 1fr;
    }

    .play-result-actions {
        justify-items: start;
    }

    .play-action-row {
        justify-content: flex-start;
    }
}

.critical-cell {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-height: 0;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.critical-cell-status-chip,
.critical-editor-curation-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.18rem 0.55rem;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border: 1px solid transparent;
}

.critical-cell-status-chip.is-curated,
.critical-editor-curation-badge.is-curated {
    background: color-mix(in srgb, var(--success-2) 26%, transparent);
    border-color: color-mix(in srgb, var(--success-4) 40%, var(--border-subtle));
    color: var(--success-5);
}

.critical-cell-status-chip.needs-curation,
.critical-editor-curation-badge.needs-curation {
    background: color-mix(in srgb, var(--warning-2) 24%, transparent);
    border-color: color-mix(in srgb, var(--warning-4) 40%, var(--border-subtle));
    color: var(--warning-5);
}

.critical-cell-footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    min-width: 0;
}

.critical-cell-description {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.2rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.critical-curation-preview-button .critical-cell-description {
    font-size: 2.25rem;
}

.critical-branch-stack {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 0;
}

.critical-branch-card {
    padding: 0.55rem 0.75rem;
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    background: color-mix(in srgb, var(--surface-card-strong) 90%, var(--surface-inline));
    min-width: 0;
}

.critical-branch-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
    min-width: 0;
}

.critical-branch-condition {
    display: inline-block;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: color-mix(in srgb, var(--accent-5) 72%, var(--text-secondary));
    overflow-wrap: anywhere;
}

.critical-branch-description {
    margin: 0.3rem 0 0;
    font-size: 0.85rem;
    line-height: 1.35;
    color: var(--text-primary);
    overflow-wrap: anywhere;
}

.critical-branch-header .affix-badge-list {
    margin-top: 0;
    justify-content: flex-end;
}

.critical-cell-footer .affix-badge-list {
    justify-content: flex-end;
}

.effect-stack {
    margin-top: 0.85rem;
}

.effect-stack h5 {
    margin: 0 0 0.5rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--field-label-color);
}

.effect-list {
    list-style: none;
    padding: 0;
    margin: 0.7rem 0 0;
    display: grid;
    gap: 0.45rem;
}

.effect-item {
    display: flex;
    gap: 0.65rem;
    align-items: baseline;
    flex-wrap: wrap;
    padding: 0.55rem 0.7rem;
    border-radius: 12px;
    background: var(--surface-inline);
    border: 1px solid var(--border-subtle);
}

.effect-token {
    padding: 0.12rem 0.38rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--surface-chip) 92%, var(--surface-subtle-accent));
    color: var(--button-secondary-text);
    font-size: 0.82rem;
}

.branch-effects {
    margin-top: 0.75rem;
}

.affix-badge-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.5rem;
    min-width: 0;
    max-width: 100%;
}

.affix-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem;
    border: 1px solid var(--button-secondary-border);
    background: color-mix(in srgb, var(--surface-subtle-accent) 94%, var(--surface-input));
    font-size: 1.2rem;
    text-transform: uppercase;
    color: var(--button-secondary-text);
}

.affix-badge-symbol {
    font-size: 1.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25em;
    min-width: 1.25em;
    height: 1em;
    line-height: 1;
    flex: 0 0 1.25em;
    margin-top: 0.2rem;
}

.critical-curation-preview-button .affix-badge {
    font-size: 2.25rem;
}

.critical-curation-preview-button .affix-badge-symbol {
    font-size: 2.25rem;
}

.affix-badge-value {
    letter-spacing: 0.04em;
}

.affix-badge-fallback {
    text-transform: none;
}

.error-text {
    color: var(--danger-5);
}

.table-list {
    display: grid;
    gap: 0.8rem;
}

.table-list-item {
    border-radius: 16px;
    padding: 0.9rem 1rem;
    background: color-mix(in srgb, var(--surface-card) 82%, transparent);
    border: 1px solid var(--border-subtle);
}

.table-list-title {
    display: block;
    margin-bottom: 0.6rem;
    color: var(--ink);
}

.chip-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.8rem;
}

.chip {
    border-radius: 999px;
    padding: 0.38rem 0.68rem;
    background: color-mix(in srgb, var(--surface-chip) 86%, transparent);
    border: 1px solid var(--border-subtle);
    color: var(--button-secondary-text);
    font-size: 0.82rem;
}

.chip small {
    color: var(--ink-soft);
}

.ui-status-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border-radius: 999px;
    padding: 0.3rem 0.68rem;
    border: 1px solid var(--border-subtle);
    background: var(--surface-chip);
    color: var(--text-muted);
    font-size: 0.75rem;
    line-height: 1;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.ui-status-chip.is-accent {
    border-color: color-mix(in srgb, var(--accent-4) 42%, var(--border-subtle));
    background: color-mix(in srgb, var(--accent-3) 16%, var(--surface-chip));
    color: var(--accent-5);
}

.ui-status-chip.is-success {
    border-color: color-mix(in srgb, var(--success-4) 36%, var(--border-subtle));
    background: color-mix(in srgb, var(--success-3) 14%, var(--surface-chip));
    color: var(--success-5);
}

.ui-status-chip.is-warning {
    border-color: color-mix(in srgb, var(--warning-4) 36%, var(--border-subtle));
    background: color-mix(in srgb, var(--warning-3) 14%, var(--surface-chip));
    color: var(--warning-5);
}

.ui-status-chip.is-danger {
    border-color: color-mix(in srgb, var(--danger-4) 36%, var(--border-subtle));
    background: color-mix(in srgb, var(--danger-3) 14%, var(--surface-chip));
    color: var(--danger-5);
}

.ui-status-chip.is-info {
    border-color: color-mix(in srgb, var(--info-4) 36%, var(--border-subtle));
    background: color-mix(in srgb, var(--info-3) 14%, var(--surface-chip));
    color: var(--info-5);
}

.ui-status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--text-muted);
}

.ui-status-indicator-dot {
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 999px;
    background: var(--border-strong);
    box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 12%, transparent);
}

.ui-status-indicator.is-accent {
    color: var(--accent-5);
}

.ui-status-indicator.is-success {
    color: var(--success-5);
}

.ui-status-indicator.is-warning {
    color: var(--warning-5);
}

.ui-status-indicator.is-danger {
    color: var(--danger-5);
}

.ui-status-indicator.is-info {
    color: var(--info-5);
}

.app-bar-action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    min-width: 0;
    min-height: 2.75rem;
    padding: 0.7rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--border-subtle);
    background: color-mix(in srgb, var(--surface-raised) 86%, transparent);
    color: var(--text-strong);
    transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease;
}

.app-bar-action-button:hover:not(:disabled) {
    border-color: var(--border-strong);
    background: var(--surface-elevated);
}

.app-bar-action-button:focus-visible,
.shell-omnibox-result:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

.app-bar-action-button:disabled {
    opacity: 0.78;
    cursor: not-allowed;
}

.segmented-tabs {
    display: inline-flex;
    align-items: stretch;
    gap: 0.25rem;
    padding: 0.25rem;
    border-radius: 999px;
    border: 1px solid var(--border-subtle);
    background: color-mix(in srgb, var(--surface-raised) 82%, transparent);
}

.segmented-tabs-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 2.75rem;
    padding: 0.4rem 0.85rem;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
}

.segmented-tabs-button:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

.segmented-tabs-button.is-selected {
    background: var(--surface-elevated);
    color: var(--text-strong);
    box-shadow: 0 10px 24px -18px var(--shadow-strong);
}

.segmented-tabs-badge {
    font-size: 0.75rem;
    color: var(--text-soft);
}

.inspector-section {
    display: grid;
    gap: 1rem;
    padding: 1rem 1.1rem;
    border-radius: 1rem;
    border: 1px solid var(--border-subtle);
    background: color-mix(in srgb, var(--surface-raised) 88%, transparent);
    box-shadow: 0 16px 36px -32px var(--shadow-strong);
}

.inspector-section-header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 1rem;
}

.inspector-section-title {
    margin: 0;
    font-size: 1rem;
}

.inspector-section-copy {
    margin: 0.2rem 0 0;
    color: var(--text-muted);
}

.inspector-section-body {
    display: grid;
    gap: 0.85rem;
}

.surface-drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 90;
    border: none;
    background: color-mix(in srgb, var(--bg-overlay) 88%, transparent);
}

.surface-drawer {
    position: fixed;
    z-index: 95;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 1rem;
    border: 1px solid var(--border-subtle);
    background: var(--surface-elevated);
    box-shadow: 0 24px 54px -28px var(--shadow-strong);
    overflow: hidden;
}

.surface-drawer.is-end {
    top: calc(var(--shell-header-height, 5.75rem) + 1rem);
    right: 1rem;
    bottom: 1rem;
    width: min(24rem, calc(100vw - 2rem));
    border-radius: 1.25rem;
}

.surface-drawer.is-bottom {
    right: 0.75rem;
    bottom: calc(var(--shell-mobile-nav-height, 0rem) + 0.75rem);
    left: 0.75rem;
    max-height: min(70vh, 36rem);
    border-radius: 1.25rem 1.25rem 0 0;
}

.surface-drawer-header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1rem 0;
}

.surface-drawer-title {
    font-size: 1rem;
}

.surface-drawer-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

.surface-drawer-body {
    display: grid;
    gap: 1rem;
    min-height: 0;
    padding: 0 1rem 1rem;
    overflow: auto;
}

.shell-omnibox {
    position: relative;
}

.shell-omnibox-trigger.is-open {
    border-color: var(--border-strong);
    background: var(--surface-elevated);
}

.shell-omnibox-backdrop {
    position: fixed;
    top: calc(var(--shell-header-height, 5.75rem) + 0.35rem);
    right: 0;
    bottom: calc(var(--shell-mobile-nav-height, 0rem));
    left: 0;
    z-index: 90;
    border: none;
    background: color-mix(in srgb, var(--bg-overlay) 85%, transparent);
}

.shell-omnibox-palette {
    position: fixed;
    top: calc(var(--shell-header-height, 5.75rem) + 0.75rem);
    left: 50%;
    z-index: 95;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    width: min(46rem, calc(100vw - 2rem));
    max-height: calc(100dvh - var(--shell-header-height, 5.75rem) - var(--shell-mobile-nav-height, 0rem) - 1.75rem);
    border: 1px solid var(--border-default);
    border-radius: 1.5rem;
    background: color-mix(in srgb, var(--bg-elevated) 96%, transparent);
    box-shadow: var(--shadow-2);
    backdrop-filter: blur(22px);
    transform: translateX(-50%);
    overflow: hidden;
}

.shell-omnibox-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.85rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border-subtle);
    background: color-mix(in srgb, var(--surface-2) 92%, transparent);
}

.shell-omnibox-search {
    display: block;
}

.shell-omnibox-input {
    width: 100%;
    min-height: 3rem;
}

.shell-omnibox-close {
    min-height: 2.75rem;
    padding: 0.65rem 0.95rem;
    border: 1px solid var(--border-default);
    border-radius: 999px;
    background: color-mix(in srgb, var(--surface-2) 84%, transparent);
    color: var(--text-primary);
}

.shell-omnibox-body {
    display: grid;
    gap: 0.9rem;
    min-height: 0;
    padding: 1rem;
    overflow: auto;
    overscroll-behavior: contain;
}

.shell-omnibox-results {
    display: grid;
    gap: 0.6rem;
}

.shell-omnibox-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
    padding: 0.85rem 0.95rem;
    border: 1px solid var(--border-subtle);
    border-radius: 1rem;
    background: color-mix(in srgb, var(--surface-elevated) 86%, transparent);
    text-align: left;
}

.shell-omnibox-result:hover {
    border-color: var(--border-strong);
    background: var(--surface-elevated);
}

.shell-omnibox-result-main {
    display: grid;
    gap: 0.2rem;
}

.shell-omnibox-result-main span {
    color: var(--text-muted);
}

.shell-omnibox-result-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
    justify-content: end;
}

.details-block {
    margin-top: 0.85rem;
}

.details-block summary {
    cursor: pointer;
    color: var(--accent);
    margin-bottom: 0.6rem;
}

.stacked-copy {
    margin: 0;
    white-space: pre-wrap;
}

.code-block {
    margin: 0;
    padding: 1rem;
    border-radius: 16px;
    background: var(--surface-code);
    color: var(--text-code);
    overflow-x: auto;
    font-family: var(--font-mono);
    line-height: 1.55;
}

.api-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
}

.blazor-error-boundary {
    background: var(--surface-danger-strong);
    color: var(--text-on-danger);
}

.tables-page {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
}

.tables-page-header {
    display: grid;
    gap: 0.5rem;
}

.tables-page-header-copy {
    display: grid;
    gap: 0.35rem;
    max-width: 52rem;
}

.tables-page-eyebrow {
    margin: 0;
    color: var(--accent-strong);
    font-family: var(--font-ui);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.tables-page-intro,
.tables-index-copy,
.table-browser-reading-hint,
.table-browser-edit-hint {
    margin: 0;
    color: var(--ink-soft);
}

.tables-reference-layout {
    display: grid;
    grid-template-columns: minmax(17rem, 20rem) minmax(0, 1fr);
    gap: 1rem;
    align-items: stretch;
    flex: 1 1 auto;
    min-height: 0;
}

.tables-reference-rail {
    display: flex;
    min-height: 0;
}

.tables-index-rail {
    display: grid;
    align-content: start;
    gap: 0.85rem;
    padding: 1rem;
    border-radius: 18px;
    background: var(--surface-card-subtle);
    border: 1px solid var(--border-default);
    box-shadow: 0 16px 26px color-mix(in srgb, var(--shadow-strong) 26%, transparent);
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

.tables-index-rail:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 3px;
}

.tables-index-rail-header {
    display: grid;
    gap: 0.35rem;
}

.tables-index-controls {
    display: grid;
    gap: 0.75rem;
}

.tables-index-search-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.tables-index-search {
    width: 100%;
}

.tables-family-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.tables-family-filter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    border: 1px solid var(--button-secondary-border);
    border-radius: 999px;
    background: color-mix(in srgb, var(--surface-subtle-accent) 92%, var(--surface-input));
    color: var(--ink-soft);
    font-size: 0.8rem;
    padding: 0.35rem 0.8rem;
    transition: border-color 0.16s ease, background-color 0.16s ease, color 0.16s ease;
}

.tables-family-filter:hover,
.tables-family-filter:focus-visible {
    border-color: color-mix(in srgb, var(--accent-4) 42%, var(--border-default));
    background: var(--surface-input-hover);
    color: var(--ink);
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

.tables-family-filter.is-selected {
    background: color-mix(in srgb, var(--accent-3) 18%, var(--surface-subtle-accent));
    border-color: color-mix(in srgb, var(--accent-4) 44%, var(--border-default));
    color: var(--ink-strong);
}

.tables-index-title {
    margin: 0;
    color: var(--ink-strong);
    font-family: var(--font-display);
    font-size: clamp(1.1rem, 1rem + 0.4vw, 1.35rem);
}

.tables-index-list {
    display: grid;
    gap: 0.35rem;
}

.tables-index-section {
    display: grid;
    gap: 0.5rem;
}

.tables-index-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.tables-index-section-header h3 {
    margin: 0;
    font-size: 0.95rem;
    color: var(--ink-strong);
}

.tables-index-section-count {
    color: var(--ink-soft);
    font-size: 0.78rem;
}

.tables-index-empty {
    margin: 0;
    color: var(--ink-soft);
    font-size: 0.9rem;
}

.table-index-option {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    padding: 0.7rem 0.8rem;
    border: 1px solid transparent;
    border-radius: 12px;
    background: color-mix(in srgb, var(--surface-subtle-accent) 86%, transparent);
    color: inherit;
    text-align: left;
    transition: background-color 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.table-index-option:hover,
.table-index-option:focus-visible {
    border-color: color-mix(in srgb, var(--accent-4) 40%, var(--border-default));
    background: color-mix(in srgb, var(--surface-input-hover) 92%, var(--surface-inline));
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

.table-index-option.is-selected {
    border-color: var(--border-strong);
    background: color-mix(in srgb, var(--surface-card-strong) 90%, var(--accent-1));
}

.table-index-option.is-active {
    box-shadow: inset 0 0 0 1px var(--selection-5);
}

.table-index-option.is-curated {
    background: color-mix(in srgb, var(--success-2) 18%, var(--surface-subtle-accent));
}

.table-index-option.is-curated:hover,
.table-index-option.is-curated:focus-visible {
    background: color-mix(in srgb, var(--success-2) 26%, var(--surface-subtle-accent));
}

.table-index-option.needs-curation {
    background: color-mix(in srgb, var(--warning-2) 18%, var(--surface-subtle-accent));
}

.table-index-option.needs-curation:hover,
.table-index-option.needs-curation:focus-visible {
    background: color-mix(in srgb, var(--warning-2) 26%, var(--surface-subtle-accent));
}

.table-index-option-copy {
    display: grid;
    gap: 0.18rem;
    min-width: 0;
}

.table-index-option-title {
    color: var(--ink);
    font-family: var(--font-ui);
    font-size: 0.98rem;
    font-weight: 600;
}

.table-index-option-meta {
    color: var(--ink-soft);
    font-size: 0.8rem;
}

.table-index-option-chips {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    justify-content: flex-end;
}

.tables-reference-main {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.tables-selection-menu {
    position: fixed;
    right: 1rem;
    bottom: calc(var(--shell-mobile-nav-height, 0rem) + 1rem);
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0.75rem;
    border-radius: 18px;
    background: color-mix(in srgb, var(--surface-card-strong) 96%, transparent);
    border: 1px solid var(--border-default);
    box-shadow: var(--shadow-2);
    backdrop-filter: blur(12px);
}

.table-shell {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 0.75rem;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    border-radius: 20px;
    padding: 1.2rem;
    background: var(--surface-card-strong);
    border: 1px solid var(--border-default);
    box-shadow: var(--shadow-1);
}

.table-browser-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0;
}

.tables-context-bar {
    position: sticky;
    z-index: 8;
    padding-bottom: 0.75rem;
    background: linear-gradient(180deg, color-mix(in srgb, var(--bg-elevated) 96%, transparent), color-mix(in srgb, var(--surface-card-subtle) 94%, transparent));
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-subtle);
}

.tables-context-primary,
.tables-context-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.tables-context-controls {
    margin-top: 0.85rem;
}

.tables-context-primary .panel-title {
    margin: 0;
}

.tables-context-tab-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.tables-context-mode-tabs {
    width: fit-content;
}

.tables-context-density-tabs {
    width: fit-content;
}

.tables-context-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.tables-context-field {
    display: grid;
    gap: 0.35rem;
    min-width: min(100%, 11rem);
    color: var(--ink-soft);
    font-size: 0.82rem;
}

.tables-context-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tables-context-filter-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    border: 1px solid var(--button-secondary-border);
    border-radius: 999px;
    background: color-mix(in srgb, var(--surface-callout) 92%, var(--surface-input));
    color: var(--ink);
    padding: 0.35rem 0.75rem;
    font-size: 0.82rem;
    transition: border-color 0.16s ease, background-color 0.16s ease;
}

.tables-context-filter-chip:hover,
.tables-context-filter-chip:focus-visible {
    border-color: color-mix(in srgb, var(--accent-4) 46%, var(--border-default));
    background: color-mix(in srgb, var(--surface-input-hover) 92%, var(--surface-callout));
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

.table-browser-reading-hint {
    margin-top: 0.2rem;
}

.table-browser-edit-hint {
    white-space: nowrap;
}

@media (max-width: 1023px) {
    .tables-reference-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .tables-reference-rail {
        display: block;
    }

    .tables-selection-menu {
        right: 0.75rem;
        left: 0.75rem;
        justify-content: flex-end;
    }
}

@media (min-width: 1024px) {
    .tables-page {
        block-size: calc(100dvh - var(--shell-header-height, 5.75rem) - var(--shell-mobile-nav-height, 0rem) - 2.25rem);
    }
}

.table-shell .table-scroll {
    overflow: auto;
    min-width: 0;
    min-height: 0;
    max-height: none;
    border-radius: 18px;
    overscroll-behavior: contain;
    scrollbar-gutter: stable both-edges;
}

.critical-table-grid {
    display: grid;
    align-items: stretch;
    min-width: 100%;
    font-size: 1.5rem;
    border-top: 1px solid var(--border-default);
    border-left: 1px solid var(--border-default);
    isolation: isolate;
    --tables-header-row-height: 3.2rem;
    --tables-group-header-top: 0;
    --tables-column-header-top: 0;
}

.critical-table-grid.has-groups {
    --tables-column-header-top: var(--tables-header-row-height);
}

.critical-table-grid-header-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: var(--tables-header-row-height);
    padding: 0.35rem;
    border-right: 1px solid var(--border-default);
    border-bottom: 1px solid var(--border-default);
    background: var(--surface-table-header);
    text-transform: uppercase;
    text-align: center;
    letter-spacing: 0.08em;
    box-sizing: border-box;
}

.critical-table-grid-group-header,
.critical-table-grid-column-header {
    font-size: 2rem;
}

.critical-table-grid-group-header {
    position: sticky;
    top: var(--tables-group-header-top);
    z-index: 5;
}

.critical-table-grid-column-header {
    position: sticky;
    top: var(--tables-column-header-top);
    z-index: 4;
}

.critical-table-grid.is-dense {
    font-size: 1.2rem;
    --tables-header-row-height: 2.6rem;
}

.critical-table-grid.is-dense .critical-table-grid-header-cell {
    padding: 0.25rem;
}

.critical-table-grid.is-dense .critical-table-cell {
    padding: 0.35rem;
}

.critical-table-grid-corner,
.critical-table-grid-roll-band-header {
    background: var(--surface-table-header);
}

.critical-table-grid-corner {
    position: sticky;
    top: var(--tables-group-header-top);
    left: 0;
    z-index: 7;
}

.critical-table-grid-roll-band-header {
    position: sticky;
    top: var(--tables-column-header-top);
    left: 0;
    z-index: 6;
}

.critical-table-grid-roll-band {
    background: var(--surface-table-header);
    font-size: 1.5rem;
    position: sticky;
    left: 0;
    z-index: 3;
}

.critical-table-cell {
    position: relative;
    display: flex;
    z-index: 1;
    min-width: 0;
    padding: 0.55rem;
    border-right: 1px solid var(--border-default);
    border-bottom: 1px solid var(--border-default);
    background: var(--surface-table-cell);
    box-sizing: border-box;
    cursor: pointer;
    transition: box-shadow 0.16s ease, background-color 0.16s ease, transform 0.16s ease;
}

.critical-table-cell:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: -2px;
}

.critical-table-cell.is-curated {
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--success-2) 32%, transparent), transparent 34%),
        var(--surface-table-cell);
}

.critical-table-cell.needs-curation {
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--warning-2) 34%, transparent), transparent 34%),
        var(--surface-table-cell);
}

.critical-table-cell.is-active-row,
.critical-table-grid-roll-band.is-active-row {
    background:
        linear-gradient(180deg, var(--selection-3), var(--selection-1)),
        var(--surface-table-cell-strong);
}

.critical-table-grid-column-header.is-active-column,
.critical-table-cell.is-active-column {
    box-shadow: inset 0 0 0 999px var(--selection-2);
}

.critical-table-grid-group-header.is-active-group,
.critical-table-grid-column-header.is-active-group,
.critical-table-cell.is-active-group {
    box-shadow: inset 0 0 0 999px color-mix(in srgb, var(--accent-4) 8%, transparent);
}

.critical-table-cell.is-selected-cell {
    box-shadow: inset 0 0 0 2px var(--selection-6);
    background:
        linear-gradient(135deg, var(--selection-4), transparent 38%),
        var(--surface-table-cell-strong);
}

.critical-table-cell.is-roll-target::after,
.critical-table-grid-roll-band.is-roll-target::after {
    content: "";
    position: absolute;
    inset: 0;
    border: 2px dashed var(--selection-5);
    pointer-events: none;
}

.critical-table-cell-shell {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    flex: 1 1 auto;
    min-height: 0;
}

.critical-table-cell-shell > .critical-cell {
    flex: 1 1 auto;
    min-height: 0;
}

.critical-table-cell-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.tables-cell-status-indicator {
    min-height: 1rem;
}

.critical-table-grid .critical-cell {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    box-sizing: border-box;
}

.critical-table-cell-empty {
    align-items: center;
    justify-content: center;
}

.tables-filtered-cell {
    color: var(--ink-faint);
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.empty-cell {
    color: var(--ink-faint);
    font-style: italic;
    display: block;
    padding: 1rem 0.75rem;
    text-align: center;
}

.critical-legend {
    margin-top: 0;
    padding: 0.9rem 1rem;
    border-radius: 16px;
    background: color-mix(in srgb, var(--surface-callout) 88%, transparent);
    border: 1px solid var(--border-default);
    max-height: min(16rem, 34%);
    overflow: auto;
}

.critical-legend-header {
    display: grid;
    gap: 0.2rem;
}

.critical-legend-header h4 {
    margin: 0;
}

.legend-grid {
    display: grid;
    gap: 0.65rem;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin-top: 0.75rem;
}

.legend-item {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
}

.legend-symbol {
    font-size: 1.3rem;
    line-height: 1;
}

.legend-item strong {
    display: block;
    font-size: 0.95rem;
}

.critical-editor-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: flex;
    justify-content: center;
    align-items: stretch;
    padding: 1.25rem;
    background: var(--bg-overlay);
    backdrop-filter: blur(4px);
}

.critical-editor-dialog {
    --critical-editor-control-height: 3.15rem;
    --critical-editor-label-height: 1.05rem;
    --critical-editor-field-gap: 0.35rem;
    --critical-editor-control-offset: calc(var(--critical-editor-label-height) + var(--critical-editor-field-gap));
    width: min(1100px, 100%);
    max-height: calc(100vh - 2.5rem);
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    border-radius: 24px;
    background: color-mix(in srgb, var(--bg-elevated) 96%, var(--surface-2));
    border: 1px solid var(--border-default);
    box-shadow: var(--shadow-2);
}

.critical-editor-form {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
}

.critical-editor-header,
.critical-editor-footer {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
}

.critical-editor-footer {
    border-top: 1px solid var(--border-subtle);
    border-bottom: none;
    align-items: center;
}

.critical-editor-close {
    white-space: nowrap;
}

.critical-editor-meta {
    margin-bottom: 0;
}

.critical-editor-status-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.55rem;
}

.critical-editor-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 1rem 1.25rem 1.25rem;
    display: grid;
    gap: 1rem;
}

.critical-editor-section,
.critical-editor-subsection {
    display: grid;
    gap: 0.85rem;
}

.critical-editor-source-image {
    width: 100%;
    max-height: 340px;
    object-fit: contain;
    border-radius: 14px;
    border: 1px solid var(--border-subtle);
    background: color-mix(in srgb, var(--surface-card-strong) 96%, var(--surface-2));
}

.critical-editor-source-image.is-inline {
    height: 100%;
    max-height: none;
}

.critical-editor-section h4,
.critical-editor-subsection h5 {
    margin: 0;
}

.critical-editor-section-header > div,
.critical-editor-card-header > div {
    display: grid;
    gap: 0.2rem;
}

.critical-editor-section-header,
.critical-editor-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.critical-editor-card {
    display: grid;
    gap: 0.85rem;
    padding: 0.9rem;
    border-radius: 16px;
    background: color-mix(in srgb, var(--surface-card) 92%, var(--surface-card-strong));
    border: 1px solid var(--border-default);
}

.critical-editor-card.nested {
    background: color-mix(in srgb, var(--surface-inline) 94%, var(--surface-card));
}

.critical-editor-textarea {
    min-height: 7rem;
}

.critical-editor-textarea.compact {
    min-height: 3.5rem;
}

.critical-editor-textarea.json {
    min-height: 12rem;
}

.critical-editor-textarea.tall {
    min-height: 8rem;
    height: 8rem;
    resize: vertical;
}

.critical-editor-dialog input.input-shell,
.critical-editor-dialog select.input-shell {
    height: var(--critical-editor-control-height);
}

.critical-editor-dialog .field-shell label {
    line-height: var(--critical-editor-label-height);
}

.critical-editor-error {
    margin: 0;
    padding: 0.85rem 0.95rem;
    border-radius: 14px;
    background: color-mix(in srgb, var(--danger-2) 18%, transparent);
    border: 1px solid color-mix(in srgb, var(--danger-4) 36%, var(--border-subtle));
}

.critical-editor-quick-parse-grid {
    display: grid;
    gap: 0.85rem;
    grid-template-columns: minmax(320px, 1.35fr) minmax(260px, 1fr);
    align-items: start;
}

.critical-editor-quick-parse-source {
    display: grid;
    gap: 0.35rem;
}

.critical-editor-quick-parse-source-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.critical-editor-quick-parse-source-header label {
    margin: 0;
}

.critical-editor-quick-parse-source-frame {
    height: 8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.55rem;
    border-radius: 14px;
    border: 1px solid var(--border-subtle);
    background: color-mix(in srgb, var(--surface-card-strong) 96%, var(--surface-2));
    box-sizing: border-box;
    overflow: hidden;
}

.critical-editor-inline-copy {
    margin: 0;
}

.critical-editor-quick-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 0.7rem;
}

.critical-editor-quick-legend-item {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.critical-editor-quick-legend-item .affix-badge-list {
    margin-top: 0;
}

.critical-editor-quick-legend-item code {
    font-size: 0.9rem;
    color: var(--button-secondary-text);
}

.critical-editor-quick-legend-equals {
    color: var(--warning-5);
    font-weight: 700;
    margin-left: 0.2rem;
    margin-right: 0.2rem;
}

.critical-editor-compare-grid {
    display: grid;
    gap: 0.85rem;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.critical-editor-compare-card {
    display: grid;
    gap: 0.75rem;
    padding: 0.9rem;
    border-radius: 16px;
    background: color-mix(in srgb, var(--surface-card) 86%, transparent);
    border: 1px solid var(--border-subtle);
}

.critical-editor-compare-card .critical-cell {
    min-height: 100%;
}

.critical-editor-inline-list {
    display: grid;
    gap: 0.55rem;
}

.critical-editor-inline-row {
    display: block;
}

.critical-editor-effect-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border-radius: 14px;
    background: color-mix(in srgb, var(--surface-card) 84%, transparent);
    border: 1px solid var(--border-subtle);
}

.critical-editor-effect-row-main {
    display: grid;
    gap: 0.65rem;
    grid-template-columns: minmax(88px, auto) minmax(180px, 1.3fr) minmax(130px, 0.8fr);
    align-items: end;
    flex: 1 1 auto;
}

.critical-editor-effect-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: var(--critical-editor-control-height);
    min-width: 0;
    margin-top: var(--critical-editor-control-offset);
}

.critical-editor-effect-badge .affix-badge-list {
    width: 100%;
    margin-top: 0;
    align-items: center;
    justify-content: center;
}

.critical-editor-effect-badge .affix-badge {
    align-items: center;
    justify-content: center;
    text-align: center;
}

.critical-editor-effect-kind,
.critical-editor-effect-value,
.critical-editor-effect-extra {
    min-width: 0;
}

.critical-editor-branch-line {
    display: grid;
    gap: 0.65rem;
    grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.4fr);
}

.critical-editor-branch-outcome {
    min-width: 0;
}

.critical-editor-validation-list {
    display: grid;
    gap: 0.45rem;
}

.critical-editor-validation-item {
    margin: 0;
    padding: 0.65rem 0.8rem;
    border-radius: 12px;
    background: color-mix(in srgb, var(--warning-2) 20%, transparent);
    color: var(--warning-5);
}

.critical-editor-advanced-hint {
    margin: 0;
}

.critical-editor-advanced {
    border-radius: 18px;
    border: 1px solid var(--border-subtle);
    background: color-mix(in srgb, var(--surface-callout) 56%, transparent);
    overflow: hidden;
}

.critical-editor-advanced-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    cursor: pointer;
    list-style: none;
    font-family: var(--font-ui);
    color: var(--button-secondary-text);
}

.critical-editor-advanced-summary::-webkit-details-marker {
    display: none;
}

.critical-editor-advanced-meta {
    font-family: var(--font-body);
    font-size: 0.92rem;
    color: var(--text-tertiary);
}

.critical-editor-advanced-body {
    display: grid;
    gap: 0.85rem;
    padding: 0 0.9rem 0.9rem;
}

.critical-editor-diagnostic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    margin: 0;
}

.critical-editor-diagnostic-grid dt {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
}

.critical-editor-diagnostic-grid dd {
    margin: 0.2rem 0 0;
    color: var(--text-primary);
}

.critical-editor-diagnostic-block {
    margin: 0;
    padding: 0.85rem 0.95rem;
    border-radius: 14px;
    background: color-mix(in srgb, var(--surface-inline) 72%, var(--accent-1));
    border: 1px solid color-mix(in srgb, var(--accent-4) 18%, var(--border-subtle));
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.9rem;
    overflow-x: auto;
}

.critical-editor-diagnostic-list {
    display: grid;
    gap: 0.65rem;
}

.critical-editor-diagnostic-item {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 0.85rem;
    padding: 0.75rem 0.85rem;
    border-radius: 14px;
    background: color-mix(in srgb, var(--surface-card) 82%, transparent);
    border: 1px solid var(--border-subtle);
}

.critical-editor-diagnostic-values {
    display: grid;
    gap: 0.25rem;
    justify-items: end;
    color: var(--text-secondary);
    text-align: right;
}

.diagnostics-page {
    display: grid;
    gap: 1rem;
}

.curation-page {
    display: grid;
    gap: 1rem;
}

.curation-queue-bar,
.curation-workspace-frame,
.curation-empty-state {
    gap: 1rem;
}

.curation-queue-bar-header,
.curation-queue-links,
.curation-queue-summary,
.curation-workspace-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.curation-queue-bar-header {
    justify-content: space-between;
}

.curation-queue-heading {
    display: grid;
    gap: 0.25rem;
}

.curation-scope-tabs {
    width: fit-content;
    max-width: 100%;
}

.curation-table-select {
    max-width: min(26rem, 100%);
}

.curation-queue-summary {
    color: var(--text-secondary);
}

.curation-queue-summary strong {
    color: var(--text-primary);
}

.curation-workspace-shell {
    display: grid;
    gap: 1rem;
}

.curation-workspace-actions {
    justify-content: flex-end;
}

.curation-empty-state {
    justify-items: start;
}

.diagnostics-selector-grid {
    display: grid;
    gap: 0.85rem;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.diagnostics-selection-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    padding: 0.85rem 1rem;
    border-radius: 16px;
    background: color-mix(in srgb, var(--surface-callout) 82%, transparent);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.critical-diagnostics-body {
    display: grid;
    gap: 0.85rem;
}

.critical-editor-inline-button {
    border: none;
    background: transparent;
    color: var(--accent);
    min-height: var(--critical-editor-control-height);
    margin-top: var(--critical-editor-control-offset);
    padding: 0.2rem 0.1rem;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.critical-editor-inline-button:hover {
    color: var(--link-hover);
}

.critical-editor-compact-button {
    padding: 0.55rem 0.9rem;
    box-shadow: none;
}

.critical-curation-dialog {
    width: min(860px, 100%);
    max-height: min(480px, calc(100vh - 2.5rem));
    align-self: center;
}

.critical-curation-body {
    flex: 0 1 auto;
    align-items: stretch;
    overflow: auto;
    padding: 0.85rem 1rem 1rem;
}

.critical-curation-body.is-quick-parse {
    overflow: auto;
}

.critical-curation-grid {
    display: grid;
    gap: 0.85rem;
    grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr);
    align-items: stretch;
}

.critical-curation-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 0.65rem;
    padding: 0.55rem 0.7rem;
    border-radius: 14px;
    background: color-mix(in srgb, var(--surface-callout) 76%, transparent);
    border: 1px solid var(--border-subtle);
}

.critical-curation-grid .critical-cell {
    height: 100%;
} 

.critical-curation-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
}

.critical-curation-legend-item strong {
    font-size: 0.9rem;
    font-weight: 400;
}

.critical-curation-preview-card,
.critical-curation-source-card {
    min-height: 100%;
    padding: 0.75rem;
}

.critical-curation-preview-card.is-quick-parse {
    padding: 0;
    display: flex;
    overflow: hidden;
}

.critical-curation-preview-button {
    width: 100%;
    min-height: 100%;
    display: block;
    padding: 0;
    border: none;
    background: transparent;
    text-align: left;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}

.critical-curation-preview-button:hover:not(:disabled),
.critical-curation-preview-button:focus-visible {
    background: color-mix(in srgb, var(--surface-callout) 82%, transparent);
    box-shadow: 0 0 0 1px var(--border-default);
    transform: translateY(-1px);
    outline: none;
}

.critical-curation-preview-button:disabled {
    cursor: default;
}

.critical-curation-quick-parse-textarea {
    display: block;
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    min-height: 100%;
    margin: 0;
    padding: 0.75rem;
    border: none;
    border-radius: inherit;
    background: transparent;
    box-sizing: border-box;
    box-shadow: none;
    resize: none;
}

.critical-curation-source-card {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(200px + 1.5rem);
}

.critical-curation-source-image {
    display: block;
    width: auto;
    height: 200px;
    max-width: 100%;
    object-fit: contain;
}

.critical-curation-source-empty {
    width: 100%;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.critical-curation-dialog .critical-editor-header,
.critical-curation-dialog .critical-editor-footer {
    padding: 0.85rem 1rem;
}

@media (max-width: 640.98px) {
    .content-shell {
        padding: 1rem;
    }

    .panel {
        border-radius: 20px;
    }

    .critical-editor-backdrop {
        padding: 0.65rem;
    }

    .critical-editor-dialog {
        width: 100%;
    }

    .table-browser-header {
        flex-direction: column;
    }

    .tables-context-fields {
        flex-direction: column;
    }

    .tables-context-field {
        min-width: 0;
    }

    .tables-context-tab-row {
        flex-direction: column;
        align-items: stretch;
    }

    .critical-editor-header,
    .critical-editor-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .critical-editor-effect-row,
    .critical-editor-card-header,
    .critical-editor-section-header,
    .critical-editor-advanced-summary,
    .critical-editor-diagnostic-item {
        flex-direction: column;
        align-items: stretch;
    }

    .critical-editor-effect-row-main,
    .critical-editor-branch-line,
    .critical-editor-quick-parse-grid,
    .critical-curation-grid {
        grid-template-columns: 1fr;
    }

    .critical-editor-diagnostic-values {
        justify-items: start;
        text-align: left;
    }

    .tool-page-actions {
        grid-auto-flow: row;
        justify-content: start;
    }

    .diagnostics-page-header,
    .diagnostics-selection-summary,
    .curation-queue-bar-header,
    .curation-queue-links,
    .curation-queue-summary,
    .curation-workspace-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .shell-omnibox-backdrop {
        top: calc(var(--shell-header-height, 5.1rem) + 0.25rem);
        bottom: calc(var(--shell-mobile-nav-height, 5.5rem));
    }

    .shell-omnibox-palette {
        top: calc(var(--shell-header-height, 5.1rem) + 0.45rem);
        right: 0.75rem;
        left: 0.75rem;
        width: auto;
        max-height: calc(100dvh - var(--shell-header-height, 5.1rem) - var(--shell-mobile-nav-height, 5.5rem) - 1rem);
        transform: none;
    }

    .shell-omnibox-header {
        grid-template-columns: 1fr;
    }
}
