.tx-sheet {
    color-scheme: light dark;
    --tx-popup-radius: 6px;
    --tx-popup-shadow: 0 6px 18px rgb(0 0 0 / 18%);
    --tx-surface: light-dark(#ffffff, #202528);
    --tx-soft: light-dark(#f5f7f6, #292f32);
    --tx-text: light-dark(#24322d, #ecf2ef);
    --tx-muted: light-dark(#59685f, #b0c0b7);
    --tx-border: light-dark(#dee5e0, #414b46);
    --tx-accent: light-dark(#187346, #7cdba1);
    --tx-focus: light-dark(#3979ad, #91bfe3);
    --tx-tint: light-dark(#edf7f0, #273d30);
    --tx-selection-overlay: light-dark(#000000, #ffffff);
    --tx-ink-dark: #24322d;
    --tx-ink-light: #ecf2ef;
    --tx-error: light-dark(#a82933, #ff9da2);
    --tx-reference-accent: light-dark(#3854d8, #a6b8ff);
    --tx-reference-tint: light-dark(#edf0ff, #2b3458);
    --tx-page-break: light-dark(#959595, #95a4ac);
    font:
        14px/1.45 system-ui,
        -apple-system,
        'Segoe UI',
        sans-serif;
    color: var(--tx-text);
    background: var(--tx-surface);
    border: 1px solid var(--tx-border);
    border-radius: 10px;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
    -webkit-user-select: none;
    user-select: none;
}
/* Top-layer dialogs and popovers need their own selection boundary. */
.tx-sheet :is(dialog, [popover]) {
    -webkit-user-select: none;
    user-select: none;
}
/* UI labels stay unselectable; editors retain native text selection and copying. */
.tx-sheet :is(input, textarea, [contenteditable]:not([contenteditable='false'])) {
    -webkit-user-select: text;
    user-select: text;
}
.tx-sheet[data-theme='light'] {
    color-scheme: only light;
}
.tx-sheet[data-theme='dark'] {
    color-scheme: only dark;
}
.tx-sheet *,
.tx-sheet *::before,
.tx-sheet *::after {
    box-sizing: border-box;
}
/* Host form-control margins must not change ribbon, editor or menu geometry. */
.tx-sheet button,
.tx-sheet input,
.tx-sheet select,
.tx-sheet textarea {
    margin: 0;
    font: inherit;
    color: inherit;
}
.tx-sheet button,
.tx-sheet select {
    cursor: pointer;
}
/* Focus is distinct from the worksheet selection accent. Text controls also
   match :focus-visible after a mouse click, so keep their indicator subtle. */
.tx-sheet button:focus-visible {
    outline: 2px solid var(--tx-focus);
    outline-offset: -2px;
}
.tx-sheet :is(input, select, textarea):focus-visible {
    outline: 1px solid var(--tx-focus);
    outline-offset: -1px;
}
/* The active cell/header editor already supplies its own selection border. */
.tx-sheet :is(.tx-cell-editor, .tx-header-footer-editor):focus-visible {
    outline: none;
}
.tx-tool-group {
    display: flex;
    gap: 4px;
    align-items: center;
    padding-right: 8px;
    border-right: 1px solid var(--tx-border);
}
.tx-tool-group:last-child {
    border: 0;
    padding: 0;
}
.tx-formula-row {
    display: flex;
    align-items: center;
    min-height: 42px;
    border-bottom: 1px solid var(--tx-border);
}
.tx-formula-row input {
    background: var(--tx-surface);
    border: 0;
    border-radius: 0;
    padding: 10px 12px;
    min-width: 0;
}
.tx-formula-row .tx-address {
    width: 74px;
    flex-shrink: 0;
    text-align: center;
    border-right: 1px solid var(--tx-border);
    font-variant-numeric: tabular-nums;
}
/* Fixed-size glyphs keep the formula commands compact in every language. */
.tx-formula-actions {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    gap: 2px;
    padding: 0 5px;
    border-right: 1px solid var(--tx-border);
}
.tx-formula-actions button {
    display: grid;
    place-items: center;
    width: 30px;
    height: 32px;
    padding: 3px;
    border: 0;
    border-radius: 3px;
    color: var(--tx-muted);
    background: transparent;
}
.tx-formula-actions button svg {
    display: block;
    width: 22px;
    height: 22px;
}
.tx-formula-actions button:hover:not(:disabled) {
    color: var(--tx-text);
    background: var(--tx-soft);
}
.tx-formula-actions button:disabled {
    opacity: 0.4;
    cursor: default;
}
.tx-formula-actions .tx-fx {
    width: 36px;
}
.tx-formula-actions .tx-fx svg {
    width: 24px;
    height: 22px;
}
@media (pointer: coarse) {
    .tx-formula-actions button,
    .tx-formula-actions .tx-fx {
        width: 44px;
        height: 44px;
    }
}
.tx-formula {
    flex: 1;
}
.tx-grid-viewport {
    cursor: cell;
    position: relative;
    width: 100%;
    overflow: auto;
    background: var(--tx-surface);
    overscroll-behavior: contain;
    overflow-anchor: none;
}
/* The canvas active-cell outline identifies grid focus without framing its scrollbars. */
.tx-grid-viewport:focus {
    outline: none;
}
.tx-canvas-layer {
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    height: 0;
    z-index: 1;
    pointer-events: none;
}
.tx-canvas {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    pointer-events: none;
}
.tx-scroll-space {
    pointer-events: none;
}
.tx-grid-viewport > .tx-sr {
    top: 0;
    left: 0;
}
.tx-editor-clip {
    position: absolute;
    overflow: hidden;
    pointer-events: none;
}
.tx-cell-editor {
    position: absolute;
    margin: 0;
    border: 2px solid var(--tx-accent);
    border-radius: 0;
    background: var(--tx-surface);
    padding: 4px 8px;
    color: var(--tx-text);
    resize: none;
    white-space: pre;
    overflow: auto;
    scrollbar-width: none;
    pointer-events: auto;
}
/* Native caret scrolling remains available without bars reducing the editing area. */
.tx-cell-editor::-webkit-scrollbar {
    display: none;
}
.tx-cell-editor[hidden] {
    display: none;
}
.tx-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    background: var(--tx-soft);
    border-top: 1px solid var(--tx-border);
    color: var(--tx-muted);
    padding: 0 14px;
    font-size: 12px;
}
.tx-sheet-label {
    display: flex;
    gap: 7px;
    align-items: center;
    padding: 12px 10px 10px;
    border-bottom: 2px solid var(--tx-accent);
    color: var(--tx-accent);
    font-size: 14px;
}
.tx-count {
    margin-left: auto;
    padding: 8px 0;
}
.tx-error {
    padding: 10px 16px;
    color: var(--tx-error);
    background: var(--tx-surface);
    border-top: 1px solid var(--tx-border);
}
.tx-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}
@media (max-width: 640px) {
    .tx-footer {
        gap: 8px;
    }
    .tx-count {
        display: none;
    }
}
@media (pointer: coarse) {
    .tx-sheet input,
    .tx-sheet select,
    .tx-sheet textarea {
        font-size: 16px;
    }
}

@media (forced-colors: active) {
    .tx-sheet {
        --tx-surface: Canvas;
        --tx-soft: Canvas;
        --tx-text: CanvasText;
        --tx-muted: CanvasText;
        --tx-border: CanvasText;
        --tx-accent: Highlight;
        --tx-focus: Highlight;
        --tx-tint: Canvas;
        --tx-error: CanvasText;
    }
}
.tx-format-toolbar {
    gap: 8px;
}
.tx-format-toolbar .tx-tool-group {
    flex-wrap: wrap;
    max-width: 100%;
}
.tx-font-size {
    width: 62px;
}
.tx-color-label,
.tx-decimal-label {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--tx-muted);
    font-size: 12px;
}
.tx-decimal-label input {
    width: 62px;
}

/* Home ribbon follows the supplied TX Text Control reference. */
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) {
    font:
        13px/1.3 'Segoe UI',
        Arial,
        sans-serif;
    color: light-dark(#5e5e5e, #d7dde1);
    background: var(--tx-surface);
    border-bottom: 1px solid light-dark(#bbbbbb, #525b60);
}
.tx-ribbon-tabs {
    display: flex;
    align-items: center;
    height: 32px;
    padding: 0 14px;
    border-bottom: 1px solid var(--tx-border);
}
.tx-ribbon-tabs button {
    height: 32px;
    padding: 4px 12px;
    border: 0;
    border-bottom: 3px solid light-dark(#4b94cf, #78b6e6);
    border-radius: 0;
    background: transparent;
    font-weight: 600;
}
.tx-ribbon-panel {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    padding: 4px 8px 3px;
    gap: 0;
}
.tx-ribbon-group {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-right: 1px solid light-dark(#bbbbbb, #525b60);
    padding: 2px 8px 0;
    min-width: 0;
    max-width: 100%;
}
.tx-ribbon-group:last-child {
    border-right: 0;
}
.tx-ribbon-content {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 5px;
    min-height: 66px;
}
.tx-ribbon-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 3px;
    min-height: 25px;
}
.tx-ribbon-caption {
    display: block;
    text-align: center;
    font-size: 11px;
    padding: 2px 0 1px;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 24px;
    min-height: 24px;
    border: 1px solid transparent;
    border-radius: 0;
    padding: 2px 4px;
    background: transparent;
    white-space: nowrap;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) button:hover {
    background: light-dark(#e5f1fb, #334d61);
    border-color: light-dark(#a4cef0, #6b9aba);
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) button[aria-pressed='true'] {
    background: light-dark(#dddddd, #4b5862);
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) button[aria-pressed='mixed'] {
    background: light-dark(#f0f0f0, #37434c);
    border-style: dashed;
    border-color: light-dark(#777777, #a0b5c5);
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) button:disabled {
    opacity: 0.4;
    cursor: default;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) select,
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) input {
    border: 1px solid light-dark(#ababab, #657078);
    border-radius: 0;
    padding: 1px 3px;
    min-height: 24px;
    background: var(--tx-surface);
    max-width: 100%;
}
.tx-font-group {
    flex-basis: 302px;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) select[data-style='fontFamily'] {
    width: 144px;
}
/* Editable font-size combo uses the same top-layer menu as other ribbon dropdowns. */
.tx-font-size-combo {
    display: inline-flex;
    width: 60px;
    min-width: 60px;
    align-items: stretch;
    border: 1px solid light-dark(#ababab, #657078);
    border-radius: 4px;
}
.tx-font-size-combo:focus-within {
    outline: 1px solid var(--tx-focus);
    outline-offset: 0;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-font-size-combo input {
    width: 0;
    flex: 1;
    min-width: 0;
    min-height: 22px;
    border: 0;
    border-radius: 3px 0 0 3px;
    padding: 1px 3px;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-font-size-combo input:focus-visible {
    outline: none;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-font-size-toggle {
    width: 18px;
    min-width: 18px;
    min-height: 22px;
    border: 0;
    border-radius: 0 3px 3px 0;
    padding: 1px 3px;
}
.tx-font-size-list.tx-dropdown-menu {
    width: 80px;
    max-height: min(560px, var(--tx-font-size-space, calc(100vh - 16px)));
    padding: 3px;
}
.tx-font-size-list::backdrop {
    background: transparent;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-font-size-list > button {
    display: flex;
    justify-content: flex-start;
    width: 100%;
    min-height: 32px;
    padding: 5px 10px;
    border: 1px solid transparent;
    border-radius: 2px;
    font-size: 14px;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-font-size-list > [aria-selected='true'] {
    background: var(--tx-soft);
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-font-size-list > [data-active] {
    background: light-dark(#e5f1fb, #334d61);
    border-color: light-dark(#a4cef0, #6b9aba);
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-font-size-list > [aria-selected='true'][data-active] {
    background: var(--tx-soft);
    border-color: transparent;
}
@media (pointer: coarse) {
    .tx-font-size-combo {
        width: 88px;
        min-width: 88px;
    }
    :is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-font-size-combo input {
        min-height: 42px;
    }
    :is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-font-size-toggle {
        width: 44px;
        min-width: 44px;
        min-height: 42px;
    }
    .tx-font-size-list.tx-dropdown-menu {
        width: 96px;
    }
    :is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-font-size-list > button {
        min-height: 44px;
        font-size: 16px;
    }
}
.tx-ribbon-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    object-fit: contain;
}
.tx-ribbon-color {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    min-height: 24px;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) input[type='color'] {
    width: 22px;
    padding: 1px;
    cursor: pointer;
}
.tx-ribbon-separator {
    width: 1px;
    height: 19px;
    background: var(--tx-border);
    margin: 0 2px;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) select[data-style='horizontalAlign'] {
    width: 82px;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) select[data-style='verticalAlign'] {
    width: 110px;
}
.tx-border-select {
    display: inline-flex;
    gap: 3px;
    align-items: center;
}
.tx-border-select select {
    width: 110px;
}
.tx-number-group {
    flex-basis: 142px;
}
.tx-number-group select {
    width: 124px;
}
.tx-decimal-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-decimal-label input {
    width: 61px;
}
.tx-ribbon-stack {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
}
.tx-ribbon-stack button {
    justify-content: flex-start;
    min-height: 22px;
}
.tx-formula-row .tx-address {
    width: 104px;
    font-size: 13px;
}
.tx-grid-viewport {
    user-select: none;
}
.tx-cell-editor {
    user-select: text;
}

.tx-merge-dialog p {
    margin: 0 0 18px;
}
.tx-dialog-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}
.tx-dialog-actions button {
    padding: 7px 12px;
    border: 1px solid var(--tx-border);
    border-radius: 4px;
    background: var(--tx-soft);
}
.tx-sheet[data-color-scheme='dark'] .tx-ribbon-icon {
    filter: invert(0.85) hue-rotate(180deg);
}
@media (max-width: 640px) {
    .tx-ribbon-panel {
        gap: 6px 0;
        padding: 5px 3px;
    }
    .tx-ribbon-group {
        padding: 3px 5px 1px;
    }
    .tx-font-group {
        flex-basis: 100%;
        border-right: 0;
    }
    .tx-ribbon-content {
        min-height: 64px;
    }
}
@media (pointer: coarse) {
    :is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) button,
    :is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) select,
    :is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) input {
        min-height: 44px;
    }
    :is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) button {
        min-width: 44px;
    }
    :is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-ribbon-row {
        gap: 4px;
    }
    .tx-ribbon-icon {
        width: 20px;
        height: 20px;
    }
    :is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) input[type='color'] {
        width: 40px;
    }
    :is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) input,
    :is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) select {
        font-size: 16px;
    }
}
@media (forced-colors: active) {
    .tx-sheet[data-color-scheme] .tx-ribbon-icon {
        filter: none;
    }
}

:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-ribbon-tabs button {
    min-height: 32px;
    border: 0;
    border-bottom: 3px solid light-dark(#4b94cf, #78b6e6);
    padding: 4px 12px;
    font-weight: 600;
}
@media (min-width: 641px) {
    .tx-font-group {
        flex-basis: 320px;
    }
}

/* Palette dropdowns use the reference color order and live SVG color bars. */
.tx-color-picker {
    display: inline-flex;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-color-trigger {
    gap: 3px;
    min-width: 34px;
}
.tx-dropdown-arrow {
    width: 0;
    height: 0;
    border-left: 3px solid transparent;
    border-right: 3px solid transparent;
    border-top: 5px solid currentColor;
}
.tx-color-icon {
    filter: none !important;
}
.tx-color-popover {
    width: min(276px, calc(100vw - 16px));
    padding: 0;
}
.tx-color-popover::backdrop {
    background: transparent;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-color-popover button {
    min-width: 0;
    border: 1px solid transparent;
    border-radius: 0;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-palette-automatic,
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-palette-more {
    width: 100%;
    justify-content: flex-start;
    min-height: 38px;
    padding: 6px 10px;
    gap: 12px;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-palette-automatic {
    border-bottom: 1px solid var(--tx-border);
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-palette-more {
    border-top: 1px solid var(--tx-border);
}
.tx-auto-swatch {
    width: 18px;
    height: 18px;
    border: 1px solid light-dark(#cccccc, #79838a);
    flex-shrink: 0;
}
.tx-auto-swatch.tx-no-fill {
    background-image: linear-gradient(135deg, transparent 45%, #b33b3b 46% 54%, transparent 55%);
}
.tx-palette-grid {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 2px;
    padding: 5px 7px;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-palette-cell {
    width: 100%;
    min-height: 28px;
    padding: 3px;
}
.tx-palette-cell span {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    border: 1px solid light-dark(#d1d1d1, #7b8388);
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-palette-cell[aria-checked='true'],
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-palette-automatic[aria-checked='true'] {
    outline: 1px solid light-dark(#4b94cf, #78b6e6);
    outline-offset: -2px;
}

.tx-custom-color-fields {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.tx-custom-color-fields label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-custom-color-fields input {
    min-height: 36px;
    width: 125px;
    padding: 5px;
}
.tx-custom-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px 0;
    font-variant-numeric: tabular-nums;
}
.tx-custom-preview > span:first-child {
    display: block;
    width: 40px;
    height: 28px;
    border: 1px solid var(--tx-border);
}
@media (pointer: coarse) {
    :is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-color-trigger {
        min-width: 44px;
    }
    .tx-color-popover {
        width: min(400px, calc(100vw - 16px));
    }
    .tx-palette-grid {
        grid-template-columns: repeat(auto-fit, minmax(44px, 1fr));
    }
    :is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-palette-cell,
    :is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-palette-automatic,
    :is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-palette-more {
        min-height: 44px;
    }
}
@media (forced-colors: active) {
    .tx-palette-cell span,
    .tx-auto-swatch,
    .tx-custom-preview > span:first-child {
        forced-color-adjust: none;
    }
}

/* Excel-style border menu and custom edge formatting. */
.tx-border-picker {
    display: inline-flex;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-border-trigger {
    gap: 5px;
    min-width: 36px;
}
.tx-border-popover,
.tx-style-popover {
    padding: 5px 0;
    width: min(310px, calc(100vw - 16px));
}
.tx-border-popover h3 {
    font-size: 14px;
    font-weight: 600;
    padding: 6px 15px;
    margin: 0;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-border-popover > button,
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-style-popover > button {
    display: flex;
    width: 100%;
    min-height: 31px;
    padding: 5px 16px;
    border: 1px solid transparent;
    justify-content: flex-start;
    gap: 14px;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-border-popover button[aria-checked='true'],
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-style-popover button[aria-checked='true'] {
    background-color: var(--tx-soft);
    outline: 1px solid var(--tx-border);
    outline-offset: -2px;
}
.tx-menu-divider {
    height: 1px;
    background: var(--tx-border);
    margin: 4px 0 4px 43px;
}
.tx-border-symbol {
    display: block;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    border: 1px dotted currentColor;
    position: relative;
    opacity: 0.85;
}
.tx-border-symbol::before,
.tx-border-symbol::after {
    content: '';
    position: absolute;
}
.tx-border-symbol::before {
    top: 0;
    bottom: 0;
    left: 50%;
    border-left: 1px dotted currentColor;
}
.tx-border-symbol::after {
    left: 0;
    right: 0;
    top: 50%;
    border-top: 1px dotted currentColor;
}
.tx-border-bottom,
.tx-border-bottom-thick,
.tx-border-bottom-double {
    border-bottom: 1px solid currentColor;
}
.tx-border-top {
    border-top: 1px solid currentColor;
}
.tx-border-left {
    border-left: 1px solid currentColor;
}
.tx-border-right {
    border-right: 1px solid currentColor;
}
.tx-border-all,
.tx-border-outside {
    border: 1px solid currentColor;
}
.tx-border-all::before {
    border-left-style: solid;
}
.tx-border-all::after {
    border-top-style: solid;
}
.tx-border-thick-outside {
    border: 3px solid currentColor;
}
.tx-border-bottom-thick {
    border-bottom-width: 3px;
}
.tx-border-bottom-double {
    border-bottom: 3px double currentColor;
}
.tx-border-top-bottom,
.tx-border-top-thick-bottom,
.tx-border-top-double-bottom {
    border-top: 1px solid currentColor;
    border-bottom: 1px solid currentColor;
}
.tx-border-top-thick-bottom {
    border-bottom-width: 3px;
}
.tx-border-top-double-bottom {
    border-bottom: 3px double currentColor;
}
.tx-border-draw,
.tx-border-grid {
    border: 1px solid currentColor;
}
.tx-border-draw i,
.tx-border-grid i {
    position: absolute;
    right: -4px;
    bottom: -1px;
    width: 4px;
    height: 19px;
    background: #4d83b8;
    transform: rotate(40deg);
    border: 1px solid var(--tx-surface);
}
.tx-border-grid::before {
    border-left-style: solid;
}
.tx-border-grid::after {
    border-top-style: solid;
}
.tx-border-erase {
    transform: rotate(40deg);
    width: 12px;
    height: 18px;
    border: 2px solid #a63bb6;
    background: light-dark(#e6c0ed, #885194);
    margin: 1px 4px;
}
.tx-border-erase::before,
.tx-border-erase::after {
    display: none;
}
.tx-border-color-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 31px;
    padding: 0 12px;
}
.tx-border-color-row > span {
    pointer-events: none;
}
.tx-border-color-row .tx-color-trigger {
    width: 100%;
}
.tx-submenu-arrow {
    margin-left: auto;
    font-size: 22px;
    line-height: 1;
}
.tx-current-line {
    width: 20px;
    flex-shrink: 0;
}
.tx-style-popover {
    width: 168px;
}
.tx-line-sample {
    display: block;
    min-width: 16px;
    width: 100%;
    height: 0;
    border-top: 1px solid currentColor;
}
.tx-line-none {
    border: 0;
}
.tx-line-hair {
    border-top-width: 0.5px;
}
.tx-line-dotted {
    border-top-style: dotted;
}
.tx-line-dashed {
    border-top-style: dashed;
}
.tx-line-double {
    border-top: 3px double currentColor;
}
.tx-line-medium,
.tx-line-medium-dashed,
.tx-line-medium-dash-dot,
.tx-line-medium-dash-dot-dot {
    border-top-width: 2px;
}
.tx-line-medium-dashed {
    border-top-style: dashed;
}
.tx-line-thick {
    border-top-width: 3px;
}
.tx-line-dash-dot,
.tx-line-medium-dash-dot {
    border: 0;
    height: 1px;
    background: repeating-linear-gradient(
        to right,
        currentColor 0 6px,
        transparent 6px 9px,
        currentColor 9px 10px,
        transparent 10px 13px
    );
}
.tx-line-dash-dot-dot,
.tx-line-medium-dash-dot-dot {
    border: 0;
    height: 1px;
    background: repeating-linear-gradient(
        to right,
        currentColor 0 6px,
        transparent 6px 9px,
        currentColor 9px 10px,
        transparent 10px 13px,
        currentColor 13px 14px,
        transparent 14px 17px
    );
}
.tx-line-medium-dash-dot,
.tx-line-medium-dash-dot-dot {
    height: 2px;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-border-auto input,
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-border-edge-controls input {
    min-height: 0;
    width: 16px;
    height: 16px;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-borders-fields input[type='color'] {
    width: 60px;
    height: 30px;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-border-dialog-presets button {
    border: 1px solid var(--tx-border);
    padding: 5px 12px;
}
.tx-grid-viewport[data-border-mode] {
    cursor: crosshair;
}
@media (pointer: coarse) {
    :is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-border-popover > button,
    :is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-style-popover > button,
    .tx-border-color-row {
        min-height: 44px;
    }
    .tx-border-edge-controls label {
        min-height: 44px;
    }
}

.tx-border-color-row .tx-color-picker {
    width: 100%;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-border-color-row .tx-color-trigger {
    justify-content: flex-start;
    gap: 14px;
}
.tx-border-color-row .tx-dropdown-arrow {
    margin-left: auto;
}
.tx-grid-viewport[data-border-mode] {
    touch-action: none;
}

/* Shared appearance for every custom ribbon dropdown. */
.tx-dropdown-menu {
    position: fixed;
    inset: auto;
    margin: 0;
    max-height: calc(100vh - 16px);
    overflow: auto;
    border: 1px solid var(--tx-border);
    border-radius: var(--tx-popup-radius);
    background: var(--tx-surface);
    color: var(--tx-text);
    box-shadow: var(--tx-popup-shadow);
    font:
        14px/1.3 'Segoe UI',
        Arial,
        sans-serif;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-dropdown-trigger {
    border-radius: 4px;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) select {
    border-radius: 4px;
}

/* Alignment follows the supplied two-row Excel arrangement. */
.tx-alignment-group {
    position: relative;
}
.tx-alignment-controls {
    display: flex;
    align-items: stretch;
    gap: 10px;
}
.tx-alignment-compact {
    display: flex;
    flex-direction: column;
    gap: 6px;
    justify-content: flex-start;
}
.tx-alignment-compact .tx-ribbon-row {
    flex-wrap: nowrap;
    gap: 2px;
}
.tx-alignment-wide {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 6px;
    border-left: 1px solid var(--tx-border);
    padding-left: 10px;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-alignment-wide > button,
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-merge-split > button {
    justify-content: flex-start;
    min-height: 27px;
    gap: 9px;
}
.tx-alignment-dropdown {
    display: inline-flex;
}
.tx-merge-split {
    display: flex;
    align-items: stretch;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-merge-split > button {
    border-radius: 4px 0 0 4px;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-merge-split .tx-dropdown-trigger {
    border-radius: 0 4px 4px 0;
    min-width: 22px;
}
.tx-merge-split:hover {
    background: var(--tx-soft);
    border-radius: 4px;
}
.tx-alignment-icon {
    display: inline-flex;
    position: relative;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    color: inherit;
    font-size: 13px;
}
.tx-icon-vtop,
.tx-icon-vmiddle,
.tx-icon-vbottom {
    align-items: flex-start;
}
.tx-icon-vtop img,
.tx-icon-vmiddle img,
.tx-icon-vbottom img {
    height: 10px;
    width: 20px;
    object-fit: fill;
}
.tx-icon-vmiddle {
    align-items: center;
}
.tx-icon-vbottom {
    align-items: flex-end;
}
.tx-icon-counterclockwise {
    transform: rotate(-45deg);
}
.tx-icon-clockwise {
    transform: rotate(45deg);
}
.tx-icon-up {
    transform: rotate(-90deg);
}
.tx-icon-down {
    transform: rotate(90deg);
}
.tx-icon-vertical {
    writing-mode: vertical-rl;
    text-orientation: upright;
    font-size: 10px;
}
.tx-icon-wrap::after {
    position: absolute;
    content: '\21b5';
    color: light-dark(#4d83b8, #81b9e8);
    bottom: -3px;
    right: -2px;
    font-size: 15px;
}
.tx-icon-wrap {
    align-items: flex-start;
    padding-top: 0;
}
.tx-icon-merge {
    height: 16px;
    border: 1px solid currentColor;
    background: linear-gradient(
        to bottom,
        transparent 29%,
        currentColor 30% 35%,
        transparent 36% 64%,
        currentColor 65% 70%,
        transparent 71%
    );
}
.tx-icon-merge::after {
    content: '\2194';
    position: absolute;
    color: light-dark(#4d83b8, #81b9e8);
    background: var(--tx-surface);
    line-height: 10px;
    top: 2px;
    left: 1px;
    right: 1px;
    text-align: center;
    font-size: 20px;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) :is(.tx-alignment-launcher, .tx-sparkline-launcher) {
    position: absolute;
    right: 3px;
    bottom: 0;
    min-height: 16px;
    min-width: 16px;
    width: 16px;
    height: 16px;
    padding: 1px;
}
.tx-alignment-menu {
    width: min(265px, calc(100vw - 16px));
    padding: 5px 0;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-alignment-menu > button {
    display: flex;
    width: 100%;
    min-height: 34px;
    padding: 6px 14px;
    gap: 12px;
    justify-content: flex-start;
    border-radius: 0;
    white-space: normal;
    text-align: left;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-alignment-menu > button[aria-checked='true'] {
    background: var(--tx-soft);
    outline: 1px solid var(--tx-border);
    outline-offset: -2px;
}
.tx-alignment-menu h3 {
    margin: 0;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-alignment-fields input,
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-alignment-fields select {
    width: 100%;
    min-height: 32px;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-alignment-checks input {
    width: 16px;
    height: 16px;
    min-height: 0;
}
.tx-size-icon {
    width: 28px;
    height: 24px;
    border: 1px solid currentColor;
    background:
        repeating-linear-gradient(to right, transparent 0 8px, currentColor 8px 9px),
        repeating-linear-gradient(to bottom, transparent 0 7px, currentColor 7px 8px);
    border-top: 2px solid light-dark(#4d83b8, #81b9e8);
}
.tx-size-dialog {
    width: min(340px, calc(100vw - 24px));
}
.tx-size-dialog p {
    color: var(--tx-muted);
    font-size: 12px;
    margin: 12px 0 18px;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-size-dialog input {
    min-height: 36px;
    width: 100%;
}
@media (max-width: 640px) {
    .tx-alignment-controls {
        flex-wrap: wrap;
        gap: 8px;
    }
    .tx-alignment-group {
        flex-basis: 100%;
        border-right: 0;
    }
    .tx-alignment-wide {
        border-left: 0;
        padding-left: 0;
    }
    .tx-alignment-group .tx-ribbon-caption {
        margin-top: 4px;
    }
}
@media (pointer: coarse) {
    :is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-alignment-menu > button,
    :is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-alignment-wide > button,
    :is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-merge-split > button {
        min-height: 44px;
    }
    :is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) :is(.tx-alignment-launcher, .tx-sparkline-launcher) {
        min-width: 44px;
        min-height: 44px;
        width: 44px;
        height: 44px;
        bottom: 0;
    }
    .tx-alignment-group {
        padding-bottom: 26px;
    }
    .tx-alignment-checks label {
        min-height: 44px;
    }
    .tx-alignment-compact .tx-ribbon-row {
        flex-wrap: wrap;
    }
    .tx-alignment-wide {
        gap: 4px;
    }
}

.tx-ribbon-icon.tx-size-icon-original {
    width: 28px;
    height: 28px;
}

.tx-cell-sizing {
    display: flex;
    gap: 2px;
    align-items: stretch;
}
.tx-cells-dropdown {
    display: flex;
}
.tx-structure-dialog fieldset {
    min-width: 0;
    border: 0;
    margin: 0;
    padding: 0;
}
.tx-structure-dialog legend {
    font-size: 13px;
    margin-bottom: 10px;
}
.tx-structure-dialog fieldset label {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    min-height: 32px;
    margin: 0;
}
.tx-structure-dialog fieldset label span {
    min-width: 0;
    overflow-wrap: anywhere;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-structure-dialog input[type='radio'] {
    width: 16px;
    height: 16px;
    min-height: 0;
    margin: 0;
    flex: none;
}
.tx-structure-dialog .tx-structure-error {
    color: var(--tx-error);
}
.tx-structure-dialog .tx-structure-error[hidden] {
    display: none;
}
@media (pointer: coarse) {
    .tx-structure-dialog fieldset label {
        min-height: 44px;
    }
}
:is(.tx-alignment-launcher, .tx-sparkline-launcher) .tx-ribbon-icon {
    width: 16px;
    height: 16px;
}

@media (min-width: 641px) and (max-width: 1200px) and (pointer: fine) {
    .tx-ribbon-group {
        padding-left: 6px;
        padding-right: 6px;
    }
    .tx-font-group {
        flex-basis: 292px;
    }
    .tx-number-group {
        flex-basis: 130px;
    }
    :is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) select[data-style='fontFamily'] {
        width: 136px;
    }
    :is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-format-cells-button {
        min-width: 60px;
    }
    .tx-alignment-controls {
        gap: 6px;
    }
    .tx-alignment-wide {
        padding-left: 6px;
    }
}

/* Adaptive groups keep the ribbon on one row; the same controls become the group popup. */
.tx-ribbon-group-trigger {
    display: none !important;
}
.tx-ribbon-group-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
}
.tx-adaptive-ribbon .tx-ribbon-panel {
    flex-wrap: nowrap;
    gap: 0;
    min-height: 90px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 6px 3px;
}
.tx-adaptive-ribbon .tx-ribbon-group {
    flex: 0 0 auto;
    width: auto;
    max-width: none;
    padding: 2px 8px 0;
}
.tx-adaptive-ribbon .tx-font-group > .tx-ribbon-group-body {
    width: 302px;
}
.tx-adaptive-ribbon .tx-ribbon-group[data-ribbon-mode='compact'] {
    padding-left: 5px;
    padding-right: 5px;
}
.tx-adaptive-ribbon .tx-font-group[data-ribbon-mode='compact'] > .tx-ribbon-group-body {
    width: 272px;
}
.tx-adaptive-ribbon .tx-font-group[data-ribbon-mode='compact'] select[data-style='fontFamily'] {
    width: 112px;
}
.tx-adaptive-ribbon [data-ribbon-mode='compact'] .tx-alignment-controls {
    gap: 4px;
}
.tx-adaptive-ribbon [data-ribbon-mode='compact'] .tx-alignment-wide {
    padding-left: 4px;
}
.tx-adaptive-ribbon [data-ribbon-mode='compact'] .tx-alignment-wide > button > span:not(.tx-alignment-icon),
.tx-adaptive-ribbon [data-ribbon-mode='compact'] .tx-merge-split > button > span,
.tx-adaptive-ribbon [data-ribbon-mode='compact'] .tx-command-label {
    display: none;
}
.tx-adaptive-ribbon [data-ribbon-mode='compact'] .tx-alignment-wide > button,
.tx-adaptive-ribbon [data-ribbon-mode='compact'] .tx-merge-split > button {
    justify-content: center;
}
.tx-adaptive-ribbon [data-ribbon-mode='compact'] .tx-size-icon-original {
    width: 20px;
    height: 20px;
}
.tx-adaptive-ribbon .tx-number-group[data-ribbon-mode='compact'] select {
    width: 96px;
}
.tx-adaptive-ribbon .tx-number-group[data-ribbon-mode='compact'] .tx-decimal-label {
    font-size: 0;
}
.tx-adaptive-ribbon .tx-number-group[data-ribbon-mode='compact'] .tx-decimal-label input {
    font:
        13px/1.3 'Segoe UI',
        Arial,
        sans-serif;
    width: 96px;
}
.tx-adaptive-ribbon [data-ribbon-mode='collapsed'] {
    padding: 2px;
}
.tx-adaptive-ribbon [data-ribbon-mode='collapsed'] > .tx-ribbon-group-trigger {
    display: inline-flex !important;
    flex: 1;
    flex-direction: column;
    min-width: 48px;
    min-height: 78px;
    padding: 5px 4px;
    gap: 6px;
    border-radius: 4px;
    font-size: 12px;
}
.tx-ribbon-group-trigger > .tx-ribbon-icon {
    width: 28px;
    height: 28px;
}
.tx-group-number-icon {
    display: block;
    height: 28px;
    font:
        30px/28px 'Segoe UI',
        sans-serif;
}
.tx-adaptive-ribbon .tx-ribbon-group-open > .tx-ribbon-group-trigger {
    background: var(--tx-soft);
    border-color: var(--tx-border);
}
.tx-adaptive-ribbon .tx-ribbon-group-body[popover] {
    display: none;
    max-width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    padding: 8px;
    width: max-content;
}
.tx-adaptive-ribbon .tx-ribbon-group-body[popover]:popover-open {
    display: flex;
}
.tx-adaptive-ribbon .tx-font-group[data-ribbon-mode='collapsed'] > .tx-ribbon-group-body {
    width: min(320px, calc(100vw - 16px));
}
.tx-adaptive-ribbon .tx-ribbon-group-body[popover] .tx-ribbon-content {
    min-height: 66px;
}
.tx-adaptive-ribbon .tx-ribbon-group-body[popover] .tx-alignment-controls {
    flex-wrap: wrap;
}
.tx-adaptive-ribbon .tx-ribbon-group-body[popover] .tx-ribbon-caption {
    padding-top: 6px;
}
.tx-adaptive-ribbon .tx-ribbon-group-body[popover] :is(.tx-alignment-launcher, .tx-sparkline-launcher) {
    right: 3px;
    bottom: 2px;
}
.tx-adaptive-ribbon .tx-ribbon-group[data-ribbon-mode='expanded'] .tx-alignment-controls,
.tx-adaptive-ribbon .tx-ribbon-group[data-ribbon-mode='compact'] .tx-alignment-controls {
    flex-wrap: nowrap;
}
@media (max-width: 640px) {
    .tx-adaptive-ribbon .tx-ribbon-panel {
        padding: 4px 3px 3px;
    }
    .tx-adaptive-ribbon .tx-alignment-wide {
        border-left: 1px solid var(--tx-border);
        padding-left: 10px;
    }
    .tx-adaptive-ribbon .tx-alignment-group {
        border-right: 1px solid var(--tx-border);
    }
    .tx-adaptive-ribbon .tx-ribbon-group-body[popover] .tx-alignment-wide {
        border-left: 0;
        padding-left: 0;
    }
}
@media (pointer: coarse) {
    .tx-adaptive-ribbon .tx-ribbon-group {
        padding-bottom: 0;
    }
    .tx-adaptive-ribbon .tx-font-group[data-ribbon-mode='compact'] > .tx-ribbon-group-body {
        width: 320px;
    }
    .tx-adaptive-ribbon .tx-alignment-group:not([data-ribbon-mode='collapsed']) > .tx-ribbon-group-body,
    .tx-adaptive-ribbon .tx-alignment-group > .tx-ribbon-group-body:popover-open {
        padding-bottom: 26px;
    }
    .tx-adaptive-ribbon .tx-ribbon-group-body[popover] .tx-ribbon-content {
        min-height: 94px;
    }
    .tx-adaptive-ribbon .tx-number-group[data-ribbon-mode='compact'] .tx-decimal-label input {
        font-size: 16px;
    }
}

/* Fill a sized host while keeping all scrolling inside the sheet. */
.tx-sheet.tx-sheet-fill {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}
.tx-sheet-fill > :not(.tx-grid-viewport) {
    flex-shrink: 0;
}
.tx-sheet-fill > .tx-grid-viewport {
    flex: 1 1 0;
    min-height: 0;
}
/* Native scrollbars reserve their own hit area; canvas selection never occupies a thumb. */
.tx-grid-viewport {
    scrollbar-gutter: stable;
}
.tx-grid-viewport::-webkit-scrollbar {
    width: 14px;
    height: 14px;
}
.tx-grid-viewport::-webkit-scrollbar-track,
.tx-grid-viewport::-webkit-scrollbar-corner {
    background: var(--tx-soft);
}
.tx-grid-viewport::-webkit-scrollbar-thumb {
    background: var(--tx-muted);
    border: 4px solid var(--tx-soft);
    border-radius: 8px;
}
.tx-grid-viewport::-webkit-scrollbar-thumb:hover {
    background: var(--tx-accent);
}
/* Formula designer follows the ribbon's compact, flat menu appearance. */
.tx-formula-designer {
    width: min(860px, calc(100vw - 32px));
    max-width: none;
    height: min(640px, calc(100dvh - 32px));
    max-height: none;
    padding: 0;
    border: 1px solid var(--tx-border);
    border-radius: var(--tx-popup-radius);
    box-shadow: var(--tx-popup-shadow);
    background: var(--tx-surface);
    color: var(--tx-text);
    overflow: hidden;
    font:
        14px/1.3 'Segoe UI',
        Arial,
        sans-serif;
}
.tx-formula-designer::backdrop {
    background: rgb(0 0 0 / 18%);
}
.tx-fd-form {
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.tx-fd-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    border-bottom: 1px solid var(--tx-border);
    gap: 12px;
}
.tx-fd-title {
    min-width: 0;
}
.tx-fd-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 650;
}
.tx-formula-designer button {
    border: 1px solid var(--tx-border);
    border-radius: 3px;
    min-height: 30px;
    padding: 5px 10px;
    background: var(--tx-surface);
}
.tx-formula-designer button:hover {
    background: var(--tx-soft);
}
.tx-formula-designer [data-fd='close'] {
    font-size: 22px;
    line-height: 1;
    border-color: transparent;
    width: 30px;
    padding: 2px;
}
/* Keep the shared dialog body bounded; each designer pane owns its own overflow. */
.tx-formula-designer .tx-dialog-body {
    display: flex;
    overflow: hidden;
}
.tx-fd-workspace {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    min-width: 0;
}
.tx-fd-library {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    padding: 12px;
    background: var(--tx-surface);
    border-right: 1px solid var(--tx-border);
}
.tx-fd-library > label {
    font-weight: 650;
    font-size: 13px;
}
.tx-formula-designer input,
.tx-formula-designer select,
.tx-formula-designer textarea {
    min-width: 0;
    width: 100%;
    border: 1px solid var(--tx-border);
    border-radius: 3px;
    background: var(--tx-surface);
    padding: 5px 8px;
    min-height: 30px;
}
.tx-fd-list {
    flex: 1;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid var(--tx-border);
}
.tx-fd-list button {
    display: block;
    text-align: left;
    padding: 6px 8px;
    background: transparent;
    border-color: transparent;
    border-radius: 0;
    flex-shrink: 0;
}
.tx-fd-list button > span {
    display: block;
    font-weight: 600;
    font-size: 13px;
}
.tx-fd-list small {
    display: block;
    color: var(--tx-muted);
    margin-top: 2px;
    font-size: 12px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tx-fd-list button[aria-pressed='true'] {
    background: var(--tx-soft);
    border-color: var(--tx-border);
}
.tx-fd-count,
.tx-fd-empty {
    margin: 0;
    font-size: 12px;
    color: var(--tx-muted);
}
.tx-fd-empty {
    padding: 8px;
}
.tx-fd-builder {
    padding: 12px 16px;
    min-width: 0;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
}
.tx-fd-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.tx-fd-heading > div {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}
.tx-fd-category {
    font-size: 12px;
    color: var(--tx-muted);
    order: 1;
}
.tx-fd-name {
    font-size: 18px;
    font-weight: 650;
    margin: 0;
}
.tx-fd-target {
    color: var(--tx-muted);
    font-size: 12px;
    white-space: nowrap;
}
.tx-fd-description {
    margin: 6px 0 8px;
    font-size: 13px;
}
.tx-fd-syntax {
    display: block;
    overflow-wrap: anywhere;
    font-size: 12px;
    color: var(--tx-muted);
    padding-bottom: 12px;
    border-bottom: 1px solid var(--tx-border);
    margin-bottom: 12px;
}
.tx-fd-arguments {
    display: grid;
    gap: 8px;
}
.tx-fd-argument {
    display: grid;
    grid-template-columns: 116px minmax(0, 1fr);
    align-items: start;
    gap: 10px;
}
.tx-fd-argument label {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
    padding-top: 6px;
    overflow-wrap: anywhere;
}
.tx-fd-argument label small {
    font-size: 11px;
    color: var(--tx-muted);
}
.tx-fd-argument-input {
    display: flex;
    gap: 4px;
    min-width: 0;
}
.tx-fd-argument-input input {
    flex: 1;
    font-family: Consolas, monospace;
    font-size: 13px;
}
.tx-fd-argument-input button {
    flex-shrink: 0;
    width: 30px;
    padding: 4px;
    display: grid;
    place-items: center;
}
.tx-fd-argument-input svg {
    display: block;
    width: 18px;
    height: 18px;
}
.tx-fd-argument-tools {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin: 10px 0 14px;
}
.tx-fd-argument-tools button {
    font-size: 12px;
}
.tx-fd-source-label {
    display: block;
    font-size: 13px;
    font-weight: 650;
    padding-top: 12px;
    border-top: 1px solid var(--tx-border);
    margin-bottom: 6px;
}
.tx-formula-designer .tx-fd-source {
    resize: vertical;
    min-height: 56px;
    max-height: 160px;
    font:
        13px/1.5 Consolas,
        monospace;
}
.tx-fd-help {
    font-size: 12px;
    color: var(--tx-muted);
    margin: 6px 0 12px;
}
.tx-fd-preview {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: baseline;
    column-gap: 12px;
    row-gap: 4px;
    padding: 12px 0 0;
    border-top: 1px solid var(--tx-border);
}
.tx-fd-preview > span {
    font-size: 13px;
    font-weight: 650;
}
.tx-fd-result {
    font-size: 16px;
    font-weight: 600;
    overflow-wrap: anywhere;
    font-variant-numeric: tabular-nums;
}
.tx-fd-feedback {
    grid-column: 1 / -1;
    margin: 0;
    font-size: 12px;
    color: var(--tx-muted);
}
.tx-fd-invalid .tx-fd-result {
    color: var(--tx-error);
}
.tx-fd-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-top: 1px solid var(--tx-border);
}
.tx-fd-footer > span {
    font-size: 12px;
    color: var(--tx-muted);
}
.tx-fd-footer > div {
    display: flex;
    gap: 8px;
}
.tx-fd-footer button {
    min-width: 84px;
}
.tx-formula-designer .tx-fd-apply {
    background: var(--tx-soft);
    border-color: var(--tx-accent);
    font-weight: 600;
}
.tx-fd-apply:disabled {
    opacity: 0.45;
    cursor: default;
}
@media (max-width: 640px) {
    .tx-formula-designer {
        width: calc(100vw - 16px);
        height: calc(100dvh - 16px);
    }
    .tx-fd-header {
        padding: 8px 12px;
    }
    .tx-fd-workspace {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto minmax(0, 1fr);
    }
    .tx-fd-library {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        padding: 12px;
        gap: 8px;
        border-right: 0;
        border-bottom: 1px solid var(--tx-border);
    }
    .tx-fd-library > label,
    .tx-fd-count {
        grid-column: 1 / -1;
    }
    .tx-fd-list {
        grid-column: 1 / -1;
        flex-direction: row;
        overflow-x: auto;
        max-height: 62px;
    }
    .tx-fd-list button {
        flex-shrink: 0;
        padding: 8px 10px;
    }
    .tx-fd-list small {
        display: none;
    }
    .tx-fd-builder {
        padding: 12px;
    }
    .tx-fd-argument {
        grid-template-columns: minmax(0, 1fr);
        gap: 4px;
    }
    .tx-fd-argument label {
        flex-direction: row;
        justify-content: space-between;
        padding-top: 0;
    }
    .tx-fd-argument-tools {
        flex-wrap: wrap;
    }
    .tx-fd-footer {
        padding: 12px;
        flex-wrap: wrap;
    }
    .tx-fd-footer > div {
        width: 100%;
    }
    .tx-fd-footer button {
        flex: 1;
    }
}
@media (pointer: coarse) {
    .tx-formula-designer input,
    .tx-formula-designer select,
    .tx-formula-designer textarea {
        font-size: 16px;
        min-height: 44px;
    }
    .tx-formula-designer button {
        min-height: 44px;
    }
    .tx-fd-argument-input button {
        width: 44px;
    }
    .tx-fd-header [data-fd='close'] {
        min-width: 44px;
    }
}

/* Transient copy perimeter: SVG animation leaves the worksheet canvas idle. */
.tx-copy-overlay {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
    pointer-events: none;
}
.tx-copy-overlay path {
    fill: none;
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
}
.tx-copy-underlay {
    stroke: var(--tx-surface);
}
.tx-copy-ants {
    stroke: var(--tx-accent);
    stroke-dasharray: 4 3;
    animation: tx-copy-clockwise 0.8s linear infinite;
}
.tx-copy-paused .tx-copy-ants {
    animation-play-state: paused;
}
@keyframes tx-copy-clockwise {
    from {
        stroke-dashoffset: 0;
    }
    to {
        stroke-dashoffset: -14;
    }
}
@media (prefers-reduced-motion: reduce) {
    .tx-copy-ants {
        animation: none;
    }
}
@media (forced-colors: active) {
    .tx-sheet {
        --tx-reference-accent: Highlight;
        --tx-reference-tint: Canvas;
    }
}

.tx-formula.tx-formula-picking {
    background: var(--tx-reference-tint);
    border-color: var(--tx-reference-accent);
}

/* Clipboard uses the same group popup and compact modes as the other Home groups. */
.tx-clipboard-controls {
    display: flex;
    align-items: flex-start;
    gap: 4px;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-paste-button {
    border-radius: 4px;
}
.tx-paste-button > .tx-ribbon-icon {
    width: 32px;
    height: 32px;
}
.tx-clipboard-controls > .tx-ribbon-stack {
    gap: 3px;
}
.tx-clipboard-controls .tx-ribbon-stack button {
    border-radius: 4px;
}
@media (max-width: 480px) {
    .tx-adaptive-ribbon [data-ribbon-mode='collapsed'] > .tx-ribbon-group-trigger {
        width: 47px;
        min-width: 47px;
        max-width: 47px;
    }
    .tx-ribbon-group-trigger > span:not(.tx-dropdown-arrow) {
        max-width: 38px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}
@media (pointer: coarse) {
    :is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-paste-button {
        border-radius: 4px;
    }
}

/* Web-font reflow must not move the scroll anchor. */
.tx-grid-viewport {
    overflow-anchor: none;
}

/* Text Control-style worksheet zoom. The ribbon and browser page keep their size. */
.tx-footer {
    min-height: 35px;
    flex-shrink: 0;
}
@media (max-width: 520px) {
    .tx-footer {
        min-height: 54px;
    }
}
@media (pointer: coarse) {
    .tx-footer {
        min-height: 45px;
    }
}
@media (max-width: 520px) and (pointer: coarse) {
    .tx-footer {
        min-height: 68px;
    }
}
.tx-footer {
    background: light-dark(#2d579b, #203a5d);
    color: #ffffff;
    gap: 10px;
}
.tx-footer .tx-sheet-label {
    color: inherit;
    border-bottom-color: #ffffff;
}
.tx-footer .tx-status {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}
.tx-footer .tx-status-error {
    padding: 0;
    border: 0;
    background: transparent;
    color: #ffe08a;
    font-weight: 600;
}
.tx-footer .tx-count {
    margin-left: 0;
    white-space: nowrap;
}
.tx-zoom {
    display: flex;
    align-items: center;
    align-self: stretch;
    gap: 2px;
    margin-left: auto;
    flex-shrink: 0;
}
.tx-zoom button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 30px;
    padding: 2px;
    border: 0;
    border-radius: 4px;
    color: inherit;
    background: transparent;
    font-size: 24px;
    line-height: 1;
}
.tx-zoom button:hover {
    background: rgb(255 255 255 / 0.16);
}
.tx-status-views {
    display: flex;
    align-self: stretch;
    margin-right: 6px;
}
.tx-status-views button {
    height: auto;
    min-height: 30px;
    padding-inline: 8px;
    border-radius: 0;
    box-shadow: none;
}
.tx-status-views button[aria-pressed='true'] {
    background: rgb(255 255 255 / 0.28);
}
.tx-status-view-icon {
    display: block;
    width: 20px;
    height: 20px;
    background: currentColor;
    mask-size: contain;
    mask-position: center;
    mask-repeat: no-repeat;
}
.tx-zoom button:disabled {
    opacity: 0.4;
    cursor: default;
}
.tx-zoom button:focus-visible,
.tx-zoom input:focus-visible {
    outline: 2px solid white;
    outline-offset: -2px;
}
.tx-status-views button:focus-visible {
    outline: none;
    background: rgb(255 255 255 / 0.45);
}
.tx-zoom svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: square;
    stroke-linejoin: miter;
}
.tx-zoom .tx-zoom-value {
    min-width: 56px;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}
/* A single filled outline keeps both arms balanced at every display scale. */
.tx-zoom svg.tx-zoom-symbol {
    display: block;
    width: 16px;
    height: 16px;
    fill: currentColor;
    stroke: none;
}
.tx-zoom-slider-track {
    position: relative;
    display: flex;
    align-items: center;
    width: 180px;
    min-width: 60px;
    height: 30px;
    margin: 0 5px;
}
/* Thumb center = 5px + (track width - 10px) * (100 - 10) / (400 - 10). */
.tx-zoom-marker {
    position: absolute;
    left: calc(23.076923% + 2.692308px);
    top: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 12px;
    background: currentColor;
    pointer-events: none;
}
.tx-zoom-slider {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    min-width: 0;
    height: 30px;
    margin: 0;
    padding: 0;
    background: transparent;
    color-scheme: light;
    cursor: pointer;
}
.tx-zoom-slider::-webkit-slider-runnable-track {
    height: 3px;
    background: #ffffff;
    border-radius: 2px;
}
.tx-zoom-slider::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 10px;
    height: 22px;
    margin-top: -9.5px;
    border-radius: 2px;
    background: #ffffff;
    border: 0;
}
.tx-zoom-slider::-moz-range-track {
    height: 3px;
    background: #ffffff;
    border-radius: 2px;
}
.tx-zoom-slider::-moz-range-thumb {
    width: 10px;
    height: 22px;
    border-radius: 2px;
    background: #ffffff;
    border: 0;
}
@media (max-width: 850px) {
    .tx-footer .tx-count {
        display: none;
    }
    .tx-zoom-slider-track {
        width: 130px;
    }
}
@media (max-width: 520px) {
    .tx-footer {
        padding: 0 6px;
        gap: 4px;
    }
    .tx-footer .tx-status {
        flex-basis: 45%;
    }
    .tx-zoom {
        width: 100%;
        justify-content: flex-end;
    }
    .tx-zoom-slider-track {
        flex: 1;
    }
}
@media (pointer: coarse) {
    .tx-zoom button,
    .tx-zoom-slider,
    .tx-zoom-slider-track {
        height: 44px;
    }
    .tx-zoom button {
        min-width: 44px;
    }
    .tx-zoom-slider-track {
        margin-inline: 0;
    }
}
@media (forced-colors: active) {
    .tx-footer {
        background: Canvas;
        color: CanvasText;
    }
    .tx-footer .tx-status-error {
        color: CanvasText;
    }
    .tx-zoom button {
        color: ButtonText;
    }
    .tx-status-views button[aria-pressed='true'],
    .tx-status-views button:focus-visible {
        color: HighlightText;
        background: Highlight;
        forced-color-adjust: none;
    }
    .tx-status-view-icon {
        forced-color-adjust: none;
    }
    .tx-zoom-slider {
        appearance: auto;
    }
    .tx-zoom button:focus-visible,
    .tx-zoom input:focus-visible {
        outline-color: Highlight;
    }
}

/* Excel-style Number controls share the ribbon's menus, launcher, and responsive groups. */
.tx-number-group {
    position: relative;
}
.tx-adaptive-ribbon .tx-number-group > .tx-ribbon-group-body {
    width: 212px;
}
.tx-adaptive-ribbon .tx-number-group[data-ribbon-mode='compact'] > .tx-ribbon-group-body {
    width: 186px;
}
.tx-number-controls {
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.tx-adaptive-ribbon .tx-number-group .tx-number-controls select {
    width: 100%;
}
.tx-number-controls > .tx-ribbon-row {
    width: 100%;
}
.tx-number-toolbar {
    display: grid;
    grid-template-columns: auto auto auto 1px auto auto;
    gap: 3px;
    align-items: center;
}
.tx-number-toolbar .tx-ribbon-separator {
    margin: 0;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-number-toolbar > button {
    min-width: 28px;
    padding: 2px;
}
.tx-accounting-split {
    display: inline-flex;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-accounting-split > button {
    min-width: 25px;
    padding: 2px;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-accounting-split > .tx-accounting-menu-trigger {
    min-width: 17px;
    border-left: 0;
}
.tx-accounting-symbol,
.tx-number-glyph {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 24px;
    height: 24px;
    font:
        24px/1 'Segoe UI',
        sans-serif;
}
.tx-comma-glyph {
    font-family: Georgia, serif;
    font-size: 30px;
    font-weight: 700;
    transform: translateY(-3px);
}
.tx-number-decimal-icon {
    width: 28px;
    height: 24px;
    overflow: visible;
}
.tx-number-decimal-icon text {
    fill: currentColor;
    font:
        9px 'Segoe UI',
        sans-serif;
}
.tx-number-arrow {
    fill: none;
    stroke: light-dark(#168ed1, #76c8f0);
    stroke-width: 1.4;
    stroke-linecap: square;
    stroke-linejoin: miter;
}
.tx-accounting-menu {
    min-width: min(266px, calc(100vw - 16px));
    padding: 5px 0;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-accounting-menu > button {
    display: flex;
    width: 100%;
    text-align: left;
    justify-content: flex-start;
    padding: 8px 13px;
    border-radius: 0;
    min-height: 34px;
}
.tx-accounting-menu > button:last-child {
    border-top: 1px solid var(--tx-border);
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-accounting-menu > [aria-checked='true'] {
    background: var(--tx-tint);
    color: var(--tx-accent);
}
@media (pointer: coarse) {
    .tx-adaptive-ribbon .tx-number-group > .tx-ribbon-group-body,
    .tx-adaptive-ribbon .tx-number-group[data-ribbon-mode='compact'] > .tx-ribbon-group-body {
        width: 288px;
        max-width: calc(100vw - 32px);
        padding-bottom: 26px;
    }
    :is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-number-toolbar button {
        min-width: 44px;
        min-height: 44px;
    }
    :is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-accounting-split > .tx-accounting-menu-trigger {
        min-width: 44px;
    }
    :is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-accounting-menu > button {
        min-height: 44px;
    }
}
@media (forced-colors: active) {
    .tx-number-arrow {
        stroke: ButtonText;
    }
}
/* Cell styles: reusable previews, grouped gallery, and a component-based editor. */
.tx-styles-controls {
    position: relative;
    display: flex;
    align-items: stretch;
    width: 490px;
    height: 68px;
    gap: 3px;
}
.tx-style-gallery {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-template-rows: repeat(2, 1fr);
    gap: 2px;
    flex: 1;
    min-width: 0;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) button.tx-cell-style {
    display: block;
    min-width: 0;
    width: 100%;
    padding: 2px;
    border: 1px solid transparent;
    border-radius: 3px;
    text-align: left;
    background: transparent;
    color: var(--tx-text);
}
.tx-cell-style > span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 1px 4px;
    line-height: 1.25;
    min-height: 27px;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) button.tx-cell-style:hover {
    border-color: var(--tx-border);
    background: var(--tx-soft);
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) button.tx-cell-style[aria-pressed='true'] {
    border-color: var(--tx-accent);
    box-shadow: inset 0 0 0 1px var(--tx-accent);
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) button.tx-cell-style[aria-pressed='mixed'] {
    border-color: var(--tx-accent);
    border-style: dashed;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-styles-expand {
    min-width: 24px;
    padding: 4px;
    border: 1px solid var(--tx-border);
    border-radius: 4px;
}
.tx-styles-menu {
    width: min(970px, calc(100vw - 16px));
    max-height: min(750px, var(--tx-styles-available-height, calc(100vh - 16px)));
    padding: 6px 10px 10px;
    overflow: auto;
}
.tx-styles-menu::backdrop,
.tx-style-context::backdrop {
    background: transparent;
}
.tx-style-category {
    padding: 8px 0;
    border-bottom: 1px solid var(--tx-border);
}
.tx-style-category h3 {
    font-size: 14px;
    font-weight: 650;
    margin: 0 4px 7px;
}
.tx-style-category-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 3px;
}
.tx-style-category:first-child .tx-style-category-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}
.tx-styles-hint {
    margin: 7px 4px 4px;
    color: var(--tx-muted);
    font-size: 12px;
}
.tx-styles-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-styles-actions button {
    justify-content: flex-start;
    min-height: 34px;
    padding: 6px 10px;
}
.tx-style-context {
    width: 225px;
    padding: 5px;
}
.tx-style-context strong {
    display: block;
    padding: 6px 9px;
    font-size: 13px;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-style-context button {
    display: flex;
    width: 100%;
    justify-content: flex-start;
    padding: 7px 9px;
}
.tx-style-dialog,
.tx-style-merge-dialog {
    width: 650px;
}
.tx-style-merge-dialog {
    width: 480px;
}
.tx-style-dialog label,
.tx-style-merge-dialog label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}
.tx-style-dialog input:not([type='checkbox']):not([type='color']),
.tx-style-dialog select,
.tx-style-merge-dialog input,
.tx-style-merge-dialog select {
    border: 1px solid var(--tx-border);
    border-radius: 4px;
    background: var(--tx-surface);
    padding: 6px 8px;
    width: 100%;
    min-width: 0;
}
.tx-style-identity {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 14px;
}
.tx-style-identity label[hidden],
.tx-style-dialog button[hidden],
.tx-style-context button[hidden] {
    display: none !important;
}
.tx-style-include {
    margin-bottom: 12px;
    font-weight: 600;
}
.tx-style-dialog .tx-style-include {
    flex-direction: row;
    align-items: center;
    gap: 7px;
}
.tx-style-error {
    color: var(--tx-error);
    margin: 10px 0;
}
.tx-style-merge-dialog form {
    display: grid;
    gap: 14px;
}
.tx-adaptive-ribbon .tx-styles-group[data-ribbon-mode='compact'] .tx-styles-controls {
    width: 318px;
}
.tx-adaptive-ribbon .tx-styles-group[data-ribbon-mode='compact'] .tx-style-gallery {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.tx-adaptive-ribbon .tx-styles-group[data-ribbon-mode='compact'] .tx-style-gallery > :nth-child(n + 7) {
    display: none;
}
.tx-adaptive-ribbon .tx-styles-group[data-ribbon-mode='collapsed'] .tx-styles-controls {
    width: min(450px, calc(100vw - 34px));
}
.tx-adaptive-ribbon .tx-styles-group[data-ribbon-mode='collapsed'] .tx-style-gallery {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}
@media (max-width: 640px) {
    .tx-style-category-grid,
    .tx-style-category:first-child .tx-style-category-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .tx-styles-menu {
        padding: 4px 7px 7px;
    }
    .tx-styles-menu .tx-cell-style > span {
        font-size: 13px !important;
    }

    .tx-adaptive-ribbon .tx-styles-group[data-ribbon-mode='collapsed'] .tx-style-gallery {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .tx-adaptive-ribbon .tx-styles-group[data-ribbon-mode='collapsed'] .tx-style-gallery > :nth-child(n + 7) {
        display: none;
    }
}
@media (max-width: 480px) {
    .tx-adaptive-ribbon [data-ribbon-mode='collapsed'] {
        padding: 0;
    }
    .tx-adaptive-ribbon [data-ribbon-mode='collapsed'] > .tx-ribbon-group-trigger {
        width: 44px;
        min-width: 44px;
        max-width: 44px;
        padding-left: 1px;
        padding-right: 1px;
    }
    .tx-style-category-grid,
    .tx-style-category:first-child .tx-style-category-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .tx-style-identity {
        grid-template-columns: 1fr;
    }
}
@media (pointer: coarse) {
    .tx-styles-controls {
        height: 92px;
    }
    :is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-styles-expand {
        min-width: 44px;
    }
    :is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) button.tx-cell-style {
        min-height: 44px;
    }
    .tx-style-dialog input:not([type='checkbox']),
    .tx-style-dialog select {
        min-height: 44px;
    }
}
@media (forced-colors: active) {
    .tx-cell-style > span {
        forced-color-adjust: auto;
    }
}
.tx-cell-style[data-cell-style='normal'] > span {
    outline: 1px solid var(--tx-border);
    outline-offset: -1px;
}

/* Conditional formatting shares the ribbon's menu and dialog styling. */
.tx-styles-command-area {
    display: flex;
    gap: 8px;
    align-items: stretch;
}
.tx-cf-controls {
    position: relative;
    flex-shrink: 0;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-cf-trigger {
    border-radius: 4px;
}
.tx-cf-icon {
    display: block;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}
.tx-cf-menu {
    width: min(286px, calc(100vw - 16px));
    padding: 5px 0;
}
.tx-cf-menu::backdrop,
.tx-cf-submenu::backdrop {
    background: transparent;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-cf-menu > button {
    display: flex;
    width: 100%;
    text-align: left;
    justify-content: flex-start;
    gap: 10px;
    min-height: 38px;
    padding: 7px 14px;
    border: 1px solid transparent;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-cf-menu > [data-cf-group]:not([data-cf-group='clear']) {
    min-height: 50px;
    font-weight: 600;
}
.tx-cf-chevron {
    margin-left: auto;
    font-size: 23px;
    line-height: 1;
}
.tx-cf-menu hr {
    border: 0;
    border-top: 1px solid var(--tx-border);
    margin: 4px 10px;
}
.tx-cf-submenu {
    width: min(290px, calc(100vw - 16px));
    padding: 5px 0;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-cf-submenu > button {
    display: flex;
    width: 100%;
    padding: 8px 14px;
    justify-content: flex-start;
    border: 1px solid transparent;
    min-height: 34px;
}
.tx-cf-submenu h3 {
    margin: 0;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 650;
}
.tx-cf-presets {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    padding: 4px 12px 10px;
    border-bottom: 1px solid var(--tx-border);
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) .tx-cf-presets button {
    display: grid;
    place-items: center;
    padding: 7px;
    min-height: 44px;
}
.tx-cf-scale {
    display: block;
    width: 26px;
    height: 30px;
    border: 1px solid var(--tx-border);
}
.tx-cf-dialog,
.tx-cf-manager {
    width: min(520px, calc(100vw - 24px));
}
.tx-cf-manager {
    width: min(960px, calc(100vw - 24px));
}
.tx-cf-dialog [hidden],
.tx-cf-manager [hidden] {
    display: none !important;
}
.tx-cf-dialog h3 {
    font-size: 14px;
    font-weight: 650;
    margin: 12px 0 8px;
    padding-top: 10px;
    border-top: 1px solid var(--tx-border);
}
.tx-cf-dialog input[type='color'] {
    width: 100%;
    height: 32px;
    padding: 2px;
}
.tx-cf-format-preview {
    display: block;
    padding: 7px 12px;
    border: 1px solid var(--tx-border);
    margin-bottom: 10px;
}
.tx-cf-note {
    color: var(--tx-muted);
    font-size: 12px;
    margin: 0 0 10px;
}
.tx-cf-error {
    color: var(--tx-error);
    margin: 8px 0;
}
.tx-cf-dialog footer,
.tx-cf-manager footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    border-top: 1px solid var(--tx-border);
    padding-top: 12px;
    margin-top: 12px;
}
.tx-cf-dialog button,
.tx-cf-manager button {
    border: 1px solid var(--tx-border);
    background: var(--tx-surface);
    border-radius: 3px;
    padding: 5px 10px;
    min-height: 30px;
}
.tx-cf-dialog header button,
.tx-cf-manager header button {
    border-color: transparent;
    padding: 2px 6px;
    font-size: 22px;
    line-height: 1;
}
.tx-cf-rule-list {
    overflow: auto;
    max-height: 55dvh;
}
.tx-cf-rule-list table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}
.tx-cf-rule-list th,
.tx-cf-rule-list td {
    padding: 8px;
    border-bottom: 1px solid var(--tx-border);
    vertical-align: top;
}
.tx-cf-rule-list th {
    font-weight: 650;
    font-size: 12px;
    background: var(--tx-soft);
}
.tx-cf-rule-list td:nth-child(2) {
    max-width: 250px;
    overflow-wrap: anywhere;
}
.tx-cf-rule-list td:last-child {
    min-width: 225px;
}
.tx-cf-rule-list button {
    margin: 0 3px 3px 0;
}
.tx-cf-rule-sample {
    display: block;
    padding: 3px 8px;
    border: 1px solid var(--tx-border);
    margin-top: 5px;
    width: 70px;
}
.tx-adaptive-ribbon .tx-styles-group[data-ribbon-mode='collapsed'] .tx-styles-command-area {
    flex-direction: column;
}
@media (pointer: coarse) {
    .tx-cf-dialog input,
    .tx-cf-dialog select,
    .tx-cf-manager select,
    .tx-cf-dialog button,
    .tx-cf-manager button {
        min-height: 44px;
    }
    .tx-cf-dialog input:not([type='checkbox']),
    .tx-cf-dialog select,
    .tx-cf-manager select {
        font-size: 16px;
    }
}

/* Worksheet context commands share the ribbon controls and popup tokens. */
.tx-context-ui {
    position: fixed;
    inset: auto;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--tx-text);
    overflow: visible;
    max-width: calc(100vw - 16px);
    font:
        13px/1.3 'Segoe UI',
        sans-serif;
}
.tx-context-ui::backdrop {
    background: transparent;
}
.tx-context-panel {
    border: 1px solid var(--tx-border);
    border-radius: var(--tx-popup-radius);
    box-shadow: var(--tx-popup-shadow);
    background: var(--tx-surface);
    color: var(--tx-text);
}
.tx-mini-toolbar {
    padding: 4px;
    width: 424px;
    max-width: calc(100vw - 16px);
    box-sizing: border-box;
    margin-bottom: 8px;
}
.tx-mini-row {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-wrap: wrap;
}
.tx-mini-row + .tx-mini-row {
    margin-top: 3px;
}
.tx-context-ui .tx-mini-toolbar select[data-mini-style='fontFamily'] {
    width: 106px;
    min-width: 80px;
}
.tx-context-ui .tx-mini-toolbar button {
    border-radius: 3px;
}
.tx-context-ui .tx-mini-toolbar > .tx-mini-row > button {
    width: 27px;
    padding: 2px;
}
.tx-context-ui .tx-mini-first > .tx-number-controls {
    flex-direction: row;
    gap: 1px;
}
.tx-mini-first .tx-number-controls > .tx-ribbon-row,
.tx-mini-first .tx-number-launcher,
.tx-mini-first .tx-number-toolbar > .tx-ribbon-separator {
    display: none;
}
.tx-mini-first .tx-number-toolbar {
    display: flex;
    gap: 0;
}
.tx-mini-first .tx-number-toolbar > button {
    min-width: 25px;
}
.tx-mini-first .tx-accounting-split > button {
    min-width: 21px;
}
.tx-mini-first .tx-accounting-split > .tx-accounting-menu-trigger {
    min-width: 14px;
}
.tx-mini-decimals {
    display: flex;
}
.tx-context-ui .tx-mini-decimals > button {
    padding: 0;
    min-width: 28px;
}
.tx-mini-second > [data-mini-command='clear-format'] {
    margin-left: 0;
}
.tx-mini-alignment {
    display: flex;
}
.tx-context-menu {
    width: 282px;
    max-width: calc(100vw - 16px);
    box-sizing: border-box;
    padding: 5px;
    max-height: var(--tx-context-height, calc(100dvh - 16px));
    overflow: auto;
}
.tx-context-ui.tx-tab-menu .tx-sheet-color-command,
.tx-context-ui.tx-context-menu > button,
.tx-context-ui .tx-context-menu > button,
.tx-context-ui :is(.tx-context-format, .tx-context-table-menu) > button {
    display: flex;
    width: 100%;
    min-height: 31px;
    justify-content: flex-start;
    text-align: left;
    gap: 10px;
    padding: 4px 9px;
    border-radius: 3px;
}
.tx-context-ui.tx-context-menu > button[hidden],
.tx-context-ui .tx-context-menu > button[hidden] {
    display: none;
}
.tx-context-menu .tx-ribbon-icon,
.tx-context-table-menu .tx-ribbon-icon,
.tx-context-icon {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
}
.tx-context-shortcut {
    margin-left: auto;
    color: var(--tx-muted);
    font-size: 11px;
}
.tx-context-table-menu {
    width: 280px;
    max-width: calc(100vw - 16px);
}
.tx-context-format {
    width: 237px;
    max-width: calc(100vw - 16px);
}
@media (max-width: 460px), (pointer: coarse) {
    .tx-mini-toolbar {
        width: 304px;
    }
    .tx-mini-row {
        flex-wrap: wrap;
    }
    .tx-mini-first .tx-number-controls > .tx-mini-decimals {
        position: static;
    }
    .tx-mini-second > [data-mini-command='clear-format'] {
        margin-left: 0;
    }
}
@media (pointer: coarse) {
    .tx-context-ui.tx-context-menu > button,
    .tx-context-ui .tx-context-menu > button,
    .tx-context-ui :is(.tx-context-format, .tx-context-table-menu) > button {
        min-height: 44px;
    }
    .tx-context-ui .tx-mini-toolbar button {
        min-width: 44px;
        min-height: 44px;
    }
}
@media (forced-colors: active) {
    .tx-context-panel {
        border-color: CanvasText;
    }
}

.tx-context-chevron {
    width: 6px;
    height: 6px;
    border-top: 1px solid currentColor;
    border-right: 1px solid currentColor;
    transform: rotate(45deg);
    margin-left: auto;
    margin-right: 3px;
}

/* Page Layout uses the same adaptive ribbon and dropdown surfaces as Home. */
.tx-ribbon-panel[hidden] {
    display: none !important;
}
/* Contextual captions share the theme's accessible green in active and inactive states. */
.tx-ribbon
    .tx-ribbon-tabs
    [role='tab']:is(
        [aria-controls$='-table-design'],
        [aria-controls$='-shape-format'],
        [aria-controls$='-chart-design'],
        [aria-controls$='-header-footer']
    ) {
    color: var(--tx-accent);
}
.tx-ribbon-tabs [role='tab'][aria-selected='false'] {
    border-bottom-color: transparent;
    font-weight: 400;
}
.tx-page-setup-controls,
.tx-page-view-controls {
    display: flex;
    align-items: stretch;
    gap: 2px;
}
.tx-page-dropdown {
    display: flex;
}
.tx-ribbon .tx-page-button {
    border-radius: 3px;
}
.tx-page-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    object-fit: contain;
}
.tx-page-setup-group {
    position: relative;
}
.tx-page-setup-group .tx-page-launcher {
    right: 2px;
    bottom: 1px;
}
.tx-page-launcher .tx-ribbon-icon {
    width: 16px;
    height: 16px;
}
.tx-page-menu {
    min-width: min(260px, calc(100vw - 16px));
    padding: 4px;
}
.tx-ribbon .tx-page-menu > button {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    min-height: 34px;
    width: 100%;
    padding: 6px 10px;
    border-radius: 3px;
    text-align: left;
}
.tx-ribbon .tx-page-menu > .tx-page-menu-icon-item {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
}
.tx-page-menu small {
    font-size: 11px;
    color: var(--tx-muted);
}
.tx-ribbon .tx-page-menu [aria-checked='true'] {
    background: var(--tx-soft);
}
.tx-page-scale-fields {
    display: grid;
    grid-template-columns: max-content 100px;
    align-items: center;
    gap: 3px 4px;
    font-size: 12px;
}
.tx-page-scale-fields label {
    display: contents;
}
.tx-ribbon .tx-page-scale-fields input {
    width: 73px;
}
.tx-page-dialog {
    width: min(550px, calc(100vw - 24px));
}
.tx-page-dialog-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}
.tx-page-dialog fieldset {
    border: 0;
    padding: 0;
    margin: 0;
    min-width: 0;
}
.tx-page-dialog legend {
    padding: 0;
    margin-bottom: 9px;
    font-weight: 600;
}
.tx-page-dialog label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
    font-size: 12px;
}
.tx-ribbon .tx-page-dialog input,
.tx-ribbon .tx-page-dialog select {
    width: 100%;
    min-height: 30px;
    border-radius: 3px;
}
.tx-page-custom-size {
    display: flex;
    gap: 8px;
}
.tx-page-custom-size label {
    flex: 1;
    min-width: 0;
}
.tx-page-dialog .tx-page-fit-check {
    flex-direction: row;
    align-items: center;
}
.tx-ribbon .tx-page-fit-check input {
    width: 16px;
    min-height: 16px;
}
.tx-page-dialog p {
    margin: 5px 0 10px;
    color: var(--tx-muted);
    font-size: 12px;
}
.tx-page-dialog .tx-page-dialog-error {
    color: var(--tx-error);
}
.tx-page-dialog-error[hidden] {
    display: none;
}
.tx-page-paper-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
}
.tx-page-paper-preview svg {
    width: 85px;
    height: 75px;
}
[data-paper-preview] {
    fill: var(--tx-surface);
    stroke: var(--tx-muted);
}
[data-margin-preview] {
    fill: transparent;
    stroke: light-dark(#168ed1, #76c8f0);
    stroke-dasharray: 3 2;
}
.tx-page-setup-group > .tx-ribbon-group-body:popover-open .tx-page-setup-controls {
    flex-wrap: wrap;
    max-width: 290px;
}
@media (max-width: 540px) {
    .tx-page-dialog-fields {
        grid-template-columns: 1fr;
    }
    .tx-page-paper-preview {
        justify-content: center;
    }
}
@media (pointer: coarse) {
    .tx-ribbon .tx-page-menu > button,
    .tx-ribbon .tx-page-dialog input,
    .tx-ribbon .tx-page-dialog select {
        min-height: 44px;
    }
    .tx-page-dialog .tx-page-fit-check input {
        width: 18px;
        min-height: 18px;
    }
    .tx-page-scale-fields label {
        font-size: 14px;
    }
    .tx-page-setup-group > .tx-ribbon-group-body:popover-open .tx-page-setup-controls {
        max-width: 290px;
    }
}

/* Sort & Filter uses the shared ribbon popup and dialog treatment. */
.tx-sort-filter-controls {
    display: flex;
    align-items: flex-start;
    gap: 3px;
}
.tx-sort-quick {
    gap: 5px;
}
.tx-sort-large .tx-ribbon-icon {
    width: 32px;
    height: 32px;
}
.tx-filter-actions button {
    gap: 5px;
}
.tx-sort-filter-group[data-ribbon-mode='compact'] .tx-filter-actions button span {
    display: none;
}
.tx-sort-filter-group[data-ribbon-mode='compact'] .tx-sort-large {
    padding-inline: 3px;
}
.tx-sort-dialog {
    box-sizing: border-box;
    width: min(580px, calc(100vw - 24px));
}
.tx-sort-dialog label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.tx-sort-dialog input:not([type='checkbox']),
.tx-sort-dialog select,
.tx-filter-menu > input {
    box-sizing: border-box;
    width: 100%;
    min-height: 30px;
    padding: 4px 6px;
    font: inherit;
    color: var(--tx-text);
    background: var(--tx-surface);
    border: 1px solid var(--tx-border);
    border-radius: 3px;
}
.tx-sort-dialog > form > p {
    color: var(--tx-muted);
    font-size: 12px;
}
.tx-sort-options {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin: 12px 0;
}
.tx-sort-options label {
    flex-direction: row;
    align-items: center;
}
.tx-sort-levels,
.tx-filter-levels {
    margin: 14px 0;
}
.tx-sort-level,
.tx-filter-level {
    display: grid;
    grid-template-columns: 1fr 1.3fr 30px;
    align-items: end;
    gap: 8px;
    margin-bottom: 10px;
}
.tx-filter-level {
    grid-template-columns: 1fr 1.3fr 1fr 30px;
}
.tx-filter-level [data-sf-second-label] {
    grid-column: 3;
}
.tx-filter-level [data-sf-remove] {
    grid-column: 4;
    grid-row: 1;
}
.tx-sort-dialog button {
    font: inherit;
    color: inherit;
    background: var(--tx-soft);
    border: 1px solid var(--tx-border);
    border-radius: 4px;
    padding: 5px 8px;
}
.tx-sort-dialog .tx-dialog-actions {
    margin-top: 18px;
}
.tx-sort-dialog .tx-sort-error {
    color: var(--tx-error);
}
.tx-sort-dialog [hidden],
.tx-filter-menu [hidden] {
    display: none;
}
.tx-filter-headers {
    position: absolute;
    left: 0;
    top: 0;
    overflow: hidden;
    pointer-events: none;
}
.tx-filter-headers button {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    pointer-events: auto;
    border: 1px solid var(--tx-border);
    border-radius: 2px;
    background: var(--tx-soft);
    color: var(--tx-muted);
    cursor: pointer;
}
.tx-filter-headers button[hidden] {
    display: none;
}
.tx-filter-headers button:hover,
.tx-filter-headers button[aria-expanded='true'] {
    border-color: var(--tx-accent);
    color: var(--tx-accent);
}
.tx-filter-headers button.tx-filter-active {
    color: #009fe3;
    border-color: currentColor;
}
.tx-filter-active::before {
    content: '';
    width: 6px;
    height: 8px;
    background: currentColor;
    clip-path: polygon(0 0, 100% 0, 60% 50%, 60% 100%, 40% 100%, 40% 50%);
}
.tx-filter-active .tx-dropdown-arrow {
    display: none;
}
.tx-filter-menu {
    box-sizing: border-box;
    width: min(280px, calc(100vw - 16px));
    padding: 10px;
    max-height: calc(100dvh - 16px);
}
.tx-filter-menu > strong {
    display: block;
    margin-bottom: 8px;
}
.tx-filter-sort-buttons {
    border-bottom: 1px solid var(--tx-border);
    margin-bottom: 10px;
    padding-bottom: 8px;
}
.tx-filter-sort-buttons button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    border: 0;
    padding: 5px;
    border-radius: 3px;
    font: inherit;
    color: inherit;
    background: transparent;
    text-align: left;
}
.tx-filter-sort-buttons button:hover {
    background: var(--tx-soft);
}
.tx-filter-values {
    max-height: min(240px, 35dvh);
    overflow: auto;
    border: 1px solid var(--tx-border);
    margin: 9px 0;
    padding: 3px;
}
.tx-filter-values label {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px;
    overflow-wrap: anywhere;
    cursor: pointer;
}
.tx-filter-values label:hover {
    background: var(--tx-soft);
}
.tx-filter-values input {
    flex: 0 0 auto;
    accent-color: var(--tx-accent);
}
.tx-filter-menu .tx-dialog-actions {
    gap: 5px;
}
.tx-filter-menu .tx-dialog-actions button {
    font: inherit;
    color: inherit;
}
.tx-filter-menu [data-filter-clear] {
    margin-right: auto;
    flex-basis: 100%;
    text-align: left;
    background: transparent;
    border: 0;
    padding: 5px;
}
@media (max-width: 540px) {
    .tx-sort-level,
    .tx-filter-level {
        grid-template-columns: 1fr 30px;
        border-bottom: 1px solid var(--tx-border);
        padding-bottom: 10px;
    }
    .tx-sort-level label,
    .tx-filter-level label {
        grid-column: 1;
    }
    .tx-sort-level [data-sf-remove],
    .tx-filter-level [data-sf-remove] {
        grid-column: 2;
        grid-row: 1;
    }
}
@media (pointer: coarse) {
    .tx-sort-dialog input:not([type='checkbox']),
    .tx-sort-dialog select,
    .tx-sort-dialog button,
    .tx-filter-sort-buttons button,
    .tx-filter-values label {
        min-height: 44px;
    }
}

/* Size minimized groups from their own panel, including embedded editors. */
.tx-adaptive-ribbon .tx-ribbon-panel.tx-ribbon-small [data-ribbon-mode='collapsed'] {
    padding: 0;
}
.tx-adaptive-ribbon .tx-ribbon-panel.tx-ribbon-small [data-ribbon-mode='collapsed'] > .tx-ribbon-group-trigger {
    width: var(--tx-ribbon-trigger-width);
    min-width: var(--tx-ribbon-trigger-width);
    max-width: var(--tx-ribbon-trigger-width);
    padding-inline: 1px;
}
.tx-adaptive-ribbon .tx-ribbon-panel.tx-ribbon-small .tx-ribbon-group-trigger > span:not(.tx-dropdown-arrow) {
    max-width: calc(var(--tx-ribbon-trigger-width) - 6px);
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (pointer: coarse) {
    /* Preserve touch targets; the ribbon itself scrolls when eight groups cannot fit. */
    .tx-adaptive-ribbon .tx-ribbon-panel.tx-ribbon-small [data-ribbon-mode='collapsed'] > .tx-ribbon-group-trigger {
        width: 44px;
        min-width: 44px;
        max-width: 44px;
    }
}

/* A shared frame keeps the sheet stationary when switching ribbon tabs. */
.tx-ribbon,
.tx-dashboard-toolbar {
    --tx-ribbon-panel-height: 112px;
}
.tx-adaptive-ribbon .tx-ribbon-panel {
    height: var(--tx-ribbon-panel-height);
    min-height: var(--tx-ribbon-panel-height);
    max-height: var(--tx-ribbon-panel-height);
}
.tx-ribbon-tabs {
    height: 36px;
}
.tx-ribbon .tx-ribbon-tabs [role='tab'] {
    height: 36px;
    min-height: 36px;
}
.tx-data-tools-buttons {
    display: flex;
    align-items: stretch;
    gap: 3px;
}
.tx-data-tool-button .tx-ribbon-icon {
    width: 32px;
    height: 32px;
}
.tx-adaptive-ribbon [data-ribbon-mode='compact'] .tx-data-tool-button {
    min-width: 62px;
    padding-inline: 2px;
    font-size: 11px;
}
.tx-data-dialog {
    box-sizing: border-box;
    width: min(620px, calc(100vw - 24px));
}
.tx-data-dialog label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
    min-width: 0;
}
.tx-data-dialog input:not([type='checkbox']):not([type='radio']),
.tx-data-dialog select,
.tx-data-dialog textarea {
    box-sizing: border-box;
    width: 100%;
    min-height: 30px;
    padding: 4px 6px;
    border: 1px solid var(--tx-border);
    border-radius: 3px;
    font: inherit;
    color: inherit;
    background: var(--tx-surface);
}
.tx-data-dialog textarea {
    resize: vertical;
}
.tx-data-dialog .tx-data-check {
    flex-direction: row;
    align-items: center;
    gap: 6px;
}
.tx-data-check input {
    accent-color: var(--tx-accent);
}
.tx-data-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.tx-data-dialog fieldset {
    border: 1px solid var(--tx-border);
    padding: 10px;
    margin: 8px 0 12px;
}
.tx-data-dialog legend {
    font-weight: 600;
    padding: 0 4px;
}
.tx-data-dialog button {
    padding: 5px 9px;
    font: inherit;
    color: inherit;
    background: var(--tx-soft);
    border: 1px solid var(--tx-border);
    border-radius: 4px;
}
.tx-data-dialog button:disabled {
    opacity: 0.5;
    cursor: default;
}
.tx-data-column-actions {
    display: flex;
    gap: 7px;
    margin-top: 8px;
}
.tx-duplicate-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 170px;
    overflow: auto;
}
.tx-data-dialog p,
.tx-data-preview-summary {
    font-size: 12px;
    color: var(--tx-muted);
}
.tx-data-dialog .tx-data-error {
    color: var(--tx-error);
}
.tx-data-dialog [hidden] {
    display: none;
}
.tx-data-preview {
    border-top: 1px solid var(--tx-border);
    margin-top: 14px;
    padding-top: 12px;
}
.tx-data-preview > strong {
    display: block;
    margin-bottom: 6px;
}
.tx-data-preview-table {
    max-height: 220px;
    overflow: auto;
}
.tx-data-preview table {
    border-collapse: collapse;
    width: 100%;
    font-size: 12px;
}
.tx-data-preview th {
    background: var(--tx-soft);
    position: sticky;
    top: 0;
    text-align: left;
}
.tx-data-preview td,
.tx-data-preview th {
    border: 1px solid var(--tx-border);
    padding: 4px 6px;
    white-space: pre;
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tx-data-preview-summary {
    display: block;
    margin: 8px 0;
}
.tx-data-dialog .tx-dialog-actions {
    margin-top: 14px;
}
@media (max-width: 540px) {
    .tx-data-fields {
        grid-template-columns: 1fr;
        gap: 0;
    }
    .tx-duplicate-columns {
        grid-template-columns: 1fr;
    }
}
@media (pointer: coarse) {
    .tx-ribbon,
    .tx-dashboard-toolbar {
        --tx-ribbon-panel-height: 176px;
    }
    .tx-ribbon-tabs {
        height: 48px;
    }
    .tx-ribbon .tx-ribbon-tabs [role='tab'] {
        height: 48px;
        min-height: 48px;
    }
    .tx-data-dialog input:not([type='checkbox']):not([type='radio']),
    .tx-data-dialog select,
    .tx-data-dialog button,
    .tx-data-dialog .tx-data-check {
        min-height: 44px;
    }
}

/* Worksheet tabs stay above the status/zoom bar, with a fixed add button. */
.tx-sheet-bar {
    display: flex;
    align-items: stretch;
    gap: 5px;
    padding: 0 12px;
    min-width: 0;
    background: var(--tx-soft);
    border-top: 1px solid var(--tx-border);
}
.tx-sheet-tabs {
    display: flex;
    align-items: stretch;
    overflow-x: auto;
    min-width: 0;
    max-width: calc(100% - 42px);
    scrollbar-width: thin;
}
.tx-sheet-tab {
    position: relative;
    flex: 0 0 auto;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 9px 18px 11px;
    border: 0;
    border-right: 1px solid var(--tx-border);
    border-radius: 0;
    background: transparent;
    color: var(--tx-text);
    font: inherit;
    cursor: pointer;
}
.tx-sheet-tab:hover {
    background: var(--tx-tint);
}
.tx-sheet-tab[aria-selected='true'],
.tx-sheet-tab[data-sheet-selected='true'] {
    background: var(--tx-surface);
    font-weight: 600;
}
.tx-sheet-tab[aria-selected='true']::after,
.tx-sheet-tab[data-sheet-selected='true']::after,
.tx-sheet-tab-colored::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 12px;
    right: 12px;
    height: 3px;
    background: var(--tx-sheet-tab-color, var(--tx-accent));
}
.tx-sheet-add {
    flex: 0 0 36px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--tx-muted);
    cursor: pointer;
}
.tx-sheet-add:hover {
    background: var(--tx-tint);
    color: var(--tx-text);
}
.tx-sheet-add svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1;
    stroke-linecap: square;
}
/* Sheet menus use the cell context menu's spacing and icons. */
.tx-tab-menu [data-color-picker] {
    width: 100%;
}
.tx-tab-menu .tx-sheet-submenu-arrow {
    margin-left: auto;
}
/* Rename uses the tab's own padding, background and underline without a second input box. */
.tx-sheet-tab-renaming {
    display: inline-grid;
    grid-template-columns: minmax(1ch, max-content);
    max-width: none;
    cursor: text;
}
.tx-sheet-name-measure,
.tx-sheet-name-editor {
    grid-area: 1 / 1;
    font: inherit;
    white-space: pre;
}
.tx-sheet-name-measure {
    visibility: hidden;
    pointer-events: none;
}
.tx-sheet-name-editor {
    width: 100%;
    min-width: 0;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
    box-shadow: none;
    cursor: text;
}
.tx-sheet .tx-sheet-name-editor:focus-visible {
    outline: none;
}
.tx-sheet-tab-renaming:has([aria-invalid='true'])::after {
    background: var(--tx-error);
}
.tx-sheet-dialog {
    width: 340px;
    max-width: calc(100vw - 32px);
    padding: 18px;
    border: 1px solid var(--tx-border);
    border-radius: 4px;
    background: var(--tx-surface);
    color: var(--tx-text);
}
.tx-sheet-dialog::backdrop {
    background: rgb(0 0 0 / 0.25);
}
.tx-sheet-dialog h2 {
    margin: 0 0 18px;
    font-size: 18px;
    font-weight: 600;
}
.tx-sheet-dialog label {
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.tx-sheet-dialog label[hidden] {
    display: none;
}
.tx-sheet-dialog input {
    width: 100%;
    padding: 6px;
    font: inherit;
    background: var(--tx-surface);
    color: var(--tx-text);
    border: 1px solid var(--tx-border);
}
.tx-sheet-dialog-error {
    color: var(--tx-error);
}
.tx-sheet-bar button:focus-visible {
    outline: 2px solid var(--tx-focus);
    outline-offset: -3px;
}
@media (pointer: coarse) {
    .tx-sheet-tab,
    .tx-sheet-add,
    .tx-tab-menu button {
        min-height: 44px;
    }
    .tx-sheet-add {
        flex-basis: 44px;
    }
}
@media (max-width: 520px) {
    .tx-sheet-bar {
        padding: 0 4px;
    }
    .tx-sheet-tab {
        padding-inline: 12px;
    }
}
@media (forced-colors: active) {
    .tx-sheet-tab[aria-selected='true'],
    .tx-sheet-tab[data-sheet-selected='true'] {
        color: Highlight;
    }
    .tx-sheet-tab[aria-selected='true']::after,
    .tx-sheet-tab[data-sheet-selected='true']::after {
        background: Highlight;
    }
}

/* Host chrome belongs to the application; areas can be toggled at runtime. */
.tx-sheet > [data-control-area][hidden] {
    display: none !important;
}

/* Reporting uses the same command groups, popup surfaces and dialogs as Data. */
.tx-reporting-commands {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    height: 100%;
}
.tx-reporting-panel .tx-ribbon-stack button {
    display: flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
}
.tx-reporting-panel .tx-ribbon-stack .tx-ribbon-icon {
    width: 22px;
    height: 22px;
}
.tx-reporting-menu {
    position: fixed;
    inset: auto;
    margin: 0;
    width: 330px;
    max-width: calc(100vw - 16px);
    padding: 8px;
    overflow: auto;
}
.tx-reporting-menu-title {
    display: block;
    padding: 4px 5px 9px;
    font-size: 14px;
}
.tx-reporting-menu input {
    box-sizing: border-box;
    width: 100%;
    min-height: 30px;
    border: 1px solid var(--tx-border);
    background: var(--tx-surface);
    color: var(--tx-text);
    padding: 4px 7px;
    margin: 0 0 5px;
}
.tx-reporting-menu-list {
    max-height: 320px;
    overflow: auto;
}
.tx-reporting-menu-list button {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid transparent;
    border-radius: 0;
    padding: 7px 8px;
    text-align: left;
    min-height: 32px;
    background: transparent;
    color: var(--tx-text);
}
.tx-reporting-menu-list button span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tx-reporting-menu-list button small {
    font-size: 11px;
    color: var(--tx-muted);
    white-space: nowrap;
}
.tx-reporting-menu-list button:hover,
.tx-reporting-menu-list button:focus-visible {
    background: var(--tx-soft);
    border-color: var(--tx-border);
}
.tx-reporting-menu-summary {
    font-size: 12px;
    margin: 5px;
    color: var(--tx-muted);
}
.tx-reporting-dialog {
    width: min(690px, calc(100vw - 24px));
}
.tx-reporting-dialog textarea {
    box-sizing: border-box;
    width: 100%;
    font-family: monospace;
    resize: vertical;
}
.tx-reporting-mappings {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
}
.tx-reporting-mappings th {
    text-align: left;
    font-weight: 600;
    padding: 6px 3px;
    border-bottom: 1px solid var(--tx-border);
}
.tx-reporting-mappings td {
    padding: 5px 3px;
}
.tx-reporting-mappings td:first-child {
    width: 75px;
}
.tx-reporting-mappings td:last-child {
    width: 32px;
}
.tx-reporting-mappings input,
.tx-reporting-mappings select {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
}
.tx-reporting-mappings button img {
    width: 22px;
    height: 22px;
}
@media (pointer: coarse) {
    .tx-reporting-menu-list button {
        min-height: 44px;
    }
    .tx-reporting-panel .tx-ribbon-stack button {
        min-height: 44px;
    }
}
@media (forced-colors: active) {
    .tx-reporting-menu-list button:focus-visible {
        outline: 2px solid Highlight;
    }
    .tx-reporting-menu-list button small,
    .tx-reporting-menu-summary {
        color: CanvasText;
    }
}

[data-alignment-menu='orientation'] > .tx-ribbon-icon {
    width: 20px;
    height: 20px;
}

/* Charts use the same ribbon, gallery and dialog treatment as the other commands. */
.tx-chart-ribbon {
    display: flex;
    gap: 12px;
    align-items: center;
}
.tx-chart-buttons {
    display: grid;
    grid-template-columns: repeat(3, 48px);
    grid-template-rows: repeat(2, 40px);
    gap: 2px;
}
.tx-chart-buttons button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
}
.tx-chart-buttons .tx-ribbon-icon {
    width: 32px;
    height: 32px;
}
.tx-chart-menu {
    position: fixed;
    margin: 0;
    padding: 0;
    width: 350px;
    max-width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    overflow: auto;
    background: var(--tx-surface);
    color: var(--tx-text);
    border: 1px solid var(--tx-muted);
    border-radius: 4px;
    box-shadow: 0 5px 12px #0003;
}
.tx-chart-menu section {
    padding: 12px 16px;
    border-bottom: 1px solid var(--tx-border);
}
.tx-chart-menu h3 {
    font-size: 14px;
    margin: 0 0 8px;
    font-weight: 600;
}
.tx-chart-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 5px;
}
.tx-chart-gallery button {
    padding: 6px;
    width: 100%;
    height: 64px;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 0;
}
.tx-chart-gallery .tx-ribbon-icon {
    width: 48px;
    height: 48px;
}
.tx-chart-gallery button:hover,
.tx-chart-gallery button:focus-visible {
    background: var(--tx-soft);
    border-color: var(--tx-accent);
    outline: none;
}
.tx-chart-more {
    display: block;
    width: 100%;
    padding: 12px 16px;
    text-align: left;
    border: 0;
    background: transparent;
    color: inherit;
}
.tx-chart-dialog {
    width: 940px;
}
.tx-chart-dialog-body {
    display: flex;
}
.tx-chart-categories {
    width: 176px;
    flex: none;
    padding: 14px 10px;
    overflow: auto;
    border-right: 1px solid var(--tx-border);
}
.tx-chart-categories[hidden] {
    display: none;
}
.tx-chart-categories button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    text-align: left;
    border: 1px solid transparent;
    border-radius: 0;
    padding: 7px 5px;
    background: transparent;
    color: var(--tx-text);
    font: inherit;
    white-space: nowrap;
}
.tx-chart-categories .tx-ribbon-icon {
    width: 25px;
    height: 25px;
    flex: none;
}
.tx-chart-categories button[aria-selected='true'] {
    background: var(--tx-tint);
    border-color: var(--tx-accent);
}
.tx-chart-categories button:hover,
.tx-chart-variants button:hover {
    background: var(--tx-soft);
}
.tx-chart-dialog-main {
    min-width: 0;
    flex: 1;
    padding: 16px;
    overflow: auto;
}
.tx-chart-variants {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--tx-border);
    padding-bottom: 10px;
}
.tx-chart-variants button {
    width: 72px;
    height: 68px;
    padding: 8px;
    border: 1px solid transparent;
    border-radius: 0;
    background: transparent;
    flex: none;
}
.tx-chart-variants .tx-ribbon-icon {
    width: 50px;
    height: 50px;
}
.tx-chart-variants button[aria-checked='true'] {
    background: var(--tx-tint);
    border-color: var(--tx-accent);
}
.tx-chart-dialog button:focus-visible {
    outline: 2px solid var(--tx-focus);
    outline-offset: 1px;
}
.tx-chart-type-heading {
    font-size: 19px;
    font-weight: 400;
    margin: 12px 0 8px;
}
.tx-chart-preview {
    border: 1px solid var(--tx-border);
    background: var(--tx-surface);
    width: 100%;
    min-height: 160px;
    aspect-ratio: 600/320;
    display: grid;
    place-items: center;
    box-sizing: border-box;
    color: var(--tx-muted);
}
.tx-chart-preview svg {
    width: 100%;
    height: 100%;
    display: block;
}
.tx-chart-settings {
    border: 1px solid var(--tx-border);
    padding: 12px;
    margin: 14px 0 0;
    min-width: 0;
}
.tx-chart-settings legend {
    padding: 0 5px;
    font-weight: 400;
}
.tx-chart-dialog-fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
}
.tx-chart-dialog-fields label {
    display: grid;
    gap: 5px;
    min-width: 0;
}
.tx-chart-range-input {
    display: flex;
    align-items: stretch;
    min-width: 0;
}
.tx-chart-range-input input {
    flex: 1;
}
.tx-chart-range-input button {
    width: 32px;
    flex: none;
    padding: 4px;
    color: var(--tx-text);
    background: var(--tx-surface);
    border: 1px solid var(--tx-border);
    border-left: 0;
    border-radius: 0;
}
.tx-chart-range-input button svg {
    width: 20px;
    height: 20px;
}
.tx-chart-imported-note {
    font-size: 12px;
    color: var(--tx-muted);
    margin: 10px 0 0;
}
.tx-chart-layer {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    overflow: hidden;
    --tx-chart-background: var(--tx-surface);
    --tx-chart-text: var(--tx-text);
    --tx-chart-axis: var(--tx-muted);
    --tx-chart-grid: var(--tx-border);
}
.tx-chart-object {
    position: absolute;
    pointer-events: auto;
    background: transparent;
    border: 0;
    box-sizing: border-box;
    touch-action: none;
    cursor: move;
}
.tx-chart-object.tx-chart-selected {
    outline: 1px solid var(--tx-accent);
}
.tx-chart-graphic {
    width: 100%;
    height: 100%;
    overflow: hidden;
}
.tx-chart-graphic svg {
    width: 100%;
    height: 100%;
    display: block;
    user-select: none;
}
.tx-chart-handle {
    position: absolute;
    display: none;
    width: 7px;
    height: 7px;
    background: var(--tx-surface);
    border: 1px solid var(--tx-accent);
    box-sizing: border-box;
}
.tx-chart-selected .tx-chart-handle {
    display: block;
}
.tx-chart-handle[data-chart-handle='nw'] {
    left: -4px;
    top: -4px;
    cursor: nwse-resize;
}
.tx-chart-handle[data-chart-handle='n'] {
    left: 50%;
    top: -4px;
    cursor: ns-resize;
}
.tx-chart-handle[data-chart-handle='ne'] {
    right: -4px;
    top: -4px;
    cursor: nesw-resize;
}
.tx-chart-handle[data-chart-handle='e'] {
    right: -4px;
    top: 50%;
    cursor: ew-resize;
}
.tx-chart-handle[data-chart-handle='se'] {
    right: -4px;
    bottom: -4px;
    cursor: nwse-resize;
}
.tx-chart-handle[data-chart-handle='s'] {
    left: 50%;
    bottom: -4px;
    cursor: ns-resize;
}
.tx-chart-handle[data-chart-handle='sw'] {
    left: -4px;
    bottom: -4px;
    cursor: nesw-resize;
}
.tx-chart-handle[data-chart-handle='w'] {
    left: -4px;
    top: 50%;
    cursor: ew-resize;
}
.tx-chart-dialog {
    --tx-chart-background: var(--tx-surface);
    --tx-chart-text: var(--tx-text);
    --tx-chart-axis: var(--tx-muted);
    --tx-chart-grid: var(--tx-border);
}

.tx-chart-dialog-fields input,
.tx-chart-dialog-fields select {
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}
@media (max-width: 620px) {
    .tx-chart-categories {
        width: 132px;
        padding: 8px 4px;
    }
    .tx-chart-categories button {
        gap: 5px;
        font-size: 12px;
    }
    .tx-chart-dialog-main {
        padding: 10px;
    }
    .tx-chart-variants button {
        width: 56px;
        height: 54px;
        padding: 5px;
    }
    .tx-chart-variants .tx-ribbon-icon {
        width: 42px;
        height: 42px;
    }
    .tx-chart-dialog-fields {
        grid-template-columns: 1fr;
    }
    .tx-chart-type-heading {
        font-size: 16px;
    }
}
@media (max-width: 440px) {
    .tx-chart-dialog-body {
        flex-direction: column;
    }
    .tx-chart-categories {
        width: auto;
        padding: 4px;
        border-right: 0;
        border-bottom: 1px solid var(--tx-border);
        max-height: 88px;
        flex: none;
    }
    .tx-chart-categories [role='tablist'] {
        display: flex;
        flex-wrap: wrap;
    }
    .tx-chart-categories button {
        width: auto;
        padding: 4px;
        flex: none;
    }
    .tx-chart-categories .tx-ribbon-icon {
        width: 20px;
        height: 20px;
    }
    .tx-chart-settings {
        padding: 8px;
    }
    .tx-chart-dialog-tabs {
        font-size: 12px;
    }
    .tx-chart-dialog-header h2 {
        font-size: 16px;
    }
}

.tx-chart-sources {
    pointer-events: none;
}
.tx-chart-source-range {
    position: absolute;
    box-sizing: border-box;
    border: 2px solid #3977ff;
    background: #3977ff12;
    pointer-events: none;
}
.tx-chart-source-range [data-chart-source-handle] {
    position: absolute;
    right: -4px;
    bottom: -4px;
    width: 7px;
    height: 7px;
    background: #3977ff;
    border: 1px solid white;
    pointer-events: auto;
    cursor: nwse-resize;
    touch-action: none;
}
.tx-chart-quick-tools {
    position: absolute;
    z-index: 2;
    display: grid;
    gap: 8px;
    pointer-events: auto;
}
.tx-chart-quick-tools[hidden] {
    display: none;
}
.tx-chart-quick-tools button {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    padding: 4px;
    background: var(--tx-surface);
    color: var(--tx-text);
    border: 1px solid var(--tx-muted);
    border-radius: 0;
}
.tx-chart-quick-tools button svg {
    width: 26px;
    height: 26px;
}
.tx-chart-quick-tools button[aria-expanded='true'] {
    background: var(--tx-soft);
    border-color: var(--tx-accent);
    color: var(--tx-accent);
}
.tx-chart-context-panel {
    position: fixed;
    margin: 0;
    width: 300px;
    max-width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    overflow: auto;
    padding: 14px;
    background: var(--tx-surface);
    color: var(--tx-text);
    border: 1px solid var(--tx-muted);
    border-radius: 0;
    box-shadow: 0 4px 12px #0003;
    font: 14px var(--tx-ui-font, Arial, sans-serif);
}
.tx-chart-context-panel h3 {
    font-size: 14px;
    font-weight: 600;
    margin: 4px 0 10px;
}
.tx-chart-context-panel button {
    background: transparent;
    color: inherit;
    border: 1px solid transparent;
    padding: 6px;
    text-align: left;
    font: inherit;
    cursor: pointer;
}
.tx-chart-context-panel button:hover,
.tx-chart-context-panel button:focus-visible {
    background: var(--tx-soft);
    border-color: var(--tx-accent);
}
.tx-chart-element-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 30px;
    padding: 0 4px;
}
.tx-chart-element-row:hover {
    background: var(--tx-soft);
}
.tx-chart-element-row button {
    margin-left: auto;
}
.tx-chart-context-panel input[type='checkbox'] {
    accent-color: var(--tx-accent);
    width: 16px;
    height: 16px;
    flex: none;
}
.tx-chart-context-panel > button {
    display: block;
    width: 100%;
}
.tx-chart-context-panel hr {
    border: 0;
    border-top: 1px solid var(--tx-border);
    margin: 10px 0;
}
.tx-chart-popup-tabs {
    display: flex;
    gap: 18px;
    border-bottom: 1px solid var(--tx-border);
    margin-bottom: 14px;
}
.tx-chart-popup-tabs button[aria-selected='true'] {
    border-bottom: 2px solid var(--tx-accent);
    font-weight: 600;
}
.tx-chart-palette {
    display: flex;
    width: 100%;
    gap: 4px;
    height: 38px;
    margin-bottom: 4px;
}
.tx-chart-palette span {
    flex: 1;
    height: 26px;
}
.tx-chart-palette[aria-pressed='true'] {
    border-color: var(--tx-muted);
}
.tx-chart-filter-list label {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 32px;
    padding-left: 20px;
}
.tx-chart-filter-list {
    max-height: 220px;
    overflow: auto;
    margin-bottom: 14px;
}
.tx-chart-filter-list span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tx-chart-filter-actions {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid var(--tx-border);
    padding-top: 8px;
}
.tx-chart-source-name {
    display: grid;
    gap: 3px;
    margin-bottom: 10px;
    overflow-wrap: anywhere;
}
.tx-chart-source-name small {
    color: var(--tx-muted);
}
.tx-chart-axis-dialog label {
    display: grid;
    gap: 4px;
    margin: 12px 0;
}

/* Chart commands are available only while a chart is selected. */
.tx-ribbon-tabs > [hidden] {
    display: none !important;
}
.tx-chart-design-tab {
    border-top: 2px solid var(--tx-accent, #217346);
}
.tx-chart-design-commands,
.tx-chart-style-ribbon {
    display: flex;
    align-items: center;
    gap: 6px;
}
.tx-chart-style-gallery {
    display: flex;
    gap: 6px;
    max-width: 768px;
    overflow: hidden;
}
.tx-chart-style-gallery button,
.tx-chart-style-menu button {
    width: 90px;
    min-width: 90px;
    height: 64px;
    padding: 3px;
    border: 1px solid var(--tx-border, #d4d8d6);
    border-radius: 0;
    background: var(--tx-surface, #fff);
}
.tx-chart-style-gallery button[aria-pressed='true'],
.tx-chart-style-menu button[aria-pressed='true'],
.tx-chart-context-previews button[aria-pressed='true'] {
    outline: 2px solid var(--tx-accent, #217346);
    outline-offset: -2px;
}
.tx-chart-style-gallery svg,
.tx-chart-style-menu svg,
.tx-chart-context-previews svg {
    display: block;
    width: 100%;
    height: 100%;
    background: #fff;
    pointer-events: none;
}
/* Quick styles use a scrollable column of the same SVG previews as Chart Design. */
.tx-chart-context-previews {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    max-height: min(510px, calc(100dvh - 150px));
    overflow: auto;
    padding: 2px;
    scrollbar-gutter: stable;
}
.tx-chart-context-previews button {
    display: block;
    width: 100%;
    min-width: 0;
    aspect-ratio: 13 / 8;
    padding: 3px;
    border: 1px solid var(--tx-border);
    background: var(--tx-surface);
    overflow: hidden;
}
.tx-chart-style-expand {
    align-self: stretch;
    width: 22px;
}
.tx-chart-design-panel [data-ribbon-mode='compact'] .tx-chart-style-gallery {
    max-width: 270px;
}
.tx-chart-style-menu {
    margin: 0;
    position: fixed;
    padding: 12px;
    display: none;
    grid-template-columns: repeat(4, 90px);
    gap: 10px;
    border: 1px solid var(--tx-border, #777);
    background: var(--tx-surface, #fff);
    box-shadow: 0 5px 14px #0003;
}
.tx-chart-style-menu:popover-open {
    display: grid;
}
.tx-chart-move-dialog {
    width: 400px;
}
.tx-chart-move-dialog form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.tx-chart-move-dialog label {
    display: flex;
    align-items: center;
    gap: 8px;
}
@media (max-width: 440px) {
    .tx-chart-style-menu {
        grid-template-columns: repeat(2, 90px);
    }
}

.tx-chart-style-gallery,
.tx-chart-style-menu,
.tx-chart-context-previews {
    --tx-chart-text: #333;
    --tx-chart-axis: #aaa;
    --tx-chart-grid: #ddd;
}

.tx-ribbon-tabs {
    overflow-x: auto;
    scrollbar-width: none;
}
.tx-ribbon-tabs::-webkit-scrollbar {
    display: none;
}
.tx-ribbon-tabs > [role='tab'] {
    flex-shrink: 0;
}

/* Paper preview controls stay separate from exportable page geometry. */
.tx-header-footer-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 6;
}
.tx-header-footer-layer[hidden] {
    display: none;
}
.tx-header-footer-layer button {
    position: absolute;
    pointer-events: auto;
    background: transparent;
    color: var(--tx-muted);
    border: 1px solid transparent;
    padding: 3px;
    cursor: text;
    opacity: 0.7;
    min-width: 0;
}
.tx-header-footer-layer button:hover {
    border-color: var(--tx-border);
    opacity: 1;
    background: color-mix(in srgb, var(--tx-surface) 85%, transparent);
}
.tx-header-footer-editor {
    position: absolute;
    pointer-events: auto;
    z-index: 1;
    box-sizing: border-box;
    resize: none;
    border: 1px solid var(--tx-accent);
    outline: none;
    background: var(--tx-surface);
    color: var(--tx-text);
    padding: 3px;
    overflow: auto;
    font-family: inherit;
}
.tx-hf-navigation .tx-ribbon-content,
.tx-hf-elements .tx-ribbon-content {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
}
.tx-hf-options {
    display: grid;
    grid-template-columns: max-content max-content;
    gap: 12px 24px;
    padding: 0 4px;
    align-content: center;
}
.tx-hf-options label {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.tx-header-footer-tab {
    color: var(--tx-accent);
}
.tx-hf-options-group .tx-ribbon-content {
    height: 84px;
    min-height: 84px;
    justify-content: center;
}

/* Shared large ribbon command: use this class for every new icon-above-label command.
   Compact groups and their popups keep the same geometry; only the group collapses. */
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) button.tx-ribbon-command {
    box-sizing: border-box;
    flex: 0 0 auto;
    width: min-content;
    min-width: 64px;
    max-width: none;
    height: 84px;
    min-height: 84px;
    padding: 2px 4px;
    gap: 2px;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    font-size: 12px;
    line-height: 1.2;
    white-space: normal;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) button.tx-ribbon-command > :is(img, svg) {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    object-fit: contain;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) button.tx-ribbon-command > span:not([aria-hidden='true']) {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 2.4em;
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: manual;
    text-align: center;
    line-height: 1.2;
}
:is(.tx-ribbon, .tx-context-ui, .tx-dashboard-toolbar) button.tx-ribbon-command > .tx-dropdown-arrow {
    flex-shrink: 0;
    margin: auto 0 2px;
}

/* Short commands start at the top alongside the large commands. */
.tx-ribbon .tx-alignment-controls {
    align-items: flex-start;
}

/* Two-row formatting groups use the available ribbon height like Excel. */
:is(.tx-ribbon, .tx-dashboard-toolbar) {
    --tx-ribbon-format-row-height: 30px;
    --tx-ribbon-format-row-gap: 12px;
}
@media (pointer: fine) {
    :is(.tx-ribbon, .tx-dashboard-toolbar) .tx-font-group .tx-ribbon-content,
    :is(.tx-ribbon, .tx-dashboard-toolbar) .tx-alignment-compact,
    :is(.tx-ribbon, .tx-dashboard-toolbar) .tx-alignment-wide {
        gap: var(--tx-ribbon-format-row-gap);
    }
    :is(.tx-ribbon, .tx-dashboard-toolbar) :is(.tx-font-group, .tx-alignment-group) .tx-ribbon-row {
        min-height: var(--tx-ribbon-format-row-height);
    }
    :is(.tx-ribbon, .tx-dashboard-toolbar) .tx-font-group .tx-ribbon-content > .tx-ribbon-row > :is(button, select),
    :is(.tx-ribbon, .tx-dashboard-toolbar)
        .tx-font-group
        .tx-ribbon-row
        > :is(.tx-border-picker, .tx-color-picker)
        > button,
    :is(.tx-ribbon, .tx-dashboard-toolbar) .tx-alignment-compact .tx-ribbon-row > button,
    :is(.tx-ribbon, .tx-dashboard-toolbar) .tx-alignment-dropdown > button,
    :is(.tx-ribbon, .tx-dashboard-toolbar) .tx-alignment-wide > button,
    :is(.tx-ribbon, .tx-dashboard-toolbar) .tx-merge-split > button {
        min-height: var(--tx-ribbon-format-row-height);
    }
    :is(.tx-ribbon, .tx-dashboard-toolbar) .tx-font-group .tx-font-size-combo {
        height: var(--tx-ribbon-format-row-height);
    }
    :is(.tx-ribbon, .tx-dashboard-toolbar) .tx-font-group .tx-font-size-combo :is(input, button) {
        min-height: calc(var(--tx-ribbon-format-row-height) - 2px);
    }
}

/* Shared dialog chrome. Every library dialog is decorated by DialogChrome. */
dialog.tx-dialog {
    max-width: calc(100vw - 32px);
    max-height: calc(100dvh - 32px);
    padding: 0;
    border: 1px solid var(--tx-border);
    border-radius: 5px;
    overflow: hidden;
    background: var(--tx-soft);
    color: var(--tx-text);
    box-shadow: var(--tx-popup-shadow);
    font:
        14px/1.45 system-ui,
        -apple-system,
        'Segoe UI',
        sans-serif;
}
dialog.tx-dialog::backdrop {
    background: rgb(0 0 0 / 0.3);
}
.tx-dialog > .tx-dialog-form {
    display: flex;
    flex-direction: column;
    min-width: 0;
    max-height: calc(100dvh - 34px);
    margin: 0;
    padding: 0;
    gap: 0;
}
.tx-dialog .tx-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex: none;
    padding: 12px 16px;
    background: var(--tx-surface);
    margin: 0 0 12px;
    border: 0;
}
.tx-dialog .tx-dialog-header {
    cursor: move;
    touch-action: none;
    user-select: none;
}
.tx-dialog .tx-dialog-header:focus-visible {
    outline: 2px solid var(--tx-focus);
    outline-offset: -2px;
}
.tx-dialog .tx-dialog-header button {
    cursor: pointer;
}
.tx-dialog .tx-dialog-header h2 {
    margin: 0;
    font-size: 18px;
    line-height: 1.4;
    font-weight: 400;
    min-width: 0;
}
.tx-dialog .tx-dialog-header .tx-dialog-close {
    font-size: 26px;
    line-height: 1;
    width: 30px;
    height: 30px;
    min-width: 30px;
    padding: 0;
    border: 1px solid transparent;
    background: transparent;
    color: inherit;
    flex: none;
    border-radius: 3px;
}
.tx-dialog .tx-dialog-close:hover {
    background: var(--tx-tint);
}
.tx-dialog .tx-dialog-tabs {
    display: flex;
    gap: 4px;
    padding: 0 12px;
    flex: none;
    overflow-x: auto;
    margin: 0;
    border: 0;
}
.tx-dialog .tx-dialog-tabs button {
    border: 1px solid transparent;
    border-bottom: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
    padding: 5px 8px;
    font: inherit;
    white-space: nowrap;
    flex: none;
}
.tx-dialog .tx-dialog-tabs button[aria-selected='true'] {
    background: var(--tx-surface);
    border-color: var(--tx-border);
    color: var(--tx-text);
}
.tx-dialog .tx-dialog-body {
    min-width: 0;
    min-height: 0;
    overflow: auto;
    background: var(--tx-surface);
    border: 1px solid var(--tx-border);
    margin: 0 12px;
    flex: 1 1 auto;
}
.tx-dialog .tx-dialog-content {
    padding: 16px;
}
.tx-dialog .tx-dialog-content > label {
    margin-bottom: 12px;
}
.tx-dialog .tx-dialog-footer {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    margin: 0;
    padding: 12px;
    flex: none;
    border: 0;
    gap: 10px;
    background: var(--tx-soft);
}
.tx-dialog :is(.tx-dialog-footer, .tx-dialog-range-actions) button {
    min-width: 94px;
    padding: 7px 12px;
    border: 1px solid var(--tx-border);
    border-radius: 4px;
    background: var(--tx-surface);
    color: inherit;
}
.tx-dialog
    :is(.tx-dialog-footer, .tx-dialog-range-actions)
    button:is(
        [value]:not([value='cancel']),
        [type='submit']:not([value='cancel']),
        [data-cf-action='apply'],
        .tx-fd-apply,
        [data-range-action='accept']
    ) {
    border-color: var(--tx-accent);
}
.tx-dialog :is(.tx-dialog-footer, .tx-dialog-range-actions) button:hover {
    background: var(--tx-tint);
}
.tx-dialog button:focus-visible {
    outline: 2px solid var(--tx-focus);
    outline-offset: 1px;
}
.tx-dialog input:not([type='checkbox'], [type='radio'], [type='color']),
.tx-dialog select,
.tx-dialog textarea {
    min-width: 0;
    box-sizing: border-box;
    font: inherit;
    background: var(--tx-surface);
    color: var(--tx-text);
    border: 1px solid var(--tx-border);
    border-radius: 3px;
    padding: 5px 8px;
}
.tx-dialog input:is([type='checkbox'], [type='radio']) {
    accent-color: var(--tx-accent);
    flex: none;
}
.tx-dialog [hidden] {
    display: none !important;
}
/* Shared field and command layouts are used by every dialog, including dynamically added fields. */
.tx-dialog .tx-dialog-field {
    display: grid;
    gap: 5px;
    min-width: 0;
    margin: 0 0 14px;
    font: inherit;
}
/* Keep the established Format Cells panel spacing unchanged. */
.tx-cell-format-editor .tx-dialog-field {
    margin: 0;
}
.tx-dialog-fields {
    display: grid;
    gap: 14px;
    align-content: start;
}
.tx-dialog
    :is(
        .tx-dialog-fields,
        .tx-dialog-field-grid,
        .tx-chart-dialog-fields,
        .tx-drawing-fields,
        .tx-data-fields,
        .tx-sparkline-fields,
        .tx-style-identity,
        .tx-page-custom-size
    )
    > :is(.tx-dialog-field, .tx-dialog-check) {
    margin: 0;
}
.tx-dialog-commands {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.tx-dialog .tx-dialog-command {
    padding: 7px 12px;
    min-height: 32px;
    font: inherit;
    color: inherit;
    background: var(--tx-surface);
    border: 1px solid var(--tx-border);
    border-radius: 4px;
}
.tx-dialog .tx-dialog-command:hover {
    background: var(--tx-tint);
}
.tx-dialog .tx-dialog-content > :last-child {
    margin-bottom: 0;
}
.tx-dialog-field input,
.tx-dialog-field select,
.tx-dialog-field textarea {
    width: 100%;
    min-height: 32px;
}
.tx-dialog-field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.tx-dialog-columns {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}
.tx-dialog .tx-dialog-section {
    border: 1px solid var(--tx-border);
    padding: 14px;
    margin: 0 0 16px;
    min-width: 0;
}
.tx-dialog-section legend {
    padding: 0 5px;
    font-weight: 400;
}
.tx-dialog .tx-dialog-check {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    min-height: 30px;
    margin: 0;
    font: inherit;
}
.tx-dialog .tx-dialog-check input {
    width: 16px;
    height: 16px;
    margin: 0;
}
/* Format Cells panel contents reuse the chrome, grids, fields and sections above. */
.tx-cell-format-editor {
    width: 760px;
}
.tx-cell-format-editor .tx-dialog-content {
    height: 460px;
    min-height: 0;
}
.tx-cell-format-editor [role='tabpanel'] {
    min-height: 310px;
}
.tx-cell-format-editor p {
    margin: 10px 0;
    color: var(--tx-muted);
    font-size: 12px;
}
.tx-cell-format-editor .tx-cell-format-error {
    color: var(--tx-error);
    font-size: 14px;
}
.tx-cell-number-layout {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 20px;
}
.tx-cell-number-layout select[data-cell-format='format'] {
    height: 390px;
    padding: 4px;
}
.tx-cell-number-layout select[data-cell-format='format'] option {
    padding: 5px 8px;
}
.tx-cell-number-sample {
    display: block;
    min-height: 32px;
    overflow: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.tx-cell-effect-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 14px;
}
.tx-cell-color-controls {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}
.tx-cell-color-controls input[type='color'] {
    height: 32px;
    width: 84px;
    padding: 2px;
    background: var(--tx-surface);
    border: 1px solid var(--tx-border);
}
.tx-cell-style-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80px;
    padding: 12px;
    overflow: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.tx-cell-fill-palette {
    display: grid;
    grid-template-columns: repeat(10, 28px);
    gap: 6px;
    margin: 0 0 20px;
}
.tx-cell-fill-palette button {
    height: 28px;
    padding: 0;
    border: 1px solid var(--tx-muted);
    border-radius: 0;
}
.tx-cell-fill-palette button[aria-pressed='true'] {
    outline: 2px solid var(--tx-accent);
    outline-offset: 2px;
}
.tx-cell-orientation-preview {
    display: grid;
    place-items: center;
    height: 138px;
    margin-top: 14px;
    border: 1px solid var(--tx-border);
    overflow: hidden;
}
.tx-cell-border-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.tx-cell-border-presets button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    background: var(--tx-surface);
    border: 1px solid var(--tx-border);
    border-radius: 3px;
    color: inherit;
}
.tx-cell-border-preview {
    position: relative;
    width: 100%;
    height: 180px;
    border: 1px solid var(--tx-border);
    background: var(--tx-soft);
}
.tx-cell-border-preview button {
    position: absolute;
    padding: 0;
    border: 0;
    background: transparent;
    z-index: 1;
    --tx-cell-border-style: solid;
    --tx-cell-border-color: var(--tx-text);
    --tx-cell-border-width: 1px;
}
.tx-cell-border-preview button span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
}
.tx-cell-border-preview
    button:is(
        [data-cell-border-edge='top'],
        [data-cell-border-edge='bottom'],
        [data-cell-border-edge='inside-horizontal']
    ) {
    left: 14%;
    width: 36%;
    height: 24px;
    transform: translateY(-50%);
}
.tx-cell-border-preview
    button:is(
        [data-cell-border-edge='left'],
        [data-cell-border-edge='right'],
        [data-cell-border-edge='inside-vertical']
    ) {
    top: 14%;
    height: 36%;
    width: 24px;
    transform: translateX(-50%);
}
.tx-cell-border-preview [data-cell-border-edge='top'] {
    top: 14%;
}
.tx-cell-border-preview [data-cell-border-edge='bottom'] {
    top: 86%;
}
.tx-cell-border-preview [data-cell-border-edge='inside-horizontal'] {
    top: 50%;
}
.tx-cell-border-preview [data-cell-border-edge='left'] {
    left: 14%;
}
.tx-cell-border-preview [data-cell-border-edge='right'] {
    left: 86%;
}
.tx-cell-border-preview [data-cell-border-edge='inside-vertical'] {
    left: 50%;
}
.tx-cell-border-preview button:disabled {
    opacity: 0.35;
    pointer-events: none;
}
.tx-cell-border-preview button:hover:not(:disabled) {
    background: var(--tx-tint);
}
.tx-cell-border-preview button[aria-pressed='mixed'] {
    background: var(--tx-tint);
}
.tx-cell-border-text {
    position: absolute;
    left: 25%;
    top: 30%;
    pointer-events: none;
}
.tx-font-group .tx-ribbon-group-body {
    position: relative;
}
.tx-font-launcher {
    margin: 0;
    bottom: 0;
    right: 0;
}
@media (max-width: 600px) {
    .tx-dialog-columns,
    .tx-cell-number-layout {
        grid-template-columns: 1fr;
    }
    .tx-cell-number-layout select[data-cell-format='format'] {
        height: 130px;
    }
    .tx-cell-format-editor .tx-dialog-content {
        height: 460px;
        min-height: 0;
    }
    .tx-cell-format-editor [role='tabpanel'] {
        min-height: 0;
    }
}
@media (max-width: 440px) {
    dialog.tx-dialog {
        max-width: calc(100vw - 16px);
        max-height: calc(100dvh - 16px);
    }
    .tx-dialog > .tx-dialog-form {
        max-height: calc(100dvh - 18px);
    }
    .tx-dialog .tx-dialog-header {
        padding: 8px 12px;
    }
    .tx-dialog .tx-dialog-header h2 {
        font-size: 16px;
    }
    .tx-dialog .tx-dialog-tabs {
        font-size: 12px;
        padding: 0 8px;
    }
    .tx-dialog .tx-dialog-body {
        margin: 0 8px;
    }
    .tx-dialog .tx-dialog-content {
        padding: 12px;
    }
    .tx-dialog-field-grid {
        grid-template-columns: 1fr;
    }
    .tx-cell-fill-palette {
        grid-template-columns: repeat(8, 24px);
        gap: 5px;
    }
    .tx-cell-fill-palette button {
        height: 24px;
    }
}

/* Keep border hit areas separate where the preview lines intersect. */
.tx-cell-border-preview button::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    pointer-events: none;
}
.tx-cell-border-preview
    button:is(
        [data-cell-border-edge='top'],
        [data-cell-border-edge='bottom'],
        [data-cell-border-edge='inside-horizontal']
    )::after {
    top: 50%;
    width: 200%;
    border-top: 1px dotted var(--tx-border);
}
.tx-cell-border-preview
    button:is(
        [data-cell-border-edge='left'],
        [data-cell-border-edge='right'],
        [data-cell-border-edge='inside-vertical']
    )::after {
    left: 50%;
    height: 200%;
    border-left: 1px dotted var(--tx-border);
}

.tx-cell-border-preview
    button[aria-pressed='true']:is(
        [data-cell-border-edge='top'],
        [data-cell-border-edge='bottom'],
        [data-cell-border-edge='inside-horizontal']
    )::after {
    border-top: var(--tx-cell-border-width) var(--tx-cell-border-style) var(--tx-cell-border-color);
}
.tx-cell-border-preview
    button[aria-pressed='true']:is(
        [data-cell-border-edge='left'],
        [data-cell-border-edge='right'],
        [data-cell-border-edge='inside-vertical']
    )::after {
    border-left: var(--tx-cell-border-width) var(--tx-cell-border-style) var(--tx-cell-border-color);
}

/* Sparklines share ribbon command sizing and the common dialog chrome. */
.tx-sparkline-buttons {
    display: flex;
    align-items: flex-start;
    gap: 3px;
}
.tx-sparkline-group .tx-ribbon-group-body {
    position: relative;
}
.tx-sparkline-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 18px;
}
.tx-sparkline-range {
    display: flex;
    align-items: stretch;
    gap: 4px;
}
.tx-sparkline-range input {
    min-width: 0;
    flex: 1;
}
.tx-sparkline-range button {
    flex: 0 0 32px;
    display: grid;
    place-items: center;
    padding: 4px;
    border: 1px solid var(--tx-border);
    background: var(--tx-surface);
    color: var(--tx-text);
    border-radius: 3px;
}
.tx-sparkline-range svg {
    width: 20px;
    height: 20px;
}
.tx-sparkline-options {
    border: 1px solid var(--tx-border);
    margin: 10px 0;
    padding: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.tx-sparkline-dialog .tx-sparkline-options label {
    display: flex;
    flex-direction: row;
    align-items: center;
    margin: 0;
    gap: 6px;
}
.tx-sparkline-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 65px;
    padding: 8px;
    border: 1px solid var(--tx-border);
    background: var(--tx-surface);
    margin-top: 12px;
}
.tx-sparkline-preview canvas {
    border: 1px solid var(--tx-border);
}
.tx-sparkline-dialog .tx-sparkline-clear {
    margin-right: auto;
}
@media (max-width: 520px) {
    .tx-sparkline-fields,
    .tx-sparkline-options {
        grid-template-columns: 1fr;
    }
    .tx-sparkline-dialog .tx-dialog-footer {
        flex-wrap: wrap;
    }
}

.tx-sparkline-buttons [data-sparkline-type='win-loss'] > span {
    width: min-content;
}

/* Named styles use the same page layouts; identity and inclusion are adapter controls. */
.tx-style-dialog.tx-cell-format-editor {
    width: 760px;
}
.tx-style-dialog .tx-style-include {
    margin: 0 0 14px;
}
.tx-style-dialog .tx-style-color {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 70px 70px;
    gap: 10px;
}
.tx-style-dialog .tx-style-color input[type='color'] {
    height: 32px;
    width: 100%;
    border: 1px solid var(--tx-border);
    padding: 2px;
}
@media (max-width: 440px) {
    .tx-style-dialog .tx-style-color {
        grid-template-columns: minmax(0, 1fr) 54px 54px;
    }
}

/* A second hit area extends each button along the entire drawn edge without
   moving its primary target onto a crossing with another edge. */
.tx-cell-border-preview button::before {
    content: '';
    position: absolute;
    pointer-events: auto;
}
.tx-cell-border-preview
    button:is(
        [data-cell-border-edge='top'],
        [data-cell-border-edge='bottom'],
        [data-cell-border-edge='inside-horizontal']
    )::before {
    left: 100%;
    top: 0;
    width: 100%;
    height: 100%;
}
.tx-cell-border-preview
    button:is(
        [data-cell-border-edge='left'],
        [data-cell-border-edge='right'],
        [data-cell-border-edge='inside-vertical']
    )::before {
    left: 0;
    top: 100%;
    width: 100%;
    height: 100%;
}
.tx-cell-border-preview button:hover:not(:disabled)::before {
    background: var(--tx-tint);
}

.tx-style-dialog.tx-cell-format-editor .tx-dialog-content {
    height: 560px;
}

/* Illustrations use the shared ribbon command sizing and dialog chrome. */
.tx-drawing-ribbon {
    display: flex;
    gap: 2px;
    align-items: stretch;
}
.tx-shape-menu,
.tx-shape-context {
    position: fixed;
    margin: 0;
    padding: 0;
    max-width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    overflow: auto;
    background: var(--tx-surface);
    color: var(--tx-text);
    border: 1px solid var(--tx-muted);
    border-radius: 4px;
    box-shadow: 0 5px 12px #0003;
    font: 14px var(--tx-ui-font, Arial, sans-serif);
}
.tx-shape-menu {
    width: 390px;
}
.tx-shape-menu section {
    padding: 12px 14px;
    border-bottom: 1px solid var(--tx-border);
}
.tx-shape-menu section:last-child {
    border-bottom: 0;
}
.tx-shape-menu h3 {
    font-size: 14px;
    margin: 0 0 8px;
    font-weight: 600;
}
.tx-shape-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(30px, 1fr));
    gap: 3px;
}
.tx-shape-gallery button {
    display: grid;
    place-items: center;
    width: 100%;
    height: 32px;
    padding: 5px;
    border: 1px solid transparent;
    border-radius: 0;
    background: transparent;
    color: inherit;
}
.tx-shape-gallery img {
    width: 22px;
    height: 22px;
    pointer-events: none;
}
.tx-shape-gallery button:hover,
.tx-shape-gallery button:focus-visible,
.tx-shape-context button:hover,
.tx-shape-context button:focus-visible {
    background: var(--tx-soft);
    border-color: var(--tx-focus);
    outline: none;
}
.tx-shape-context {
    width: 190px;
    padding: 4px;
}
.tx-shape-context button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px;
    border: 1px solid transparent;
    border-radius: 0;
    font: inherit;
    color: inherit;
    background: transparent;
}
.tx-drawing-layer {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    overflow: hidden;
}
.tx-drawing-object {
    position: absolute;
    pointer-events: auto;
    box-sizing: border-box;
    touch-action: none;
    cursor: move;
    background: transparent;
    border: 0;
}
.tx-drawing-selected {
    outline: 1px solid var(--tx-focus);
    outline-offset: 1px;
}
.tx-drawing-graphic {
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
}
.tx-drawing-graphic > svg {
    width: 100%;
    height: 100%;
    display: block;
    user-select: none;
}
.tx-drawing-handle {
    position: absolute;
    display: none;
    width: 8px;
    height: 8px;
    background: var(--tx-surface);
    border: 1px solid var(--tx-focus);
    box-sizing: border-box;
    pointer-events: auto;
}
.tx-drawing-selected .tx-drawing-handle {
    display: block;
}
.tx-drawing-handle[data-drawing-handle='nw'] {
    left: -4px;
    top: -4px;
    cursor: nwse-resize;
}
.tx-drawing-handle[data-drawing-handle='n'] {
    left: 50%;
    top: -4px;
    cursor: ns-resize;
}
.tx-drawing-handle[data-drawing-handle='ne'] {
    right: -4px;
    top: -4px;
    cursor: nesw-resize;
}
.tx-drawing-handle[data-drawing-handle='e'] {
    right: -4px;
    top: 50%;
    cursor: ew-resize;
}
.tx-drawing-handle[data-drawing-handle='se'] {
    right: -4px;
    bottom: -4px;
    cursor: nwse-resize;
}
.tx-drawing-handle[data-drawing-handle='s'] {
    left: 50%;
    bottom: -4px;
    cursor: ns-resize;
}
.tx-drawing-handle[data-drawing-handle='sw'] {
    left: -4px;
    bottom: -4px;
    cursor: nesw-resize;
}
.tx-drawing-handle[data-drawing-handle='w'] {
    left: -4px;
    top: 50%;
    cursor: ew-resize;
}
.tx-drawing-dialog {
    width: 760px;
}
.tx-drawing-settings {
    overflow: auto;
    min-height: 0;
}
.tx-drawing-text {
    grid-column: 1/-1;
}
.tx-drawing-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 130px;
    padding: 12px;
    border: 1px solid var(--tx-border);
    background: var(--tx-soft);
}
.tx-drawing-preview > svg {
    height: 100%;
    max-width: 100%;
    width: auto;
    overflow: visible;
}
@media (max-width: 540px) {
    .tx-drawing-fields {
        grid-template-columns: 1fr;
    }
    .tx-shape-menu {
        width: 340px;
    }
}
@media (pointer: coarse) {
    .tx-shape-gallery {
        grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
    }
    .tx-shape-gallery button,
    .tx-shape-context button {
        min-height: 44px;
    }
    .tx-drawing-handle {
        width: 14px;
        height: 14px;
    }
    .tx-drawing-fields label:has(input[type='checkbox']) {
        min-height: 44px;
    }
}

/* Contextual shape commands reuse ribbon groups and shared dialog chrome. */
.tx-shape-format-tab {
    border-top: 2px solid var(--tx-accent, #217346);
}
.tx-shape-style-ribbon,
.tx-shape-arrange {
    display: flex;
    gap: 6px;
    align-items: flex-start;
}
.tx-shape-style-gallery {
    display: flex;
    gap: 4px;
    width: 420px;
    overflow: hidden;
    align-self: center;
}
.tx-shape-style-gallery button,
.tx-shape-style-grid button {
    width: 56px;
    min-width: 56px;
    height: 60px;
    padding: 4px;
    border: 1px solid transparent;
    background: var(--tx-surface, #fff);
    border-radius: 3px;
}
.tx-shape-style-gallery svg,
.tx-shape-style-grid svg {
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: block;
}
.tx-shape-style-gallery button[aria-pressed='true'],
.tx-shape-style-grid button[aria-pressed='true'],
.tx-shape-format-menu button[aria-pressed='true'] {
    border-color: var(--tx-focus, #4d82b8);
    box-shadow: inset 0 0 0 1px var(--tx-focus, #4d82b8);
}
.tx-shape-format-stack {
    display: grid;
    gap: 3px;
}
.tx-ribbon .tx-shape-format-small {
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    height: 28px;
    padding: 3px 5px;
}
.tx-ribbon .tx-shape-format-small .tx-ribbon-icon {
    width: 22px;
    height: 22px;
}
.tx-ribbon .tx-shape-format-small .tx-dropdown-arrow {
    margin-left: auto;
}
.tx-ribbon .tx-shape-format-launcher {
    position: absolute;
    right: 1px;
    bottom: 0;
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    padding: 0;
    line-height: 1;
}
.tx-shape-size {
    display: grid;
    gap: 5px;
    width: 195px;
}
.tx-shape-size label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    font-size: 12px;
}
.tx-shape-size input[type='number'] {
    width: 75px;
    min-width: 0;
    height: 29px;
    padding: 3px 5px;
}
.tx-shape-size label:last-child {
    justify-content: flex-start;
}
.tx-shape-format-panel [data-ribbon-mode='compact'] .tx-shape-style-gallery {
    width: 180px;
}
:is(.tx-shape-format-menu, .tx-shape-gradient-menu) {
    display: none;
    position: fixed;
    inset: auto;
    margin: 0;
    padding: 12px;
    border: 1px solid var(--tx-border, #777);
    border-radius: 4px;
    background: var(--tx-surface, #fff);
    color: var(--tx-text, #24322d);
    box-shadow: 0 5px 14px #0003;
    max-width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    overflow: auto;
    min-width: 210px;
}
:is(.tx-shape-format-menu, .tx-shape-gradient-menu):popover-open {
    display: grid;
    gap: 7px;
}
:is(.tx-shape-format-menu, .tx-shape-gradient-menu) h3 {
    margin: 0 0 5px;
    font-size: 14px;
}
:is(.tx-shape-format-menu, .tx-shape-gradient-menu) > button {
    min-height: 30px;
    padding: 5px 8px;
    text-align: left;
    border: 1px solid transparent;
    background: var(--tx-surface, #fff);
    color: inherit;
}
:is(.tx-shape-format-menu, .tx-shape-gradient-menu) button:hover {
    background: var(--tx-hover, #eaf3ef);
}
.tx-shape-style-grid {
    display: grid;
    grid-template-columns: repeat(7, 56px);
    gap: 5px;
}
.tx-shape-palette {
    display: grid;
    grid-template-columns: repeat(7, 26px);
    gap: 4px;
}
.tx-shape-palette button {
    width: 26px;
    height: 26px;
    background: var(--tx-swatch);
    border: 1px solid var(--tx-border, #bbb);
    padding: 0;
}
.tx-shape-format-menu label {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
}
.tx-shape-format-menu input[type='number'] {
    width: 75px;
}
.tx-shape-format-menu input[type='color'] {
    width: 46px;
    height: 30px;
    padding: 2px;
}
.tx-shape-format-menu :is(input, select) {
    background: var(--tx-surface, #fff);
    color: inherit;
    border: 1px solid var(--tx-border, #bbb);
    border-radius: 3px;
}
@media (max-width: 490px) {
    .tx-shape-style-grid {
        grid-template-columns: repeat(4, 56px);
    }
}
@media (pointer: coarse) {
    .tx-shape-format-menu > button,
    .tx-shape-palette button {
        min-width: 44px;
        min-height: 44px;
    }
    .tx-shape-palette {
        grid-template-columns: repeat(7, 44px);
    }
    .tx-ribbon .tx-shape-format-small {
        height: 36px;
    }
    .tx-ribbon .tx-shape-format-launcher {
        min-width: 26px;
        min-height: 26px;
    }
}
@media (pointer: coarse) and (max-width: 380px) {
    .tx-shape-palette {
        grid-template-columns: repeat(5, 44px);
    }
}

.tx-shape-style-grid .tx-shape-no-fill {
    background-color: var(--tx-surface, #fff);
    background-image: conic-gradient(
        var(--tx-border, #ddd) 25%,
        transparent 0 50%,
        var(--tx-border, #ddd) 0 75%,
        transparent 0
    );
    background-size: 10px 10px;
}

.tx-shape-style-ribbon > .tx-styles-expand {
    flex: 0 0 24px;
    min-width: 24px;
}
.tx-shape-format-panel .tx-ribbon-group-body[popover] .tx-shape-style-ribbon {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 24px;
    width: min(310px, calc(100vw - 34px));
}
.tx-shape-format-panel .tx-ribbon-group-body[popover] .tx-shape-style-gallery {
    width: 100%;
    min-width: 0;
}
.tx-shape-format-panel .tx-ribbon-group-body[popover] .tx-shape-format-stack {
    grid-column: 1 / -1;
}
.tx-shape-format-panel .tx-ribbon-group-body[popover] .tx-shape-arrange {
    flex-wrap: wrap;
    max-width: calc(100vw - 34px);
}
@media (pointer: coarse) {
    .tx-shape-style-ribbon > .tx-styles-expand {
        flex-basis: 44px;
        min-width: 44px;
    }
    .tx-shape-format-panel .tx-ribbon-group-body[popover] .tx-shape-style-ribbon {
        grid-template-columns: minmax(0, 1fr) 44px;
    }
}

/* Excel-style outline palette shares the shape popover and color-dialog styles. */
.tx-shape-outline-menu {
    width: 310px;
    min-width: 0;
    padding: 0;
    gap: 0 !important;
}
.tx-shape-outline-menu .tx-outline-row {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    min-height: 34px;
    padding: 7px 12px;
    border-radius: 0;
    text-align: left;
    color: inherit;
}
.tx-shape-outline-menu
    .tx-outline-row
    > :is(.tx-ribbon-icon, .tx-outline-auto, .tx-outline-empty, .tx-outline-command-icon) {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
}
.tx-outline-auto,
.tx-outline-empty {
    display: inline-block;
    border: 1px solid var(--tx-border, #ccc);
    background: var(--tx-swatch, transparent);
}
.tx-outline-colors {
    padding: 10px 12px;
    border-top: 1px solid var(--tx-border, #ddd);
}
.tx-shape-outline-menu h3 {
    margin: 0 0 9px;
    font-size: 13px;
    font-weight: 600;
}
.tx-outline-color-grid {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 3px;
}
.tx-outline-color-grid button {
    position: relative;
    width: 100%;
    min-width: 0 !important;
    min-height: 0 !important;
    aspect-ratio: 1;
    border: 1px solid var(--tx-border, #ccc);
    padding: 0;
    background: var(--tx-swatch);
}
.tx-shape-outline-menu .tx-outline-color-grid button:hover {
    background: var(--tx-swatch);
    outline: 2px solid var(--tx-focus, #4d82b8);
    outline-offset: 1px;
    z-index: 1;
}
.tx-shape-outline-menu [aria-checked='true'],
.tx-shape-outline-submenu [aria-checked='true'] {
    box-shadow: inset 0 0 0 2px var(--tx-focus, #4d82b8);
}
.tx-shape-outline-menu .tx-outline-shades {
    margin-top: 9px;
    row-gap: 0;
}
.tx-outline-shades button {
    border-top: 0;
    border-bottom: 0;
}
.tx-outline-divider {
    border-top: 1px solid var(--tx-border, #ddd) !important;
}
.tx-outline-chevron {
    margin-left: auto;
    font-size: 20px;
    line-height: 1;
}
.tx-outline-command-icon {
    color: var(--tx-focus, #4d82b8);
}
.tx-shape-outline-submenu {
    min-width: 230px;
    width: max-content;
    padding: 5px;
    gap: 2px;
}
.tx-shape-outline-submenu > button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 30px;
    width: 100%;
    white-space: nowrap;
}
.tx-outline-line-preview {
    display: block;
    width: 118px;
    height: 16px;
    flex: 0 0 118px;
    color: var(--tx-text, #24322d);
}
.tx-shape-outline-custom {
    display: contents;
}
.tx-shape-outline-custom [data-role='color-toggle'] {
    display: none !important;
}
@media (pointer: coarse) {
    .tx-shape-outline-menu .tx-outline-row,
    .tx-shape-outline-submenu > button {
        min-height: 44px;
    }
    .tx-shape-outline-menu {
        width: 350px;
    }
    .tx-outline-color-grid button {
        aspect-ratio: 1;
        min-height: 28px !important;
    }
}

.tx-shape-outline-menu .tx-outline-row {
    justify-content: flex-start;
}

/* Gradient presets reuse the shape popover surface, theme colors and submenu placement. */
.tx-shape-gradient-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}
.tx-shape-gradient-trigger .tx-ribbon-icon {
    width: 20px;
    height: 20px;
}
.tx-shape-gradient-menu {
    width: 322px;
    min-width: 0;
}
.tx-shape-gradient-menu h3.tx-outline-divider {
    padding-top: 10px;
    margin-top: 4px;
}
.tx-shape-gradient-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
}
.tx-shape-gradient-menu .tx-gradient-preview {
    width: 100%;
    min-width: 0;
    max-width: 70px;
    padding: 3px;
    border: 1px solid transparent;
    border-radius: 3px;
    background: var(--tx-surface, #fff);
    color: inherit;
}
.tx-gradient-preview svg {
    display: block;
    width: 100%;
    height: auto;
}
.tx-shape-gradient-menu [aria-checked='true'] {
    box-shadow: inset 0 0 0 2px var(--tx-focus, #4d82b8);
}
.tx-shape-gradient-menu .tx-gradient-more {
    width: 100%;
    text-align: left;
}
@media (pointer: coarse) {
    .tx-shape-gradient-trigger,
    .tx-shape-gradient-menu .tx-gradient-more {
        min-height: 44px;
    }
}

/* Arrange and effects menu commands share the thin ribbon drawings at a smaller size. */
.tx-shape-format-menu > .tx-shape-menu-command {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
}
.tx-shape-menu-command .tx-shape-menu-icon {
    display: block;
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    pointer-events: none;
}
.tx-shape-menu-command > span {
    text-align: left;
}

.tx-drawing-selection {
    pointer-events: none;
    background: none;
}
.tx-drawing-multiple .tx-drawing-object:not(.tx-drawing-selection) .tx-drawing-handle {
    display: none;
}
.tx-drawing-multiple .tx-drawing-selection .tx-drawing-handle {
    display: block;
}
.tx-drawing-selection[hidden] {
    display: none !important;
}
.tx-shape-format-panel .tx-ribbon-group-body:not([popover]) {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    align-items: stretch;
    min-height: 0;
}
.tx-shape-format-panel .tx-ribbon-caption {
    align-self: end;
    line-height: 1.3;
    margin: 0;
}
.tx-shape-style-ribbon > .tx-styles-expand {
    height: 60px;
    align-self: center;
    flex: 0 0 24px;
    min-width: 24px;
}
@media (pointer: coarse) {
    .tx-shape-style-ribbon > .tx-styles-expand {
        flex-basis: 44px;
        min-width: 44px;
    }
}

.tx-shape-format-panel .tx-ribbon-content {
    min-height: 0;
}

/* Selected objects expose a rotation handle; the selection chrome follows their angle. */
.tx-drawing-chrome {
    position: absolute;
    inset: 0;
    transform: rotate(var(--tx-drawing-angle, 0deg));
    pointer-events: none;
}
.tx-drawing-object:not(.tx-drawing-page-fragment):not(.tx-drawing-selection).tx-drawing-selected {
    outline: none;
}
.tx-drawing-selected > .tx-drawing-chrome {
    outline: 1px solid var(--tx-focus);
    outline-offset: 1px;
}
.tx-drawing-multiple .tx-drawing-chrome {
    outline: none;
}
.tx-drawing-graphic {
    pointer-events: auto;
}
.tx-drawing-layer > .tx-drawing-rotation-handle {
    position: absolute;
    width: 26px;
    height: 26px;
    min-width: 26px;
    min-height: 26px;
    padding: 0;
    border: 1px solid var(--tx-muted);
    border-radius: 50%;
    background: var(--tx-surface);
    color: var(--tx-muted);
    pointer-events: auto;
    touch-action: none;
    cursor: grab;
    overflow: visible;
    box-sizing: border-box;
}
.tx-drawing-rotation-handle[hidden] {
    display: none !important;
}
.tx-drawing-rotation-handle::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    height: 19px;
    border-left: 1px solid var(--tx-muted);
    pointer-events: none;
}
.tx-drawing-rotation-handle > svg {
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
}
.tx-drawing-layer > .tx-drawing-rotation-handle:active {
    cursor: grabbing;
}
.tx-drawing-layer > .tx-drawing-rotation-handle:focus-visible {
    outline: 2px solid var(--tx-focus);
    outline-offset: 2px;
}
@media (pointer: coarse) {
    .tx-drawing-layer > .tx-drawing-rotation-handle {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
    }
    .tx-drawing-rotation-handle::after {
        height: 14px;
    }
}

.tx-drawing-page-fragment.tx-drawing-selected:has(> .tx-drawing-chrome) {
    outline: none;
}

/* Paper fragments recreate their graphic on layout changes; keep pointer targets stable. */
.tx-drawing-page-fragment > .tx-drawing-graphic {
    pointer-events: none;
}

/* Worksheet display and print options, independent for each worksheet. */
.tx-sheet-options {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.tx-sheet-options fieldset {
    display: grid;
    gap: 7px;
    margin: 0;
    padding: 0 12px 0 0;
    border: 0;
    border-right: 1px solid var(--tx-border);
    min-width: 78px;
}
.tx-sheet-options fieldset:last-child {
    border-right: 0;
    padding-right: 0;
}
.tx-sheet-options legend {
    font-size: 13px;
    margin-bottom: 9px;
    padding: 0;
}
.tx-sheet-options label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    white-space: nowrap;
    cursor: pointer;
}
.tx-sheet-options input[type='checkbox'] {
    margin: 0;
    width: 16px;
    height: 16px;
    min-height: 0;
    accent-color: var(--tx-accent);
}
.tx-page-sheet-options-group .tx-ribbon-caption {
    padding-top: 8px;
}
/* Dimension icons and a separate caption gap keep the aspect lock readable. */
.tx-shape-size {
    width: 230px;
    gap: 2px;
}
.tx-shape-size input[type='number'] {
    height: 24px;
    min-height: 24px;
}
.tx-shape-dimension-label {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.tx-shape-dimension-label .tx-ribbon-icon {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    display: block;
}
.tx-shape-size .tx-shape-aspect-lock {
    margin-top: 0;
    margin-bottom: 0;
    min-height: 20px;
    gap: 7px;
}
.tx-shape-format-panel .tx-shape-size-group > .tx-ribbon-group-body:not([popover]) {
    min-height: 0;
}
.tx-shape-size-group .tx-ribbon-caption {
    padding-top: 2px;
    margin-top: 8px;
}
@media (pointer: coarse) {
    .tx-sheet-options label {
        min-height: 36px;
    }
    .tx-sheet-options input[type='checkbox'] {
        width: 20px;
        height: 20px;
    }
    .tx-shape-size-group .tx-ribbon-group-body[popover] .tx-shape-size input[type='number'] {
        height: 38px;
        min-height: 38px;
    }
    .tx-shape-size-group .tx-ribbon-group-body[popover] .tx-shape-aspect-lock {
        min-height: 32px;
    }
    .tx-shape-format-panel .tx-shape-size-group > .tx-ribbon-group-body:not([popover]) {
        min-height: 0;
    }
}

.tx-cell-picture-layer {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    overflow: hidden;
}
.tx-picture-menu {
    width: 230px;
}
.tx-picture-menu button {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    gap: 10px;
}
.tx-picture-menu .tx-ribbon-icon {
    width: 20px;
    height: 20px;
    flex: none;
}

.tx-cell-editor[contenteditable] {
    min-height: 1em;
    cursor: text;
}
.tx-cell-editor[contenteditable] span {
    user-select: text;
}

/* Trial branding is independent of worksheet data and never intercepts editing or selection. */
.tx-trial-watermark {
    position: absolute;
    top: 60%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-30deg);
    color: var(--tx-text);
    opacity: 0.18;
    font-size: clamp(20px, 4vw, 52px);
    line-height: 1.2;
    white-space: nowrap;
    pointer-events: none;
    user-select: none;
    z-index: 4;
}

/* Range picking keeps the current native dialog and its actual fields in the modal top layer. */
.tx-dialog-range-input {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}
.tx-dialog-range-input > :is(input, textarea) {
    flex: 1;
    min-width: 0;
    width: 100%;
}
.tx-dialog-range-button {
    border: 1px solid var(--tx-border);
    border-radius: 4px;
    background: var(--tx-surface);
    color: inherit;
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    padding: 4px;
}
.tx-dialog-range-button :is(img, svg) {
    display: block;
    width: 20px;
    height: 20px;
}
dialog.tx-dialog-range-picking {
    top: 16px;
    bottom: auto !important;
    margin: 0 auto;
    width: min(460px, calc(100vw - 32px)) !important;
    min-width: 0 !important;
    height: auto !important;
    max-height: calc(100vh - 32px);
}
dialog.tx-dialog-range-picking > form {
    display: block;
    height: auto !important;
    min-height: 0 !important;
}
.tx-dialog-range-picking > form > :not(.tx-dialog-header):not(.tx-dialog-range-toolbar) {
    display: none !important;
}
.tx-dialog-range-picking .tx-dialog-range-button {
    display: none;
}
.tx-dialog-range-toolbar {
    padding: 16px;
}
.tx-dialog-range-toolbar[hidden] {
    display: none;
}
.tx-dialog-range-field > :is(label, div) {
    display: grid;
    gap: 8px;
    margin: 0;
}
.tx-dialog-range-toolbar p {
    margin: 12px 0;
}
.tx-dialog-range-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}
.tx-dialog-range-preview {
    position: absolute;
    z-index: 9;
    pointer-events: none;
    box-sizing: border-box;
    color: var(--tx-reference-accent);
    border: 2px dashed currentColor;
    background: var(--tx-reference-tint);
}

.tx-dialog-range-picking::backdrop {
    cursor: cell;
}
@media (pointer: coarse) {
    .tx-dialog-range-button {
        flex-basis: 44px;
        width: 44px;
        height: 44px;
    }
}

/* The name box remains editable; its arrow lists all names independently of the current address. */
.tx-name-box {
    display: flex;
    align-self: stretch;
    flex-shrink: 0;
    border-right: 1px solid var(--tx-border);
}
.tx-formula-row .tx-name-box .tx-address {
    width: 80px;
    border-right: 0;
}
.tx-name-box-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 0;
    padding: 0 5px;
    background: var(--tx-surface);
    color: var(--tx-text);
}
.tx-name-box-toggle:hover {
    background: var(--tx-soft);
}
.tx-name-box-menu {
    position: fixed;
    margin: 0;
    padding: 3px;
    min-width: 160px;
    max-width: min(360px, 100vw);
    overflow: auto;
    border: 1px solid var(--tx-border);
    background: var(--tx-surface);
    color: var(--tx-text);
    box-shadow: 0 3px 9px #0003;
}
.tx-name-box-menu button {
    display: block;
    width: 100%;
    border: 0;
    border-radius: 0;
    padding: 5px 10px;
    text-align: left;
    background: transparent;
    color: inherit;
    white-space: nowrap;
}
.tx-name-box-menu button:hover,
.tx-name-box-menu button:focus-visible {
    background: var(--tx-tint);
    outline: 1px solid var(--tx-accent);
    outline-offset: -1px;
}

.tx-paste-options-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 9px 2px;
    font-weight: 600;
}
.tx-paste-options-label .tx-ribbon-icon {
    width: 20px;
    height: 20px;
}
.tx-paste-options {
    display: flex;
    gap: 2px;
    padding: 3px 5px 6px;
}
.tx-paste-options button {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 0;
    min-width: 0;
    min-height: 40px;
    padding: 3px;
    border: 1px solid transparent;
    border-radius: 2px;
    background: transparent;
    color: inherit;
}
.tx-paste-options button:hover:not(:disabled),
.tx-paste-options button:focus-visible {
    background: var(--tx-tint);
    border-color: var(--tx-accent);
    outline: 0;
}
.tx-paste-options button:disabled {
    opacity: 0.4;
}
.tx-paste-options .tx-ribbon-icon {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
}
@media (pointer: coarse) {
    .tx-paste-options button {
        min-height: 44px;
    }
}
@media (forced-colors: active) {
    .tx-paste-options button:focus-visible {
        border-color: Highlight;
    }
}

/* Worksheet commands follow the last visible sheet; dashboard tabs retain separate overflow. */
.tx-sheet-bar > .tx-sheet-tabs {
    flex: 0 1 auto;
    max-width: 50%;
}
.tx-dashboard-tab-group {
    display: flex;
    align-items: stretch;
    flex: 0 1 auto;
    min-width: 0;
}
.tx-view-divider {
    flex: 0 0 1px;
    align-self: stretch;
    background: var(--tx-border);
    margin: 7px 5px;
}
.tx-dashboard-tabs {
    display: flex;
    flex: 0 1 auto;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: thin;
}
.tx-dashboard-icon {
    --tx-dashboard-icon-orange: light-dark(#b94c19, #ffad80);
    --tx-dashboard-icon-green: light-dark(#247044, #83d5a2);
    --tx-dashboard-icon-purple: light-dark(#9350a1, #d3a2df);
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    vertical-align: middle;
}
.tx-dashboard-icon-accent {
    stroke: var(--tx-focus);
}
.tx-dashboard-icon-danger {
    stroke: var(--tx-error);
}
.tx-dashboard-tab svg {
    width: 20px;
    height: 20px;
}
.tx-sheet-bar > .tx-sheet-add {
    position: relative;
}
.tx-sheet-bar > .tx-sheet-add > span {
    position: absolute;
    right: 0;
    top: 0;
    line-height: 1;
    background: var(--tx-soft);
    font-weight: 600;
}
.tx-view-sheet-tab::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-right: 7px;
    vertical-align: -4px;
    background: currentColor;
    mask: var(--tx-sheet-icon) center / contain no-repeat;
}
.tx-view-sheet-tab.tx-sheet-tab-renaming {
    grid-template-columns: max-content minmax(1ch, max-content);
    align-items: center;
}
.tx-view-sheet-tab.tx-sheet-tab-renaming::before {
    grid-area: 1 / 1;
}
.tx-view-sheet-tab.tx-sheet-tab-renaming :is(.tx-sheet-name-measure, .tx-sheet-name-editor) {
    grid-area: 1 / 2;
}
.tx-dashboard-active > .tx-ribbon,
.tx-dashboard-active > .tx-formula-row,
.tx-dashboard-active > .tx-grid-viewport,
.tx-dashboard-active > footer .tx-zoom {
    display: none !important;
}
.tx-dashboard-viewport[hidden],
.tx-dashboard-toolbar[hidden] {
    display: none !important;
}
.tx-dashboard-viewport {
    --tx-dashboard-accent: var(--tx-accent);
    height: 520px;
    overflow: auto;
    padding: 24px;
    background: var(--tx-soft);
    min-height: 0;
}
.tx-sheet-fill > .tx-dashboard-viewport {
    flex: 1 1 0;
    min-height: 0;
}
.tx-dashboard-toolbar {
    border-bottom: 1px solid var(--tx-border);
    background: var(--tx-surface);
    flex-shrink: 0;
}
.tx-dashboard-commandbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    min-height: 43px;
}
.tx-dashboard-commandbar strong {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--tx-accent);
    margin-right: auto;
}
:is(.tx-dashboard-commandbar, .tx-dashboard-ribbon-group) button:where(:not(.tx-styles-expand)) {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid transparent;
    border-radius: 3px;
    background: transparent;
    padding: 6px 9px;
    font-size: 12px;
}
:is(.tx-dashboard-commandbar, .tx-dashboard-ribbon-group) button:where(:not(.tx-styles-expand)):hover {
    border-color: var(--tx-border);
    background: var(--tx-tint);
}
:is(.tx-dashboard-commandbar, .tx-dashboard-ribbon-group) button:where(:not(.tx-styles-expand)):disabled {
    opacity: 0.45;
    cursor: default;
}
.tx-dashboard-design-ribbon {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    padding: 5px 10px 2px;
    border-top: 1px solid var(--tx-border);
    background: var(--tx-surface);
}
.tx-dashboard-toolbar[data-mode='view'] .tx-dashboard-design-ribbon {
    display: none;
}
.tx-dashboard-ribbon-group {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-right: 1px solid var(--tx-border);
    padding: 2px 10px 0;
}
.tx-dashboard-ribbon-group:last-child {
    border: 0;
}
.tx-dashboard-ribbon-group > div {
    display: flex;
    align-items: center;
    gap: 5px;
    min-height: 62px;
}
.tx-dashboard-ribbon-group button:where(:not(.tx-styles-expand)) {
    flex-direction: column;
    gap: 4px;
    min-width: 55px;
    max-width: 90px;
    line-height: 1.2;
    text-align: center;
}
.tx-dashboard-ribbon-group button svg {
    width: 28px;
    height: 28px;
}
.tx-dashboard-ribbon-group label {
    display: flex;
    flex-direction: column;
    gap: 3px;
    color: var(--tx-muted);
    font-size: 11px;
}
.tx-dashboard-ribbon-group select {
    width: 130px;
    background: var(--tx-surface);
    border: 1px solid var(--tx-border);
    border-radius: 3px;
    padding: 5px;
    font-size: 12px;
}
.tx-dashboard-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 22px;
}
.tx-dashboard-eyebrow {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.14em;
    color: var(--tx-muted);
    margin: 0 0 4px;
}
.tx-dashboard-heading h2 {
    font-size: 24px;
    font-weight: 600;
    margin: 0;
}
.tx-dashboard-mode-label {
    padding: 4px 10px;
    border: 1px solid var(--tx-border);
    border-radius: 4px;
    font-size: 11px;
    color: var(--tx-muted);
}
.tx-dashboard-diagnostics:not(:empty) {
    font-size: 12px;
    color: var(--tx-muted);
    padding: 12px;
    margin-bottom: 16px;
    border-left: 2px solid var(--tx-dashboard-accent);
    background: var(--tx-surface);
}
/* Content-sized spans keep tall cards from stretching unrelated grid rows. */
.tx-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-auto-rows: var(--tx-dashboard-row, 56px);
    gap: 16px;
    padding-bottom: 20px;
    align-items: stretch;
}
.tx-dashboard-widget {
    min-width: 0;
    min-height: 0;
    position: relative;
    background: var(--tx-surface);
    border: 1px solid var(--tx-border);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 5px rgb(0 0 0 / 3%);
}
.tx-dashboard-viewport[data-mode='design'] .tx-dashboard-widget[data-selected='true'] {
    border-color: var(--tx-accent);
    box-shadow: 0 0 0 1px var(--tx-accent);
}
.tx-dashboard-widget:focus-visible {
    outline: 2px solid var(--tx-focus);
    outline-offset: 2px;
}
.tx-dashboard-widget > header {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    padding: 10px 14px 6px;
    min-height: 42px;
}
.tx-dashboard-widget > header[data-widget-move] {
    cursor: grab;
    touch-action: none;
}
.tx-dashboard-widget h3 {
    flex: 1;
    min-width: 0;
    margin: 0;
    font-size: 13px;
    font-weight: 600;
}
.tx-dashboard-widget > header button {
    display: grid;
    place-items: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 3px;
    padding: 4px;
    color: var(--tx-muted);
}
.tx-dashboard-widget > header button:hover {
    background: var(--tx-tint);
    border-color: var(--tx-border);
    color: var(--tx-text);
}
.tx-dashboard-widget > header button svg {
    width: 18px;
    height: 18px;
}
.tx-dashboard-widget-body {
    padding: 8px 16px 16px;
    overflow: visible;
    flex: 0 0 auto;
    min-width: 0;
}
.tx-dashboard-kpi {
    display: block;
    font-size: clamp(28px, 3vw, 42px);
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    color: var(--tx-dashboard-accent);
}
.tx-dashboard-record-count {
    display: block;
    margin-top: 10px;
    font-size: 11px;
    color: var(--tx-muted);
}
.tx-dashboard-chart {
    width: 100%;
    position: relative;
}
.tx-dashboard-chart svg {
    display: block;
    width: 100%;
    height: auto;
    --tx-chart-text: var(--tx-muted);
    --tx-chart-grid: var(--tx-border);
}
.tx-dashboard-chart svg > rect:first-of-type,
.tx-dashboard-chart svg > rect:last-of-type:not([data-chart-point]) {
    stroke: none;
}
.tx-dashboard-chart svg text {
    font-family: inherit;
}
.tx-dashboard-chart [data-chart-point] {
    transition:
        filter 140ms ease,
        opacity 140ms ease;
}
.tx-dashboard-chart [data-chart-point]:hover,
.tx-dashboard-chart [data-chart-point]:focus {
    filter: brightness(1.2);
    outline: none;
    stroke: var(--tx-focus);
    stroke-width: 2;
}
.tx-dashboard-chart-mark {
    transform-box: fill-box;
    transform-origin: center;
    animation: tx-dashboard-mark-in 320ms cubic-bezier(0.16, 1, 0.3, 1) var(--tx-mark-delay, 0ms) both;
}
.tx-dashboard-chart-tooltip {
    position: absolute;
    right: 8px;
    top: 6px;
    max-width: calc(100% - 16px);
    pointer-events: none;
    padding: 7px 10px;
    border: 1px solid var(--tx-border);
    border-radius: 4px;
    box-shadow: var(--tx-popup-shadow);
    background: var(--tx-surface);
    color: var(--tx-text);
    font-size: 12px;
    z-index: 1;
}
@keyframes tx-dashboard-mark-in {
    from {
        opacity: 0;
        transform: var(--tx-mark-from, scale(0.35));
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}
.tx-dashboard-marks {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
}
.tx-dashboard-marks button,
.tx-dashboard-widget-body > button,
.tx-dashboard-empty button {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    padding: 5px 9px;
    background: var(--tx-surface);
    border: 1px solid var(--tx-border);
    border-radius: 3px;
    font-size: 11px;
}
.tx-dashboard-marks button:hover,
.tx-dashboard-widget-body > button:hover {
    background: var(--tx-tint);
}
.tx-dashboard-icon-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.tx-dashboard-widget-body > .tx-dashboard-icon-button {
    margin-top: 8px;
}
.tx-dashboard-widget-body > .tx-dashboard-icon-button svg {
    width: 16px;
    height: 16px;
}
.tx-dashboard-drill-path {
    color: var(--tx-accent);
    font-size: 11px;
    padding-bottom: 6px;
}
.tx-dashboard-chart-hint {
    display: block;
    color: var(--tx-muted);
    font-size: 11px;
    margin-top: 8px;
}
.tx-dashboard-widget table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    table-layout: fixed;
}
.tx-dashboard-widget :is(th, td) {
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid var(--tx-border);
    overflow-wrap: anywhere;
}
.tx-dashboard-widget th {
    background: var(--tx-soft);
    font-weight: 600;
}
.tx-dashboard-widget tbody tr:nth-child(even) {
    background: var(--tx-soft);
}
.tx-dashboard-widget details {
    margin-top: 12px;
    font-size: 11px;
    color: var(--tx-muted);
}
.tx-dashboard-widget summary {
    cursor: pointer;
    padding-block: 4px;
}
.tx-dashboard-widget-body > :is(input[type='date'], input[type='search']) {
    display: block;
    width: 100%;
    margin-bottom: 8px;
    background: var(--tx-surface);
    border: 1px solid var(--tx-border);
    border-radius: 3px;
    padding: 7px 9px;
    font-size: 12px;
}
.tx-dashboard-native-filter {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
}
.tx-dashboard-filter-choices {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding-bottom: 4px;
}
.tx-dashboard-filter-choices :is(button, span) {
    border: 1px solid var(--tx-border);
    background: var(--tx-soft);
    border-radius: 3px;
    padding: 7px 12px;
    font-size: 12px;
}
.tx-dashboard-filter-choices button[aria-pressed='true'] {
    background: var(--tx-tint);
    border-color: var(--tx-accent);
    color: var(--tx-accent);
}
.tx-dashboard-filter-choices button:hover {
    border-color: var(--tx-focus);
}
.tx-dashboard-filter-choices button[hidden] {
    display: none;
}
.tx-dashboard-widget-body img {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
}
.tx-dashboard-text {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    user-select: text;
}
.tx-dashboard-query-error,
.tx-dashboard-settings-error {
    color: var(--tx-error);
}
.tx-dashboard-resize {
    position: absolute;
    right: 2px;
    bottom: 2px;
    width: 16px;
    height: 16px;
    border: 0;
    background: repeating-linear-gradient(135deg, transparent 0 3px, var(--tx-muted) 3px 4px, transparent 4px 6px);
    clip-path: polygon(100% 0, 100% 100%, 0 100%);
    cursor: nwse-resize;
    touch-action: none;
}
.tx-dashboard-empty {
    grid-column: 1 / -1;
    grid-row: span 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 1px dashed var(--tx-border);
    border-radius: 6px;
    padding: 24px;
    gap: 12px;
}
.tx-dashboard-empty svg {
    width: 44px;
    height: 44px;
    stroke: var(--tx-focus);
}
.tx-dashboard-empty h3,
.tx-dashboard-empty p {
    margin: 0;
}
.tx-dashboard-menu {
    max-height: min(600px, calc(100dvh - 24px));
    background: var(--tx-surface);
    border: 1px solid var(--tx-border);
    border-radius: var(--tx-popup-radius);
    box-shadow: var(--tx-popup-shadow);
}
.tx-dashboard-dialog {
    width: min(1100px, calc(100vw - 32px));
    max-height: calc(100dvh - 32px);
    overflow: auto;
    border: 1px solid var(--tx-border);
    border-radius: 8px;
    padding: 0;
    color: var(--tx-text);
    background: var(--tx-surface);
}
.tx-dashboard-dialog::backdrop {
    background: rgb(0 0 0 / 30%);
}
.tx-dashboard-dialog-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px 24px;
    border-bottom: 1px solid var(--tx-border);
}
.tx-dashboard-dialog-heading > div {
    display: flex;
    gap: 14px;
}
.tx-dashboard-dialog-heading > div > svg {
    width: 32px;
    height: 32px;
    color: var(--tx-accent);
}
.tx-dashboard-dialog-heading h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}
.tx-dashboard-dialog-heading p {
    font-size: 12px;
    color: var(--tx-muted);
    margin: 5px 0 0;
}
.tx-dashboard-dialog-heading button {
    display: grid;
    place-items: center;
    background: transparent;
    border: 0;
    padding: 4px;
    border-radius: 3px;
}
.tx-dashboard-dialog-heading button:hover {
    background: var(--tx-tint);
}
.tx-dashboard-designer {
    display: grid;
    grid-template-columns: 142px minmax(250px, 1fr) minmax(240px, 0.9fr);
    align-items: start;
    gap: 20px;
    padding: 20px;
}
.tx-dashboard-widget-gallery {
    display: flex;
    flex-direction: column;
    gap: 5px;
    position: sticky;
    top: 16px;
}
.tx-dashboard-widget-gallery button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    text-align: left;
    font-size: 12px;
}
.tx-dashboard-widget-gallery button:hover {
    background: var(--tx-soft);
}
.tx-dashboard-widget-gallery button[aria-pressed='true'] {
    background: var(--tx-tint);
    border-color: var(--tx-accent);
    color: var(--tx-accent);
}
.tx-dashboard-settings {
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.tx-dashboard-dialog .tx-dashboard-settings fieldset {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    border: 0;
    border-top: 1px solid var(--tx-border);
    padding: 14px 0 0;
    margin: 0;
    min-width: 0;
}
.tx-dashboard-settings legend {
    display: flex;
    align-items: center;
    gap: 7px;
    padding-right: 10px;
    font-size: 12px;
    font-weight: 600;
}
.tx-dashboard-settings legend svg {
    width: 18px;
    height: 18px;
}
.tx-dashboard-dialog .tx-dashboard-settings label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 12px;
    min-width: 0;
}
.tx-dashboard-settings
    label:has(
        :is(
            textarea,
            [type='checkbox'],
            [aria-label='Title'],
            [aria-label='Source'],
            [aria-label='Drill-down hierarchy']
        )
    ) {
    grid-column: 1 / -1;
}
.tx-dashboard-settings input:not([type='checkbox']),
.tx-dashboard-settings select {
    width: 100%;
    min-width: 0;
    padding: 8px;
    border: 1px solid var(--tx-border);
    border-radius: 3px;
    background: var(--tx-surface);
    font-size: 12px;
}
.tx-dashboard-dialog .tx-dashboard-settings label:has([type='checkbox']) {
    flex-direction: row-reverse;
    justify-content: flex-end;
    align-items: center;
}
.tx-dashboard-settings label > button {
    background: var(--tx-soft);
    border: 1px solid var(--tx-border);
    border-radius: 3px;
    padding: 6px;
}
.tx-dashboard-preview-panel {
    position: sticky;
    top: 16px;
    background: var(--tx-soft);
    border: 1px solid var(--tx-border);
    border-radius: 6px;
    padding: 14px;
}
.tx-dashboard-preview-panel > h3 {
    margin: 0;
    font-size: 13px;
}
.tx-dashboard-preview-panel > p {
    font-size: 11px;
    color: var(--tx-muted);
    margin: 7px 0 14px;
}
.tx-dashboard-preview-panel .tx-dashboard-widget {
    box-shadow: none;
    min-height: 210px;
}
.tx-dashboard-preview-panel .tx-dashboard-widget-body {
    font-size: 12px;
}
.tx-dashboard-preview-caption {
    margin-bottom: 0 !important;
}
.tx-dashboard-dialog .tx-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    position: sticky;
    bottom: 0;
    padding: 14px 24px;
    background: var(--tx-soft);
    border-top: 1px solid var(--tx-border);
}
.tx-dashboard-dialog .tx-dialog-actions button {
    background: var(--tx-surface);
    border: 1px solid var(--tx-border);
    border-radius: 4px;
    padding: 8px 24px;
    min-width: 90px;
}
.tx-dashboard-dialog .tx-dialog-actions button[type='submit'] {
    border-color: var(--tx-accent);
    color: var(--tx-accent);
}
.tx-dashboard-settings-error:not(:empty) {
    padding: 0 24px;
}
.tx-dashboard-generate-commands {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 3px;
}
@media (max-width: 850px) {
    .tx-dashboard-designer {
        grid-template-columns: 110px minmax(0, 1fr);
        gap: 14px;
    }
    .tx-dashboard-preview-panel {
        grid-column: 2;
        position: static;
    }
    .tx-dashboard-ribbon-group select {
        width: 115px;
    }
}
@media (max-width: 650px) {
    .tx-dashboard-viewport {
        padding: 14px;
    }
    .tx-dashboard-grid {
        display: flex;
        flex-direction: column;
    }
    .tx-dashboard-widget {
        min-height: 150px;
    }
    .tx-dashboard-widget:has(.tx-dashboard-chart) {
        min-height: 280px;
    }
    .tx-dashboard-resize {
        display: none;
    }
    .tx-dashboard-commandbar {
        padding: 6px;
        gap: 2px;
        flex-wrap: wrap;
    }
    .tx-dashboard-commandbar strong {
        flex: 1;
        font-size: 12px;
    }
    :is(.tx-dashboard-commandbar, .tx-dashboard-ribbon-group) button:where(:not(.tx-styles-expand)) {
        padding: 5px;
    }
    .tx-dashboard-commandbar button span {
        display: none;
    }
    .tx-dashboard-design-ribbon {
        max-height: 180px;
        overflow: auto;
        flex-wrap: nowrap;
    }
    .tx-dashboard-ribbon-group {
        flex-shrink: 0;
    }
    .tx-dashboard-heading h2 {
        font-size: 21px;
    }
    .tx-sheet-bar {
        padding-inline: 4px;
        gap: 2px;
    }
    .tx-sheet-tab {
        padding-inline: 9px;
    }
    .tx-dashboard-designer {
        grid-template-columns: minmax(0, 1fr);
        padding: 14px;
    }
    .tx-dashboard-widget-gallery {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        position: static;
    }
    .tx-dashboard-widget-gallery button {
        flex-direction: column;
        padding: 8px 3px;
        font-size: 11px;
    }
    .tx-dashboard-preview-panel {
        grid-column: 1;
    }
    .tx-dashboard-dialog-heading {
        padding: 14px;
    }
}
@media (prefers-reduced-motion: reduce) {
    .tx-dashboard-chart-mark {
        animation: none;
    }
    .tx-dashboard-chart [data-chart-point] {
        transition: none;
    }
}
@media (forced-colors: active) {
    .tx-dashboard-widget,
    .tx-dashboard-menu {
        border-color: CanvasText;
    }
    .tx-sheet-tab[aria-selected='true'] {
        border-bottom: 3px solid Highlight;
    }
    .tx-view-divider {
        background: CanvasText;
    }
    .tx-dashboard-widget-gallery button[aria-pressed='true'],
    .tx-dashboard-filter-choices button[aria-pressed='true'] {
        outline: 2px solid Highlight;
    }
}
.tx-dashboard-active > .tx-review-workspace {
    display: none !important;
}
.tx-dashboard-active .tx-count {
    display: none;
}
.tx-dashboard-viewport {
    position: relative;
}
.tx-dashboard-trial-watermark {
    position: sticky;
    top: 45%;
    left: auto;
    height: 0;
    width: max-content;
    margin-inline: auto;
    transform: rotate(-30deg);
}
.tx-dashboard-chart svg {
    --tx-chart-background: var(--tx-surface);
    --tx-chart-axis: var(--tx-border);
}
.tx-dashboard-settings [hidden] {
    display: none !important;
}
.tx-dashboard-settings textarea {
    min-height: 90px;
    padding: 8px;
    border: 1px solid var(--tx-border);
    background: var(--tx-surface);
    resize: vertical;
}
.tx-dashboard-hierarchy {
    grid-column: 1 / -1;
    margin: 0;
    padding-left: 20px;
}
.tx-dashboard-hierarchy li {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 5px 0;
}
.tx-dashboard-hierarchy li span {
    flex: 1;
}
.tx-dashboard-hierarchy button {
    border: 1px solid var(--tx-border);
    border-radius: 3px;
    background: var(--tx-surface);
    padding: 2px 7px;
}
.tx-dashboard-generate-commands svg {
    width: 26px;
    height: 26px;
}
.tx-dashboard-generate-commands {
    flex-direction: row;
    align-items: flex-start;
}
.tx-dashboard-generation .tx-ribbon-command {
    border: 1px solid transparent;
    background: transparent;
}

.tx-dashboard-dialog .tx-dashboard-settings .tx-dialog-field {
    margin: 0;
}
.tx-dashboard-dialog .tx-dashboard-settings .tx-dialog-section {
    border: 0;
    border-top: 1px solid var(--tx-border);
    padding: 12px 0 0;
    margin: 0;
}
.tx-dashboard-dialog .tx-dashboard-settings .tx-dialog-section[hidden] {
    display: none !important;
}
.tx-dashboard-viewport:focus {
    outline: none;
}
.tx-dashboard-viewport:focus-visible {
    outline: 2px solid var(--tx-focus);
    outline-offset: -2px;
}
.tx-dashboard-drill-path button {
    border: 0;
    background: transparent;
    color: var(--tx-accent);
    font-size: 11px;
    padding: 3px;
    border-radius: 2px;
}
.tx-dashboard-drill-path button:hover:not(:disabled) {
    background: var(--tx-tint);
    text-decoration: underline;
}
.tx-dashboard-drill-path button:disabled {
    color: var(--tx-muted);
    cursor: default;
}
.tx-dashboard-line-draw {
    stroke-dasharray: 1;
    animation: tx-dashboard-line-draw 360ms cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes tx-dashboard-line-draw {
    from {
        stroke-dashoffset: 1;
    }
    to {
        stroke-dashoffset: 0;
    }
}
@media (prefers-reduced-motion: reduce) {
    .tx-dashboard-line-draw {
        animation: none;
    }
}

/* A host-owned viewer policy survives document loads and saved dashboard design modes. */
.tx-dashboard-viewer
    :is(
        .tx-sheet-tabs,
        [data-sheet-add],
        [data-dashboard-add],
        .tx-view-divider,
        .tx-dashboard-design-ribbon,
        [data-dashboard-action='mode']
    ) {
    display: none !important;
}
.tx-dashboard-viewer .tx-dashboard-tab-group {
    flex: 1 1 auto;
}
.tx-dashboard-viewer .tx-dashboard-toolbar [hidden] {
    display: none !important;
}

/* Calendar slicers share the spreadsheet field colors and expand with their contents. */
.tx-dashboard-date-filter {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}
.tx-dashboard-date-filter label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
    color: var(--tx-muted);
    font-size: 12px;
}
.tx-dashboard-date-filter label:first-child {
    grid-column: 1 / -1;
}
.tx-dashboard-date-filter :is(input, select) {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    background: var(--tx-surface);
    color: var(--tx-text);
    border: 1px solid var(--tx-border);
    border-radius: 3px;
    padding: 7px 8px;
    font: inherit;
}
.tx-dashboard-date-filter :is(input, select):focus-visible {
    outline: 2px solid var(--tx-focus);
    outline-offset: 1px;
}
.tx-dashboard-date-filter input[aria-invalid='true'] {
    border-color: var(--tx-error);
}
.tx-dashboard-date-error {
    grid-column: 1 / -1;
    color: var(--tx-error);
    font-size: 12px;
    margin: 0;
}
.tx-dashboard-date-error[hidden] {
    display: none;
}

/* Dashboard authoring uses the spreadsheet ribbon frame and native formatting controls. */
.tx-dashboard-commandbar {
    box-sizing: border-box;
    height: 36px;
    min-height: 36px;
    padding: 0 8px;
}
.tx-dashboard-design-ribbon {
    box-sizing: border-box;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    align-items: stretch;
    padding: 4px 8px 3px;
    background: var(--tx-surface);
}
.tx-dashboard-ribbon-group {
    flex-shrink: 0;
    padding: 2px 8px 0;
}
.tx-dashboard-ribbon-group > div {
    min-height: 84px;
    align-items: flex-start;
}
.tx-dashboard-ribbon-group label {
    font-size: 11px;
}
.tx-dashboard-ribbon-group :is(select, input) {
    box-sizing: border-box;
    height: 25px;
    min-height: 25px;
    padding: 2px 5px;
    color: inherit;
    border: 1px solid var(--tx-border);
    border-radius: 2px;
    background: var(--tx-surface);
    font: inherit;
}
.tx-dashboard-ribbon-group select {
    width: 112px;
}
.tx-dashboard-ribbon-group button[aria-pressed='true'] {
    background: var(--tx-tint);
    border-color: var(--tx-accent);
}
.tx-dashboard-widget {
    background: var(--tx-widget-background, var(--tx-surface));
    border-color: var(--tx-widget-border, var(--tx-border));
}
.tx-dashboard-widget h3 {
    color: var(--tx-widget-title-color, inherit);
    font-size: var(--tx-widget-title-size, 13px);
}
.tx-dashboard-widget h3[hidden] {
    display: none;
}
.tx-dashboard-widget-body {
    color: var(--tx-widget-text-color, inherit);
    font-family: var(--tx-widget-font, inherit);
    font-size: var(--tx-widget-font-size, inherit);
    font-weight: var(--tx-widget-weight, inherit);
    font-style: var(--tx-widget-style, normal);
    text-decoration: var(--tx-widget-decoration, none);
    text-align: var(--tx-widget-align, left);
}
.tx-dashboard-widget :where(.tx-dashboard-kpi, td, th, .tx-dashboard-filter-choices button) {
    color: var(--tx-widget-text-color, inherit);
    font-family: var(--tx-widget-font, inherit);
    font-size: var(--tx-widget-font-size, inherit);
    font-style: var(--tx-widget-style, inherit);
    font-weight: var(--tx-widget-weight, inherit);
    text-align: var(--tx-widget-align, inherit);
}
.tx-dashboard-widget .tx-dashboard-kpi {
    font-size: var(--tx-widget-font-size, clamp(28px, 3vw, 42px));
    color: var(--tx-widget-text-color, var(--tx-dashboard-accent));
    font-weight: var(--tx-widget-weight, 600);
}
.tx-dashboard-settings input[type='color'] {
    min-height: 32px;
    padding: 3px;
    width: 100%;
}

@media (pointer: coarse) {
    .tx-dashboard-commandbar {
        height: 48px;
        min-height: 48px;
    }
}
.tx-dashboard-widget h3 {
    font-family: var(--tx-widget-font, inherit);
}

/* Hidden contextual controls retain the native hidden behavior despite label layout rules. */
.tx-dashboard-ribbon-group [hidden] {
    display: none !important;
}

/* Date filtering is self-contained in the widget, including in locked dashboards. */
.tx-dashboard-date-filter > label:first-child {
    grid-column: auto;
}
.tx-dashboard-date-search {
    grid-column: 1 / -1;
    min-width: 0;
    display: grid;
    gap: 8px;
}
.tx-dashboard-date-filter [hidden] {
    display: none !important;
}
.tx-dashboard-date-empty {
    margin: 0;
    color: var(--tx-muted);
}

/* Dashboard commands retain blue selection; shared font/number controls inherit the spreadsheet theme. */
.tx-dashboard-commandbar,
.tx-dashboard-ribbon-group {
    --tx-accent: light-dark(#3979ad, #91bfe3);
    --tx-tint: light-dark(#e5f0fa, #263d50);
}
.tx-dashboard-commandbar strong {
    height: 32px;
    padding: 0 10px;
    color: var(--tx-text);
}
.tx-dashboard-presentation > .tx-sheet-bar {
    display: none !important;
}
.tx-dashboard-chart-styles > div {
    align-items: center;
    gap: 3px;
}
.tx-dashboard-style-tiles {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
}
.tx-dashboard-style-strip .tx-dashboard-style-tiles {
    grid-template-columns: repeat(4, 70px);
    gap: 2px;
}
:is(.tx-dashboard-toolbar, .tx-dashboard-style-picker, .tx-dashboard-style-menu) [data-chart-style] {
    display: grid;
    place-items: center;
    min-width: 0;
    width: 100%;
    padding: 4px;
    border: 1px solid transparent;
    border-radius: 2px;
    background: var(--tx-surface);
}
:is(.tx-dashboard-toolbar, .tx-dashboard-style-picker, .tx-dashboard-style-menu) [data-chart-style] svg {
    display: block;
    width: 100%;
    height: 48px;
}
:is(.tx-dashboard-toolbar, .tx-dashboard-style-picker, .tx-dashboard-style-menu)
    [data-chart-style]:is(:hover, [aria-pressed='true']) {
    border-color: var(--tx-focus);
    background: light-dark(#e5f0fa, #263d50);
}
.tx-dashboard-style-category > strong {
    display: block;
    margin-bottom: 8px;
    font-size: 12px;
}
.tx-dashboard-style-category + .tx-dashboard-style-category {
    border-top: 1px solid var(--tx-border);
    margin-top: 12px;
    padding-top: 12px;
}
.tx-dashboard-style-menu {
    width: min(540px, calc(100vw - 24px));
    max-height: calc(100dvh - 24px);
    overflow: auto;
    padding: 14px;
    color: var(--tx-text);
    background: var(--tx-surface);
}
.tx-dashboard-style-picker {
    grid-column: 1 / -1;
}
.tx-dashboard-chart-styles .tx-styles-controls {
    width: auto;
}
/* One expandable category at a time keeps the preview and primary actions nearby. */
.tx-dashboard-dialog .tx-dashboard-settings > fieldset {
    display: block;
    padding: 0;
    border: 0;
}
.tx-dashboard-dialog .tx-dashboard-settings > fieldset > legend {
    display: none;
}
.tx-dashboard-settings > details {
    border-top: 1px solid var(--tx-border);
    min-width: 0;
}
.tx-dashboard-settings > details > summary {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
    cursor: pointer;
    padding: 10px 0;
    font-size: 12px;
    font-weight: 600;
}
.tx-dashboard-settings > details > summary::-webkit-details-marker {
    display: none;
}
.tx-dashboard-settings > details > summary::after {
    content: '';
    width: 6px;
    height: 6px;
    border-right: 1px solid currentColor;
    border-bottom: 1px solid currentColor;
    transform: rotate(-45deg);
    margin-left: auto;
    margin-right: 3px;
}
.tx-dashboard-settings > details[open] > summary::after {
    transform: rotate(45deg);
}
.tx-dashboard-settings > details > summary svg {
    width: 18px;
    height: 18px;
}
.tx-dashboard-section-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding-bottom: 8px;
}
.tx-dashboard-settings > details:not([open]) > .tx-dashboard-section-fields,
.tx-dashboard-settings [hidden] {
    display: none !important;
}
.tx-dashboard-dialog .tx-dashboard-settings {
    gap: 6px;
}
.tx-dashboard-dialog-heading {
    padding: 14px 20px;
}
.tx-dashboard-designer {
    gap: 18px;
    padding: 16px 20px;
}
.tx-dashboard-style-picker .tx-dashboard-style-tiles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 640px) {
    .tx-dashboard-section-fields {
        grid-template-columns: minmax(0, 1fr);
    }
    .tx-dashboard-style-tiles {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.tx-dashboard-active > .tx-footer .tx-count {
    display: none;
}

.tx-dashboard-ribbon-group > .tx-ribbon-group-body {
    align-items: stretch;
    min-height: 0;
}
.tx-dashboard-ribbon-group > .tx-ribbon-group-body > .tx-ribbon-content {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    min-height: 82px;
}
.tx-dashboard-chart-styles .tx-ribbon-content {
    align-items: center !important;
    gap: 3px !important;
}
.tx-dashboard-ribbon-group .tx-ribbon-group-trigger {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    white-space: normal;
    text-align: center;
    height: 84px;
    padding: 5px 2px;
}
.tx-dashboard-ribbon-group .tx-ribbon-group-trigger svg {
    width: 28px;
    height: 28px;
}
.tx-dashboard-ribbon-group .tx-ribbon-group-body:popover-open {
    min-height: 100px;
    height: auto;
    background: var(--tx-surface);
    color: var(--tx-text);
    padding: 8px;
    border: 1px solid var(--tx-border);
    box-shadow: var(--tx-popup-shadow);
}

.tx-dashboard-ribbon-group > .tx-ribbon-group-body {
    gap: 0;
}
.tx-dashboard-ribbon-group > .tx-ribbon-group-body > .tx-ribbon-content {
    flex-direction: row;
    flex-wrap: nowrap;
}

/* Worksheet and dashboard tabs share one label and inline editor layout. */
.tx-sheet-tab[hidden] {
    display: none !important;
}
.tx-sheet-tab:not(.tx-sheet-tab-renaming) {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.tx-sheet-tab-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tx-view-sheet-tab::before {
    flex: 0 0 20px;
    margin-right: 0;
}
.tx-sheet-tab.tx-sheet-tab-renaming {
    display: inline-grid;
    column-gap: 8px;
}
.tx-sheet-tab-renaming:has(> svg) {
    grid-template-columns: max-content minmax(1ch, max-content);
    align-items: center;
    gap: 8px;
}
.tx-sheet-tab-renaming > svg {
    grid-area: 1 / 1;
}
.tx-sheet-tab-renaming:has(> svg) :is(.tx-sheet-name-measure, .tx-sheet-name-editor) {
    grid-area: 1 / 2;
}
/* Space neighboring action rows as well as buttons within each row. */
.tx-dashboard-widget-body > button {
    margin-block: 8px;
    margin-inline-end: 8px;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
}
.tx-dashboard-marks {
    gap: 8px;
    margin-block: 10px;
}
.tx-dashboard-widget-body > button + :is(table, .tx-dashboard-table) {
    margin-top: 4px;
}
.tx-dashboard-chart text {
    white-space: pre;
}

/* Display and edit calendar bounds in the source-cell format while retaining the native calendar chooser. */
.tx-dashboard-date-input {
    display: block;
    position: relative;
}
.tx-dashboard-date-input > input:first-child {
    padding-right: 36px;
}
.tx-dashboard-date-filter .tx-dashboard-date-picker {
    position: absolute;
    inset-block: 1px;
    right: 4px;
    width: 28px;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: transparent;
}
.tx-dashboard-date-picker::-webkit-datetime-edit {
    display: none;
}
.tx-dashboard-date-picker::-webkit-calendar-picker-indicator {
    margin: 0;
    cursor: pointer;
}

/* Workbook feature commands reuse the existing ribbon caption and responsive group layout. */
.tx-feature-ribbon-buttons {
    display: flex;
    align-items: stretch;
    gap: 4px;
    min-height: 84px;
}

.tx-ribbon button.tx-feature-command {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    gap: 5px;
    width: min-content;
    min-width: 84px;
    max-width: 160px;
    min-height: 84px;
    padding: 6px 4px;
    white-space: normal;
    text-align: center;
}

/* Let the longest translated word determine the button width before responsive group measurement. */
.tx-ribbon button.tx-feature-command > span {
    overflow-wrap: break-word;
}

/* Collapsed groups must also fit longer captions inside their viewport-sized popup. */
.tx-ribbon-group-body[popover] .tx-feature-ribbon-buttons {
    flex-wrap: wrap;
    max-width: calc(100vw - 34px);
}

.tx-feature-command .tx-ribbon-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
}

/* Editing combines its short command stack with large Find/Fill commands within one ribbon row. */
.tx-ribbon [data-ribbon-group='editing'] .tx-ribbon-content {
    flex-direction: row;
    align-items: flex-start;
    gap: 8px;
}

.tx-ribbon [data-ribbon-group='editing'] .tx-ribbon-content > * {
    flex: 0 0 auto;
}

dialog.tx-feature-dialog {
    width: min(560px, calc(100vw - 32px));
}

.tx-comment-entries,
.tx-search-results {
    display: grid;
    gap: 10px;
    max-height: 320px;
    overflow: auto;
}

.tx-comment-entries:empty,
.tx-search-results:empty {
    display: none;
}

.tx-comment-entries article {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    border-bottom: 1px solid var(--tx-border);
    padding-bottom: 12px;
}

.tx-comment-entries textarea {
    grid-column: 1 / -1;
    user-select: text;
}

.tx-comment-entries time {
    color: var(--tx-muted);
    font-size: 0.85em;
}

.tx-search-results button {
    text-align: left;
    overflow-wrap: anywhere;
}

.tx-active-cell-controls {
    position: absolute;
    pointer-events: none;
    z-index: 5;
    overflow: hidden;
}

.tx-interactive-cell {
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    pointer-events: auto;
    font: inherit;
    color: var(--tx-text);
    background: var(--tx-surface);
    border: 0;
    margin: 0;
    padding: 1px 4px;
}

.tx-cell-radio-list {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tx-cell-radio-list label {
    display: flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
}

.tx-cell-radio-list input {
    margin: 0;
    width: 12px;
    height: 12px;
}

.tx-validation-help {
    position: absolute;
    z-index: 8;
    max-width: 260px;
    padding: 8px 12px;
    color: #24322d;
    background: #fff4d2;
    border: 1px solid #646766;
    box-shadow: 2px 3px 8px #0002;
    pointer-events: none;
    font-size: 12px;
}

.tx-validation-help strong {
    display: block;
    margin-bottom: 4px;
}

.tx-pane-scrollbars {
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
}

.tx-pane-scrollbar {
    position: absolute;
    height: 12px;
    margin: 0;
    padding: 0;
    pointer-events: auto;
    accent-color: #646766;
}

.tx-pane-scrollbar-vertical {
    width: 12px;
    writing-mode: vertical-lr;
    direction: rtl;
}

.tx-fill-preview {
    position: absolute;
    z-index: 9;
    pointer-events: none;
    box-sizing: border-box;
    border: 2px dashed var(--tx-accent);
    background: #1873460d;
}

.tx-formula-audit {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 4;
    overflow: hidden;
}

/* Review surfaces share the editor tokens while keeping drafts outside exported worksheet content. */
.tx-review-workspace {
    display: flex;
    min-width: 0;
    min-height: 0;
    position: relative;
}
.tx-sheet-fill > .tx-review-workspace {
    flex: 1 1 0;
    min-height: 0;
}
.tx-review-workspace > .tx-grid-viewport {
    flex: 1 1 0;
    width: 0;
    min-width: 0;
}
.tx-sheet-fill .tx-review-workspace > .tx-grid-viewport {
    height: auto;
    min-height: 0;
}
.tx-comments-sidebar {
    display: flex;
    flex: 0 0 var(--tx-comments-width, 340px);
    width: var(--tx-comments-width, 340px);
    max-width: calc(100% - 96px);
    min-width: 0;
    min-height: 0;
    background: var(--tx-soft);
    border-left: 1px solid var(--tx-border);
    color: var(--tx-text);
    font-size: 13px;
}
.tx-comments-sidebar[hidden],
.tx-comments-filters[hidden],
.tx-note-box[hidden],
.tx-review-error[hidden] {
    display: none !important;
}
.tx-comments-resizer {
    flex: 0 0 6px;
    cursor: col-resize;
    touch-action: none;
}
.tx-comments-resizer:hover,
.tx-comments-resizer:focus-visible {
    background: var(--tx-focus);
    outline: none;
}
.tx-comments-sidebar-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    min-width: 0;
    padding: 12px;
    overflow: hidden;
}
.tx-comments-sidebar-content > header,
.tx-comments-toolbar,
.tx-review-thread-heading,
.tx-review-author {
    display: flex;
    align-items: center;
    gap: 8px;
}
.tx-comments-sidebar h2 {
    margin: 0;
    flex: 1;
    font-size: 16px;
}
.tx-comments-toolbar {
    flex-wrap: wrap;
    justify-content: space-between;
}
.tx-comments-toolbar > span {
    font-size: 12px;
}
.tx-comments-filters {
    display: grid;
    gap: 8px;
}
.tx-comments-filters label {
    display: flex;
    gap: 6px;
    align-items: center;
}
.tx-comments-filters select {
    width: 100%;
    min-height: 30px;
    background: var(--tx-surface);
    color: inherit;
    border: 1px solid var(--tx-border);
    border-radius: 3px;
}
.tx-comments-list {
    flex: 1;
    min-height: 0;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 2px;
}
.tx-comment-popup {
    position: fixed;
    inset: auto;
    margin: 0;
    padding: 0;
    width: 340px;
    max-width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    overflow: auto;
    border: 1px solid var(--tx-border);
    border-radius: var(--tx-popup-radius);
    box-shadow: var(--tx-popup-shadow);
    background: var(--tx-surface);
    color: var(--tx-text);
    font:
        13px/1.45 'Segoe UI',
        Arial,
        sans-serif;
}
.tx-comment-thread {
    border: 1px solid var(--tx-border);
    border-left: 3px solid light-dark(#8b2ca2, #cf97e0);
    border-radius: 4px;
    padding: 12px;
    background: var(--tx-surface);
    min-width: 0;
    flex: 0 0 auto;
}
.tx-comment-thread.tx-review-active {
    outline: 1px solid light-dark(#8b2ca2, #cf97e0);
}
.tx-comment-popup .tx-comment-thread {
    border: 0;
    border-top: 3px solid light-dark(#8b2ca2, #cf97e0);
}
.tx-review-thread-heading {
    margin-bottom: 10px;
}
.tx-review-thread-heading > .tx-review-author {
    flex: 1;
    min-width: 0;
}
.tx-review-author strong {
    overflow-wrap: anywhere;
}
.tx-review-avatar {
    display: grid;
    place-items: center;
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: light-dark(#eee2f2, #49324e);
    color: light-dark(#713283, #f2d9fa);
    font-size: 11px;
    font-weight: 600;
}
.tx-review-address {
    border: 0;
    background: transparent;
    color: var(--tx-muted);
    font-size: 12px;
    cursor: pointer;
}
.tx-review-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 28px;
    min-height: 28px;
    padding: 4px 6px;
    border: 1px solid var(--tx-border);
    border-radius: 4px;
    background: var(--tx-surface);
    color: inherit;
    font: inherit;
    cursor: pointer;
}
.tx-review-button > .tx-ribbon-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
}
.tx-review-button:disabled {
    opacity: 0.45;
    cursor: default;
}
.tx-review-button:hover:not(:disabled),
.tx-review-button:focus-visible {
    background: var(--tx-tint);
    border-color: var(--tx-focus);
}
.tx-review-entry {
    margin: 12px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--tx-border);
}
.tx-review-entry time {
    display: block;
    margin-left: 36px;
    color: var(--tx-muted);
    font-size: 11px;
}
.tx-review-entry-text {
    margin: 6px 0 6px 36px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.tx-review-entry-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}
.tx-review-composer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    margin-top: 12px;
}
.tx-review-composer > textarea {
    grid-column: 1 / -1;
}
.tx-review-composer small {
    color: var(--tx-muted);
    align-self: center;
}
:is(.tx-comment-popup, .tx-comments-sidebar) textarea {
    width: 100%;
    min-height: 52px;
    max-height: 220px;
    resize: vertical;
    border: 1px solid var(--tx-border);
    border-radius: 3px;
    padding: 7px 8px;
    background: var(--tx-surface);
    color: inherit;
    font: inherit;
}
:is(.tx-comment-popup, .tx-comments-sidebar) textarea:focus {
    outline: 1px solid var(--tx-focus);
    border-color: var(--tx-focus);
}
.tx-review-error {
    color: var(--tx-error);
    margin: 8px 0 0;
}
.tx-review-resolved,
.tx-review-empty {
    color: var(--tx-muted);
}
.tx-notes-layer {
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 8;
}
.tx-note-box {
    position: absolute;
    overflow: visible;
    z-index: 1;
    background: #ffffe1;
    color: #24322d;
    border: 1px solid #646766;
    box-shadow: 2px 2px 3px #0002;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    pointer-events: auto;
}
.tx-note-connectors {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}
.tx-note-content {
    height: 100%;
    max-height: inherit;
    padding: var(--tx-note-padding, 7px);
    overflow: auto;
}
.tx-note-content > strong {
    cursor: move;
    touch-action: none;
}
.tx-note-box:focus {
    outline: none;
    border-color: var(--tx-accent);
}
.tx-note-resize {
    position: absolute;
    width: 7px;
    height: 7px;
    background: var(--tx-surface);
    border: 1px solid #859b8c;
    visibility: hidden;
    touch-action: none;
}
.tx-note-box:is(:hover, :focus-within, .tx-note-dragging) > .tx-note-resize {
    visibility: visible;
}
.tx-note-resize[data-note-resize='nw'] {
    left: -4px;
    top: -4px;
    cursor: nwse-resize;
}
.tx-note-resize[data-note-resize='n'] {
    left: calc(50% - 4px);
    top: -4px;
    cursor: ns-resize;
}
.tx-note-resize[data-note-resize='ne'] {
    right: -4px;
    top: -4px;
    cursor: nesw-resize;
}
.tx-note-resize[data-note-resize='e'] {
    right: -4px;
    top: calc(50% - 4px);
    cursor: ew-resize;
}
.tx-note-resize[data-note-resize='se'] {
    right: -4px;
    bottom: -4px;
    cursor: nwse-resize;
}
.tx-note-resize[data-note-resize='s'] {
    left: calc(50% - 4px);
    bottom: -4px;
    cursor: ns-resize;
}
.tx-note-resize[data-note-resize='sw'] {
    left: -4px;
    bottom: -4px;
    cursor: nesw-resize;
}
.tx-note-resize[data-note-resize='w'] {
    left: -4px;
    top: calc(50% - 4px);
    cursor: ew-resize;
}
.tx-note-dragging .tx-note-content {
    user-select: none;
}
.tx-note-box strong {
    display: block;
    font-weight: 700;
}
.tx-note-editor {
    z-index: 2;
    border-color: var(--tx-accent);
}
.tx-note-editor .tx-note-content {
    display: flex;
    flex-direction: column;
}
.tx-note-editor textarea {
    width: 100%;
    padding: 3px 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    resize: none;
    min-height: 0;
    flex: 1;
}
.tx-note-editor textarea:focus {
    outline: none;
}
.tx-note-editor-actions {
    flex-shrink: 0;
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}
.tx-notes-menu .tx-review-button {
    border-color: transparent;
    background: transparent;
}
@media (pointer: coarse) {
    .tx-review-button {
        min-width: 44px;
        min-height: 44px;
    }
    .tx-comments-resizer {
        flex-basis: 12px;
    }
}

/* Table Design shares ribbon groups, control colors, caption baselines and adaptive collapse behavior. */
.tx-table-design-panel .tx-ribbon-group-body:not([popover]) {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
}

.tx-table-design-panel .tx-ribbon-content {
    min-height: 0;
}

.tx-table-design-panel .tx-ribbon-caption {
    margin: 0;
    line-height: 1.3;
}

.tx-table-properties {
    width: 142px;
    min-height: 84px;
    display: grid;
    align-content: start;
    gap: 5px;
}

.tx-table-properties label {
    display: grid;
    gap: 5px;
}

.tx-table-properties input {
    width: 100%;
    min-width: 0;
    height: 27px;
    box-sizing: border-box;
    font: inherit;
}

.tx-ribbon button.tx-table-command,
.tx-table-styles-menu > .tx-table-command {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    width: auto;
    min-width: 0;
    height: 28px;
    font-size: inherit;
    gap: 7px;
    text-align: left;
    white-space: nowrap;
    min-height: 28px;
    padding: 3px 5px;
}

.tx-ribbon button.tx-table-command > .tx-ribbon-icon,
.tx-table-styles-menu .tx-table-command > .tx-ribbon-icon {
    width: 23px;
    height: 23px;
    flex: 0 0 23px;
}

.tx-ribbon button.tx-table-command > span:not([aria-hidden='true']) {
    width: auto;
    min-height: 0;
    white-space: nowrap;
    text-align: left;
}

.tx-table-tools {
    display: grid;
    align-content: center;
    gap: 6px;
    min-height: 84px;
}

.tx-table-style-options {
    display: grid;
    grid-template-rows: repeat(3, 26px);
    grid-auto-flow: column;
    align-content: center;
    gap: 2px 14px;
    min-height: 84px;
}

.tx-table-style-options label {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.tx-table-style-options input {
    margin: 0;
    width: 15px;
    height: 15px;
    accent-color: var(--tx-accent);
}

.tx-table-style-ribbon {
    display: flex;
    align-items: center;
    gap: 3px;
    min-height: 84px;
}

.tx-table-style-strip {
    display: flex;
    gap: 2px;
    width: 526px;
    overflow: hidden;
}

.tx-table-style-ribbon > .tx-styles-expand {
    width: 24px;
    min-width: 24px;
    height: 60px;
    align-self: center;
}

.tx-table-style-strip button,
.tx-table-style-grid button {
    flex: 0 0 73px;
    width: 73px;
    min-width: 0;
    height: 55px;
    min-height: 0;
    border: 1px solid transparent;
    border-radius: 2px;
    padding: 3px;
    background: var(--tx-surface);
}

.tx-table-style-strip svg,
.tx-table-style-grid svg {
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

:is(.tx-table-style-strip, .tx-table-style-grid) button[aria-pressed='true'] {
    border-color: var(--tx-focus);
    box-shadow: inset 0 0 0 1px var(--tx-focus);
}

.tx-table-styles-menu {
    position: fixed;
    inset: auto;
    margin: 0;
    padding: 10px;
    border: 1px solid var(--tx-border);
    border-radius: var(--tx-popup-radius, 4px);
    background: var(--tx-surface);
    color: var(--tx-text);
    box-shadow: 0 5px 14px #0003;
    max-width: calc(100vw - 16px);
    max-height: calc(100dvh - 96px);
    overflow: auto;
    box-sizing: border-box;
}

.tx-table-styles-menu {
    width: 632px;
}

.tx-table-styles-menu section + section,
.tx-table-styles-menu > .tx-table-command {
    border-top: 1px solid var(--tx-border);
    margin-top: 12px;
    padding-top: 10px;
}

.tx-table-styles-menu h3 {
    margin: 0 0 10px;
    font-size: 14px;
}

.tx-table-style-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 5px;
}

.tx-table-style-grid button {
    width: 100%;
}

.tx-table-styles-menu button {
    color: inherit;
}

.tx-table-styles-menu button:hover {
    background: var(--tx-hover, #eaf3ef);
    border-color: var(--tx-focus);
}

.tx-table-styles-menu > .tx-table-command {
    width: 100%;
    background: transparent;
    border-right: 0;
    border-left: 0;
    border-bottom: 0;
}

.tx-table-design-panel [data-ribbon-mode='compact'] .tx-table-style-strip {
    width: 225px;
}

.tx-table-design-panel .tx-ribbon-group-body[popover] .tx-table-style-strip {
    width: min(300px, calc(100vw - 76px));
}

@media (max-width: 540px) {
    .tx-table-style-options {
        grid-template-rows: repeat(4, 28px);
    }
}

@media (pointer: coarse) {
    .tx-ribbon button.tx-table-command,
    .tx-table-style-options label {
        min-height: 36px;
    }

    .tx-table-style-options {
        grid-template-rows: repeat(3, 36px);
    }

    .tx-table-style-ribbon > .tx-styles-expand {
        min-width: 44px;
    }
}

/* A true modal keeps worksheet commands blocked while backdrop gestures pick the proposed range. */
dialog.tx-table-resize-dialog {
    width: min(410px, calc(100vw - 24px));
    touch-action: none;
}

dialog.tx-table-resize-dialog::backdrop {
    background: transparent;
    cursor: crosshair;
}

.tx-table-resize-label {
    display: grid;
    gap: 8px;
}

.tx-table-resize-reference {
    display: flex;
    align-items: stretch;
    gap: 4px;
}

.tx-table-resize-reference input {
    flex: 1;
    min-width: 0;
    height: 30px;
    padding: 3px 6px;
    box-sizing: border-box;
    color: var(--tx-text);
    background: var(--tx-surface);
    border: 1px solid var(--tx-border);
    font: inherit;
}

.tx-table-resize-reference button {
    flex: 0 0 32px;
    padding: 3px;
    background: var(--tx-surface);
    border: 1px solid var(--tx-border);
}

.tx-table-resize-reference button[aria-pressed='true'] {
    border-color: var(--tx-focus);
    background: var(--tx-soft);
}

.tx-table-resize-reference img {
    display: block;
    width: 22px;
    height: 22px;
}

.tx-table-resize-note {
    margin: 12px 0 0;
}
