/* Design tokens imported from tokens.css (generated from tokens.json) */
@import url('tokens.css');
@import url('glyph-overview.css');
@import url('features-editor.css');
@import url('editor-left-sidebar.css');
@import url('editor-right-sidebar.css');
@import url('ui/dialogs.css');
@import url('ui/font-windows.css');
@import url('ui/offline-strip.css');
@import url('ui/add-axis-dialog.css');
@import url('ui/tour.css');
@import url('docs-viewer.css');

/* Local Inter font with OpenType features */
@font-face {
    font-family: 'Inter';
    src: url('../assets/fonts/Inter-UI.woff2') format('woff2');
    font-weight: 100 700;
    font-style: normal;
    font-display: swap;
}

/* Glyph Data search uses the shared info-popup language with a denser result row.
   One fixed size for every provider, so switching providers doesn't resize it. */
.add-glyphs-popup {
    box-sizing: border-box;
    height: 92vh;
    max-height: 92vh;
    width: min(1720px, calc(100vw - 128px));
    max-width: 1720px;
}

.info-popup-content.kerning-editor-content {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    overflow: hidden;
    padding-top: 12px;
}

.kerning-editor-toolbar {
    align-items: center;
    display: flex;
    flex-shrink: 0;
    gap: 12px;
    justify-content: space-between;
}

.kerning-editor-toolbar-start {
    align-items: center;
    display: flex;
    flex: 1 1 auto;
    gap: 12px;
    min-width: 0;
}

.kerning-editor-toolbar .kerning-editor-search {
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    flex: 1 1 200px;
    margin: 0;
    max-width: 360px;
    width: auto;
}

.kerning-editor-direction {
    background: var(--background-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    display: inline-flex;
    overflow: hidden;
}

.kerning-editor-direction-btn {
    background: transparent;
    border: 0;
    color: var(--text-secondary);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 14px;
}

.kerning-editor-direction-btn:hover {
    background: var(--background-hover);
    color: var(--text-primary);
}

.kerning-editor-direction-btn.active {
    background: var(--accent-magenta);
    color: var(--background-primary);
}

.kerning-editor-table-wrap {
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

.kerning-editor-table {
    border-collapse: separate;
    border-spacing: 0;
    table-layout: auto;
    width: max-content;
}

.kerning-editor-table th,
.kerning-editor-table td {
    border-bottom: 1px solid var(--border-primary);
    border-right: 1px solid var(--border-primary);
    color: var(--text-primary);
    font-size: 12px;
    line-height: 1.3;
    padding: 6px 8px;
    text-align: left;
    white-space: nowrap;
}

.kerning-editor-table th:last-child,
.kerning-editor-table td:last-child {
    border-right: 0;
}

.kerning-editor-table thead th {
    background: var(--background-secondary);
    color: var(--text-secondary);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 2;
}

.kerning-editor-table th.kerning-editor-sortable {
    cursor: pointer;
    user-select: none;
}

.kerning-editor-table th.kerning-editor-sortable:hover {
    color: var(--text-primary);
}

.kerning-editor-table .kerning-editor-pair-col {
    min-width: 6rem;
}

.kerning-editor-table .kerning-editor-class-name {
    font-weight: 700;
}

.kerning-editor-table .kerning-editor-value-col {
    min-width: 5.5rem;
}

.kerning-editor-table tbody tr {
    cursor: pointer;
}

.kerning-editor-table tbody tr:hover td {
    background: var(--background-hover);
}

.kerning-editor-table tbody tr.selected td {
    background: color-mix(in srgb, var(--accent-magenta) 18%, transparent);
}

.kerning-editor-table .kerning-editor-value-input {
    background: var(--background-primary);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    box-sizing: border-box;
    color: var(--text-primary);
    font: inherit;
    font-variant-numeric: tabular-nums;
    min-width: 4.5rem;
    padding: 3px 6px;
    text-align: right;
    width: 100%;
}

.kerning-editor-table .kerning-editor-value-input:focus {
    border-color: var(--accent-magenta);
    outline: none;
}

.kerning-editor-empty {
    color: var(--text-secondary);
    padding: 24px 12px;
    text-align: center;
}

.rename-glyphs-popup {
    width: min(960px, calc(100vw - 32px));
    max-width: 960px;
}

.info-popup-content.rename-glyphs-content {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 14px;
    min-height: 0;
    overflow: hidden;
}

.rename-glyphs-fields {
    display: grid;
    flex-shrink: 0;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rename-glyphs-fields label {
    color: var(--text-secondary);
    display: grid;
    font-size: 12px;
    gap: 5px;
}

.rename-glyphs-input {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 4px;
    color: var(--text-primary);
    font: inherit;
    padding: 7px 8px;
}

.rename-glyphs-rewire {
    align-items: center;
    color: var(--text-primary);
    display: flex;
    flex-shrink: 0;
    font-size: 12px;
    gap: 8px;
}

.rename-glyphs-rewire[hidden] {
    display: none;
}

.rename-glyphs-rewire-input {
    accent-color: var(--accent-cyan);
    margin: 0;
}

.rename-glyphs-preview-wrap {
    flex: 1;
    min-height: 0;
    max-height: min(65vh, 640px);
    overflow-y: auto;
}

.rename-glyphs-preview {
    border-collapse: collapse;
    table-layout: fixed;
    width: 100%;
}

.rename-glyphs-preview col {
    width: 50%;
}

.rename-glyphs-preview.has-references col:nth-child(1),
.rename-glyphs-preview.has-references col:nth-child(2) {
    width: 28%;
}

.rename-glyphs-preview.has-references col:nth-child(3) {
    width: 44%;
}

.rename-glyphs-preview th,
.rename-glyphs-preview td {
    border-bottom: 1px solid var(--border-primary);
    padding: 7px 8px;
    text-align: left;
}

.rename-glyphs-preview th {
    background: var(--modal-bg);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 1;
}

.rename-glyphs-preview td {
    color: var(--text-primary);
    font-family: var(--font-families-mono);
    font-size: 12px;
    word-break: break-all;
}

.rename-glyphs-search-mark {
    color: var(--accent-orange);
    font-weight: 600;
}

.rename-glyphs-replace-mark {
    color: var(--accent-cyan);
    font-weight: 600;
}

.rename-glyphs-result.has-error {
    color: var(--accent-red);
    font-weight: 700;
}

.rename-glyphs-comment {
    color: var(--text-primary);
    display: inline;
    font-size: 10px;
    font-weight: 400;
    margin-left: 8px;
}

.rename-glyphs-rewire-entry {
    display: block;
}

.rename-glyphs-rewire-entry.is-inactive {
    color: var(--text-secondary);
    text-decoration: line-through;
}

.rename-glyphs-content .find-glyph-actions {
    flex-shrink: 0;
}

.info-popup-content.add-glyphs-content {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.add-glyphs-popup > .info-popup-header,
.add-glyph-provider-control,
.add-glyphs-composition,
.add-glyphs-content .find-glyph-actions {
    flex-shrink: 0;
}

.add-glyph-provider-control {
    align-items: center;
    color: var(--text-secondary);
    display: flex;
    font-size: 12px;
    gap: 8px;
}

.add-glyph-provider-select {
    background: var(--background-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    color: var(--text-primary);
    font: inherit;
    padding: 5px 8px;
}

/* The composition choice sits in the footer, left of Cancel and Add. */
.add-glyphs-content .find-glyph-actions {
    align-items: flex-end;
}

.add-glyphs-content .find-glyph-actions > .dialog-button {
    flex-shrink: 0;
    white-space: nowrap;
}

.add-glyphs-composition {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    margin-right: 16px;
}

.add-glyphs-composition[hidden] {
    display: none;
}

.add-glyphs-composition .plugin-ui-radio {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    margin: 0;
}

.add-glyphs-composition .plugin-ui-label {
    color: var(--text-secondary);
    font-family: var(--font-families-sans);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.add-glyphs-composition .plugin-setting-help {
    margin: 0;
    color: var(--text-tertiary);
    font-family: var(--font-families-sans);
    font-size: 12px;
    line-height: 1.4;
}

.add-glyphs-composition .plugin-ui-radio-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.add-glyphs-composition .plugin-ui-radio-label {
    color: var(--text-primary);
    font-family: var(--font-families-sans);
    font-size: 13px;
}

.add-glyphs-composition .plugin-ui-radio-label.has-help {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    align-content: start;
    gap: 2px 6px;
    padding: 6px 10px 8px;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    font-weight: 600;
}

.add-glyphs-composition .plugin-ui-radio-label.has-help:hover {
    background: var(--background-hover);
}

.add-glyphs-composition .plugin-ui-radio-label.has-help:has(input:checked) {
    border-color: var(--accent-blue);
    background: color-mix(
        in srgb,
        var(--accent-blue) 12%,
        var(--background-primary)
    );
}

.add-glyphs-composition .plugin-ui-radio-help {
    grid-column: 1 / -1;
    color: var(--text-secondary);
    font-size: 11.5px;
    font-weight: 400;
    line-height: 1.35;
}

.add-glyph-body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    margin-top: 12px;
    min-height: 0;
}

.add-glyphs-popup.has-character-set-tree .add-glyph-body {
    align-items: stretch;
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(260px, 0.32fr) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
}

.add-glyph-set-panel,
.add-glyph-results-panel {
    border: 1px solid var(--border-active);
    border-radius: 6px;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
}

.add-glyph-set-panel[hidden] {
    display: none;
}

.add-glyph-set-panel h3,
.add-glyph-results-panel h3 {
    color: var(--text-secondary);
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 600;
    margin: 0;
    padding: 10px 10px 0;
}

.add-glyph-set-panel > .find-glyph-search,
.add-glyph-results-toolbar {
    flex-shrink: 0;
    margin: 8px 10px 22px;
}

.add-glyph-set-panel > .find-glyph-search {
    width: auto;
}

.add-glyph-set-panel h3 {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.add-glyph-set-count {
    color: var(--text-tertiary);
    font-weight: 400;
    font-variant-numeric: tabular-nums;
}

/* Filters a Character Set provider declares, such as Hyperglot's writing script. */
.add-glyph-facets {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    gap: 6px;
    padding: 0 10px 8px;
}

.add-glyph-facets[hidden] {
    display: none;
}

.add-glyph-facet {
    align-items: center;
    color: var(--text-secondary);
    display: flex;
    font-size: 12px;
    gap: 8px;
    white-space: nowrap;
}

.add-glyph-facet-select {
    background: var(--background-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    color: var(--text-primary);
    flex: 1 1 auto;
    font: inherit;
    min-width: 0;
    padding: 5px 8px;
}

.add-glyph-facet-select.is-active {
    background: color-mix(
        in srgb,
        var(--accent-blue) 18%,
        var(--background-primary)
    );
    border-color: var(--accent-blue);
}

.add-glyph-facet-clear {
    background: none;
    border: 0;
    color: var(--accent-blue);
    cursor: pointer;
    font: inherit;
    padding: 0;
}

.add-glyph-facet-clear:hover {
    text-decoration: underline;
}

.add-glyph-results-toolbar {
    align-items: center;
    display: flex;
    gap: 12px;
    min-width: 0;
}

.add-glyph-results-toolbar > .find-glyph-search {
    flex: 1 1 auto;
    margin: 0;
    min-width: 0;
    width: auto;
}

.add-glyph-results-toolbar:has(+ .add-glyph-category-filters:not([hidden])) {
    margin-bottom: 10px;
}

.add-glyph-category-filters {
    align-items: center;
    display: flex;
    flex-shrink: 0;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 10px 14px;
}

.add-glyph-category-filters[hidden] {
    display: none;
}

.add-glyph-presence {
    background: var(--background-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    display: inline-flex;
    flex-shrink: 0;
    overflow: hidden;
}

.add-glyph-presence button {
    background: transparent;
    border: 0;
    color: var(--text-secondary);
    cursor: pointer;
    font: inherit;
    font-size: 11px;
    padding: 3px 8px;
}

.add-glyph-presence button + button {
    border-left: 1px solid var(--border-primary);
}

.add-glyph-presence button.is-selected {
    background: var(--background-hover);
    color: var(--text-primary);
}

.add-glyph-category-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.add-glyph-category-chip {
    align-items: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 999px;
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-size: 11px;
    gap: 6px;
    padding: 1px 2px 1px 8px;
}

.add-glyph-category-chip.is-selected {
    background: var(--background-hover);
    border-color: transparent;
    color: var(--text-primary);
}

.add-glyph-category-chip .add-glyph-set-coverage {
    pointer-events: none;
}

.add-glyph-column-title {
    align-items: center;
    display: flex;
    gap: 6px;
    min-width: 0;
}

.add-glyph-column-title h4 {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.add-glyph-set-tree,
.add-glyph-list {
    flex: 1 1 auto;
    margin: 0;
    max-width: 100%;
    min-height: 0;
    overflow: auto;
}

.add-glyph-set-detail {
    align-items: center;
    border-top: 1px solid var(--border-primary);
    display: flex;
    flex-shrink: 0;
    gap: 12px;
    padding: 10px;
}

.add-glyph-set-detail[hidden] {
    display: none;
}

.add-glyph-set-detail-text {
    flex: 1 1 auto;
    min-width: 0;
}

.add-glyph-set-detail-text h4 {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    margin: 0 0 4px;
}

.add-glyph-set-detail-text p {
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.4;
    margin: 0;
}

.add-glyph-set-detail img {
    flex: 0 0 auto;
    height: 72px;
    max-height: 72px;
    object-fit: contain;
    width: auto;
}

.add-glyph-columns {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.add-glyph-column {
    border-top: 1px solid var(--border-primary);
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
}

.add-glyph-column.is-empty {
    flex: 0 0 200px;
}

.add-glyph-column + .add-glyph-column {
    border-left: 1px solid var(--border-primary);
}

.add-glyph-column-header {
    align-items: center;
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    flex-shrink: 0;
    gap: 8px;
    justify-content: space-between;
    padding: 6px 8px;
}

.add-glyph-column-header h4 {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    margin: 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.add-glyph-select-all {
    align-items: center;
    color: var(--text-secondary);
    display: flex;
    flex: 0 0 auto;
    font-size: 12px;
    gap: 6px;
}

.add-glyph-set-row {
    align-items: center;
    background: transparent;
    border: 0;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    font: inherit;
    font-size: 12px;
    gap: 8px;
    margin: 0;
    padding: 6px 8px;
    text-align: left;
    width: 100%;
}

.add-glyph-set-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.add-glyph-set-coverage {
    background: var(--background-secondary);
    border-radius: 999px;
    color: var(--text-secondary);
    flex: 0 0 auto;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    line-height: 1.4;
    padding: 0 6px;
}

.add-glyph-set-coverage.is-complete {
    background: color-mix(
        in srgb,
        var(--accent-green) 18%,
        var(--background-primary)
    );
    color: var(--accent-green);
}

.add-glyph-set-row:hover,
.add-glyph-set-row.is-active {
    background: var(--background-hover);
}

.add-glyph-set-row.is-selected {
    background: color-mix(
        in srgb,
        var(--accent-blue) 18%,
        var(--background-primary)
    );
}

@media (max-width: 700px) {
    .add-glyphs-popup {
        width: calc(100vw - 32px);
    }

    .add-glyphs-popup.has-character-set-tree .add-glyph-body {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
    }

    .add-glyph-columns {
        flex-direction: column;
    }

    .add-glyph-column,
    .add-glyph-column.is-empty {
        flex: 1 1 0;
    }

    .add-glyph-column + .add-glyph-column {
        border-left: 0;
        border-top: 1px solid var(--border-primary);
    }
}

.add-glyph-row {
    align-items: stretch;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--border-primary);
    color: var(--text-primary);
    column-gap: 10px;
    cursor: pointer;
    display: grid;
    font: inherit;
    grid-template-columns: auto minmax(0, 1fr) max-content;
    margin: 0;
    min-width: 0;
    overflow: hidden;
    padding: 0 8px 0 0;
    text-align: left;
    width: 100%;
}

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

.add-glyph-row:hover,
.add-glyph-row.is-active {
    background: var(--background-hover);
}

.add-glyph-row.is-selected {
    background: color-mix(
        in srgb,
        var(--accent-blue) 18%,
        var(--background-primary)
    );
}

.add-glyph-row.is-existing {
    color: var(--text-faint);
}

.add-glyph-row.is-existing .add-glyph-preview,
.add-glyph-row.is-existing .add-glyph-details,
.add-glyph-row.is-existing .add-glyph-category {
    opacity: 0.45;
}

.add-glyph-row.is-existing.is-selected .add-glyph-preview,
.add-glyph-row.is-existing.is-selected .add-glyph-details,
.add-glyph-row.is-existing.is-selected .add-glyph-category {
    opacity: 0.7;
}

.add-glyph-present {
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    font-variant-numeric: normal;
    gap: 2px;
    justify-self: end;
    width: fit-content;
}

.add-glyph-present .material-symbols-outlined {
    font-size: 13px;
    font-variation-settings:
        'FILL' 0,
        'wght' 600,
        'GRAD' 0,
        'opsz' 20;
}

.add-glyph-row:disabled {
    color: var(--text-faint);
    cursor: default;
}

.add-glyph-preview {
    align-items: center;
    align-self: stretch;
    aspect-ratio: 1;
    display: flex;
    height: auto;
    justify-content: center;
    justify-self: stretch;
    min-height: 56px;
    min-width: 56px;
    width: auto;
}

.add-glyph-preview canvas {
    display: block;
    height: 100%;
    width: 100%;
}

.add-glyph-preview-char {
    font-family:
        system-ui, 'Segoe UI Symbol', 'Segoe UI Historic', 'Apple Symbols',
        'Noto Sans Symbols 2', 'Noto Sans Symbols', 'Noto Sans', sans-serif;
    font-size: 44px;
    line-height: 1;
    text-align: center;
}

.add-glyph-details {
    align-items: stretch;
    align-self: center;
    display: flex;
    flex-direction: column;
    gap: 2px;
    justify-content: center;
    min-width: 0;
    overflow: hidden;
    padding: 6px 0;
    text-align: left;
}

.add-glyph-details strong {
    display: block;
    font-family: var(--font-families-mono);
    font-size: 14px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
}

.add-glyph-meta {
    align-items: flex-end;
    align-self: center;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    gap: 2px;
    justify-content: center;
    padding: 6px 0;
    text-align: right;
}

.add-glyph-status,
.add-glyph-category {
    font-size: 12px;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.add-glyph-status {
    color: var(--text-tertiary);
}

.add-glyph-category {
    color: var(--text-secondary);
}

.add-glyph-unicode-name {
    color: var(--text-tertiary);
    display: block;
    font-size: 12px;
    min-width: 0;
    overflow: hidden;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
}

.add-glyph-codepoint {
    font-family: var(--font-families-mono);
}

/* Local Inter UI font for canvas labels */
@font-face {
    font-family: 'Inter UI';
    src: url('../assets/fonts/Inter-UI.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Inter';
    src: url('../assets/fonts/Inter-Italic.woff2') format('woff2');
    font-weight: 100 700;
    font-style: italic;
    font-display: swap;
}

/* Local Funnel Display font */
@font-face {
    font-family: 'Funnel Display';
    src: url('../assets/fonts/FunnelDisplay.woff2') format('woff2');
    font-weight: 400 700;
    font-style: normal;
    font-display: swap;
}

/* Local IBM Plex Mono font */
@font-face {
    font-family: 'IBM Plex Mono';
    src: url('../assets/fonts/IBMPlexMono-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'IBM Plex Mono';
    src: url('../assets/fonts/IBMPlexMono-Italic.woff2') format('woff2');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'IBM Plex Mono';
    src: url('../assets/fonts/IBMPlexMono-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'IBM Plex Mono';
    src: url('../assets/fonts/IBMPlexMono-MediumItalic.woff2') format('woff2');
    font-weight: 500;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'IBM Plex Mono';
    src: url('../assets/fonts/IBMPlexMono-SemiBold.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'IBM Plex Mono';
    src: url('../assets/fonts/IBMPlexMono-SemiBoldItalic.woff2') format('woff2');
    font-weight: 600;
    font-style: italic;
    font-display: swap;
}

/* Local Material Symbols fonts */
@font-face {
    font-family: 'Material Symbols Outlined';
    src: url('../assets/fonts/MaterialSymbolsOutlined.woff2') format('woff2');
    font-weight: 100 700;
    font-style: normal;
    font-display: swap;
}

/* Additional CSS variable overrides not in tokens */
:root {
    color-scheme: dark;
    /* Font family fallbacks (tokens only has primary font) */
    --font-families-mono: 'IBM Plex Mono', 'Courier New', Courier, monospace;
    --font-families-sans:
        'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
        sans-serif;
    --background-loading: #313131;
    --kerning-accent-first: #4ea7cf;
    --kerning-accent-second: #d98a4a;
}

:root[data-theme='light'] {
    color-scheme: light;
    --background-loading: #cecece;
    --kerning-accent-first: #00bfff;
    --kerning-accent-second: #ffab57;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

::-webkit-scrollbar-corner {
    background: var(--scrollbar-track);
}

html,
body {
    /* Disable trackpad swipe navigation gestures */
    overscroll-behavior-x: none;
    overscroll-behavior-y: none;
}

html {
    background-color: var(--border-primary);
}

body {
    font-family:
        'Inter',
        -apple-system,
        BlinkMacSystemFont,
        'Segoe UI',
        Roboto,
        sans-serif;
    font-style: normal;
    background-color: var(--background-primary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    letter-spacing: 0.02em;
    transition:
        background-color 0.3s ease,
        color 0.3s ease;
}

.glyph-canvas-background-editing {
    background-color: color-mix(in srgb, var(--accent-yellow) 10%, transparent);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-faint);
    opacity: 1;
}

/* Loading cursor override for all elements */
body.loading,
body.loading * {
    cursor: wait !important;
}

/* Material Symbols */
.material-symbols-outlined {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 1.2em;
    display: inline-block;
    line-height: 1;
    text-transform: none;
    letter-spacing: 0em;
    word-wrap: normal;
    white-space: nowrap;
    direction: ltr;
    vertical-align: middle;
}

/* Keyboard shortcut style */
kbd {
    display: inline-block;
    padding: 2px 6px;
    font-family: var(--font-families-mono);
    font-size: 11px;
    line-height: 1.4;
    color: var(--text-primary);
    background-color: var(--background-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 3px;
    box-shadow: 0 1px 0 var(--border-primary);
    white-space: nowrap;
    vertical-align: baseline;
}

kbd + kbd {
    margin-left: 2px;
}

.material-symbols-outlined + .material-symbols-outlined {
    margin-left: -0.12em;
}

.shortcut-command-modifier::before {
    content: 'keyboard_command_key';
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    -webkit-font-feature-settings: 'liga';
    font-feature-settings: 'liga';
}

html[data-command-modifier='ctrl'] .shortcut-command-modifier::before {
    content: 'keyboard_control_key';
}

.shortcut-option-modifier::before {
    content: 'keyboard_option_key';
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    -webkit-font-feature-settings: 'liga';
    font-feature-settings: 'liga';
}

html[data-command-modifier='ctrl'] .shortcut-option-modifier::before {
    content: 'keyboard_alt_key';
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--background-loading);
    z-index: 999999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    transition: opacity 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

.loading-icon {
    width: 88px;
    height: auto;
    display: block;
    opacity: 0;
}

.loading-icon.fade-in {
    opacity: 1;
}

.loading-version {
    min-height: 20px;
    text-align: center;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 400;
    color: var(--text-muted);
    opacity: 0;
    z-index: 2;
}

.unsupported-browser-overlay {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background-color: var(--background-loading);
}

.unsupported-browser-panel {
    max-width: 720px;
    width: 100%;
    background-color: var(--background-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 24px;
}

.unsupported-browser-title {
    font-family: 'Inter', sans-serif;
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.unsupported-browser-text {
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.browser-feature-matrix-wrapper {
    margin: 14px 0;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    overflow: hidden;
}

.browser-feature-matrix {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--background-secondary);
}

.browser-feature-matrix th,
.browser-feature-matrix td {
    padding: 9px 12px;
    text-align: left;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    border-bottom: 1px solid var(--border-primary);
    color: var(--text-primary);
}

.browser-feature-matrix thead th {
    font-weight: 600;
    background-color: var(--background-tertiary);
}

.matrix-support-cell {
    text-align: center;
}

.matrix-support-icon {
    font-size: 18px;
    vertical-align: middle;
}

.matrix-support-icon-yes {
    color: var(--accent-green);
}

.matrix-support-icon-no {
    color: var(--accent-red);
}

.matrix-note-cell {
    white-space: nowrap;
}

.browser-note-recommended {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid var(--accent-green);
    color: var(--accent-green);
    font-size: 12px;
    font-weight: 600;
    margin-right: 8px;
}

.browser-note-current {
    font-weight: 700;
}

.browser-feature-matrix tbody tr:last-child td {
    border-bottom: none;
}

.browser-feature-matrix tbody tr.current-browser td {
    background-color: var(--background-selected);
    font-weight: 600;
}

.unsupported-browser-continue {
    margin-top: 8px;
    padding: 10px 16px;
    border-radius: 6px;
    border: 1px solid var(--button-border);
    background-color: var(--button-bg);
    color: var(--button-text);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.unsupported-browser-continue:hover {
    background-color: var(--button-hover-bg);
}

.loading-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-family: 'Inter', sans-serif;
    font-size: 36px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.08;
    letter-spacing: 0;
    opacity: 0;
}

.loading-logo-line {
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
}

.loading-logo.fade-in {
    opacity: 1;
}

.loading-logo.fade-out {
    opacity: 0;
}

@keyframes pulse {
    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Toolbar styles */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--border-primary);
    padding: 12px 20px;
    padding-left: 9px;
    padding-right: 9px;
    height: 50px;
    flex-shrink: 0;
}

.toolbar-left {
    display: flex;
    align-items: center;
}

.app-name {
    font-family: 'Inter', sans-serif;
    font-size: 20px;
    font-weight: 500;
    position: relative;
    left: 4px;
    top: -1px;
    margin: 0;
}

.app-name > span {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 400;
}

.toolbar-center {
    display: flex;
    align-items: center;
    flex: 1;
    justify-content: center;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toolbar-link-folder-btn {
    background-color: var(--folder-setup-callout-bg);
    border: 1px solid var(--folder-setup-callout-border);
    color: var(--folder-setup-callout-text);
    padding: 6px 12px;
    border-radius: 4px;
    font-family: var(--font-families-sans);
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

.toolbar-link-folder-btn:hover {
    filter: brightness(1.08);
}

.toolbar-tour-launch {
    display: flex;
    align-items: stretch;
    border-radius: 4px;
    overflow: hidden;
}

.toolbar-tour-launch[hidden] {
    display: none;
}

.toolbar-tour-launch-btn,
.toolbar-tour-launch-dismiss {
    background-color: var(--tour-launch-button-bg);
    border: 1px solid var(--tour-launch-button-border);
    color: var(--tour-launch-button-text);
    font-family: var(--font-families-sans);
    cursor: pointer;
}

.toolbar-tour-launch-btn {
    padding: 6px 12px;
    font-size: 12px;
    white-space: nowrap;
    border-right: none;
    border-radius: 4px 0 0 4px;
}

.toolbar-tour-launch-dismiss {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    border-radius: 0 4px 4px 0;
}

.toolbar-tour-launch-dismiss .material-symbols-outlined {
    font-size: 16px;
}

.toolbar-tour-launch-btn:hover,
.toolbar-tour-launch-dismiss:hover {
    filter: brightness(1.08);
}

.plugin-menu-separator {
    height: 1px;
    margin: 4px 8px;
    background-color: var(--border-primary);
}

.font-display-container {
    position: relative;
    display: flex;
    align-items: center;
}

.file-dirty-indicator {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    line-height: 1;
    color: var(--accent-red);
    opacity: 0;
    pointer-events: none;
    z-index: 10;
    transition:
        opacity 0.3s ease,
        color 0.15s ease;
}

.file-dirty-indicator.visible {
    opacity: 1;
}

.file-dirty-indicator.exporting {
    color: var(--accent-blue);
}

.current-font-display {
    color: var(--button-text);
    padding: 6px 12px 6px 24px;
    font-family: var(--font-families-mono);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.current-font-display .font-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.current-font-display .font-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.current-font-display .font-window-role-badge {
    flex-shrink: 0;
    margin-left: 6px;
    padding: 1px 6px;
    border: 1px solid var(--border-primary);
    color: var(--text-faint);
    font-size: 10px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.share-button {
    background: var(--background-secondary);
    border: 1px solid var(--border-primary);
    color: var(--text-primary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
    opacity: 0;
    pointer-events: none;
}

.share-button.visible {
    opacity: 1;
    pointer-events: auto;
}

.share-button:hover {
    background: var(--background-hover);
    color: var(--text-primary);
}

.share-button.share-button-active {
    background: var(--background-hover);
    color: var(--text-primary);
}

.share-button .material-symbols-outlined {
    font-size: 18px;
}

.cloud-status-chip {
    align-items: center;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: default;
    display: none;
    flex-shrink: 0;
    height: 32px;
    justify-content: center;
    min-width: 32px;
    padding: 0;
    width: 32px;
}

.cloud-status-chip.visible {
    display: inline-flex;
}

.cloud-status-chip .material-symbols-outlined {
    color: var(--text-primary);
    font-size: 18px;
}

.cloud-status-chip.tone-warning .material-symbols-outlined {
    color: var(--accent-orange);
}

.cloud-status-chip.tone-error .material-symbols-outlined {
    color: var(--accent-red);
}

.cloud-status-tooltip {
    min-width: 220px;
}

.cloud-status-tooltip .cloud-status-tooltip-sentence {
    margin: 0 0 8px 0;
}

.cloud-status-tooltip ul {
    margin: 0;
    padding-left: 18px;
}

.cloud-status-tooltip li {
    margin: 4px 0;
}

.cloud-access-role-badge {
    display: none;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    color: var(--background-primary);
}

.cloud-access-role-badge.visible {
    display: inline-flex;
}

.cloud-access-role-badge .material-symbols-outlined {
    font-size: 16px;
}

.cloud-access-role-badge.role-editor {
    background: var(--accent-cyan);
}

.cloud-access-role-badge.role-viewer {
    background: var(--accent-orange);
}

.container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 50px);
    width: 100vw;
    background-color: var(--border-primary);
    padding: 0px 5px 5px 5px;
}

.top-row {
    display: flex;
    flex: 1.61;
    /* 63% of total height */
    min-height: 200px; /* Primary view (editor) minimum */
    width: 100%;
    min-width: 0;
}

.bottom-row {
    display: flex;
    flex: 1;
    /* 37% of total height */
    min-height: 24px; /* Secondary views can collapse to title bar */
    width: 100%;
    min-width: 0;
}

.view {
    --view-title-color: var(--border-focus-outline);
    background-color: var(--background-primary);
    border: 3px solid var(--border-primary);
    overflow: hidden;
    min-width: 100px;
    min-height: 24px; /* Title bar height - allows secondary views to collapse */
    flex: 1 1 0;
    position: relative;
    color: var(--text-primary);
    transition:
        background-color 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease;
    display: flex;
    flex-direction: column;
    border-radius: 6px;
}

/* Active view indicator — 3px chrome, color only (no width change).
   Stack above the workspace and idle dividers so every edge of the
   colored border stays visible (especially Docs vs #docs-divider). */
.view.focused {
    z-index: 3;
    border-color: var(--view-title-color);
}

/* Keyboard view activation focuses the view shell (tabindex=-1). Suppress the
   browser focus ring — the colored view border is the only focus indicator. */
.view:focus,
.view:focus-visible {
    outline: none;
}

/* Primary view (editor) - larger minimum size */
.view.view-editor {
    min-width: 24px;
    min-height: 200px;
}

.top-row > .view,
.bottom-row > .view {
    min-width: 24px;
}

/* Secondary views - can collapse to title bar only */
.view:not(.view-editor) {
    min-height: 24px;
}

/* Font info view special case - collapses to width instead of height */
.view-fontinfo {
    min-width: 24px;
    min-height: 100px;
}

/* Overview view special case - collapses to width instead of height */
.view-overview {
    min-width: 24px;
    min-height: 100px;
}

/* Collapsed secondary views (height collapsed to title bar) */
.view:not(.view-editor).collapsed {
    overflow: hidden;
    background-color: var(--background-secondary);
}

.view:not(.view-editor).collapsed .view-content,
.view:not(.view-editor).collapsed #console-container,
.view:not(.view-editor).collapsed #script-editor,
.view:not(.view-editor).collapsed #history-view-content {
    display: none;
}

/* Hide non-essential title bar elements when collapsed */
.view:not(.view-editor).collapsed .view-title-bar .view-title-button,
.view:not(.view-editor).collapsed .view-title-bar .view-title-action-btn,
.view:not(.view-editor).collapsed .view-title-bar .editor-plugins-toggle,
.view:not(.view-editor).collapsed .view-title-bar .script-file-dropdown-btn,
.view:not(.view-editor).collapsed .view-title-bar .script-file-reload-btn {
    display: none !important;
}

/* Collapsed width views - rotated title bar when collapsed to minimum width */
.view.collapsed-width {
    overflow: hidden;
    min-width: 24px;
}

.view.collapsed-width .view-content {
    display: none;
}

.view.collapsed-width .view-title-bar {
    /* writing-mode: vertical-lr; */
    /* text-orientation: mixed; */
    transform: rotate(-90deg);
    /* height: 100%; */
    justify-content: flex-end;
    border: none;
}

.view.collapsed-width .view-title-bar .view-title-left {
    flex-direction: row;
    gap: 6px;
    white-space: nowrap;
}

.view.collapsed-width .view-title-heading {
    padding-right: 3px;
    border-right: none;
}

.view.collapsed-width .view-title-bar .view-title-button,
.view.collapsed-width .view-title-bar .view-title-action-btn,
.view.collapsed-width .view-title-bar .view-title-actions,
.view.collapsed-width .view-title-bar .editor-plugins-toggle,
.view.collapsed-width .editor-glyph-name {
    display: none !important;
}

/* Overview-specific elements to hide when collapsed */
.view-overview.collapsed-width .view-title-bar .overview-search-control,
.view-overview.collapsed-width .view-title-bar .overview-size-control {
    display: none;
}

/* Hide font info search when view is collapsed */
.view-fontinfo.collapsed-width .view-title-bar #fontinfo-search-control {
    display: none;
}

/* View Title Bar */
.view-title-bar {
    height: 24px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0 0 8px;
    border-bottom: 2px solid var(--border-primary);
    font-family: var(--font-families-sans);
    font-size: 11px;
    background-color: inherit;
    flex-shrink: 0;
    box-sizing: border-box;
}

.view-title-field {
    display: flex;
    align-items: center;
    align-self: stretch;
    box-sizing: border-box;
    gap: 4px;
    height: 100%;
    padding: 0 6px;
    background: var(--input-bg);
    border-left: 1px solid var(--border-primary);
    border-right: 1px solid var(--border-primary);
}

.view-title-field:focus-within {
    border-color: var(--accent-primary);
}

.view-title-field input {
    height: 100%;
    min-width: 0;
    padding: 0;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 12px;
    font-family: inherit;
}

.view-title-field input::placeholder {
    color: var(--text-faint);
    opacity: 0.5;
}

.view-title-left {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 100%;
}

.editor-glyph-chip.inactive {
    cursor: pointer;
}

.editor-glyph-chip.active {
    cursor: default;
}

.editor-glyph-chip,
.editor-glyph-name-single {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0 4px;
    border: 1px solid color-mix(in srgb, var(--border-primary) 40%, transparent);
    line-height: 16px;
    border-radius: 3px;
}

.editor-glyph-chip.active,
.editor-glyph-name-single {
    background-color: color-mix(
        in srgb,
        var(--background-hover) 55%,
        transparent
    );
}

.editor-glyph-chip-separator {
    position: relative;
    top: 3px;
    margin-left: -2px;
    margin-right: -2px;
}

.editor-glyph-bg-badge {
    font-size: 8px;
    font-weight: 600;
    letter-spacing: 0.06em;
    line-height: 1;
    padding: 1px 3px;
    border: 1px solid
        color-mix(in srgb, var(--accent-yellow) 45%, var(--border-primary));
    color: var(--accent-yellow);
    text-transform: uppercase;
}

.editor-glyph-live-ref-warning {
    font-size: 11px;
    color: var(--accent-orange);
}

.view-title-window-actions {
    display: flex;
    align-items: center;
    gap: 0px;
    margin-right: 0px;
    margin-left: -4px;
    height: 100%;
}

.view-title-heading {
    display: flex;
    align-items: center;
    gap: 5px;
    padding-right: 7px;
    border-right: 1px solid var(--border-primary);
    height: 100%;
}

.view-title-actions {
    display: flex;
    align-items: center;
    gap: none;
}

.view-title-right {
    display: flex;
    align-items: center;
    gap: 0;
    height: 100%;
}

.view-title-name {
    color: inherit;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 10px;
}

.keyboard-shortcut,
.view-title-shortcut,
.button-shortcut {
    color: var(--text-faint);
    font-size: 10px;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    white-space: nowrap;
}

.keyboard-shortcut .material-symbols-outlined,
.view-title-shortcut .material-symbols-outlined,
.button-shortcut .material-symbols-outlined {
    top: -1px;
    position: relative;
    font-size: 1.2em;
    color: inherit;
}

/* Parent buttons set 18px icons; keep shortcut glyphs at chip size. */
.view-title-button .keyboard-shortcut .material-symbols-outlined,
.assistant-send-button .keyboard-shortcut .material-symbols-outlined,
.dialog-button .keyboard-shortcut .material-symbols-outlined {
    font-size: 1.2em;
}

/* Content containers for views with text content */
.view-content {
    margin-top: 0px;
    margin-bottom: 0px;
    overflow: auto;
    flex: 1;
    scrollbar-width: none;
}

.view-files .view-content {
    margin: 0px;
}

/* Hide scrollbar for view-content */
.view-content::-webkit-scrollbar {
    width: 0;
    display: none;
}

.view-content::-webkit-scrollbar-track {
    background: transparent;
}

.view-content::-webkit-scrollbar-thumb {
    background: transparent;
}

.view-content h3 {
    color: inherit;
    margin-bottom: 10px;
    font-weight: 500;
}

.view-content p {
    line-height: 1.6;
    color: inherit;
}

#history-view-content {
    padding: 0;
}

.history-panel {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    background-color: inherit;
    color: inherit;
    font-family: var(--font-families-sans);
    font-size: 11px;
}

.history-change-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    background-color: inherit;
}

.history-entry {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-primary);
    transition:
        background-color 0.2s ease,
        opacity 0.15s ease;
}

.history-entry-flat {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.history-entry-main {
    flex: 1;
    min-width: 0;
}

.history-entry-title-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.history-entry-summary {
    flex: 1;
    min-width: 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.history-entry-trailing {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    flex: 0 0 auto;
}

.history-entry-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    min-width: 0;
}

.history-entry-devmeta {
    font-size: 10px;
    color: var(--text-faint);
    margin-top: 4px;
}

.history-entry-subtitle {
    font-size: 10px;
    color: var(--text-faint);
    margin-top: 2px;
}

.history-action-chip {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border-secondary);
    background-color: transparent;
    border-radius: 0;
    padding: 1px 5px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.2;
    flex: 0 0 auto;
}

.history-action-edit {
    color: var(--text-secondary);
}

.history-action-undo {
    color: var(--accent-orange);
    border-color: var(--accent-orange);
}

.history-action-redo {
    color: var(--accent-cyan);
    border-color: var(--accent-cyan);
}

.history-origin-label {
    font-size: 11px;
    color: var(--text-faint);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-cascade-icon {
    font-size: 16px;
    color: var(--text-faint);
    line-height: 1;
}

/* Development aid: pen while an edit burst is going out, check once final. */
.history-burst-indicator {
    font-size: 16px;
    color: var(--text-faint);
    line-height: 1;
}

.history-burst-indicator[data-burst-state='finalized'] {
    color: var(--accent-green);
}

.history-burst-indicator.is-flashing {
    animation: history-burst-pen-flash 0.4s ease-out;
}

@keyframes history-burst-pen-flash {
    0% {
        color: var(--accent-orange);
        transform: scale(1.35);
    }
    100% {
        color: var(--text-faint);
        transform: scale(1);
    }
}

.history-entry-pending .history-entry-summary {
    color: var(--text-secondary);
    font-weight: 400;
}

.history-hidden-run {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    min-height: 22px;
    padding: 4px 10px;
    border: none;
    border-bottom: 1px solid var(--border-primary);
    background: transparent;
    color: var(--text-faint);
    font-family: var(--font-families-sans);
    font-size: 11px;
    cursor: pointer;
    text-align: left;
}

.history-hidden-run:hover {
    color: var(--text-secondary);
    background-color: var(--input-bg);
}

.history-hidden-run-dots {
    letter-spacing: 0.12em;
    opacity: 0.8;
}

.history-hidden-run-label {
    min-width: 0;
}

.history-entry-cmdz-unreachable {
    opacity: 0.38;
}

.history-entry-cmdz-unreachable:hover {
    opacity: 0.55;
}

.history-entry:hover {
    background-color: var(--input-bg);
}

.history-meta {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 4px;
    justify-content: space-between;
}

.history-time {
    color: var(--text-faint);
    font-size: 10px;
    letter-spacing: 0.03em;
}

.history-info-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: none;
    background-color: transparent;
    color: var(--text-faint);
    padding: 0;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    flex: 0 0 auto;
    transition: color 0.2s ease;
}

.history-info-button:hover {
    color: var(--text-primary);
}

.view-title-button.history-show-unreachable-toggle.active {
    background-color: var(--background-primary);
    border-left-color: var(--border-primary);
    color: var(--text-primary) !important;
}

.view-title-button.history-show-unreachable-toggle:not(.active) {
    color: var(--text-secondary) !important;
}

.history-metadata-tooltip {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: min(60vh, 560px);
    overflow: auto;
    padding: 2px;
    font-family: var(--font-families-sans);
    font-size: 12px;
    line-height: 1.4;
}

.history-metadata-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.history-metadata-section-title {
    margin: 0;
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.history-metadata-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
}

.history-metadata-row {
    display: grid;
    grid-template-columns: minmax(96px, 120px) minmax(0, 1fr);
    gap: 8px;
    align-items: start;
}

.history-metadata-row dt {
    margin: 0;
    color: var(--text-faint);
}

.history-metadata-row dd {
    margin: 0;
    color: var(--text-primary);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-family: var(--font-families-mono);
}

.history-empty-state {
    color: var(--text-faint);
    padding: 40px 16px;
    text-align: center;
    letter-spacing: 0.03em;
}

/* Divider styles — 4px visual marker; ::before widens the hit target.
   Idle dividers sit under focused view chrome; hover/active rise above
   so the resize line stays visible while dragging. */
.divider {
    background-color: var(--border-primary);
    position: relative;
    z-index: 2;
    transition: background-color 0.2s ease;
}

.divider:hover,
.divider.active {
    z-index: 4;
    background-color: var(--border-active);
}

.vertical-divider {
    width: 4px;
    cursor: col-resize;
    min-height: 100%;
    flex: 0 0 4px;
    /* Fixed size, no growing or shrinking */
}

.vertical-divider::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: -6px;
    width: 16px;
}

.horizontal-divider {
    height: 4px;
    cursor: row-resize;
    width: 100%;
    min-width: 100%;
    flex: 0 0 4px;
    /* Fixed size, no growing or shrinking */
}

.horizontal-divider::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: -6px;
    height: 16px;
}

/* View specific title colors - remove left border, color title instead */
.view-fontinfo {
    flex: 1;
    --view-title-color: var(--view-fontinfo);
}

.view-overview {
    flex: 1;
    --view-title-color: var(--view-overview);
}

.view-editor {
    flex: 2;
    --view-title-color: var(--view-editor);
}

.view-fontinfo .view-title-name {
    color: var(--view-fontinfo);
}

.view-overview .view-title-name {
    color: var(--view-overview);
}

.view-editor .view-title-name {
    color: var(--view-editor);
}

.view-files {
    --view-title-color: var(--view-files);
}

.view-files .view-title-name {
    color: var(--view-files);
}

.view-console {
    --view-title-color: var(--view-console);
}

.view-console .view-title-name {
    color: var(--view-console);
}

.view-scripts {
    --view-title-color: var(--view-scripts);
}

.view-scripts .view-title-name {
    color: var(--view-scripts);
}

.view-assistant {
    --view-title-color: var(--view-assistant);
}

.view-assistant .view-title-name {
    color: var(--view-assistant);
}

.view-history {
    --view-title-color: var(--accent-cyan);
}

.view-history .view-title-name {
    color: var(--accent-cyan);
}

/* View Title Button */
.view-title-button {
    background-color: transparent;
    border: none;
    border-left: 1px solid var(--border-primary);
    color: var(--text-primary) !important;
    padding: 0 8px;
    border-radius: 0;
    cursor: pointer;
    font-family: var(--font-families-sans);
    font-size: 10px;
    font-weight: normal;
    letter-spacing: 0.03em;
    transition: all 0.2s ease;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 3px;
}

.view-title-button > .material-symbols-outlined {
    font-size: 18px;
}

.view-title-button:hover {
    background-color: var(--input-bg);
    border-left-color: var(--text-secondary);
}

.view-title-button.assistant-edit-toggle.active {
    background-color: var(--background-primary);
    border-left-color: var(--border-primary);
    color: var(--text-primary) !important;
}

.view-title-button.assistant-edit-toggle {
    align-self: stretch;
    box-sizing: border-box;
    justify-content: center;
    min-width: 36px;
    padding: 0 8px;
}

.view-title-button.assistant-edit-toggle:not(.active) {
    color: var(--text-secondary) !important;
}

.view-title-button.assistant-edit-toggle:disabled {
    cursor: default;
    opacity: 0.65;
}

.view-title-button.assistant-edit-toggle.locked {
    opacity: 0.65;
}

/* View Title Action Buttons */
.view-title-action-btn {
    background-color: transparent;
    border: none;
    color: var(--text-faint);
    padding: 2px;
    cursor: pointer;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-title-action-btn .material-symbols-outlined {
    font-size: 12px;
}

.view-title-action-btn:hover {
    background-color: var(--input-bg);
    color: var(--text-secondary);
}

.view-title-action-btn:active {
    background-color: var(--border-primary);
    color: var(--text-primary);
}

.editor-health-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 2px;
    padding: 0 2px;
    border: none;
    background: transparent;
    color: var(--accent-orange);
    cursor: pointer;
    height: 100%;
}

.editor-health-chip[hidden] {
    display: none !important;
}

.editor-health-chip .material-symbols-outlined {
    font-size: 14px;
    font-variation-settings:
        'FILL' 1,
        'wght' 500,
        'GRAD' 0,
        'opsz' 20;
}

.editor-health-chip:hover {
    color: var(--text-primary);
    background-color: var(--background-hover);
}

.editor-health-chip-process {
    color: var(--accent-yellow);
}

.view-editor.collapsed-width .view-title-bar .editor-health-chip:not([hidden]) {
    display: flex !important;
}

/* Editor text layout (left of edit tools) */
.editor-text-layout {
    display: flex;
    align-items: stretch;
    height: 100%;
    flex: 0 0 auto;
}

#glyph-text-layout-section {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 0;
    height: 100%;
}

.text-layout-field + .text-layout-field {
    margin-left: -1px;
}

.text-layout-align {
    display: flex;
    align-items: stretch;
    height: 100%;
    margin-left: -1px;
}

.text-layout-icon-label {
    display: flex;
    align-items: center;
    color: var(--text-secondary);
    cursor: pointer;
}

.text-layout-icon-label .material-symbols-outlined {
    font-size: 16px;
}

.view-title-field .text-layout-input {
    font-family: var(--font-families-mono);
    text-align: right;
}

.view-title-field #glyph-line-height-input {
    width: 3ch;
}

.view-title-field #glyph-point-size-input {
    width: 5ch;
}

.text-layout-suffix {
    color: var(--text-secondary);
    font-size: 10px;
}

.text-layout-calibrate-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 0 4px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
}

.text-layout-calibrate-btn:hover {
    background: var(--background-hover);
}

.text-layout-calibrate-btn .material-symbols-outlined {
    font-size: 16px;
}

.view-title-button.text-layout-align-button {
    min-width: 24px;
    justify-content: center;
    padding: 0 6px;
}

.view-title-button.text-layout-align-button.active {
    background-color: var(--input-bg);
    color: var(--accent-cyan) !important;
}

/* Editor edit tools (left of View / Plugins) */
.editor-edit-tools {
    display: flex;
    align-items: stretch;
    gap: 0;
    height: 100%;
}

.view-title-button.editor-edit-tool-btn {
    min-width: 28px;
    justify-content: center;
    padding: 0 6px;
    color: var(--text-primary) !important;
}

.view-title-button.editor-edit-tool-btn .material-symbols-outlined {
    font-size: 16px;
}

.view-title-button.editor-edit-tool-btn.active {
    color: var(--accent-cyan) !important;
    background-color: var(--input-bg);
}

.view-title-button.editor-edit-tool-btn.unavailable,
.view-title-button.editor-edit-tool-btn:disabled {
    color: var(--text-faint) !important;
    opacity: 0.45;
    cursor: default;
    pointer-events: none;
    background-color: transparent;
}

.view-title-button.editor-edit-tool-btn.unavailable .material-symbols-outlined,
.view-title-button.editor-edit-tool-btn:disabled .material-symbols-outlined {
    color: var(--text-faint);
}

@keyframes editor-edit-tool-flash {
    0%,
    35% {
        background-color: var(--accent-cyan);
    }
    100% {
        background-color: var(--input-bg);
    }
}

.view-title-button.editor-edit-tool-btn.tool-flash {
    animation: editor-edit-tool-flash 420ms ease-out;
}

.view-title-button.editor-edit-tool-btn.tool-flash,
.view-title-button.editor-edit-tool-btn.tool-flash .material-symbols-outlined {
    color: var(--background-primary) !important;
}

.tool-cursor-badge {
    position: fixed;
    display: none;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin: 0;
    padding: 0;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 2147483646;
    color: var(--text-primary);
    background: transparent;
}

.tool-cursor-badge-icon {
    font-size: 14px;
    line-height: 1;
}

/* Editor Plugins Toggle */
.editor-plugins-toggle {
    display: flex;
    align-items: stretch;
    gap: 0;
    /* border-right: 4px solid var(--border-primary); */
    height: 100%;
    margin-left: auto;
    position: relative;
}

.editor-plugins-dropdown-btn {
    background-color: transparent;
    border: none;
    border-left: 1px solid var(--border-primary);
    color: var(--text-primary);
    padding: 0 8px;
    border-radius: 0;
    cursor: pointer;
    font-family: var(--font-families-mono);
    font-size: 10px;
    font-weight: normal;
    transition: all 0.2s ease;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 3px;
}

.editor-plugins-dropdown-btn:hover {
    background-color: var(--input-bg);
    border-left-color: var(--text-primary);
}

.editor-plugins-dropdown-btn:disabled,
.editor-plugins-dropdown-btn.inactive {
    color: var(--text-faint);
    opacity: 0.5;
    cursor: default;
    background-color: transparent;
    border-left-color: var(--border-primary);
    pointer-events: none;
}

.editor-plugins-dropdown-btn:disabled:hover,
.editor-plugins-dropdown-btn.inactive:hover {
    background-color: transparent;
    border-left-color: var(--border-primary);
}

.editor-plugins-dropdown-btn .material-symbols-outlined {
    font-size: 14px;
}

.editor-plugins-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--background-primary);
    border: 1px solid var(--border-primary);
    border-left-width: 3px;
    border-bottom-width: 3px;
    border-right: none;
    min-width: 300px;
    overflow-y: auto;
    z-index: 1000;
    font-family: var(--font-families-sans);
}

.editor-plugins-dropdown-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-primary);
    transition: background-color 0.15s ease;
}

.editor-plugins-dropdown-item:last-child {
    border-bottom: none;
    /* padding-bottom: 0px; */
}

.editor-plugins-dropdown-item:hover {
    background-color: var(--input-bg);
}

.editor-plugins-dropdown-item:has(+ .plugin-ui-elements) {
    border-bottom: none;
}

/* Plugin tags use the general tag-button style */
.editor-plugins-dropdown-item .plugin-name {
    margin-left: 8px;
    /* Inherits from .tag-description */
}

.editor-plugins-dropdown-empty {
    padding: 12px;
    text-align: center;
    color: var(--text-faint);
    font-family: var(--font-families-mono);
    font-size: 10px;
}

/* Plugin UI Elements */
.plugin-ui-elements {
    padding: 2px 12px 11px 20px;
    border-bottom: 1px solid var(--border-primary);
}

.plugin-ui-slider {
    display: grid;
    grid-template-columns: 70px 1fr 40px;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.plugin-ui-slider:last-child {
    margin-bottom: 0;
}

.plugin-ui-label {
    font-family: var(--font-families-mono);
    font-size: 10px;
    color: var(--text-secondary);
}

/* Shared slider styles for plugin UI, axes, and reusable ui-slider */
.plugin-ui-slider input[type='range'],
.editor-axis-slider,
.ui-slider {
    width: 100%;
    height: 4px;
    background: var(--border-primary);
    border-radius: 2px;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

.plugin-ui-slider input[type='range']::-webkit-slider-runnable-track,
.editor-axis-slider::-webkit-slider-runnable-track,
.ui-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    background: linear-gradient(
        to right,
        var(--text-secondary) 0%,
        var(--text-secondary) var(--value-percent, 50%),
        var(--border-primary) var(--value-percent, 50%),
        var(--border-primary) 100%
    );
    border-radius: 2px;
}

.plugin-ui-slider input[type='range']::-moz-range-track,
.editor-axis-slider::-moz-range-track,
.ui-slider::-moz-range-track {
    width: 100%;
    height: 4px;
    background: var(--border-primary);
    border-radius: 2px;
}

.plugin-ui-slider input[type='range']::-moz-range-progress,
.editor-axis-slider::-moz-range-progress,
.ui-slider::-moz-range-progress {
    height: 4px;
    background: var(--text-secondary);
    border-radius: 2px;
}

.plugin-ui-slider input[type='range']::-webkit-slider-thumb,
.editor-axis-slider::-webkit-slider-thumb,
.ui-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: var(--text-primary);
    cursor: pointer;
    border-radius: 50%;
    margin-top: -4px;
}

.plugin-ui-slider input[type='range']::-moz-range-thumb,
.editor-axis-slider::-moz-range-thumb,
.ui-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: var(--text-primary);
    cursor: pointer;
    border-radius: 50%;
    border: none;
}

.plugin-ui-value {
    font-family: var(--font-families-mono);
    font-size: 10px;
    color: var(--text-primary);
    width: 40px;
    text-align: right;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 2px;
    padding: 1px 3px;
    outline: none;
    transition: all 0.15s ease;
}

.plugin-ui-value:hover {
    border-color: var(--border-secondary);
    background: var(--background-secondary);
}

.plugin-ui-value:focus {
    border-color: var(--accent-primary);
    background: var(--background-primary);
}

/* Plugin UI field rows (text field, checkbox, radio group, color picker) */
.plugin-ui-textfield,
.plugin-ui-checkbox,
.plugin-ui-radio-group,
.plugin-ui-color {
    display: grid;
    grid-template-columns: 70px 1fr;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.plugin-ui-textfield:last-child,
.plugin-ui-checkbox:last-child,
.plugin-ui-radio-group:last-child,
.plugin-ui-color:last-child {
    margin-bottom: 0;
}

.plugin-ui-text-input {
    font-family: var(--font-families-mono);
    font-size: 10px;
    color: var(--text-primary);
    background: var(--background-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 2px;
    padding: 4px 6px;
    outline: none;
    transition: all 0.15s ease;
}

.plugin-ui-text-input:hover {
    border-color: var(--border-secondary);
}

.plugin-ui-text-input:focus {
    border-color: var(--accent-primary);
    background: var(--background-primary);
}

.plugin-ui-checkbox-input {
    width: 14px;
    height: 14px;
    cursor: pointer;
    margin: 0;
    filter: saturate(0);
}

.plugin-ui-radio-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
}

.plugin-ui-radio-label.has-help {
    flex-wrap: wrap;
}

.plugin-ui-radio-help {
    flex-basis: 100%;
    color: var(--text-tertiary);
    font-family: var(--font-families-sans);
}

.plugin-ui-radio-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-family: var(--font-families-mono);
    font-size: 10px;
    color: var(--text-secondary);
}

.plugin-ui-radio-input {
    width: 12px;
    height: 12px;
    cursor: pointer;
    margin: 0;
    filter: saturate(0);
}

.plugin-ui-color-input {
    width: 50px;
    height: 24px;
    border: 1px solid var(--border-primary);
    border-radius: 2px;
    cursor: pointer;
    padding: 0;
    background: transparent;
}

.plugin-ui-color-input:hover {
    border-color: var(--border-secondary);
}

/* AI Info Popup Specific Styles */
.ai-info-section {
    margin-bottom: 24px;
}

.ai-info-section:last-child {
    margin-bottom: 0;
}

.ai-info-section h4 {
    color: var(--accent-green);
}

.assistant-tool-category-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 10px 0 16px;
}

#assistant-info-modal .info-popup-content,
#assistant-info-modal .assistant-tool-list,
#assistant-info-modal .assistant-tool-category,
#assistant-info-modal .ai-info-section {
    min-width: 0;
}

#assistant-info-modal .ai-info-section h4,
#assistant-info-modal .ai-info-section code {
    overflow-wrap: anywhere;
}

.assistant-tool-category-chip {
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    background: var(--background-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    padding: 4px 8px;
}

.assistant-tool-category-chip:hover,
.assistant-tool-category-chip[aria-pressed='true'] {
    border-color: var(--border-secondary);
    background: var(--background-hover);
    color: var(--text-primary);
}

.assistant-tool-category {
    margin-bottom: 20px;
}

.assistant-tool-category-title {
    margin: 0 0 10px;
    color: var(--text-primary);
    font-size: 13px;
}

.assistant-tool-empty {
    color: var(--text-tertiary);
    font-size: 12px;
    margin: 0;
}

.run-python-script-popup {
    max-width: min(640px, calc(100vw - 32px));
    width: 90%;
}

#run-python-script-modal .info-popup-content,
#run-python-script-modal .run-python-script-list {
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
}

#run-python-script-modal .info-popup-content {
    display: flex;
    flex-direction: column;
    gap: 0;
    box-sizing: border-box;
}

.run-python-script-folder-select {
    width: 100%;
    max-width: 100%;
    margin: 10px 0 0;
    padding: 6px 8px;
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    background: var(--background-secondary);
    color: var(--text-primary);
    font: inherit;
    font-size: 12px;
    box-sizing: border-box;
}

.run-python-script-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 180px;
    max-height: min(70vh, 720px);
    overflow-x: hidden;
    overflow-y: auto;
}

.run-python-script-item {
    display: block;
    flex-shrink: 0;
    width: 100%;
    max-width: 100%;
    text-align: left;
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    background: var(--background-secondary);
    color: var(--text-primary);
    cursor: pointer;
    font: inherit;
    padding: 7px 10px;
    box-sizing: border-box;
    overflow: visible;
    overflow-wrap: anywhere;
}

.run-python-script-item:hover {
    border-color: var(--border-secondary);
    background: var(--background-hover);
}

.run-python-script-item.selected {
    border-color: var(--accent-green);
    background: color-mix(in srgb, var(--accent-green) 12%, transparent);
}

.run-python-script-item-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    overflow-wrap: anywhere;
}

.run-python-script-item-path {
    margin-top: 0;
    font-size: 9px;
    color: var(--text-faint);
    font-family: var(--font-families-mono);
    overflow-wrap: anywhere;
}

.run-python-script-item-description {
    margin-top: 3px;
    font-size: 12px;
    color: var(--text-tertiary);
    line-height: 1.45;
    white-space: normal;
    overflow-wrap: break-word;
}

.run-python-script-item-keywords {
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-faint);
    overflow-wrap: anywhere;
}

.run-python-script-item-keywords code {
    background: var(--background-hover);
    padding: 1px 4px;
    border-radius: 3px;
    margin-right: 4px;
    overflow-wrap: anywhere;
}

.run-python-script-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border-primary);
}

/* Matplotlib plot modal */
.matplotlib-modal {
    display: none;
    position: fixed;
    z-index: 10001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
}

.matplotlib-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.matplotlib-modal-content {
    background-color: var(--modal-bg);
    border: 2px solid var(--border-tertiary);
    border-radius: 8px;
    padding: 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
}

.matplotlib-modal-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-tertiary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.matplotlib-modal-header h3 {
    margin: 0;
    font-size: 16px;
    color: var(--accent-green);
}

.matplotlib-modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.matplotlib-modal-close:hover {
    color: var(--text-primary);
}

.matplotlib-modal-body {
    padding: 16px;
    overflow: auto;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.matplotlib-modal-body canvas,
.matplotlib-modal-body matplotlib-figure {
    max-width: 100%;
    max-height: calc(95vh - 80px);
    object-fit: contain;
}

.matplotlib-modal-body matplotlib-figure {
    display: block;
}

.ai-info-section h3 {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: var(--accent-green);
    font-weight: 600;
}

.ai-info-section p {
    margin: 8px 0;
    line-height: 1.6;
}

.ai-info-section ul {
    margin: 12px 0;
    padding-left: 20px;
}

.ai-info-section li {
    margin: 8px 0;
    line-height: 1.6;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

/* Script Editor */
/* Ace Editor Container */
#script-editor {
    width: 100%;
    height: 100%;
    position: relative;
    flex: 1;
    background-color: var(--background-primary);
}

/* Ace Editor customizations */
#script-editor .ace_editor {
    font-family: var(--font-families-mono);
    font-size: calc(var(--size, 1) * (12px / var(--pixel-density, 1)));
    line-height: 1.6;
}

#script-editor .ace_line {
    line-height: 1.6;
}

#script-editor .ace_gutter {
    background-color: transparent;
}

/* Script Editor File Menu */
.script-editor-buttons {
    display: flex;
    align-items: stretch;
    gap: 0;
    height: 100%;
    margin-left: auto;
}

.script-file-dropdown-btn {
    background-color: transparent;
    border: none;
    border-left: 1px solid var(--border-primary);
    color: var(--text-primary);
    padding: 0 8px;
    border-radius: 0;
    cursor: pointer;
    font-family: var(--font-families-sans);
    font-size: 10px;
    font-weight: normal;
    transition: all 0.2s ease;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 3px;
}

.script-file-dropdown-btn:hover {
    background-color: var(--input-bg);
    border-left-color: var(--text-primary);
}

.script-file-dropdown-btn .material-symbols-outlined {
    font-size: 14px;
}

.script-modified-indicator {
    color: var(--accent-orange);
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    font-size: 10px;
    line-height: 1;
    margin-right: 2px;
}

.script-file-reload-btn {
    background-color: transparent;
    border: none;
    border-left: 1px solid var(--border-primary);
    color: var(--text-primary);
    padding: 0 8px;
    border-radius: 0;
    cursor: pointer;
    font-family: var(--font-families-mono);
    font-size: 10px;
    font-weight: normal;
    transition: all 0.2s ease;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 4px;
}

.script-file-reload-btn:hover {
    background-color: var(--input-bg);
}

.script-file-reload-btn .material-symbols-outlined {
    font-size: 14px;
}

/* Script File Menu (via Tippy) */
.script-file-menu {
    background: var(--background-secondary);
    min-width: 200px;
    font-family: var(--font-families-sans);
    font-size: 11px;
    border-radius: 3px;
    overflow: hidden;
}

.script-file-menu-path {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-primary);
    color: var(--text-secondary);
    font-family: var(--font-families-mono);
    font-size: 10px;
    word-break: break-all;
    display: flex;
    align-items: center;
    gap: 4px;
}

.script-file-menu-path .script-modified-indicator {
    color: var(--accent-orange);
}

.script-file-menu-notice {
    font-size: 11px;
    color: var(--text-tertiary);
    padding: 8px 12px;
    font-style: italic;
    border-bottom: 1px solid var(--border-primary);
}

.script-file-menu-item,
.plugin-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    color: var(--text-primary);
}

.script-file-menu-item:hover,
.script-file-menu-item.focused,
.plugin-menu-item:hover,
.plugin-menu-item.focused {
    background-color: var(--input-bg);
}

.script-file-menu-item.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.script-file-menu-item.disabled:hover {
    background-color: transparent;
}

.script-file-menu-item .material-symbols-outlined {
    font-size: 16px;
    color: var(--text-secondary);
}

/* Official Pyodide Console Styles */

@supports (--css: variables) {
    .cmd,
    .cmd div,
    .cmd span,
    .terminal,
    .terminal-output > :not(.raw) a,
    .terminal-output > :not(.raw) div,
    .terminal-output > :not(.raw) span {
        font-size: calc(var(--size, 1) * (12px / var(--pixel-density, 1)));
        font-family: var(--font-families-mono) !important;
        color: var(--text-primary) !important;
    }
}

.terminal .terminal-output > :not(.raw) .terminal-error,
.terminal .terminal-output > :not(.raw) .terminal-error * {
    color: var(--accent-red) !important;
}

#console-container {
    width: 100%;
    flex: 1;
    position: relative;
    overflow: hidden;
    background-color: var(--background-primary);
    transition: background-color 0.2s ease;
}

#console-container .terminal {
    --size: 1.2;
    --color: var(--view-console);
    --background: var(--background-primary);
    font-family: var(--font-families-mono) !important;
    background-color: transparent !important;
    height: 100% !important;
    border: none !important;
}

#console-container .terminal ::selection {
    background-color: var(--view-console);
    color: var(--background-primary);
}

#console-container .terminal ::-moz-selection {
    background-color: var(--view-console);
    color: var(--background-primary);
}

#console-container .terminal .terminal-output {
    color: var(--text-primary);
}

#console-container .terminal .cmd {
    background-color: transparent !important;
}

#console-container .terminal .cmd-prompt {
    color: var(--accent-red) !important;
    font-weight: bold;
}

.terminal-wrapper {
    margin-left: 4px;
}

#loading {
    display: inline-block;
    width: 30px;
    height: 30px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 3px solid var(--input-bg);
    border-radius: 50%;
    border-top-color: var(--accent-red);
    /* animation: spin 1s ease-in-out infinite; */
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* View title tabs (glyph overview modes) */
.context-tab {
    color: var(--text-muted) !important;
}

.context-tab.active {
    background-color: var(--input-bg);
    color: var(--text-primary) !important;
}

/* Plugin Menu (Tippy Content) */
.plugin-menu {
    background: var(--background-secondary);
    min-width: 220px;
    font-family: var(--font-families-sans);
    font-size: 11px;
    border-radius: 3px;
    overflow: hidden;
}

.plugin-menu-item.plugin-menu-item-disabled,
.plugin-menu-setting.plugin-menu-item-disabled {
    opacity: 0.45;
    cursor: default;
    pointer-events: none;
}

.plugin-menu-item.plugin-menu-item-disabled:hover,
.plugin-menu-item.plugin-menu-item-disabled.focused {
    background-color: transparent;
}

.plugin-menu-item .material-symbols-outlined {
    font-size: 16px;
    color: var(--text-secondary);
}

.plugin-menu-item .plugin-menu-check {
    display: inline-flex;
    width: 16px;
    min-width: 16px;
    justify-content: center;
}

.plugin-menu-item .plugin-menu-check.empty {
    visibility: hidden;
}

.plugin-menu-item .plugin-menu-shortcut {
    margin-left: auto;
}

.plugin-menu-item.has-submenu {
    position: relative;
}

.plugin-menu-item.has-submenu:hover,
.plugin-menu-item.has-submenu:focus-within,
.plugin-menu-item.has-submenu.submenu-open {
    z-index: 2;
}

.plugin-menu-chevron {
    margin-left: auto;
}

/*
 * Nested flyouts (AGENTS.md: Tippy nested submenus).
 * Overlap the parent row and keep an 8px ::before hover bridge so the
 * pointer never hits a dead zone between parent and flyout.
 */
.plugin-menu-submenu {
    position: absolute;
    top: -1px;
    left: calc(100% - 1px);
    z-index: 1;
    display: none;
    min-width: 220px;
    padding: 4px 0;
    border: 1px solid var(--border-primary);
    border-radius: 3px;
    background: var(--background-secondary);
    box-shadow: 0 8px 24px var(--modal-overlay);
}

.plugin-menu-submenu::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    right: 100%;
    width: 8px;
}

.plugin-menu-item.has-submenu:hover > .plugin-menu-submenu,
.plugin-menu-item.has-submenu:focus-within > .plugin-menu-submenu,
.plugin-menu-item.has-submenu.submenu-open > .plugin-menu-submenu {
    display: block;
}

.plugin-menu:has(.has-submenu) {
    overflow: visible;
}

.tippy-box:has(.plugin-menu-item.has-submenu),
.tippy-box:has(.plugin-menu-item.has-submenu) > .tippy-content {
    overflow: visible;
}

.plugin-menu-item .keyboard-shortcut .material-symbols-outlined,
.plugin-menu-item .plugin-menu-shortcut .material-symbols-outlined {
    font-size: 1.2em;
    position: relative;
    top: -1px;
    color: inherit;
}

.plugin-menu-setting {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 12px 10px;
    color: var(--text-primary);
}

.plugin-menu-setting-label {
    color: var(--text-secondary);
}

.plugin-menu-fill-setting .ui-slider {
    height: 12px;
    background: transparent;
    cursor: pointer;
}

.plugin-menu-fill-setting .ui-slider::-webkit-slider-runnable-track {
    background: linear-gradient(
        to right,
        var(--text-secondary) 0%,
        var(--text-secondary) var(--value-percent, 50%),
        var(--input-bg) var(--value-percent, 50%),
        var(--input-bg) 100%
    );
}

.plugin-menu-fill-setting .ui-slider::-moz-range-track {
    background: var(--input-bg);
}

.plugin-menu-fill-setting .ui-slider::-moz-range-progress {
    background: var(--text-secondary);
}

.plugin-menu-segments {
    display: flex;
    border: 1px solid var(--border-primary);
    border-radius: 3px;
    overflow: hidden;
}

.plugin-menu-segment {
    flex: 1;
    padding: 4px 6px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    cursor: pointer;
}

.plugin-menu-segment:not(:last-child) {
    border-right: 1px solid var(--border-primary);
}

.plugin-menu-segment:hover {
    background-color: var(--background-hover);
}

.plugin-menu-segment.active {
    background-color: var(--view-editor);
    color: var(--background-primary);
}

/* Plugin Menu Backdrop */
.plugin-menu-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: transparent;
    z-index: 9998;
    display: none;
}

.plugin-menu-backdrop.visible {
    display: block;
}

.fontinfo-names-fields {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 12px;
}

.compile-filter-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.compile-filter-intro,
.compile-filter-empty {
    margin: 0;
    max-width: 42rem;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

.compile-filter-list,
.compile-filter-choices {
    display: flex;
    flex-direction: column;
}

.compile-filter-card,
.compile-filter-choice {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
    border-top: 1px solid var(--border-primary);
}

.compile-filter-choice:first-child {
    border-top: none;
    padding-top: 0;
}

.compile-filter-name {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.compile-filter-description {
    margin: 4px 0 0;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

.compile-filter-card .compile-filter-status {
    margin: 4px 0 0;
    color: var(--text-secondary);
    font-size: 12px;
}

.compile-filter-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    flex-shrink: 0;
}

.compile-filter-header .dialog-button,
.compile-filter-card .dialog-button,
.compile-filter-choice .dialog-button {
    flex-shrink: 0;
    white-space: nowrap;
}

.fontinfo-records-pane {
    height: 100%;
    min-height: 0;
}

.fontinfo-name-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 760px;
    margin-bottom: 14px;
    padding: 12px 14px;
    border: 1px solid var(--border-inner);
    border-radius: 6px;
    background-color: var(--background-tertiary);
}

.fontinfo-section-description {
    margin: -2px 0 2px;
    color: var(--text-secondary);
    font-size: 11px;
    line-height: 1.45;
    max-width: 62ch;
}

/* One field per row: label on the left, control and help on the right.
   Narrow panels stack the label above the control. */
.fontinfo-name-group-fields {
    display: flex;
    flex-direction: column;
    container-type: inline-size;
}

.fontinfo-name-group-fields > .localized-string-editor {
    display: grid;
    grid-template-columns: minmax(110px, 170px) minmax(0, 1fr);
    column-gap: 16px;
    row-gap: 4px;
    align-items: start;
    padding: 9px 0;
}

.fontinfo-name-group-fields > .localized-string-editor + * {
    border-top: 1px solid var(--border-inner);
}

.fontinfo-name-group-fields > .localized-string-editor > * {
    grid-column: 2;
}

.fontinfo-name-group-fields
    > .localized-string-editor
    > :is(.localized-string-label, .localized-string-editor-header) {
    grid-column: 1;
    grid-row: 1 / span 3;
    padding-top: 6px;
}

.fontinfo-name-group-fields
    > .localized-string-editor
    > .localized-string-editor-header {
    flex-direction: column;
    align-items: flex-start;
    padding-top: 0;
}

.fontinfo-name-group-fields .localized-string-label {
    font-size: 11px;
    letter-spacing: 0.02em;
    text-transform: none;
    color: var(--text-primary);
    font-weight: 600;
}

.fontinfo-name-group-fields .localized-string-helper {
    color: var(--text-secondary);
    font-size: 10.5px;
    max-width: 62ch;
}

.fontinfo-name-group-fields .localized-string-input {
    max-width: 460px;
}

.fontinfo-name-group-fields .localized-string-input[type='number'] {
    max-width: 110px;
    font-variant-numeric: tabular-nums;
}

.fontinfo-field-key {
    display: block;
    margin-top: 1px;
    color: var(--text-secondary);
    font-family: var(--font-families-mono);
    font-size: 10px;
    font-weight: 400;
}

@container (max-width: 420px) {
    .fontinfo-name-group-fields > .localized-string-editor {
        grid-template-columns: minmax(0, 1fr);
    }

    .fontinfo-name-group-fields
        > .localized-string-editor
        > :is(.localized-string-label, .localized-string-editor-header) {
        grid-row: auto;
        padding-top: 0;
    }

    .fontinfo-name-group-fields > .localized-string-editor > * {
        grid-column: 1;
    }
}

.fontinfo-metric-inputs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
}

.fontinfo-metric-input {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.fontinfo-metric-caption {
    color: var(--text-secondary);
    font-size: 10.5px;
}

.fontinfo-metric-input .localized-string-input {
    width: 90px;
}

.fontinfo-metrics-body {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-start;
}

.fontinfo-metrics-body > .fontinfo-name-group-fields {
    flex: 1 1 320px;
    min-width: 0;
}

.fontinfo-metrics-preview {
    display: block;
    border-radius: 6px;
    background-color: var(--background-secondary);
}

.fontinfo-metrics-preview-line {
    stroke: var(--text-secondary);
    stroke-width: 1;
}

.fontinfo-metrics-preview-zone {
    fill: var(--accent-blue);
    opacity: 0.5;
}

.fontinfo-name-group-fields .fontinfo-version-fields {
    grid-template-columns: repeat(2, 90px);
}

.fontinfo-metrics-preview-slant {
    stroke: var(--accent-blue);
    stroke-width: 1.5;
}

.fontinfo-metrics-preview-label {
    fill: var(--text-secondary);
    font-family: var(--font-families-sans);
    font-size: 10px;
}

.fontinfo-script-metrics-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 0 2px;
}

.fontinfo-script-metrics-name {
    font-weight: 600;
    font-size: 12px;
}

.fontinfo-script-add {
    max-width: 240px;
}

.fontinfo-line-spacing,
.fontinfo-range-table {
    align-self: flex-start;
    width: auto;
}

.fontinfo-line-spacing {
    border-collapse: collapse;
}

.fontinfo-line-spacing th {
    padding: 4px 8px 4px 0;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    text-align: left;
}

.fontinfo-line-spacing td {
    padding: 3px 8px 3px 0;
}

.fontinfo-line-spacing-empty {
    color: var(--text-secondary);
    font-size: 11px;
}

.fontinfo-range-table {
    border-collapse: collapse;
}

.fontinfo-range-table th {
    padding: 4px 10px 4px 0;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    text-align: left;
}

.fontinfo-range-table td {
    padding: 3px 10px 3px 0;
}

.fontinfo-range-table .localized-string-input {
    width: 90px;
}

.fontinfo-bit-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 2px 14px;
}

.fontinfo-bit-option {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 3px 0;
    font-size: 11px;
    cursor: pointer;
}

.fontinfo-bit-number {
    color: var(--text-secondary);
    font-family: var(--font-families-mono);
    font-size: 10px;
}

.fontinfo-axis-map-group {
    gap: 12px;
}

.fontinfo-axis-map-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.fontinfo-axis-map-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.fontinfo-axis-map-editor {
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(180px, 1fr);
    gap: 14px;
    min-width: 0;
    outline: none;
}

.fontinfo-axis-map-chart-panel,
.fontinfo-axis-map-list-panel {
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    background: var(--background-primary);
}

.fontinfo-axis-map-chart-panel {
    padding: 10px;
}

.fontinfo-axis-map-chart {
    display: block;
    width: 100%;
    height: auto;
}

.fontinfo-axis-map-frame {
    fill: var(--background-primary);
    stroke: var(--border-primary);
    stroke-width: 1;
}

.fontinfo-axis-map-axis-label,
.fontinfo-axis-map-tick-label {
    fill: var(--text-secondary);
    font-family: var(--font-families-sans);
    font-size: 11px;
}

.fontinfo-axis-map-tick {
    stroke: var(--text-secondary);
    stroke-width: 1;
}

.fontinfo-axis-map-line {
    fill: none;
    stroke: var(--accent-blue);
    stroke-width: 2;
}

.fontinfo-axis-map-guide {
    stroke: var(--accent-blue);
    stroke-width: 1;
    stroke-dasharray: 4 4;
    opacity: 0.5;
}

.fontinfo-axis-map-point {
    fill: var(--background-primary);
    stroke: var(--accent-blue);
    stroke-width: 2;
    cursor: grab;
}

.fontinfo-axis-map-point.selected {
    fill: var(--accent-blue);
}

.fontinfo-axis-map-list-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.fontinfo-axis-map-list-title {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-primary);
    color: var(--text-secondary);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.fontinfo-axis-map-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px;
    min-height: 0;
}

.fontinfo-axis-map-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    background: var(--background-secondary);
    color: var(--text-primary);
    padding: 8px 10px;
    text-align: left;
}

.fontinfo-axis-map-row.selected {
    border-color: var(--accent-blue);
    box-shadow: inset 0 0 0 1px var(--accent-blue);
}

.fontinfo-axis-map-row-userspace,
.fontinfo-axis-map-row-designspace {
    font-variant-numeric: tabular-nums;
}

.fontinfo-axis-map-input {
    min-width: 0;
    text-align: center;
}

@media (max-width: 900px) {
    .fontinfo-axis-map-editor {
        grid-template-columns: 1fr;
    }
}

.fontinfo-records-layout {
    display: grid;
    grid-template-columns: var(--top-row-sidebar-width, 150px) minmax(0, 1fr);
    gap: 0;
    align-items: stretch;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.fontinfo-records-sidebar {
    width: var(--top-row-sidebar-width, 200px);
    min-width: var(--top-row-sidebar-width, 200px);
    height: 100%;
    min-height: 0;
    border-right: 1px solid var(--border-primary);
}

.fontinfo-records-list {
    display: flex;
    flex-direction: column;
    margin: 0 -12px;
}

.fontinfo-stations-blocked-notice {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin: 6px 0 8px;
}

.fontinfo-records-detail {
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-width: 0;
    min-height: 0;
    height: 100%;
    overflow: auto;
    padding: 12px 20px 12px 15px;
}

.fontinfo-record-item {
    width: 100%;
    text-align: left;
    border-bottom: 1px solid var(--border-primary);
}

.fontinfo-record-item:first-child {
    border-top: 1px solid var(--border-primary);
}

.fontinfo-record-item-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.fontinfo-record-item-primary {
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fontinfo-record-item-secondary {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.fontinfo-record-item-secondary-line {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 900px) {
    .fontinfo-records-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .fontinfo-records-sidebar {
        height: auto;
        max-height: 40%;
        border-right: none;
        border-bottom: 1px solid var(--border-primary);
    }

    .fontinfo-records-detail {
        min-height: 0;
    }
}

.fontinfo-version-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.localized-string-editor {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.fontinfo-field-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.localized-string-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.localized-string-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.localized-string-label {
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.localized-string-input {
    width: 100%;
    min-width: 0;
    padding: 6px 8px;
    border: 1px solid var(--border-primary);
    background-color: var(--input-bg);
    color: var(--text-primary);
    font-family: var(--font-families-sans);
    font-size: 11px;
    border-radius: 4px;
    box-sizing: border-box;
}

.localized-string-textarea {
    min-height: 76px;
    resize: vertical;
}

.localized-string-helper {
    color: var(--text-faint);
    font-size: 10px;
    line-height: 1.4;
}

.localized-string-locales-button {
    border: 1px solid var(--border-primary);
    background-color: transparent;
    color: var(--text-primary);
    border-radius: 4px;
    cursor: pointer;
    font-family: var(--font-families-sans);
    font-size: 10px;
    padding: 5px 8px;
    transition:
        background-color 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease;
}

.localized-string-locales-button:hover {
    background-color: var(--input-bg);
    border-color: var(--text-secondary);
}

.localized-string-locales-button:disabled {
    opacity: 0.45;
    cursor: default;
}

.localized-string-modal .matplotlib-modal-body {
    align-items: stretch;
    justify-content: flex-start;
}

.localized-string-modal-content {
    width: min(720px, calc(100vw - 40px));
}

.localized-string-modal-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.localized-string-modal-controls,
.localized-string-modal-actions,
.localized-string-modal-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.localized-string-modal-actions {
    justify-content: flex-end;
}

.localized-string-modal-rows {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.localized-string-modal-locale-select,
.localized-string-modal-locale {
    width: 120px;
    flex: 0 0 120px;
}

.localized-string-modal-locale-select {
    border: 1px solid var(--border-primary);
    background-color: var(--input-bg);
    color: var(--text-primary);
    border-radius: 4px;
    padding: 6px 8px;
    font-family: var(--font-families-sans);
    font-size: 11px;
}

.localized-string-modal-locale {
    color: var(--text-secondary);
    font-family: var(--font-families-mono);
    font-size: 11px;
    padding-top: 8px;
}

.localized-string-modal-input {
    flex: 1 1 auto;
}

.fontinfo-station-location-modal .matplotlib-modal-body {
    align-items: stretch;
    justify-content: flex-start;
}

.fontinfo-station-location-modal-content {
    width: min(420px, calc(100vw - 40px));
}

.feature-variation-settings-modal-content {
    width: min(500px, calc(100vw - 32px));
}

.feature-variation-settings-modal-body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
}

.feature-variation-settings-description {
    color: var(--text-secondary);
    font-size: 11px;
    line-height: 1.45;
}

.feature-variation-settings-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.feature-variation-settings-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(80px, 0.7fr) minmax(
            80px,
            0.7fr
        );
    align-items: end;
    gap: 8px;
}

.feature-variation-settings-axis-label,
.feature-variation-settings-bound {
    color: var(--text-secondary);
    font-family: var(--font-families-sans);
    font-size: 10px;
}

.feature-variation-settings-axis-label {
    padding-bottom: 7px;
}

.feature-variation-settings-bound {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.feature-variation-settings-input {
    min-width: 0;
    width: 100%;
}

.feature-variation-settings-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border-primary);
}

@media (max-width: 480px) {
    .feature-variation-settings-row {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .feature-variation-settings-axis-label {
        grid-column: 1 / -1;
        padding-bottom: 0;
    }
}

.fontinfo-station-location-modal-body,
.fontinfo-station-location-rows {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.fontinfo-station-location-description {
    color: var(--text-secondary);
    font-size: 11px;
}

.fontinfo-station-location-row,
.fontinfo-station-location-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.fontinfo-station-location-actions {
    justify-content: flex-end;
}

.fontinfo-station-location-label {
    width: 120px;
    flex: 0 0 120px;
    color: var(--text-secondary);
    font-family: var(--font-families-mono);
    font-size: 11px;
}

.fontinfo-station-location-input {
    flex: 1 1 auto;
}

/* Tippy.js Theme - Dark & Light (arrows take the box's fill and border) */
.tippy-box[data-theme='dark'],
.tippy-box[data-theme='light'] {
    background-color: var(--background-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 3px;
    color: var(--text-primary);
    --tippy-arrow-fill: var(--background-secondary);
    --tippy-arrow-border: var(--border-primary);
}

.tippy-box[data-theme='dark'] > .tippy-arrow,
.tippy-box[data-theme='light'] > .tippy-arrow {
    color: var(--tippy-arrow-fill);
}

.tippy-box[data-theme='dark'] > .tippy-arrow::after,
.tippy-box[data-theme='light'] > .tippy-arrow::after {
    content: '';
    position: absolute;
    z-index: -1;
    border-color: transparent;
    border-style: solid;
}

.tippy-box[data-placement^='top'] > .tippy-arrow::after {
    bottom: -8px;
    left: -1px;
    border-width: 9px 9px 0;
    border-top-color: var(--tippy-arrow-border);
}

.tippy-box[data-placement^='bottom'] > .tippy-arrow::after {
    top: -8px;
    left: -1px;
    border-width: 0 9px 9px;
    border-bottom-color: var(--tippy-arrow-border);
}

.tippy-box[data-placement^='left'] > .tippy-arrow::after {
    right: -8px;
    top: -1px;
    border-width: 9px 0 9px 9px;
    border-left-color: var(--tippy-arrow-border);
}

.tippy-box[data-placement^='right'] > .tippy-arrow::after {
    left: -8px;
    top: -1px;
    border-width: 9px 9px 9px 0;
    border-right-color: var(--tippy-arrow-border);
}

.tippy-content {
    padding: 1px !important;
}

.assistant-access-gate .folder-setup-callout {
    max-width: 360px;
    width: 100%;
    margin-block: auto;
    box-sizing: border-box;
}

/* Shared AI account gate styles — assistant uses .folder-setup-callout */

/* Keep header button shortcuts visible */
.view-title-bar .ai-button-shortcut,
.view-title-bar .keyboard-shortcut {
    display: inline-flex;
}

#view-assistant:not(.focused) .assistant-send-shortcut,
#view-scripts:not(.focused) .run-script-shortcut {
    display: none;
}

/* ======================== ASSISTANT VIEW ======================== */

.view-assistant .view-content {
    display: flex;
    flex-direction: column;
    margin-left: 0;
    margin-right: 0;
    overflow: hidden;
}

#assistant-chat-container {
    display: none;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

#assistant-chat-container.assistant-input-only {
    flex: 0 0 auto;
}

#assistant-chat-container.assistant-input-only #assistant-messages {
    display: none;
}

/* "Sign In Required" / "Advanced Subscription Required": the Assistant panel
   and the glyph filter editor. */
.assistant-access-gate {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    flex: 1;
    min-height: 0;
    padding: 12px;
    overflow-x: hidden;
    overflow-y: auto;
}

/* Assistant panel: the explanation, then the sign-up line with Sign In
   beside it. The button drops under that line only in a very narrow panel. */
.assistant-account-callout {
    align-items: stretch;
    gap: 6px;
    margin: 0;
    text-align: left;
}

.assistant-access-gate .assistant-account-callout {
    max-width: 600px;
}

.assistant-account-callout .folder-setup-callout-heading {
    justify-content: flex-start;
}

.assistant-account-callout p {
    line-height: 1.3;
}

.assistant-account-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
}

.assistant-account-row p {
    flex: 1 1 180px;
    min-width: 0;
}

.assistant-account-row .settings-action-btn {
    flex: 0 0 auto;
    margin-left: auto;
}

/* The panel shows these from script. */
#assistant-login-container,
#assistant-subscription-container {
    display: none;
}

#assistant-messages {
    flex: 1;
    padding-bottom: 0;
}

#assistant-input-container {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex-shrink: 0;
    padding: 10px 12px;
    /* margin-top: 8px; */
    background-color: var(--input-bg);
    border-top: 1px solid var(--border-primary);
}

#assistant-prompt-wrapper {
    position: relative;
    width: 100%;
}

#assistant-prompt {
    width: 100%;
    min-height: calc(1.4em + 14px);
    max-height: 120px;
    padding: 6px 10px;
    font-family: var(--font-families-mono);
    font-size: calc(var(--size, 1) * (12px / var(--pixel-density, 1)));
    line-height: 1.4;
    color: var(--text-primary);
    background-color: var(--background-primary);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    resize: none;
    outline: none;
    box-sizing: border-box;
}

#assistant-prompt::placeholder {
    color: var(--text-faint);
}

#assistant-prompt:focus {
    border-color: var(--border-focus-outline);
}

#assistant-prompt:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.assistant-input-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

#assistant-session-metrics {
    display: none;
    margin-left: auto;
    font-size: 10px;
    color: var(--text-tertiary);
    font-family: var(--font-families-mono);
    opacity: 0.65;
    white-space: nowrap;
}

.assistant-send-button {
    align-self: flex-start;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background-color: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    font-family: var(--font-families-sans);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.assistant-send-button:hover:not(:disabled) {
    background-color: var(--input-bg);
    color: var(--text-primary);
    border-color: var(--text-primary);
}

.assistant-send-button:active:not(:disabled) {
    background-color: var(--border-primary);
}

.assistant-send-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.assistant-send-button > .material-symbols-outlined {
    font-size: 18px;
}

.assistant-input-controls .assistant-status {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-left: auto;
}

@keyframes assistant-spin {
    to {
        transform: rotate(360deg);
    }
}

/* The transcript itself is styled by css/assistant-chat.css (.assistant-chat). */
/* Assistant stream indicator (spinner + stop button) */
#assistant-stream-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.assistant-stream-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--border-primary);
    border-top: 2px solid var(--view-assistant);
    border-radius: 50%;
    animation: assistant-spin 0.8s linear infinite;
    flex-shrink: 0;
}

.assistant-stop-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 1px solid var(--border-primary);
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: 4px;
    padding: 0;
    transition: all 0.15s ease;
}

.assistant-stop-button:hover {
    color: var(--view-assistant);
    border-color: var(--view-assistant);
    background-color: rgba(239, 65, 54, 0.1);
}

.assistant-stop-button .material-symbols-outlined {
    font-size: 16px;
}

/* ======================== END ASSISTANT VIEW ======================== */

/* Diff Review Modal */
.diff-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgb(0 0 0 / 34%);
    backdrop-filter: blur(4px);
}

.diff-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.diff-modal-content {
    background-color: var(--background-primary);
    border: 2px solid var(--border-tertiary);
    width: 90%;
    max-width: 1400px;
    height: 85%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.diff-modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-tertiary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--background-tertiary);
}

.diff-modal-header h2 {
    margin: 0;
    font-family: var(--font-families-mono);
    font-size: calc(var(--size, 1) * (16px / var(--pixel-density, 1)));
    font-weight: bold;
    color: var(--text-tertiary);
}

.diff-modal-close {
    background: transparent;
    border: 1px solid var(--border-tertiary);
    color: var(--text-muted);
    font-size: 24px;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.2s ease;
    font-family: var(--font-families-mono);
    line-height: 1;
}

.diff-modal-close:hover {
    background: var(--input-bg);
    border-color: var(--text-muted);
}

.diff-modal-body {
    flex: 1;
    overflow: auto;
    padding: 16px;
    background-color: var(--background-secondary);
}

/* Settings Panel */
.settings-button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border-radius: 4px;
    position: relative;
}

.settings-button:hover {
    background: var(--input-bg);
    color: var(--text-primary);
}

.settings-button .material-symbols-outlined {
    font-size: 24px;
}

.settings-update-label {
    display: none;
}

/* Update available: the gear becomes the end segment of a labelled chip,
   styled like the Take a Tour and Link Folder buttons. */
.settings-button.has-update {
    width: auto;
    align-items: stretch;
    background-color: var(--update-button-bg);
    border: 1px solid var(--update-button-border);
    color: var(--update-button-text);
}

.settings-button.has-update:hover {
    background-color: var(--update-button-bg);
    color: var(--update-button-text);
    filter: brightness(1.08);
}

.settings-button.has-update .settings-update-label {
    display: flex;
    align-items: center;
    padding: 0 6px 0 12px;
    font-family: var(--font-families-sans);
    font-size: 12px;
    white-space: nowrap;
}

.settings-button.has-update .material-symbols-outlined {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    border-left: 1px solid var(--update-button-border);
    font-size: 20px;
}

/* Memory notification indicator on settings button */
.settings-memory-indicator {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.settings-memory-indicator.warning {
    background-color: var(--accent-yellow);
}

.settings-memory-indicator.critical {
    background-color: var(--accent-red);
    animation: pulse-indicator 1s ease-in-out infinite;
}

.shard-memory-warning {
    margin: 8px 0 0;
    color: var(--accent-yellow);
    font-size: 12px;
}

#truncate-undo-history-btn {
    margin-top: 8px;
}

@keyframes pulse-indicator {
    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

.settings-panel {
    position: fixed;
    top: 51px;
    right: -350px;
    width: 350px;
    height: calc(100vh - 50px);
    background-color: var(--background-secondary);
    border-left: 3px solid var(--border-primary);
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9999;
    display: flex;
    flex-direction: column;
}

.settings-panel.open {
    right: 0;
}

.settings-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.settings-section {
    margin-bottom: 32px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-item {
    margin-bottom: 16px;
}

.settings-item-label {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: block;
    font-weight: 500;
}

.settings-item-label-with-icon {
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-item-label-with-icon .material-symbols-outlined {
    font-size: 20px;
    color: var(--text-secondary);
}

.settings-item-description {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
    line-height: 1.5;
}

.settings-version-number {
    font-family: var(--font-families-mono);
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.4;
}

.settings-version-rows {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.settings-version-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.settings-version-row[hidden] {
    display: none;
}

/* Installed and Available are only labelled when both are shown. */
.settings-version-key {
    display: none;
    min-width: 60px;
    font-family: var(--font-families-sans);
    font-size: 12px;
    color: var(--text-secondary);
}

.settings-version-rows.has-update .settings-version-key {
    display: inline;
}

.settings-up-to-date {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: -4px;
    font-family: var(--font-families-sans);
    font-size: 12px;
    color: var(--update-confirmed-text);
}

.settings-up-to-date[hidden] {
    display: none;
}

.settings-up-to-date .material-symbols-outlined {
    font-size: 15px;
}

/* Same look as the title-bar update button. */
.settings-update-btn {
    display: inline-flex;
    align-items: stretch;
    height: 32px;
    padding: 0;
    background-color: var(--update-button-bg);
    border: 1px solid var(--update-button-border);
    color: var(--update-button-text);
    border-radius: 4px;
    font-family: var(--font-families-sans);
    cursor: pointer;
}

.settings-update-btn[hidden] {
    display: none;
}

.settings-update-btn:hover:not(:disabled) {
    filter: brightness(1.08);
}

.settings-update-btn:disabled {
    cursor: default;
    opacity: 0.75;
}

.settings-update-btn-label {
    display: flex;
    align-items: center;
    padding: 0 6px 0 12px;
    font-size: 12px;
    white-space: nowrap;
}

.settings-update-btn-end {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    border-left: 1px solid var(--update-button-border);
}

.settings-update-btn-end .material-symbols-outlined {
    font-size: 20px;
}

.settings-update-btn-end .material-symbols-outlined.spinning {
    animation: settings-update-spin 1s linear infinite;
}

@keyframes settings-update-spin {
    to {
        transform: rotate(360deg);
    }
}

.settings-update-links {
    display: flex;
    align-items: center;
    margin-top: 8px;
    font-size: 12px;
}

.settings-update-links[hidden] {
    display: none;
}

.settings-update-links a {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    color: var(--text-secondary);
}

.settings-update-links a .material-symbols-outlined {
    font-size: 14px;
}

.settings-version-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.settings-auto-update {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border-primary);
}

.settings-switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
}

.settings-switch-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.settings-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.settings-switch input {
    position: absolute;
    opacity: 0;
    width: 36px;
    height: 20px;
    margin: 0;
    cursor: pointer;
}

.settings-switch-track {
    position: relative;
    width: 36px;
    height: 20px;
    border-radius: 999px;
    background-color: var(--button-bg);
    border: 1px solid var(--button-border);
    transition:
        background-color 0.15s ease,
        border-color 0.15s ease;
}

.settings-switch-track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: var(--text-secondary);
    transition:
        transform 0.15s ease,
        background-color 0.15s ease;
}

.settings-switch input:checked + .settings-switch-track {
    background-color: var(--accent-blue);
    border-color: var(--accent-blue);
}

.settings-switch input:checked + .settings-switch-track::after {
    transform: translateX(16px);
    background-color: var(--background-primary);
}

.settings-switch input:focus-visible + .settings-switch-track {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

/* Theme Switcher */
.theme-switcher {
    display: flex;
    gap: 8px;
}

.settings-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background-color: var(--button-bg);
    border: 1px solid var(--button-border);
    color: var(--button-text);
    font-family: var(--font-families-sans);
    font-size: 12px;
    line-height: 1.2;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
}

.settings-action-btn[hidden] {
    display: none;
}

.settings-action-btn .material-symbols-outlined {
    font-size: 16px;
}

.settings-action-btn:hover:not(:disabled) {
    background-color: var(--button-hover-bg);
    border-color: var(--border-secondary);
    color: var(--text-primary);
}

.settings-action-btn:disabled {
    cursor: wait;
    opacity: 0.6;
}

.settings-action-btn.active {
    background-color: var(--background-active);
    color: var(--text-primary);
    border-color: var(--border-secondary);
}

.theme-option {
    flex: 1;
}

.settings-folder-control {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.settings-account-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.settings-credits {
    margin-top: 2px;
    font-size: 11px;
}

.settings-folder-name {
    min-width: 0;
    overflow: hidden;
    padding: 8px 10px;
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 13px;
    line-height: 20px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Memory Display in Settings */
.memory-display-settings {
    display: flex;
    align-items: center;
    gap: 12px;
}

.memory-bar-container {
    flex: 1;
    height: 8px;
    background-color: var(--background-primary);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    overflow: hidden;
}

.memory-bar {
    height: 100%;
    transition:
        width 0.3s ease,
        background-color 0.3s ease;
    background-color: var(--accent-green);
}

.memory-bar.warning {
    background-color: var(--accent-yellow);
}

.memory-bar.critical {
    background-color: var(--accent-red);
}

.memory-percentage {
    font-family: var(--font-families-mono);
    font-size: 13px;
    color: var(--text-primary);
    min-width: 45px;
    text-align: right;
    font-weight: 600;
}

.memory-details {
    font-family: var(--font-families-mono);
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 6px;
    line-height: 1.5;
}

.info-popup.memory-usage-popup {
    max-width: 720px;
    width: min(720px, 92vw);
}

.memory-breakdown-tables {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.memory-breakdown-block h4 {
    margin: 0 0 8px;
}

.memory-breakdown-status {
    font-family: var(--font-families-mono);
    font-size: 11px;
    color: var(--text-secondary);
    margin: 0 0 8px;
}

.memory-breakdown-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-families-mono);
    font-size: 11px;
    line-height: 1.4;
}

.memory-breakdown-table th,
.memory-breakdown-table td {
    padding: 4px 6px;
    border-bottom: 1px solid var(--border-primary);
    text-align: left;
    vertical-align: top;
    color: var(--text-secondary);
}

.memory-breakdown-table th {
    color: var(--text-primary);
    font-weight: 600;
}

.memory-breakdown-table tr.memory-breakdown-section th {
    padding-top: 10px;
    background-color: var(--background-secondary);
    color: var(--text-primary);
    font-weight: 600;
}

.memory-breakdown-table tfoot td {
    color: var(--text-primary);
    font-weight: 600;
    border-bottom: 1px solid var(--border-primary);
}

.memory-breakdown-table tfoot tr:first-child td {
    padding-top: 10px;
}

.memory-breakdown-table tfoot tr:last-child td {
    border-bottom: none;
}

.memory-breakdown-num {
    white-space: nowrap;
    text-align: right;
}

.memory-breakdown-note {
    color: var(--text-tertiary);
}

/* Info Icon Button (Reusable) */
.info-icon-btn {
    background: none;
    border: none;
    padding: 0;
    margin-left: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-blue);
    opacity: 0.7;
    transition:
        opacity 0.2s ease,
        transform 0.2s ease;
    vertical-align: middle;
}

.info-icon-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.info-icon-btn .material-symbols-outlined {
    font-size: 16px;
}

/* Must follow .info-popup so width/max-* beat the default 500px / 90% shell. */
.info-popup.kerning-editor-popup {
    height: auto;
    max-height: calc(100vh - 48px);
    max-width: calc(100vw - 48px);
    width: max-content;
}

.find-glyph-popup {
    max-width: min(640px, calc(100vw - 32px));
}

.find-glyph-content {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    padding: 16px 20px 20px;
    overflow: hidden;
}

.find-glyph-search {
    width: 100%;
    box-sizing: border-box;
    padding: 6px 8px;
    border: 1px solid var(--border-primary);
}

.find-glyph-search-input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text-primary);
    font: inherit;
}

.find-glyph-search-input::placeholder {
    color: var(--text-faint);
}

.find-glyph-list {
    height: min(56vh, 480px);
    min-height: 0;
    overflow-y: auto;
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    background: var(--background-secondary);
}

.find-glyph-row {
    display: flex;
    box-sizing: border-box;
    height: 68px;
    align-items: stretch;
    gap: 12px;
    padding: 0 12px 0 0;
    border-bottom: 1px solid var(--border-primary);
    cursor: pointer;
}

.find-glyph-row[aria-selected='true'] {
    background: color-mix(in srgb, var(--background-secondary) 94%, black);
    box-shadow: inset 3px 0 0 var(--view-editor);
}

.find-glyph-preview {
    width: 67px;
    flex: 0 0 67px;
    align-self: stretch;
    background: color-mix(in srgb, var(--background-secondary) 50%, white);
}

.find-glyph-row[aria-selected='true'] .find-glyph-preview {
    background: var(--background-editor-sidebar);
}

.find-glyph-details {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 8px 0;
}

.find-glyph-name {
    overflow: hidden;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.find-glyph-unicode {
    margin-top: 3px;
    color: var(--text-faint);
    font-family: var(--font-families-mono);
    font-size: 11px;
}

.find-glyph-empty {
    padding: 20px;
    color: var(--text-faint);
    text-align: center;
}

.find-glyph-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
}

.add-glyphs-quota-error {
    flex: 1;
    margin: 0;
    margin-right: auto;
    color: var(--status-error);
    font-size: 12px;
}

.plugin-manager-popup {
    max-width: 680px;
    max-width: min(680px, calc(100vw - 32px));
}

.plugin-manager-section {
    min-width: 0;
}

.plugin-manager-storage-notice {
    display: grid;
    gap: 12px;
    min-width: 0;
}

.plugin-manager-storage-notice h4,
.plugin-manager-storage-notice p {
    margin: 0;
}

.plugin-manager-storage-notice h4 {
    color: var(--text-primary);
    font-size: 14px;
}

.plugin-manager-storage-notice .plugin-manager-action {
    justify-self: start;
}

.plugin-manager-diagnostics {
    display: grid;
    gap: 6px;
    margin-bottom: 12px;
    padding: 10px;
    border: 1px solid var(--accent-yellow);
    border-radius: 4px;
    background: var(--background-secondary);
}

.plugin-manager-diagnostics h4,
.plugin-manager-diagnostics p {
    margin: 0;
}

.plugin-manager-diagnostics h4 {
    color: var(--text-primary);
    font-size: 13px;
}

.plugin-manager-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 12px;
}

.plugin-manager-section h4 {
    margin: 0;
    color: var(--text-primary);
    font-size: 14px;
}

.plugin-manager-reload {
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--accent-lightblue);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.plugin-manager-reload:hover {
    text-decoration: underline;
}

.plugin-manager-price {
    margin: 0;
    max-width: 140px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    text-align: right;
}

.plugin-manager-search-wrap {
    width: 100%;
    margin: 0 0 12px;
}

.plugin-manager-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.plugin-manager-pay-hint {
    max-width: 168px;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--accent-lightblue);
    font: inherit;
    font-size: 12px;
    line-height: 1.35;
    text-align: right;
    cursor: pointer;
}

.plugin-manager-pay-hint:hover {
    text-decoration: underline;
}

.plugin-manager-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.plugin-manager-spinner,
.add-glyph-loading-spinner {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    border: 2px solid var(--border-primary);
    border-top-color: var(--text-primary);
    border-radius: 50%;
    animation: assistant-spin 0.8s linear infinite;
}

.plugin-purchase-sheet {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    background: var(--modal-overlay);
    animation: infoPopupFadeIn 0.2s ease;
}

.plugin-purchase-card {
    display: grid;
    gap: 16px;
    width: min(400px, calc(100% - 32px));
    padding: 24px;
    border: 1px solid var(--border-primary);
    border-radius: 10px;
    background: var(--modal-bg);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    color: var(--text-primary);
    font-size: 13px;
    animation: infoPopupSlideUp 0.3s ease;
}

.plugin-purchase-card h4,
.plugin-purchase-card p,
.plugin-purchase-card dl,
.plugin-purchase-card dd {
    margin: 0;
}

.plugin-purchase-header {
    display: grid;
    gap: 4px;
}

.plugin-purchase-eyebrow,
.plugin-purchase-label {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.plugin-purchase-header h4 {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.plugin-purchase-meta {
    color: var(--text-secondary);
    font-size: 12px;
    overflow-wrap: anywhere;
}

.plugin-purchase-summary {
    display: grid;
    gap: 8px;
    padding: 14px 16px;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    background: var(--background-secondary);
}

.plugin-purchase-line {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--text-secondary);
}

.plugin-purchase-line dd {
    font-variant-numeric: tabular-nums;
}

.plugin-purchase-total {
    margin-top: 4px;
    padding-top: 10px;
    border-top: 1px solid var(--border-primary);
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
}

.plugin-purchase-method {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
}

.plugin-purchase-method-icon {
    color: var(--text-secondary);
    font-size: 22px;
}

.plugin-purchase-method-text {
    display: grid;
    flex: 1;
    gap: 2px;
    min-width: 0;
    overflow-wrap: anywhere;
}

.plugin-purchase-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.plugin-purchase-actions .dialog-button {
    padding: 8px 18px;
    font-size: 13px;
}

.plugin-purchase-actions .dialog-button-primary {
    font-weight: 600;
}

.plugin-purchase-invoice {
    text-decoration: none;
}

.plugin-purchase-link {
    border: 0;
    padding: 0;
    background: none;
    color: var(--accent-lightblue);
    font: inherit;
    cursor: pointer;
}

.plugin-purchase-link:hover,
.plugin-purchase-footnote a:hover {
    text-decoration: underline;
}

.plugin-purchase-footnote {
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.5;
    text-align: center;
}

.plugin-purchase-footnote a {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: var(--border-primary);
}

.plugin-purchase-error {
    padding: 10px 12px;
    border-radius: 6px;
    background: color-mix(in srgb, var(--accent-red) 12%, transparent);
    color: var(--accent-red);
    line-height: 1.4;
}

.plugin-purchase-error[hidden] {
    display: none;
}

.plugin-purchase-success {
    display: grid;
    justify-items: center;
    gap: 6px;
    padding: 8px 0 4px;
    text-align: center;
}

.plugin-purchase-success-icon {
    color: var(--accent-green);
    font-size: 40px;
}

.plugin-purchase-success h4 {
    font-size: 18px;
    font-weight: 600;
}

.plugin-purchase-success p {
    color: var(--text-secondary);
}

.plugin-manager-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: start;
    min-width: 0;
    padding: 14px 8px 14px 0;
    border-top: 1px solid var(--border-primary);
}

.plugin-manager-row[hidden] {
    display: none;
}

.plugin-manager-row:first-of-type {
    border-top: 0;
}

.plugin-manager-details h5,
.plugin-manager-details p {
    margin: 0;
    overflow-wrap: anywhere;
}

.plugin-manager-details {
    min-width: 0;
}

.plugin-manager-image {
    display: block;
    width: 100%;
    height: auto;
    margin-top: 8px;
    border: 1px solid var(--border-primary);
    border-radius: 4px;
}

.plugin-manager-details h5 {
    color: var(--text-primary);
    font-size: 13px;
}

.plugin-manager-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.plugin-screened {
    display: inline-flex;
    flex: 0 0 auto;
    border-radius: 3px;
    color: var(--accent-blue);
}

.plugin-screened:focus-visible {
    outline: 2px solid var(--border-focus-outline);
    outline-offset: 1px;
}

.plugin-screened svg {
    width: 17px;
    height: 17px;
}

.plugin-screened-panel {
    display: grid;
    gap: 8px;
    padding: 6px 4px;
    font-size: 12px;
    line-height: 1.45;
}

.plugin-screened-panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.plugin-screened-panel-header h5 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
}

.plugin-screened-panel-icon {
    display: inline-flex;
    color: var(--accent-blue);
}

.plugin-screened-panel-icon svg {
    width: 18px;
    height: 18px;
}

.plugin-screened-panel p {
    margin: 0;
    color: var(--text-secondary);
}

.plugin-screened-panel ul {
    display: grid;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.plugin-screened-panel li {
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.plugin-screened-panel li .material-symbols-outlined {
    color: var(--accent-green);
    font-size: 16px;
}

.plugin-installed-badge {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 4px;
    margin-left: 4px;
    padding: 2px 8px 2px 5px;
    border: 1px solid color-mix(in srgb, var(--accent-green) 45%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent-green) 14%, transparent);
    color: var(--accent-green);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.plugin-installed-badge .material-symbols-outlined {
    font-size: 14px;
    font-variation-settings: 'FILL' 1;
}

.plugin-update-badge {
    margin-left: 0;
    border-color: color-mix(in srgb, var(--accent-orange) 45%, transparent);
    background: color-mix(in srgb, var(--accent-orange) 14%, transparent);
    color: var(--accent-orange);
}

.plugin-manager-details p {
    margin-top: 3px;
}

.plugin-manager-details a {
    display: inline-block;
    margin-top: 5px;
    color: var(--accent-blue);
    max-width: 100%;
    overflow-wrap: anywhere;
}

.plugin-manager-action {
    /* Extends .dialog-button */
    min-width: 78px;
}
.toolbar-menu-bar {
    display: flex;
    align-items: center;
    gap: 1px;
    margin-left: 12px;
}

.toolbar-menu-trigger {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    height: 26px;
    padding: 0 6px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: var(--font-families-sans);
    font-size: 13px;
    transition:
        background-color 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease;
}

.toolbar-menu-trigger:hover,
.toolbar-menu-trigger.menu-active {
    background: var(--input-bg);
    border-color: var(--border-primary);
    color: var(--text-primary);
}

.toolbar-menu-trigger .material-symbols-outlined {
    font-size: 16px;
    color: inherit;
}

.toolbar-menu {
    min-width: 230px;
    overflow: visible;
}

.plugin-menu-item.disabled {
    opacity: 0.45;
    cursor: default;
    pointer-events: none;
}

.plugin-menu-item.toolbar-menu-item {
    min-height: 32px;
}

@media (max-width: 820px) {
    .toolbar-menu-bar {
        margin-left: 10px;
    }

    .toolbar-menu-trigger {
        padding: 0 8px;
    }
}

.feature-variation-settings-coordinate-note {
    display: block;
    margin-top: 8px;
    color: var(--text-tertiary);
    font-size: 11px;
    line-height: 1.3;
}

/* The class sits on the Tippy root (popper), so the box is its child. */
.delete-glyphs-preview-tippy > .tippy-box {
    max-height: min(360px, 70vh);
    color: var(--text-primary);
}

.delete-glyphs-preview-tippy > .tippy-box > .tippy-content {
    max-height: min(360px, 70vh);
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    padding: 8px !important;
}

.delete-glyphs-preview {
    max-width: 520px;
    color: var(--text-primary);
}

.delete-glyphs-preview-empty {
    font-size: 12px;
    color: var(--text-faint);
}

.delete-glyphs-preview-heading {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 6px 0;
}

.delete-glyphs-fea-block + .delete-glyphs-fea-block {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border-primary);
}

.delete-glyphs-kern-block + .delete-glyphs-kern-block {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border-primary);
}

.delete-glyphs-fea-line {
    display: grid;
    grid-template-columns: 3ch 1fr;
    gap: 8px;
    align-items: start;
    font-family: var(--font-families-mono);
    font-size: 11px;
    line-height: 1.55;
}

.delete-glyphs-fea-line-number {
    color: var(--text-faint);
    text-align: right;
    user-select: none;
}

.delete-glyphs-fea-code {
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text-primary);
}

.delete-glyphs-fea-preview .fea-comment {
    color: var(--text-faint);
    font-style: italic;
}

.delete-glyphs-fea-preview .fea-string {
    color: var(--accent-green);
}

.delete-glyphs-fea-preview .fea-number {
    color: var(--accent-blue);
}

.delete-glyphs-fea-preview .fea-class {
    color: var(--accent-cyan);
}

.delete-glyphs-fea-preview .fea-keyword {
    color: var(--accent-magenta);
    font-weight: 600;
}

.delete-glyphs-fea-preview .fea-support {
    color: var(--accent-blue);
}

.delete-glyphs-fea-preview .fea-ident {
    color: var(--text-primary);
}

.delete-glyphs-fea-preview .fea-glyph-hit {
    background: rgba(255, 200, 0, 0.3);
    border-radius: 2px;
}

:root[data-theme='light'] .delete-glyphs-fea-preview .fea-glyph-hit {
    background: rgba(255, 220, 0, 0.4);
}

.delete-glyphs-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    color: var(--text-primary);
}

.delete-glyphs-preview-table th,
.delete-glyphs-preview-table td {
    text-align: left;
    padding: 4px 8px;
    border-bottom: 1px solid var(--border-primary);
    vertical-align: top;
    color: var(--text-primary);
    overflow-wrap: anywhere;
}

.delete-glyphs-preview-table th {
    color: var(--text-faint);
    font-weight: 600;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.delete-glyphs-preview-table td code {
    font-family: var(--font-families-mono);
    font-size: 11px;
    color: var(--text-secondary);
}

.delete-glyphs-kern-value {
    font-family: var(--font-families-mono);
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.delete-glyphs-kern-row-remove td {
    color: var(--accent-red);
    font-weight: 700;
}

.delete-glyphs-kern-row-keep td {
    color: var(--text-primary);
    font-weight: 400;
}

.delete-glyphs-preview-legend {
    margin: 0 0 10px 0;
    font-size: 11px;
    line-height: 1.45;
    color: var(--text-secondary);
}

.delete-glyphs-kern-legend-remove {
    color: var(--accent-red);
    font-weight: 700;
}

.diff-explanation {
    margin-top: 24px;
    padding: 16px;
    background-color: var(--input-bg);
    border-top: 1px solid var(--border-tertiary);
    font-family: 'Inter', sans-serif;
    font-size: calc(var(--size, 1) * (12px / var(--pixel-density, 1)));
    line-height: 1.6;
    color: var(--text-tertiary);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Apply same markdown styles to diff explanation */
.diff-explanation h1,
.diff-explanation h2,
.diff-explanation h3 {
    font-family: var(--font-families-mono);
    color: var(--text-primary);
    margin: 12px 0 8px 0;
    font-weight: bold;
}

.diff-explanation h1 {
    font-size: calc(var(--size, 1) * (18px / var(--pixel-density, 1)));
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 4px;
}

.diff-explanation h2 {
    font-size: calc(var(--size, 1) * (16px / var(--pixel-density, 1)));
}

.diff-explanation h3 {
    font-size: calc(var(--size, 1) * (14px / var(--pixel-density, 1)));
}

.diff-explanation strong {
    font-weight: bold;
    color: var(--text-primary);
}

.diff-explanation em {
    font-style: italic;
    color: var(--text-tertiary);
}

.diff-explanation code {
    font-family: var(--font-families-mono);
    background-color: var(--code-bg);
    padding: 2px 6px;
    border-radius: 3px;
    color: var(--text-tertiary);
}

.diff-explanation a {
    color: var(--accent-blue);
    text-decoration: none;
    border-bottom: 1px solid var(--accent-blue);
    transition: all 0.2s ease;
}

.diff-explanation a:hover {
    color: var(--accent-cyan);
    border-bottom-color: var(--accent-cyan);
}

.diff-explanation ul,
.diff-explanation ol {
    margin: 8px 0;
    padding-left: 24px;
}

.diff-explanation li {
    margin: 4px 0;
    list-style-position: outside;
}

.diff-explanation ul li {
    list-style-type: disc;
}

.diff-explanation ol li {
    list-style-type: decimal;
}

.diff-explanation p {
    margin: 8px 0;
}

.diff-explanation p:first-child {
    margin-top: 0;
}

.diff-explanation p:last-child {
    margin-bottom: 0;
}

.diff-explanation pre {
    background-color: var(--code-bg);
    padding: 12px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 8px 0;
}

.diff-explanation pre code {
    background-color: transparent;
    padding: 0;
    border-radius: 0;
    color: var(--text-tertiary);
}

.diff-explanation blockquote {
    border-left: 3px solid var(--accent-blue);
    padding-left: 12px;
    margin: 8px 0;
    color: var(--text-muted);
    font-style: italic;
}

.diff-explanation hr {
    border: none;
    border-top: 1px solid var(--border-tertiary);
    margin: 16px 0;
}

.diff-explanation table {
    border-collapse: collapse;
    margin: 8px 0;
    width: 100%;
}

.diff-explanation th,
.diff-explanation td {
    border: 1px solid var(--border-tertiary);
    padding: 6px 12px;
    text-align: left;
}

.diff-explanation th {
    background-color: var(--input-bg);
    font-weight: bold;
}

.diff-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-tertiary);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background-color: var(--background-tertiary);
}

/* Override diff2html styles for dark theme */
#diff-container {
    --d2h-empty-placeholder-bg-color: none;
}

#diff-container,
#diff-container * {
    font-family: var(--font-families-mono) !important;
}

#diff-container .d2h-file-header {
    display: none !important;
}

#diff-container .d2h-code-line ins,
#diff-container .d2h-code-side-line ins {
    color: var(--text-primary) !important;
}

#diff-container .d2h-code-line del,
#diff-container .d2h-code-side-line del {
    color: var(--text-primary) !important;
}

/* Dark borders */
#diff-container * {
    border-color: rgba(255, 255, 255, 0.1) !important;
}

#diff-container .d2h-file-diff {
    border-color: var(--border-tertiary);
}

#diff-container .d2h-code-side-linenumber,
#diff-container .d2h-code-linenumber {
    background-color: var(--background-tertiary);
    border-color: var(--border-primary);
    color: var(--text-faint);
    position: static !important;
}

#diff-container .d2h-ins {
    background-color: rgba(0, 255, 0, 0.15);
}

#diff-container .d2h-ins .d2h-code-side-linenumber,
#diff-container .d2h-ins .d2h-code-linenumber {
    background-color: rgba(0, 255, 0, 0.2);
    border-color: rgba(0, 255, 0, 0.3);
}

#diff-container .d2h-del {
    background-color: rgba(255, 0, 0, 0.15);
}

#diff-container .d2h-del .d2h-code-side-linenumber,
#diff-container .d2h-del .d2h-code-linenumber {
    background-color: rgba(255, 0, 0, 0.2);
    border-color: rgba(255, 0, 0, 0.3);
}

#diff-container .d2h-code-line {
    color: var(--text-tertiary);
}

#diff-container .d2h-info {
    background-color: var(--ai-user-bg);
    color: var(--ai-user-text);
}

/* ====================== */
/* Glyph Canvas Styles    */
/* ====================== */

#glyph-canvas-stage {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: auto;
}

/* Toolbar must sit above .plugin-menu-backdrop (9998) so sibling menu
   titles stay hoverable while a menu is open. Tippy menus use 10001. */
.toolbar {
    position: relative;
    z-index: 9999;
}

.app-shell,
.container {
    position: relative;
    z-index: 1;
}

body.preview-mode-chrome.preview-area-full .toolbar,
body.preview-mode-chrome.preview-area-full .app-shell {
    opacity: var(--preview-chrome-opacity, 1);
    transition: none;
}

body.preview-mode-chrome.preview-area-medium #view-editor .view-title-bar,
body.preview-mode-chrome.preview-area-medium #view-editor .view-sidebar,
body.preview-mode-chrome.preview-area-medium
    #glyph-canvas-container
    > .glyph-property-panel {
    opacity: var(--preview-chrome-opacity, 1);
    transition: none;
}

/* Click-through from the first Space-preview frame, including hole
   descendants that otherwise set pointer-events: auto. */
body.preview-mode-chrome.preview-area-full .toolbar,
body.preview-mode-chrome.preview-area-full .app-shell,
body.preview-mode-chrome.preview-area-full .toolbar *,
body.preview-mode-chrome.preview-area-full .app-shell *,
body.preview-mode-chrome.preview-area-medium #view-editor .view-title-bar,
body.preview-mode-chrome.preview-area-medium #view-editor .view-sidebar,
body.preview-mode-chrome.preview-area-medium
    #glyph-canvas-container
    > .glyph-property-panel,
body.preview-mode-chrome.preview-area-medium #view-editor .view-title-bar *,
body.preview-mode-chrome.preview-area-medium #view-editor .view-sidebar *,
body.preview-mode-chrome.preview-area-medium
    #glyph-canvas-container
    > .glyph-property-panel
    * {
    pointer-events: none;
}

/* Canvas sits behind chrome; only the editor drawing slot is a hole. */
body.has-full-window-glyph-canvas .app-shell,
body.has-full-window-glyph-canvas .container {
    background-color: transparent;
}

/* View shells are rounded; the full-window canvas shows through those
   corner notches. Outline paints the chrome gutter color into them
   (outline is not clipped by overflow:hidden). */
body.has-full-window-glyph-canvas .view {
    outline: 6px solid var(--border-primary);
    outline-offset: 0;
}

body.has-full-window-glyph-canvas .container {
    box-shadow:
        inset 5px 0 0 var(--border-primary),
        inset -5px 0 0 var(--border-primary),
        inset 0 -5px 0 var(--border-primary);
}

body.has-full-window-glyph-canvas .app-shell,
body.has-full-window-glyph-canvas .container,
body.has-full-window-glyph-canvas .top-row,
body.has-full-window-glyph-canvas #view-editor,
body.has-full-window-glyph-canvas #view-editor .view-content,
body.has-full-window-glyph-canvas #glyph-canvas-container,
body.has-full-window-glyph-canvas .glyph-canvas-viewport {
    pointer-events: none;
}

body.has-full-window-glyph-canvas .container > :not(.top-row),
body.has-full-window-glyph-canvas .top-row > :not(#view-editor),
body.has-full-window-glyph-canvas .app-shell.docs-open > .view-docs,
body.has-full-window-glyph-canvas .app-shell.docs-open > #docs-divider,
body.has-full-window-glyph-canvas #view-editor .view-title-bar,
body.has-full-window-glyph-canvas #view-editor .view-sidebar,
body.has-full-window-glyph-canvas
    #glyph-canvas-container
    > .glyph-property-panel {
    pointer-events: auto;
}

#view-editor:has(#glyph-canvas-container) {
    background-color: transparent;
}

#view-editor:has(#glyph-canvas-container) .view-title-bar {
    background-color: var(--background-primary);
}

#glyph-canvas-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    background-color: transparent;
}

.glyph-canvas-viewport {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

#glyph-canvas-container canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.glyph-property-panel {
    flex: 0 0 auto;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px 12px;
    border-top: 1px solid var(--border-primary);
    background: var(--background-editor-sidebar);
}

#glyph-canvas-container > .glyph-property-panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    max-height: 40%;
    overflow-x: hidden;
    overflow-y: auto;
    box-sizing: border-box;
}

.glyph-property-panel.hidden {
    visibility: hidden;
    pointer-events: none;
}

.glyph-property-panel.component-properties {
    flex: 0 0 auto;
    min-height: 0;
    padding: 2px 12px;
}

.glyph-property-panel-content {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 2px;
}

.glyph-property-control,
.glyph-property-display,
.glyph-component-property-control,
.glyph-component-property-transform-group,
.glyph-kerning-side,
.glyph-kerning-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 0;
    padding: 4px;
    box-sizing: border-box;
    border: 1px solid var(--background-secondary);
    border-radius: 4px;
}

.glyph-property-control-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: center;
    line-height: 1.1;
}

.glyph-property-input {
    width: 48px;
    height: 18px;
    padding: 0 5px;
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    background: var(--background-primary);
    color: var(--text-primary);
    font-family: var(--font-families-mono);
    font-size: 10px;
    text-align: center;
    box-sizing: border-box;
}

select.glyph-property-input {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 16px;
    background-image: none;
}

.glyph-property-input.invalid {
    color: #d14b4b;
}

.glyph-property-value {
    color: var(--text-secondary);
    font-family: var(--font-families-mono);
    font-size: 10px;
    text-align: center;
    line-height: 1.1;
}

.glyph-property-display-value {
    color: var(--text-primary);
    font-family: var(--font-families-mono);
    font-size: 10px;
    text-align: center;
    line-height: 1.2;
    min-height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.glyph-auto-qa-widget {
    flex: 0 0 auto;
}

.glyph-auto-qa-icon {
    font-size: 18px;
    line-height: 1;
    color: var(--status-warning, #e6a817);
    cursor: help;
}

.glyph-auto-qa-popup {
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
}

.glyph-auto-qa-popup p {
    margin: 0;
}

.glyph-auto-qa-explainer {
    color: var(--text-faint);
    font-size: 11px;
    line-height: 1.35;
}

.glyph-auto-qa-popup .glyph-auto-qa-item-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.glyph-auto-qa-popup .glyph-auto-qa-item {
    margin: 0;
    color: var(--text-primary);
    font-size: 12px;
    line-height: 1.4;
    padding: 8px 10px;
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    background: var(--background-primary);
}

.glyph-auto-qa-popup .glyph-auto-qa-item pre {
    display: inline;
    margin: 0;
    padding: 0 4px;
    font-family: var(--font-families-mono);
    font-size: 11px;
    background: var(--background-hover);
    border-radius: 3px;
    white-space: nowrap;
}

.glyph-property-panel-placeholder {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding: 0;
}

.glyph-component-property-panel-content {
    width: 100%;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: center;
    gap: 2px;
}

.glyph-path-boolean-actions {
    display: grid;
    grid-template-columns: repeat(2, 24px);
    gap: 2px;
    align-self: center;
}

.glyph-path-boolean-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    background: var(--background-secondary);
    color: var(--text-primary);
    cursor: pointer;
}

.glyph-path-boolean-button:hover {
    background: var(--background-hover);
}

.glyph-path-boolean-button .material-symbols-outlined {
    font-size: 16px;
}

.glyph-path-boolean-button.is-filled .material-symbols-outlined {
    font-variation-settings:
        'FILL' 1,
        'wght' 400,
        'GRAD' 0,
        'opsz' 24;
}

.glyph-component-property-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: stretch;
    gap: 2px;
    width: 100%;
}

.glyph-component-property-control .glyph-property-input {
    width: 48px;
}

.glyph-anchor-property-name .glyph-property-input {
    width: 88px;
}

.glyph-component-property-reference {
    max-width: 240px;
    white-space: nowrap;
}

.glyph-component-property-transform-group {
    display: grid;
    grid-template-columns: auto auto;
    justify-items: center;
    align-items: center;
    align-content: center;
    column-gap: 2px;
    row-gap: 2px;
}

.glyph-component-property-transform-group > .glyph-property-control-label {
    grid-column: 1 / -1;
}

.glyph-component-property-transform-group > .glyph-component-property-control {
    border: none;
    background: transparent;
    padding: 0;
    gap: 0;
}

.glyph-kerning-center {
    width: max-content;
    max-width: 100%;
    justify-self: center;
}

.glyph-kerning-center > .glyph-property-panel-content {
    gap: 4px;
}

.glyph-kerning-center .glyph-property-control,
.glyph-kerning-center .glyph-property-display {
    border: none;
    padding: 0;
}

.glyph-component-reference-box {
    display: flex;
    align-items: center;
    gap: 0;
    width: 132px;
    height: 18px;
    padding: 0 0 0 5px;
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    background: var(--background-primary);
    color: var(--text-primary);
    font-family: var(--font-families-mono);
    font-size: 10px;
    box-sizing: border-box;
}

.glyph-component-reference-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: var(--font-families-mono);
    font-size: 10px;
    color: var(--text-primary);
    line-height: 16px;
}

.glyph-component-reference-replace {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    display: grid;
    place-items: center;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 3px;
}

.glyph-component-reference-replace .material-symbols-outlined {
    font-size: 14px;
}

.glyph-component-reference-replace:hover {
    color: var(--text-primary);
    background: var(--background-hover);
}

.glyph-component-property-checkbox {
    white-space: nowrap;
}

.glyph-component-property-auto-align {
    margin: 0;
}

.glyph-component-property-checkbox-input {
    width: 12px;
    height: 12px;
    margin: 0;
    accent-color: var(--accent-blue);
}

.glyph-property-input-mixed::placeholder {
    color: var(--text-muted);
}

.glyph-property-panel.glyph-kerning-groups-panel,
.glyph-property-panel.text-mode-kerning-panel {
    flex: 0 0 auto;
    min-height: 56px;
    padding: 2px 12px;
    --glyph-kerning-first-accent: var(--kerning-accent-first);
    --glyph-kerning-second-accent: var(--kerning-accent-second);
}

.glyph-property-panel.glyph-kerning-groups-rtl {
    --glyph-kerning-first-accent: var(--kerning-accent-second);
    --glyph-kerning-second-accent: var(--kerning-accent-first);
}

.glyph-kerning-panel-content {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: stretch;
}

.glyph-kerning-panel-shell {
    width: fit-content;
    max-width: 100%;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: auto;
    justify-content: center;
    justify-items: stretch;
    align-items: stretch;
    column-gap: 2px;
    row-gap: 2px;
}

.glyph-kerning-pills {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 2px;
    align-items: center;
    justify-content: center;
    max-width: 100%;
}

.glyph-kerning-side-multiline {
    width: 11.5rem;
    max-width: 100%;
}

.glyph-kerning-side-multiline .glyph-kerning-pills {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-content: center;
    width: 100%;
}

.glyph-kerning-side-multiline .glyph-kerning-pill {
    flex: 0 1 auto;
}

.glyph-kerning-pill {
    appearance: none;
    -webkit-appearance: none;
    background-color: var(--background-secondary);
    border: 1px solid transparent;
    border-radius: 999px;
    cursor: pointer;
    min-width: 0;
    max-width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    box-sizing: border-box;
    min-height: 13px;
    padding: 0 7px;
    font-family: var(--font-families-mono);
    font-size: 10px;
    color: var(--text-secondary);
    transition:
        background-color 0.15s ease,
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        color 0.15s ease;
}

.glyph-kerning-pill-base {
    font-weight: 600;
}

.glyph-kerning-pill-participates {
    background-color: var(--background-hover);
    color: var(--text-primary);
}

.glyph-kerning-pill.active[data-kerning-side='first'] {
    background-color: var(--glyph-kerning-first-accent);
    color: var(--text-primary);
}

.glyph-kerning-pill.active[data-kerning-side='second'] {
    background-color: var(--glyph-kerning-second-accent);
    color: var(--text-primary);
}

.glyph-property-control-label[data-kerning-side='first'] {
    color: var(--glyph-kerning-first-accent, var(--kerning-accent-first));
}

.glyph-property-control-label[data-kerning-side='second'] {
    color: var(--glyph-kerning-second-accent, var(--kerning-accent-second));
}

.glyph-kerning-pill.selected-glyph-group,
.glyph-kerning-pill.active.selected-glyph-group {
    border-color: var(--text-primary);
}

.glyph-kerning-pill.glyph-filter-legend-item {
    padding: 0 7px;
    gap: 4px;
}

.glyph-kerning-pill-label {
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: inherit;
    font-size: inherit;
    font-weight: 700;
    line-height: 1;
    color: inherit;
}

.glyph-kerning-pill-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 2px;
    min-width: 10px;
    height: 10px;
    border-radius: 999px;
    background-color: transparent;
    color: currentColor;
    font-size: 9px;
    line-height: 1;
    flex: 0 0 auto;
}

.glyph-kerning-pill-remove-icon {
    font-size: 9px;
    line-height: 1;
}

.glyph-kerning-pill:hover .glyph-kerning-pill-remove,
.glyph-kerning-pill.active .glyph-kerning-pill-remove {
    background-color: transparent;
    color: currentColor;
}

.glyph-kerning-pill-placeholder {
    border: 1px dashed var(--border-primary);
    background-color: transparent;
    color: var(--text-tertiary);
    font-weight: 400;
}

.glyph-kerning-pill-placeholder:hover {
    background-color: transparent;
    color: var(--text-secondary);
}

.glyph-kerning-code {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: max-content;
    max-width: 100%;
    gap: 2px;
    font-family: var(--font-families-mono);
    font-size: 12px;
    line-height: 1.2;
}

.glyph-kerning-code-line {
    display: flex;
    align-items: center;
    justify-content: center;
    width: max-content;
    max-width: 100%;
    white-space: nowrap;
}

.glyph-kerning-code-first {
    color: var(--glyph-kerning-first-accent);
    font-weight: 700;
}

.glyph-kerning-code-second {
    color: var(--glyph-kerning-second-accent);
    font-weight: 700;
}

.glyph-kerning-value-input {
    width: 52px;
    text-align: center;
    font-family: var(--font-families-mono);
    font-size: 10px;
}

@media (max-width: 900px) {
    .glyph-kerning-panel-shell {
        grid-template-columns: auto auto auto;
        column-gap: 2px;
    }
}

/* Only apply to editor view when canvas is present */
.view-editor:has(#glyph-canvas-container) .view-content {
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* Only apply to overview view when main container is present */
.view-overview:has(#overview-main) .view-content {
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* Glyph Editor Sidebar Styles */

/* Section headlines for both sidebars */
.editor-section-title {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    /* margin-top: 12px; */
    margin-bottom: -4px;
}

.editor-drawings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 0;
}

.editor-drawings-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
}

.editor-section-title-text {
    min-width: 0;
}

/* Masters/Layers list container (unified widget for both modes) */
.editor-drawings-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 0 -12px;
    /* Extend to edges of sidebar */
}

/* Individual master/layer item */
.editor-drawing-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--top-row-sidebar-element-gap, 8px);
    padding: var(--top-row-sidebar-item-block-padding, 5px)
        var(--top-row-sidebar-item-inline-padding, 12px);
    border-radius: 0;
    cursor: pointer;
    font-size: 11px;
    color: var(--text-primary);
    background-color: transparent;
    border-top: none;
    border-bottom: 1px solid var(--border-primary);
    border-left: none;
    border-right: none;
    transition: background-color 0.15s ease;
}

.editor-drawing-item:first-child {
    border-top: 1px solid var(--border-primary);
}

/* Dark theme colors - matches consolidated sidebar-item pattern */
:root:not([data-theme='light']) .editor-drawing-item:hover:not(.selected) {
    background-color: rgba(255, 255, 255, 0.05);
}

:root:not([data-theme='light']) .editor-drawing-item:hover:not(.selected) {
    background-color: rgba(255, 255, 255, 0.08);
}

:root:not([data-theme='light']) .editor-drawing-item.selected {
    background-color: rgba(255, 255, 255, 0.12);
}

/* Light theme colors - matches consolidated sidebar-item pattern */
:root[data-theme='light'] .editor-drawing-item:hover:not(.selected) {
    background-color: rgba(0, 0, 0, 0.06);
}

:root[data-theme='light'] .editor-drawing-item.selected {
    background-color: rgba(0, 0, 0, 0.1);
}

/* Inactive layer items (master without corresponding layer) */
.editor-drawing-item-content {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.editor-drawing-link-toggle,
.editor-drawing-add-button,
.editor-feature-variation-add-button {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    flex: 0 0 auto;
    opacity: 1;
    transition:
        opacity 0.15s ease,
        color 0.15s ease,
        background-color 0.15s ease;
}

.editor-drawing-link-toggle .material-symbols-outlined,
.editor-drawing-add-button .material-symbols-outlined,
.editor-feature-variation-add-button .material-symbols-outlined {
    font-size: 15px;
}

.editor-drawings-widget .editor-drawing-link-toggle[data-linked='true'] {
    opacity: 0;
    pointer-events: none;
}

.editor-drawings-widget:hover .editor-drawing-link-toggle[data-linked='true'] {
    opacity: 0.7;
    pointer-events: auto;
}

.editor-drawings-widget .editor-drawing-link-toggle[data-linked='false'] {
    opacity: 0.85;
    pointer-events: auto;
}

.editor-drawing-link-toggle:hover:not(:disabled),
.editor-drawing-add-button:hover:not(:disabled),
.editor-feature-variation-add-button:hover:not(:disabled) {
    color: var(--text-primary);
    background-color: var(--background-hover);
}

.editor-drawing-link-toggle:disabled,
.editor-drawing-add-button:disabled,
.editor-feature-variation-add-button:disabled {
    opacity: 0.3;
    cursor: default;
}

.editor-drawing-add-button,
.editor-feature-variation-add-button {
    opacity: 0.85;
    pointer-events: auto;
}

.editor-drawing-compatibility-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    color: var(--accent-red);
    flex: 0 0 auto;
}

.editor-drawing-compatibility-indicator .material-symbols-outlined {
    font-size: 15px;
}

:root:not([data-theme='light']) .editor-drawing-item.inactive:hover {
    background-color: rgba(255, 255, 255, 0.04);
}

:root[data-theme='light'] .editor-drawing-item.inactive:hover {
    background-color: rgba(0, 0, 0, 0.03);
}

.editor-drawing-add-button,
.editor-feature-variation-add-button {
    margin: 0;
}

/* Master/Layer item content */
.station-item-name {
    font-family: var(--font-families-sans);
    font-size: 11px;
    color: var(--text-primary);
}

.station-item-name-free {
    font-style: italic;
}

.station-item-location {
    font-family: var(--font-families-mono);
    font-size: 9px;
    color: var(--text-muted);
    margin-top: 2px;
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.station-item-location-line {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Axis controls container */
.editor-axis-container {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.editor-axis-label-row {
    display: flex;
    align-items: center;
    font-size: 11px;
    margin-bottom: 4px;
    gap: 4px;
}

.editor-axis-columns-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 32px 32px;
    align-items: center;
    gap: 1px;
    margin-top: 4px;
    color: var(--text-muted);
    font-family: var(--font-families-mono);
    font-size: 9px;
}

.editor-axis-columns-spacer {
    min-width: 0;
}

.editor-axis-column-label {
    text-align: right;
    padding-right: 5px;
}

.editor-axis-name {
    color: var(--text-primary);
    font-weight: 500;
    min-width: 0;
    flex: 1 1 auto;
}

.editor-axis-value-fields {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 1px;
}

.editor-axis-play-button {
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--text-secondary);
    opacity: 0.6;
    transition:
        opacity 0.15s ease,
        color 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
}

.editor-axis-play-button .material-symbols-outlined {
    font-size: 14px;
}

.editor-axis-play-button:hover {
    opacity: 1;
}

.editor-axis-play-button.playing {
    color: var(--accent-primary);
    opacity: 1;
}

.editor-axis-value {
    color: var(--text-secondary);
    font-family: var(--font-families-mono);
    font-size: 10px;
    background: transparent;
    border: 1px solid transparent;
    padding: 1px 3px;
    border-radius: 2px;
    text-align: right;
    width: 32px;
    transition: all 0.15s ease;
}

.editor-axis-value:hover {
    border-color: var(--border-secondary);
    background: var(--background-secondary);
}

.editor-axis-value:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--background-primary);
}

.editor-axis-slider {
    width: 100%;
}

.editor-axis-slider-wrap {
    position: relative;
    display: flex;
    align-items: center;
    height: 12px;
}

.editor-axis-slider-track {
    position: absolute;
    left: 6px;
    right: 6px;
    height: 4px;
    border-radius: 2px;
    pointer-events: none;
    z-index: 0;
    background: linear-gradient(
        to right,
        var(--text-secondary) 0%,
        var(--text-secondary) var(--value-percent, 50%),
        var(--border-primary) var(--value-percent, 50%),
        var(--border-primary) 100%
    );
}

.editor-axis-drawing-marks {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.editor-axis-drawing-mark {
    position: absolute;
    top: 50%;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border-primary);
    transform: translate(-50%, -50%);
    left: calc(6px + (100% - 12px) * var(--drawing-location-t, 0));
    z-index: 1;
}

.editor-axis-drawing-mark-passed {
    background: var(--text-secondary);
}

.editor-axis-slider-wrap .editor-axis-slider {
    position: relative;
    z-index: 2;
    height: 12px;
    background: transparent;
    margin: 0;
}

.editor-axis-slider-wrap .editor-axis-slider::-webkit-slider-runnable-track {
    background: transparent;
    height: 4px;
}

.editor-axis-slider-wrap .editor-axis-slider::-moz-range-track {
    background: transparent;
}

.editor-axis-slider-wrap .editor-axis-slider::-moz-range-progress {
    background: transparent;
}

.editor-axis-slider-wrap .editor-axis-slider::-webkit-slider-thumb {
    position: relative;
    z-index: 3;
}

/* Empty state message */
.editor-empty-message {
    font-size: 11px;
    color: var(--text-secondary);
    font-style: italic;
}

/* General Tag Button Style (used by OpenType features and plugins) */
.tag-button {
    font-family: var(--font-families-mono);
    font-size: 11px;
    font-weight: 600;
    padding: max(
            1px,
            calc(var(--top-row-sidebar-item-block-padding, 5px) - 2px)
        )
        var(--top-row-sidebar-item-inline-padding, 12px);
    border: 1px solid var(--border-primary);
    border-radius: 3px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
    min-width: 36px;
    text-align: center;
}

.tag-button:hover {
    background: var(--button-hover);
    border-color: var(--border-hover);
}

.tag-button.enabled {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.tag-button.enabled:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: var(--border-hover);
}

/* Light theme adjustments */
:root[data-theme='light'] .tag-button.enabled {
    background: rgba(0, 0, 0, 0.08);
    color: var(--text-primary);
}

:root[data-theme='light'] .tag-button.enabled:hover {
    background: rgba(0, 0, 0, 0.12);
}

/* ============================================================================
   CONSOLIDATED SIDEBAR STYLES
   ============================================================================
   These styles are shared across all three top view sidebars (editor, fontinfo,
   overview). Background colors and selection states automatically change based
   on whether the parent view has the 'focused' class.
   ============================================================================ */

/* Base sidebar container styles */
.view-sidebar {
    width: var(--top-row-sidebar-width, 200px);
    min-width: var(--top-row-sidebar-width, 200px);
    height: 100%;
    padding: var(--top-row-sidebar-padding, 12px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--top-row-sidebar-gap, 12px);
    flex-shrink: 0;
    background-color: var(--background-secondary);
    border-color: var(--border-primary);
}

/* Sidebar background */
.view-sidebar {
    background-color: var(--background-editor-sidebar);
}

/* Sidebar positioned on the left (border on right) */
.view-sidebar-left {
    border-right: 1px solid var(--border-primary);
}

/* Sidebar positioned on the right (border on left) */
.view-sidebar-right {
    border-left: 1px solid var(--border-primary);
}

/* Sidebar section title (shared across all sidebars) */
.sidebar-section-title {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: var(--top-row-sidebar-section-title-margin-top, 6px);
    margin-bottom: 0px;
}

/* .sidebar-section-title:first-child {
    margin-top: 0;
} */

/* Sidebar list container (extends to edges) */
.sidebar-list,
.features-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 0 calc(var(--top-row-sidebar-list-bleed, 12px) * -1);
}

/* Individual sidebar item */
.sidebar-item {
    padding: var(--top-row-sidebar-item-block-padding, 5px)
        var(--top-row-sidebar-item-inline-padding, 12px);
    border-radius: 0;
    cursor: pointer;
    font-size: 11px;
    color: var(--text-primary);
    background-color: transparent;
    border-top: none;
    /* border-bottom: 1px solid var(--border-primary); */
    border-left: none;
    border-right: none;
    transition: background-color 0.15s ease;
}

/* Dark theme - sidebar item hover */
:root:not([data-theme='light']) .sidebar-item:hover:not(.selected) {
    background-color: rgba(255, 255, 255, 0.08);
}

/* Dark theme - sidebar item selected */
:root:not([data-theme='light']) .sidebar-item.selected {
    background-color: rgba(255, 255, 255, 0.12);
}

/* Light theme - sidebar item hover */
:root[data-theme='light'] .sidebar-item:hover:not(.selected) {
    background-color: rgba(0, 0, 0, 0.06);
}

/* Light theme - sidebar item selected */
:root[data-theme='light'] .sidebar-item.selected {
    background-color: rgba(0, 0, 0, 0.1);
}

/* Inactive/disabled sidebar item */
.sidebar-item.inactive {
    opacity: 0.4;
    cursor: default;
}

:root:not([data-theme='light']) .sidebar-item.inactive:hover,
:root[data-theme='light'] .sidebar-item.inactive:hover {
    background-color: transparent;
}

/* General Tag Description Style (used by OpenType features and plugins) */
.tag-description {
    opacity: 0.7;
    font-size: 11px;
    flex: 1;
    user-select: none;
    font-family: 'Inter UI';
}

.tag-description.custom-name {
    background: var(--background-custom-name-highlight);
    padding: 4px 6px;
    border-radius: 3px;
    margin-left: -2px;
}

/* Critical Error Overlay */
#critical-error-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.critical-error-content {
    background: var(--background-secondary);
    border: 2px solid var(--accent-red);
    border-radius: 12px;
    padding: 40px;
    max-width: 600px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(255, 51, 0, 0.3);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.critical-error-icon {
    font-size: 64px;
    margin-bottom: 20px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.critical-error-title {
    color: var(--accent-red);
    font-size: 28px;
    font-weight: bold;
    margin: 0 0 20px 0;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.critical-error-message {
    color: var(--text-primary);
    font-size: 16px;
    margin: 0 0 30px 0;
    line-height: 1.6;
}

.critical-error-instructions {
    background: rgba(255, 51, 0, 0.1);
    border: 1px solid var(--accent-red);
    border-radius: 8px;
    padding: 20px;
    margin: 0 0 20px 0;
}

.critical-error-instructions p {
    color: var(--text-primary);
    font-size: 14px;
    margin: 8px 0;
    line-height: 1.6;
}

.critical-error-instructions strong {
    color: var(--accent-red);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.critical-error-details {
    border-top: 1px solid var(--border-primary);
    padding-top: 20px;
    margin-top: 20px;
}

.critical-error-details p {
    color: var(--text-secondary);
    font-size: 13px;
    margin: 8px 0;
    line-height: 1.5;
}

/* Font Info - Features View Styles */
.features-container {
    display: flex;
    height: 100%;
    overflow: hidden;
}

.features-sidebar {
    width: var(--top-row-sidebar-width, 200px);
    min-width: var(--top-row-sidebar-width, 200px);
    flex-shrink: 0;
    border-right: 1px solid var(--border-primary);
    overflow-y: auto;
    padding: var(--top-row-sidebar-padding, 12px);
    /* Background color is handled by consolidated sidebar styles */
}

/* Section titles for prefixes, classes, features */
.features-sidebar .editor-section-title {
    margin-top: var(--top-row-sidebar-section-title-margin-top, 6px);
    margin-bottom: var(--top-row-sidebar-element-gap, 8px);
}

.features-sidebar .editor-section-title:first-child {
    margin-top: 0;
}

.features-list[hidden],
.sidebar-section-title[hidden] {
    display: none;
}

.features-list + .editor-section-title {
    margin-top: calc(var(--top-row-sidebar-element-gap, 8px) * 2);
}

.features-empty {
    padding: 16px;
    text-align: center;
    color: var(--text-faint);
    font-size: 12px;
}

.feature-list-item {
    display: flex;
    position: relative;
    align-items: center;
    gap: var(--top-row-sidebar-element-gap, 8px);
    padding: var(--top-row-sidebar-item-block-padding, 3px)
        var(--top-row-sidebar-item-inline-padding, 12px);
    cursor: pointer;
    border-radius: 0;
    font-family: var(--font-families-sans);
    font-size: 11px;
    color: var(--text-primary);
    background-color: transparent;
    border-top: none;
    /* border-bottom: 1px solid var(--border-primary); */
    border-left: none;
    border-right: none;
    transition: background-color 0.15s ease;
}

/* Dark theme colors - matches consolidated sidebar-item pattern */
:root:not([data-theme='light']) .feature-list-item:hover:not(.selected) {
    background-color: rgba(255, 255, 255, 0.05);
}

:root:not([data-theme='light']) .feature-list-item.selected {
    background-color: rgba(255, 255, 255, 0.12);
}

/* Light theme colors - matches consolidated sidebar-item pattern */
:root[data-theme='light'] .feature-list-item:hover:not(.selected) {
    background-color: rgba(0, 0, 0, 0.06);
}

:root[data-theme='light'] .feature-list-item.selected {
    background-color: rgba(0, 0, 0, 0.1);
}

/* GSUB/GPOS indicator dots */
.feature-table-indicator {
    width: 11px;
    height: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.feature-table-circle {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: var(--text-primary);
    opacity: 0.1;
}

.feature-tag {
    font-family: var(--font-families-mono);
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}

.feature-name {
    font-family: var(--font-families-sans);
    font-size: 11px;
    color: var(--text-primary);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.feature-auto-icon {
    font-size: 14px !important;
    color: var(--text-secondary);
    opacity: 0.6;
    flex-shrink: 0;
}

.feature-auto-icon.is-managed {
    color: var(--accent-cyan);
    opacity: 1;
    font-weight: 700;
    filter: brightness(1.3) saturate(1.4);
}

.feature-manage-checkbox {
    padding: 6px 10px;
    font-size: 12px;
}

.feature-error-icon {
    font-size: 14px !important;
    color: var(--accent-orange);
    opacity: 0.85;
    flex-shrink: 0;
}

/* Drag handle for sortable features */
.feature-drag-handle {
    width: 11px;
    height: 12px;
    font-size: 14px !important;
    color: var(--text-primary);
    opacity: 0.3;
    flex-shrink: 0;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feature-drag-handle:active {
    cursor: grabbing;
}

.feature-list-item:hover .feature-drag-handle {
    opacity: 0.5;
}

/* Draggable features */
.draggable-feature {
    cursor: move;
    position: relative;
}

.draggable-feature:active {
    cursor: grabbing;
}

.draggable-feature.dragging {
    opacity: 0.5;
}

.draggable-feature.feature-drop-target-before::before,
.draggable-feature.feature-drop-target-after::after {
    content: '';
    position: absolute;
    left: var(--top-row-sidebar-item-inline-padding, 12px);
    right: var(--top-row-sidebar-item-inline-padding, 12px);
    height: 2px;
    border-radius: 999px;
    background-color: var(--accent-cyan);
    box-shadow: 0 0 0 1px
        color-mix(in srgb, var(--accent-cyan) 35%, transparent);
    pointer-events: none;
}

.draggable-feature.feature-drop-target-before::before {
    top: -1px;
}

.draggable-feature.feature-drop-target-after::after {
    bottom: -1px;
}

/* Script selector dropdown */
.feature-script-selector {
    margin-bottom: 8px;
    padding: 0 var(--top-row-fontinfo-control-inline-padding, 12px);
    display: flex;
    align-items: center;
    gap: var(--top-row-sidebar-element-gap, 8px);
    font-size: 11px;
}

.feature-script-selector-label {
    color: var(--text-secondary);
}

.feature-script-dropdown {
    flex: 1;
    padding: var(--top-row-fontinfo-control-block-padding, 4px)
        var(--top-row-fontinfo-control-inline-padding, 8px);
    background: var(--input-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    font-family: var(--font-families-mono);
    font-size: 11px;
    cursor: pointer;
}

.feature-section-separator {
    padding: var(--top-row-fontinfo-control-block-padding, 6px)
        var(--top-row-fontinfo-control-inline-padding, 12px);
    font-size: 10px;
    color: var(--text-secondary);
    opacity: 0.5;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-top: 8px;
}

.feature-script-dropdown:hover {
    border-color: var(--text-primary);
}

.feature-script-dropdown:focus {
    outline: none;
    border-color: var(--primary);
}

/* Font Info Names content - ensure it scrolls properly */
#fontinfo-general-content,
#fontinfo-names-content,
#fontinfo-custom-ot-values-content {
    margin-right: 20px;
    margin-left: 15px;
    margin-top: 0px;
    margin-bottom: 0px;
}

#fontinfo-stations-content,
#fontinfo-instances-content {
    margin: 0;
}

#fontinfo-general-content,
#fontinfo-names-content,
#fontinfo-stations-content,
#fontinfo-instances-content,
#fontinfo-custom-ot-values-content {
    scrollbar-width: none;
}

#fontinfo-general-content::-webkit-scrollbar,
#fontinfo-names-content::-webkit-scrollbar,
#fontinfo-stations-content::-webkit-scrollbar,
#fontinfo-instances-content::-webkit-scrollbar,
#fontinfo-custom-ot-values-content::-webkit-scrollbar {
    width: 0;
    display: none;
}

#fontinfo-general-content::-webkit-scrollbar-track,
#fontinfo-names-content::-webkit-scrollbar-track,
#fontinfo-stations-content::-webkit-scrollbar-track,
#fontinfo-instances-content::-webkit-scrollbar-track,
#fontinfo-custom-ot-values-content::-webkit-scrollbar-track {
    background: transparent;
}

#fontinfo-general-content::-webkit-scrollbar-thumb,
#fontinfo-names-content::-webkit-scrollbar-thumb,
#fontinfo-stations-content::-webkit-scrollbar-thumb,
#fontinfo-instances-content::-webkit-scrollbar-thumb,
#fontinfo-custom-ot-values-content::-webkit-scrollbar-thumb {
    background: transparent;
}

/* ace editor overwrite */

.ace-chrome .ace_gutter {
    background: transparent;
    border-right: 1px solid
        color-mix(in srgb, var(--border-primary) 35%, transparent);
}
