/* Workbook document — chrome, grid, and sheet (loaded with styles.css) */
.wb-logo {
    display: block;
    height: 3rem;
    width: auto;
    flex-shrink: 0;
}

.wb-name {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--base-hover);
    letter-spacing: -0.02em;
    line-height: 1;
    margin: 0;
    min-width: 0;
}

.wb-name-btn {
    margin: 0;
    padding: 0.1rem 0.1rem;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: inherit;
    font: inherit;
    letter-spacing: inherit;
    line-height: inherit;
    text-align: left;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    box-shadow: none;
}

.wb-name-btn:hover,
.wb-name-btn:focus-visible {
    background: var(--base-soft);
    color: var(--base-hover);
}

.wb-name-input {
    margin: 0;
    padding: 0.1rem 0.2rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
    color: inherit;
    font: inherit;
    letter-spacing: inherit;
    line-height: inherit;
    width: min(24rem, 100%);
    box-shadow: none;
}

.wb-name-input:focus {
    border-color: var(--base);
    box-shadow: 0 0 0 2px var(--base-ring);
    background: var(--surface);
}

html:has(body.workbook-page) {
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
}

body.workbook-page {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    max-height: 100dvh;
    min-height: 0;
    overflow: hidden;
    overscroll-behavior: none;
    background: var(--surface);
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

body.workbook-page .workbook {
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.workbook {
    --wb-chrome: #f4f6fb;
    --wb-grid-bg: #eef1f6;
    --wb-sheetbar: #e8edf3;
    --wb-tab: #d5dce6;
    --wb-tab-hover: #e4e9f0;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    min-height: 0;
    max-width: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--charcoal);
    background: var(--surface);
}

.wb-chrome {
    flex-shrink: 0;
    position: relative;
    z-index: 20;
    border-bottom: 1px solid var(--border);
    background: var(--wb-chrome);
}

.wb-workspace {
    display: flex;
    flex: 1;
    min-width: 0;
    min-height: 0;
    position: relative;
}

.wb-main {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    min-height: 0;
}

.wb-panel {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: relative;
    width: 22rem;
    min-width: 0;
    min-height: 0;
    border-left: 4px solid var(--border);
    background: var(--surface);
    color: var(--charcoal);
}

.wb-panel[hidden] {
    display: none;
}

.wb-panel-resize {
    position: absolute;
    left: -4px;
    top: 0;
    bottom: 0;
    width: 8px;
    z-index: 2;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: col-resize;
    touch-action: none;
}

.wb-panel-resize:hover,
.wb-panel-resize:focus-visible,
.wb-panel.is-resizing .wb-panel-resize {
    background: var(--base);
    opacity: 0.28;
}

.workbook.is-panel-resizing {
    cursor: col-resize;
    user-select: none;
}

.wb-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-shrink: 0;
    padding: 0.55rem 0.55rem 0.5rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--wb-chrome);
}

.wb-panel-head h2 {
    margin: 0;
    flex: 1;
    min-width: 0;
    font-size: 1rem;
    color: var(--base-hover);
}

.workbook .wb-panel-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    min-width: 2rem;
    margin: 0;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: var(--charcoal);
    box-shadow: none;
    flex-shrink: 0;
}

.workbook .wb-panel-close:hover,
.workbook .wb-panel-close:focus-visible {
    background: var(--base-soft);
    color: var(--base-hover);
}

.wb-panel-close svg {
    display: block;
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
}

.wb-panel-body {
    flex: 1;
    min-height: 0;
    padding: 0.9rem 1.05rem 1.15rem;
    overflow: auto;
    scroll-padding-top: 5.75rem;
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.5;
}

.wb-header {
    display: flex;
    align-items: flex-start;
    gap: 0;
    padding: 0.5rem 1rem 0;
    min-height: var(--header-band-h);
}

.wb-logo-link {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    padding: 0;
    text-decoration: none;
    color: inherit;
    border-radius: 6px;
}

.wb-logo-link:hover {
    color: inherit;
    background: transparent;
}

.wb-header-main {
    flex: 1;
    min-width: 0;
}

.wb-chrome .nav-signed-in,
.wb-guest-login {
    display: flex;
    align-items: center;
    align-self: stretch;
    gap: 0.5rem;
    margin-top: 0;
    flex-shrink: 0;
    z-index: 30;
}

.wb-chrome .nav-account {
    margin-top: 0;
    z-index: 30;
}

.wb-demo-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.4rem 1rem;
    flex-shrink: 0;
    padding: 0.45rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--base-soft);
    color: var(--charcoal);
    font-size: 0.9rem;
    line-height: 1.4;
}

.wb-demo-bar p {
    margin: 0;
}

.wb-demo-bar a {
    font-weight: 600;
    white-space: nowrap;
}

.wb-chrome .nav-account-links a {
    display: block;
    width: 100%;
    padding: 0.7rem 0.9rem;
    margin: 0;
    border-radius: 0.65rem;
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--base);
}

.wb-chrome .nav-account-links a:hover,
.wb-chrome .nav-account-links a:focus-visible {
    background-color: var(--base-soft);
    color: var(--base);
}

.wb-chrome .nav-account-logout {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    gap: 0;
    background: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.wb-chrome .nav-account-links .nav-account-logout button {
    display: block;
    width: 100%;
    padding: 0.7rem 0.9rem;
    margin: 0;
    border: none;
    border-radius: 0.65rem;
    background: none;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: inherit;
    color: var(--base);
    cursor: pointer;
}

.wb-chrome .nav-account-links .nav-account-logout button:hover,
.wb-chrome .nav-account-links .nav-account-logout button:focus-visible {
    background-color: var(--base-soft);
    color: var(--base);
}

.wb-titlebar {
    display: flex;
    align-items: baseline;
    padding: 0 0.5rem 0rem 0.6rem;
}

.wb-menubar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.1rem;
    padding: 0 0.4rem 0.15rem 0.15rem;
}

.wb-menu-item {
    position: relative;
}

.workbook .wb-menubar button,
.workbook .wb-toolbar button,
.workbook .wb-subtoolbar .wb-tool,
.workbook .wb-sheetbar button,
.workbook .wb-menu-dropdown a[role="menuitem"] {
    margin: 0;
    padding: 0.28rem 0.55rem;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: var(--charcoal);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    line-height: 1.2;
    box-shadow: none;
}

.workbook .wb-menubar button:hover:not(:disabled),
.workbook .wb-menubar button:focus-visible,
.workbook .wb-toolbar button:hover:not(:disabled),
.workbook .wb-subtoolbar .wb-tool:hover:not(:disabled),
.workbook .wb-subtoolbar .wb-tool:focus-visible,
.workbook .wb-sheetbar button:hover:not(:disabled),
.workbook .wb-menu-dropdown a[role="menuitem"]:hover,
.workbook .wb-menu-dropdown a[role="menuitem"]:focus-visible,
.wb-menu-item.is-open>button {
    background: var(--base-soft);
    color: var(--charcoal);
}

.workbook .wb-menubar button:disabled,
.workbook .wb-toolbar button:disabled,
.workbook .wb-subtoolbar .wb-tool:disabled,
.workbook .wb-sheetbar button:disabled,
.workbook .wb-select:disabled {
    opacity: 0.38;
    color: var(--muted);
    pointer-events: none;
}

.wb-tip {
    display: inline-flex;
}

.wb-menu-dropdown>.wb-tip {
    display: flex;
    flex-direction: column;
}

.workbook .wb-tip[hidden],
.workbook .wb-menu-dropdown>.wb-tip[hidden],
.workbook .wb-menu-item[hidden],
.workbook .wb-toolgroup[hidden],
.workbook .wb-menu-dropdown>hr[hidden],
.workbook .wb-menu-dropdown button[hidden] {
    display: none;
}

.wb-menu-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 20;
    width: max-content;
    min-width: 13.5rem;
    padding: 0.3rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 8px 24px var(--base-shadow-menu);
}

.wb-menu-item.is-open > .wb-menu-dropdown,
.wb-menu-sub.is-open > .wb-menu-dropdown {
    display: flex;
    flex-direction: column;
}

.wb-menu-sub {
    position: relative;
    display: flex;
    flex-direction: column;
}

.wb-menu-sub > .wb-menu-dropdown {
    top: 0;
    left: 100%;
    z-index: 22;
}

.wb-menu-sub.is-open > button {
    background: var(--base-soft);
}

.wb-menu-caret {
    display: block;
    width: 8px;
    height: 8px;
    margin-left: auto;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.workbook .wb-menu-dropdown button,
.workbook .wb-menu-dropdown a[role="menuitem"] {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    padding: 0.4rem 0.7rem 0.4rem 0.5rem;
    text-align: left;
    font-weight: 400;
    color: var(--charcoal);
    text-decoration: none;
    white-space: nowrap;
}

.wb-menu-icon {
    display: block;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.wb-tool svg.wb-icon-solid,
.wb-menu-icon.wb-icon-solid {
    fill: currentColor;
    stroke: none;
}

.wb-menu-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    font-size: 0.78rem;
    line-height: 1;
}

.workbook .wb-menu-dropdown button[role="menuitemcheckbox"]::before,
.workbook .wb-menu-dropdown button[role="menuitemradio"]::before {
    content: "";
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    font-size: 0.78rem;
    line-height: 14px;
    text-align: center;
}

.workbook .wb-menu-dropdown button[aria-checked="true"]::before {
    content: "✓";
}

.wb-menu-shortcut {
    margin-left: auto;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.wb-menu-dropdown hr {
    width: 100%;
    margin: 0.25rem 0;
    border: 0;
    border-top: 1px solid var(--border);
}

.wb-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.55rem;
    padding: 0.3rem 0.55rem 0.4rem;
    border-top: 1px solid var(--border);
}

.wb-toolgroup {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    padding-right: 0.55rem;
    border-right: 1px solid var(--border);
}

.wb-toolgroup:last-child,
.wb-toolgroup:not([hidden]):not(:has(~ .wb-toolgroup:not([hidden]))) {
    border-right: 0;
    padding-right: 0;
}

.wb-toolbar-end {
    display: flex;
    align-items: center;
    gap: 0.35rem 0.55rem;
    margin-left: auto;
}

.wb-tool-drop {
    position: relative;
    display: inline-flex;
}

.wb-subtoolbar {
    display: none;
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    z-index: 21;
    padding: 0.2rem;
    gap: 0.15rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 8px 24px var(--base-shadow-menu);
}

.wb-tool-drop.is-open .wb-subtoolbar {
    display: flex;
    align-items: center;
}

/* Open lists are moved onto the chrome. The toolbar scrolls on a phone, and that clips descendants. */
.wb-subtoolbar.is-anchored {
    display: flex;
    align-items: center;
    z-index: 40;
}

.wb-tool-drop.is-open .wb-border-tools,
.wb-border-tools.is-anchored {
    flex-direction: column;
    align-items: stretch;
    gap: 0.3rem;
    min-width: 11.5rem;
    padding: 0.35rem;
}

.wb-border-weights,
.wb-border-actions {
    display: flex;
    align-items: center;
    gap: 0.15rem;
}

.wb-border-weight {
    min-width: 3.4rem;
    font-size: 0.72rem;
}

.wb-convert-list.is-anchored {
    align-items: stretch;
}

.wb-convert-list {
    flex-direction: column;
    align-items: stretch;
    min-width: 12.5rem;
    max-height: min(22rem, calc(100vh - 8rem));
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0.3rem;
}

.wb-tool-drop.is-open .wb-convert-list {
    display: flex;
    align-items: stretch;
}

.wb-menu-sub > .wb-convert-list {
    top: 0;
    left: 100%;
    z-index: 22;
}

.wb-convert-dim {
    position: sticky;
    top: -0.3rem;
    z-index: 1;
    margin: -0.3rem -0.3rem 0;
    padding: 0.4rem 0.7rem 0.3rem 0.5rem;
    background: var(--surface);
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.wb-convert-empty {
    margin: 0;
    padding: 0.4rem 0.7rem 0.4rem 0.5rem;
    color: var(--muted);
    font-size: 0.82rem;
}

.workbook .wb-convert-unit,
.workbook .wb-toolbar .wb-convert-unit,
.workbook .wb-grid-menu .wb-convert-unit {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    width: 100%;
    min-width: 0;
    min-height: 2rem;
    margin: 0;
    padding: 0.4rem 0.7rem 0.4rem 0.5rem;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--charcoal);
    font-size: 0.82rem;
    font-weight: 400;
    line-height: 1.3;
    text-align: left;
    white-space: nowrap;
    box-shadow: none;
}

.workbook .wb-convert-unit:hover:not(:disabled),
.workbook .wb-convert-unit:focus-visible,
.workbook .wb-toolbar .wb-convert-unit:hover:not(:disabled),
.workbook .wb-toolbar .wb-convert-unit:focus-visible,
.workbook .wb-convert-unit.is-current {
    background: var(--base-soft);
    color: var(--charcoal);
}

.wb-convert-unit-note {
    color: var(--muted);
    font-size: 0.75rem;
}

.wb-convert-unit > .wb-convert-unit-note:last-child {
    margin-left: auto;
}

.wb-convert-unit-value {
    margin-left: auto;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.wb-tool-drop.is-open > .wb-tip > .wb-tool {
    background: var(--base-soft);
    border-color: var(--border);
}

.workbook .wb-tool-drop-btn {
    gap: 0.08rem;
    padding-left: 0.28rem;
    padding-right: 0.22rem;
}

.workbook .wb-tool-drop-btn svg.wb-tool-caret {
    width: 7px;
    height: 7px;
    stroke-width: 1.6;
}

.workbook .wb-tool {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.7rem;
    min-height: 1.7rem;
    padding: 0.2rem 0.35rem;
    font-size: 0.78rem;
}

.wb-tool svg {
    display: block;
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.wb-toolbar [data-workbook-merge-toolbar] svg,
.wb-toolbar [data-workbook-merge-cells] svg,
.wb-toolbar [data-workbook-unmerge-cells] svg {
    width: 18px;
    height: 18px;
}

.wb-tool-letter {
    font-family: Georgia, 'Times New Roman', serif;
}

.workbook .wb-tool-decimal {
    flex-direction: column;
    gap: 0.02rem;
    padding: 0.14rem 0.3rem 0.16rem;
    font-size: 0.7rem;
    line-height: 1;
    letter-spacing: -0.03em;
}

.workbook .wb-tool-decimal svg {
    width: 11px;
    height: 5.5px;
    stroke-width: 1.3;
}

.workbook .wb-tool[data-workbook-increase-decimal] svg {
    margin-left: 0.18rem;
}

.workbook .wb-tool[aria-pressed="true"] {
    background: var(--base-soft);
    border-color: var(--border);
}

.workbook .wb-tool[data-workbook-unit-space] {
    align-items: flex-end;
    padding-top: 0.38rem;
    padding-bottom: 0.08rem;
}

.workbook .wb-tool[data-workbook-unit-space] svg {
    width: 20px;
}

.workbook .wb-tool-color {
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.14rem 0.28rem 0.16rem;
}

.wb-tool-color-glyph {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1;
}

.workbook .wb-tool-color svg {
    width: 14px;
    height: 14px;
}

.wb-tool-color-bar {
    display: block;
    width: 0.95rem;
    height: 0.22rem;
    border-radius: 1px;
    background: var(--charcoal);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
}

.workbook .wb-tool[data-workbook-bg-color] .wb-tool-color-bar {
    background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--border);
}

.workbook .wb-select {
    margin: 0;
    padding: 0.2rem 0.4rem;
    min-height: 0;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
    color: var(--charcoal);
    font-size: 0.78rem;
    box-shadow: none;
}

.workbook .wb-select:focus {
    border-color: var(--base);
    box-shadow: 0 0 0 2px var(--base-ring);
}

.wb-font {
    width: 7.5rem;
}

.wb-size {
    width: 3.4rem;
}

.wb-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.wb-formula {
    --wb-formula-h: 1.7rem;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    gap: 0.4rem;
    padding: 0.3rem 0.55rem;
    background: var(--wb-chrome);
}

.workbook.is-session-expired {
    pointer-events: none;
}

.workbook.is-formula-bar-off .wb-formula {
    display: none;
}

.workbook.is-formula-bar-off .wb-grid-shell {
    border-top: 1px solid var(--border);
}

.wb-name-box,
.wb-formula-dim,
.wb-formula-precise,
.workbook .wb-formula-input,
.workbook .wb-name-box,
.workbook .wb-name-box:focus {
    box-sizing: border-box;
    height: var(--wb-formula-h);
    min-height: var(--wb-formula-h);
    padding: 0 0.5rem;
    border: 1px solid var(--border);
    border-radius: 3px;
    font-size: 0.8rem;
    line-height: calc(var(--wb-formula-h) - 2px);
}

.wb-name-box,
.wb-formula-dim,
.wb-formula-precise {
    background: var(--wb-sheetbar);
    color: var(--charcoal);
}

.workbook .wb-formula-input {
    background: var(--surface);
    color: var(--charcoal);
}

.workbook .wb-name-box,
.workbook .wb-name-box:focus {
    display: block;
    flex-shrink: 0;
    width: 6.5rem;
    min-width: 5.5rem;
    max-width: 9rem;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
    font-size: 0.8rem;
    text-align: center;
    font-family: -apple-system, "system-ui", "Segoe UI", sans-serif;
    background: var(--wb-sheetbar);
    color: var(--charcoal);
    box-shadow: none;
    outline: none;
    transition: none;
}

.workbook .wb-name-box:focus {
    border-color: var(--base);
    box-shadow: 0 0 0 2px var(--base-ring);
    background: var(--surface);
}

.wb-fx {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    height: var(--wb-formula-h);
    color: var(--muted);
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 0.95rem;
    font-style: italic;
}

.workbook .wb-formula-input,
.workbook .wb-formula-input:focus {
    position: relative;
    z-index: 1;
    flex: none;
    width: 100%;
    min-width: 0;
    margin: 0;
    font-family: -apple-system, "system-ui", "Segoe UI", sans-serif;
    font-size: 0.8rem;
    box-shadow: none;
}

.wb-formula-field {
    position: relative;
    flex: 1;
    min-width: 0;
    height: var(--wb-formula-h);
}

.wb-formula-hl {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    white-space: pre;
    pointer-events: none;
    box-sizing: border-box;
    padding: 0 0.5rem;
    color: var(--charcoal);
    background: transparent;
    font-family: -apple-system, "system-ui", "Segoe UI", sans-serif;
    font-size: 0.8rem;
    line-height: calc(var(--wb-formula-h) - 2px);
}

.wb-formula-dim,
.wb-formula-precise {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 6.5rem;
    max-width: 14rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
    text-align: center;
}

.wb-formula-precise {
    flex-shrink: 1;
    min-width: 7.5rem;
    max-width: 16rem;
    margin: 0;
    justify-content: flex-end;
    font-variant-numeric: tabular-nums;
    font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, monospace;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--charcoal);
    cursor: pointer;
    appearance: none;
    transition: none;
}

.workbook .wb-formula-precise:hover,
.workbook .wb-formula-precise:focus-visible {
    background: var(--base-soft);
    color: var(--charcoal);
    border-color: var(--base);
}

.workbook .wb-formula-precise:focus-visible {
    box-shadow: 0 0 0 2px var(--base-ring);
    outline: none;
}

.wb-formula-precise:empty {
    display: none;
}

.wb-copied-toast {
    position: fixed;
    z-index: 40;
    padding: 0.18rem 0.5rem;
    border-radius: 4px;
    background: var(--charcoal);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.01em;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, 4px);
    box-shadow: 0 4px 12px var(--base-shadow-float);
}

.wb-copied-toast.is-on {
    animation: wb-copied-fade 1.2s ease-out forwards;
}

@keyframes wb-copied-fade {
    0% {
        opacity: 0;
        transform: translate(-50%, 4px);
    }
    12% {
        opacity: 1;
        transform: translate(-50%, 0);
    }
    70% {
        opacity: 1;
        transform: translate(-50%, 0);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, 0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .wb-copied-toast.is-on {
        animation: none;
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

.wb-formula-dim:not(:empty) {
    color: var(--charcoal);
    font-weight: 600;
}

.wb-formula-dim.is-error {
    color: #721c24;
}

.wb-grid-shell {
    --wb-grid-scroll: 12px;
    --wb-grid-header-w: 2.4rem;
    --wb-grid-header-h: 1.55rem;
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    min-height: 0;
}

.wb-grid-wrap {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: auto;
    background: var(--wb-grid-bg);
    scrollbar-width: none;
}

.wb-grid-wrap::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.wb-grid-scroll {
    position: absolute;
    z-index: 5;
    box-sizing: border-box;
    opacity: 0;
    pointer-events: none;
    user-select: none;
    touch-action: none;
    transition: opacity 0.2s linear;
}

.wb-grid-shell.is-scrolling .wb-grid-scroll:not([hidden]),
.wb-grid-scroll.is-dragging:not([hidden]) {
    opacity: 1;
    pointer-events: auto;
    transition-duration: 0.12s;
}

.wb-grid-scroll-x {
    left: var(--wb-grid-header-w, 2.4rem);
    right: 0;
    bottom: 0;
    height: var(--wb-grid-scroll);
}

.wb-grid-scroll-y {
    top: var(--wb-grid-header-h, 1.55rem);
    right: 0;
    bottom: 0;
    width: var(--wb-grid-scroll);
}

.wb-grid-shell.is-scroll-xy .wb-grid-scroll-x {
    right: var(--wb-grid-scroll);
}

.wb-grid-shell.is-scroll-xy .wb-grid-scroll-y {
    bottom: var(--wb-grid-scroll);
}

.wb-grid-scroll-thumb {
    position: absolute;
    box-sizing: border-box;
    background: rgba(74, 74, 74, 0.45);
    border-radius: 6px;
}

.wb-grid-scroll-x .wb-grid-scroll-thumb {
    top: 2px;
    height: 8px;
    min-width: 24px;
}

.wb-grid-scroll-y .wb-grid-scroll-thumb {
    left: 2px;
    width: 8px;
    min-height: 24px;
}

.wb-grid-scroll-thumb:hover,
.wb-grid-scroll.is-dragging .wb-grid-scroll-thumb {
    background: rgba(74, 74, 74, 0.65);
}

.sheet-grid {
    width: max-content;
    min-width: max-content;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    background: var(--surface);
    user-select: none;
}

.sheet-grid col.sheet-corner-col {
    width: 2.4rem;
}

.sheet-grid tr {
    height: 1.55rem;
}

.sheet-grid th,
.sheet-grid td {
    box-sizing: border-box;
    min-height: 1.55rem;
    height: inherit;
    padding: 0 0.4rem;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
    line-height: 1.55rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
    vertical-align: middle;
}

.sheet-grid .sheet-corner,
.sheet-grid .sheet-colhdr,
.sheet-grid .sheet-rowhdr {
    background: var(--wb-grid-bg);
    color: var(--muted);
    font-weight: 600;
    text-align: center;
    user-select: none;
    cursor: pointer;
}

.sheet-corner,
.sheet-rowhdr {
    position: sticky;
    left: 0;
    z-index: 2;
    width: 2.4rem;
    min-width: 2.4rem;
    max-width: 2.4rem;
    padding: 0;
}

.sheet-colhdr,
.sheet-corner {
    position: sticky;
    top: 0;
    z-index: 3;
}

.sheet-corner {
    z-index: 6;
}

.sheet-grid td.is-frozen-row,
.sheet-grid td.is-frozen-col {
    position: sticky;
    z-index: 2;
}

.sheet-grid td.is-frozen-row.is-frozen-col {
    z-index: 3;
}

.sheet-grid .sheet-rowhdr.is-frozen-row {
    z-index: 4;
}

.sheet-grid .sheet-colhdr.is-frozen-col {
    z-index: 5;
}

.sheet-grid .is-freeze-row-edge {
    box-shadow: inset 0 -1px 0 #8a8a8a;
}

.sheet-grid .is-freeze-col-edge {
    box-shadow: inset -1px 0 0 #8a8a8a;
}

.sheet-grid .is-freeze-row-edge.is-freeze-col-edge {
    box-shadow: inset -1px -1px 0 #8a8a8a;
}

/* Width comes from the col, not the text, so a column can be narrower than its longest value. */
.sheet-grid td,
.sheet-colhdr {
    width: 0;
    min-width: 0;
    max-width: 0;
}

.sheet-col-resize {
    position: absolute;
    z-index: 5;
    top: 0;
    right: 0;
    width: 8px;
    height: 100%;
    cursor: col-resize;
}

.sheet-row-resize {
    position: absolute;
    z-index: 5;
    left: 0;
    bottom: 0;
    height: 8px;
    width: 100%;
    cursor: row-resize;
}

.workbook.is-col-resizing,
.workbook.is-col-resizing * {
    cursor: col-resize !important;
}

.workbook.is-row-resizing,
.workbook.is-row-resizing * {
    cursor: row-resize !important;
}

.workbook.is-view-only .sheet-col-resize,
.workbook.is-view-only .sheet-row-resize,
.workbook.is-view-only .sheet-unhide-col,
.workbook.is-view-only .sheet-unhide-row {
    display: none;
}

.sheet-colhdr.is-hidden-edge {
    box-shadow: inset 2px 0 0 #5a5a5a, inset 4px 0 0 #5a5a5a;
}

.sheet-rowhdr.is-hidden-edge {
    box-shadow: inset 0 2px 0 #5a5a5a, inset 0 4px 0 #5a5a5a;
}

.sheet-unhide-col {
    position: absolute;
    z-index: 6;
    top: 0;
    left: 0;
    width: 8px;
    height: 100%;
    cursor: pointer;
}

.sheet-unhide-row {
    position: absolute;
    z-index: 6;
    left: 0;
    top: 0;
    height: 8px;
    width: 100%;
    cursor: pointer;
}

.sheet-cell {
    cursor: cell;
    color: var(--charcoal);
    background: var(--surface);
}

.sheet-grid td.sheet-cell {
    text-overflow: clip;
}

.sheet-cell.is-wrap {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    text-overflow: clip;
}

td.sheet-cell.is-overflow {
    overflow: visible;
    z-index: 3;
    text-overflow: clip;
}

td.sheet-cell.is-overflow:not(.is-frozen-row):not(.is-frozen-col) {
    position: relative;
}

td.sheet-cell.is-clip {
    overflow: hidden;
    text-overflow: clip;
    white-space: pre;
}

.sheet-overflow {
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip;
    pointer-events: none;
    line-height: inherit;
}

.sheet-overflow.is-vT {
    align-items: flex-start;
}

.sheet-overflow.is-vB {
    align-items: flex-end;
}

.sheet-overflow.is-hR {
    justify-content: flex-end;
}

.sheet-overflow.is-hC {
    justify-content: center;
}

.sheet-cell.is-num,
.sheet-cell.is-qty {
    text-align: right;
}

.sheet-cell.is-ccy,
#wb-print .wb-print-cell.is-ccy {
    text-align: left;
}

.sheet-ccy-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    width: 100%;
    min-width: 0;
}

.sheet-ccy {
    flex: 0 0 auto;
}

.sheet-amt {
    flex: 1 1 auto;
    min-width: 0;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sheet-cell.is-bool {
    text-align: center;
}

.sheet-cell.is-text,
.sheet-cell.is-error {
    text-align: left;
}

.workbook.is-gridlines-off .sheet-cell {
    border-right-color: transparent;
    border-bottom-color: transparent;
}

.sheet-title {
    font-weight: 600;
    color: var(--base);
}

.sheet-colhead {
    font-weight: 600;
    color: var(--base);
    background: var(--base-soft);
}

.sheet-note {
    color: var(--muted);
    font-style: italic;
    overflow: visible;
}

.sheet-formula {
    color: var(--base);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.75rem;
}

.sheet-colhdr.is-selected,
.sheet-rowhdr.is-selected {
    background: linear-gradient(var(--base-soft-2), var(--base-soft-2)), var(--wb-grid-bg);
    color: var(--base);
}

.sheet-cell.is-range {
    background: #e8edfc;
}

.sheet-cell.is-selected {
    background: #e8edfc;
    outline: 2px solid var(--base);
    outline-offset: -2px;
    position: relative;
    z-index: 1;
}

.wb-clipboard-marquee,
.wb-paint-marquee {
    position: absolute;
    z-index: 2;
    box-sizing: border-box;
    pointer-events: none;
    background:
        linear-gradient(90deg, var(--base) 4px, transparent 4px) 0 0 / 8px 2px repeat-x,
        linear-gradient(90deg, var(--base) 4px, transparent 4px) 0 100% / 8px 2px repeat-x,
        linear-gradient(180deg, var(--base) 4px, transparent 4px) 0 0 / 2px 8px repeat-y,
        linear-gradient(180deg, var(--base) 4px, transparent 4px) 100% 0 / 2px 8px repeat-y;
    animation: wb-clipboard-ants 0.35s linear infinite;
}

.wb-fill-handle {
    position: absolute;
    z-index: 5;
    width: 8px;
    height: 8px;
    box-sizing: border-box;
    background: var(--base);
    border: 1px solid #fff;
    cursor: crosshair;
}

.wb-fill-preview {
    position: absolute;
    z-index: 3;
    box-sizing: border-box;
    pointer-events: none;
    border: 1px dashed var(--base);
    background: rgba(61, 133, 198, 0.1);
}

.wb-selection-frame {
    position: absolute;
    z-index: 3;
    box-sizing: border-box;
    pointer-events: none;
    border: 2px solid var(--base);
}

.wb-move-preview {
    position: absolute;
    z-index: 4;
    box-sizing: border-box;
    pointer-events: none;
    border: 2px solid var(--base);
    background: rgba(61, 133, 198, 0.12);
}

.workbook.is-move-cursor .sheet-cell {
    cursor: grab;
}

.workbook.is-cell-moving .wb-grid-wrap,
.workbook.is-cell-moving .wb-grid-wrap * {
    cursor: grabbing;
}

.workbook.is-cell-moving .wb-grid-wrap {
    user-select: none;
}

.workbook.is-formula-pointing .sheet-cell,
.workbook.is-formula-pointing .sheet-colhdr,
.workbook.is-formula-pointing .sheet-rowhdr,
.workbook.is-formula-pointing .sheet-corner {
    cursor: cell;
}

.workbook.is-paint-format .sheet-cell,
.workbook.is-paint-format .sheet-colhdr,
.workbook.is-paint-format .sheet-rowhdr,
.workbook.is-paint-format .sheet-corner {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Cpath fill='%23222' d='M5.25 1.7h10a1.8 1.8 0 0 1 0 3.6h-10a1.8 1.8 0 0 1 0-3.6z'/%3E%3Cpath fill='none' stroke='%23222' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M3.45 3.5V7.95H10.75V10.6'/%3E%3Cpath fill='%23222' d='M8.6 11.45a2.15 2.15 0 0 1 4.3 0v5a2.15 2.15 0 0 1-4.3 0z'/%3E%3C/svg%3E") 10 4, crosshair;
}

.wb-formula-refs {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
}

.wb-formula-ref {
    position: absolute;
    box-sizing: border-box;
    pointer-events: none;
}

.wb-formula-ref-0 {
    border: 2px solid #3d85c6;
    background: rgba(61, 133, 198, 0.12);
}

.wb-formula-ref-1 {
    border: 2px solid #e69138;
    background: rgba(230, 145, 56, 0.12);
}

.wb-formula-ref-2 {
    border: 2px solid #6aa84f;
    background: rgba(106, 168, 79, 0.12);
}

.wb-formula-ref-3 {
    border: 2px solid #a64d79;
    background: rgba(166, 77, 121, 0.12);
}

.wb-formula-ref-4 {
    border: 2px solid #674ea7;
    background: rgba(103, 78, 167, 0.12);
}

.wb-formula-ref-5 {
    border: 2px solid #cc4125;
    background: rgba(204, 65, 37, 0.12);
}

@keyframes wb-clipboard-ants {
    to {
        background-position: 8px 0, -8px 100%, 0 -8px, 100% 8px;
    }
}

.sheet-cell.is-error {
    color: #721c24;
    font-weight: 600;
}

.sheet-cell.is-editing {
    position: relative;
    padding: 0;
    overflow: visible;
    z-index: 5;
    text-align: left;
    font-weight: 400;
}

.sheet-cell-editor-host {
    position: absolute;
    z-index: 6;
    box-sizing: border-box;
    overflow: visible;
    pointer-events: none;
}

.sheet-cell-editor-hl {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 6;
    box-sizing: border-box;
    min-width: 100%;
    min-height: 100%;
    margin: 0;
    pointer-events: none;
    overflow: hidden;
    white-space: pre;
    color: var(--charcoal);
    background: var(--surface);
    font-family: -apple-system, "system-ui", "Segoe UI", sans-serif;
    font-size: 0.8rem;
    font-weight: 400;
    line-height: 1.55rem;
    text-align: left;
}

.workbook .sheet-cell-editor,
.workbook .sheet-cell-editor:focus {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 7;
    display: block;
    box-sizing: border-box;
    min-width: 100%;
    min-height: 100%;
    margin: 0;
    padding: 0 0.4rem;
    border: 0;
    border-radius: 0;
    outline: 2px solid var(--base);
    outline-offset: -2px;
    box-shadow: none;
    background: var(--surface);
    color: var(--charcoal);
    font-family: -apple-system, "system-ui", "Segoe UI", sans-serif;
    font-size: 0.8rem;
    font-weight: 400;
    line-height: 1.55rem;
    resize: none;
    overflow: hidden;
    white-space: pre;
    overflow-wrap: normal;
    text-align: left;
    pointer-events: auto;
}

.workbook .wb-formula-input.is-formula-hl,
.workbook .wb-formula-input.is-formula-hl:focus,
.workbook .sheet-cell-editor.is-formula-hl,
.workbook .sheet-cell-editor.is-formula-hl:focus {
    color: transparent;
    -webkit-text-fill-color: transparent;
    caret-color: var(--charcoal);
    background: transparent;
}

.wb-formula-hl,
.sheet-cell-editor-hl,
.workbook .wb-formula-input,
.workbook .sheet-cell-editor {
    font-kerning: none;
    font-variant-ligatures: none;
}

.wb-formula-hl *,
.sheet-cell-editor-hl * {
    font: inherit;
    letter-spacing: inherit;
    font-kerning: inherit;
    font-variant-ligatures: inherit;
}

.wb-ref-0 {
    color: #3d85c6;
}

.wb-ref-1 {
    color: #e69138;
}

.wb-ref-2 {
    color: #6aa84f;
}

.wb-ref-3 {
    color: #a64d79;
}

.wb-ref-4 {
    color: #674ea7;
}

.wb-ref-5 {
    color: #cc4125;
}

.wb-sheetbar {
    --wb-sheet-tab-pad-x: 0.85rem;
    --wb-sheet-tab-font: 0.9rem;
    display: flex;
    align-items: stretch;
    gap: 0.35rem;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
    height: 2.4rem;
    padding: 0 0.5rem 0.3rem;
    border-top: 1px solid var(--border);
    background: var(--wb-sheetbar);
    box-sizing: border-box;
}

.workbook .wb-sheetbar .wb-sheet-add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: stretch;
    min-width: 2rem;
    min-height: 0;
    padding: 0 0.55rem;
    border: 1px solid var(--border);
    border-top: 0;
    border-radius: 0 0 7px 7px;
    background: var(--wb-tab);
    font-size: 1.05rem;
    font-weight: 500;
    line-height: 1;
}

.workbook .wb-sheetbar .wb-sheet-add:hover:not(:disabled) {
    background: var(--wb-tab-hover);
    color: var(--charcoal);
}

.wb-sheets {
    display: flex;
    align-items: stretch;
    align-self: stretch;
    gap: 0.05rem;
    min-width: 0;
    overflow-x: auto;
}

.wb-sheet-tab {
    display: flex;
    align-items: stretch;
    position: relative;
    min-width: 0;
    height: 100%;
}

.workbook:not(.is-view-only) .wb-sheet-tab.is-reorderable .wb-sheet {
    cursor: grab;
}

.wb-sheets.is-reordering,
.wb-sheets.is-reordering .wb-sheet {
    cursor: grabbing;
    user-select: none;
}

.wb-sheet-tab.is-dragging .wb-sheet {
    opacity: 0.45;
}

.wb-sheet-tab.is-drop-before::before,
.wb-sheet-tab.is-drop-after::after {
    content: "";
    position: absolute;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--base);
}

.wb-sheet-tab.is-drop-before::before {
    left: 0;
}

.wb-sheet-tab.is-drop-after::after {
    right: 0;
}

.workbook .wb-sheetbar .wb-sheet,
.workbook input.wb-sheet-rename {
    box-sizing: border-box;
    height: 100%;
    min-height: 0;
    max-height: 100%;
    margin: 0;
    padding: 0 var(--wb-sheet-tab-pad-x);
    border: 1px solid var(--border);
    border-top: 0;
    border-radius: 0 0 7px 7px;
    background: var(--wb-tab);
    color: var(--charcoal);
    font-family: inherit;
    font-size: var(--wb-sheet-tab-font);
    font-weight: 500;
    line-height: 1.2;
    box-shadow: none;
}

.workbook .wb-sheetbar .wb-sheet {
    display: inline-flex;
    align-items: center;
    min-width: 3.25rem;
    max-width: 10rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workbook .wb-sheetbar .wb-sheet:hover:not(:disabled):not(.is-active) {
    background: var(--wb-tab-hover);
    color: var(--charcoal);
}

.workbook .wb-sheetbar .wb-sheet[hidden],
.workbook input.wb-sheet-rename[hidden] {
    display: none;
}

.workbook .wb-sheetbar .wb-sheet.is-active {
    background: var(--surface);
    border-color: var(--border);
    color: var(--base);
    font-weight: 600;
    position: relative;
    top: -1px;
    height: calc(100% + 1px);
}

.workbook .wb-sheetbar .wb-sheet.is-active:hover {
    background: var(--surface);
    color: var(--base);
}

.workbook .wb-sheetbar .wb-sheet:focus-visible {
    outline: 2px solid var(--base);
    outline-offset: -2px;
}

.workbook .wb-sheetbar .wb-sheet.has-tab-color {
    position: relative;
}

.workbook .wb-sheetbar .wb-sheet.has-tab-color::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 4px;
    background: var(--wb-tab-color);
    pointer-events: none;
}

.workbook input.wb-sheet-rename:not([hidden]),
.workbook input.wb-sheet-rename:not([hidden]):focus {
    display: block;
    appearance: none;
    -webkit-appearance: none;
    min-width: 4.5rem;
    max-width: 10rem;
    background: var(--surface);
    border-color: var(--base);
    color: var(--base);
    font-weight: 600;
    box-shadow: none;
    outline: none;
    position: relative;
    top: -1px;
    height: calc(100% + 1px);
}

.wb-sheet-menu,
.wb-grid-menu {
    display: flex;
    flex-direction: column;
    position: fixed;
    z-index: 40;
    width: max-content;
    min-width: 8.5rem;
    max-height: calc(100vh - 16px);
    overflow-y: auto;
    padding: 0.3rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 8px 24px var(--base-shadow-menu);
}

.wb-grid-menu {
    min-width: 12.5rem;
}

.wb-sheet-menu {
    overflow: visible;
}

.wb-sheet-menu .wb-menu-dropdown {
    min-width: 8.5rem;
}

.wb-sheet-menu[hidden],
.wb-grid-menu[hidden] {
    display: none;
}

.wb-sheet-menu-item[hidden] {
    display: none;
}

.wb-sheet-menu-item,
.wb-grid-menu-item {
    display: flex;
    align-items: center;
    width: auto;
    margin: 0;
    padding: 0.4rem 0.7rem;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--charcoal);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 400;
    text-align: left;
    white-space: nowrap;
}

.wb-grid-menu-item {
    gap: 0.5rem;
    padding: 0.4rem 0.7rem 0.4rem 0.5rem;
}

.wb-grid-menu-item [data-workbook-menu-label] {
    flex: 1 1 auto;
    min-width: 0;
}

.wb-sheet-menu-item:hover:not(:disabled),
.wb-sheet-menu-item:focus-visible,
.wb-grid-menu-item:hover:not(:disabled),
.wb-grid-menu-item:focus-visible {
    background: var(--base-soft);
}

.wb-sheet-menu-item:disabled,
.wb-grid-menu-item:disabled {
    opacity: 0.38;
    color: var(--muted);
}

.wb-sheet-menu hr,
.wb-grid-menu hr {
    width: 100%;
    margin: 0.25rem 0;
    border: 0;
    border-top: 1px solid var(--border);
}

.wb-sheet-status {
    display: flex;
    align-items: center;
    align-self: stretch;
    margin-left: auto;
    color: var(--muted);
    font-size: 0.75rem;
}

.wb-sheet-status.is-retry {
    color: #721c24;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

.wb-sheet-status.is-retry:focus-visible {
    outline: 2px solid var(--base);
    outline-offset: 2px;
    border-radius: 2px;
}

.wb-dialog {
    width: min(34rem, calc(100vw - 2rem));
    max-height: min(40rem, calc(100vh - 2rem));
    margin: auto;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--charcoal);
    box-shadow: 0 16px 40px var(--base-shadow-float);
}

.wb-dialog::backdrop {
    background: rgba(74, 74, 74, 0.42);
}

.wb-dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.7rem 0.75rem 0.65rem 1.1rem;
    border-bottom: 1px solid var(--border);
    background: var(--wb-chrome);
}

.wb-dialog-head h2 {
    margin: 0;
    flex: 1;
    min-width: 0;
    font-size: 1.1rem;
    color: var(--base-hover);
}

.wb-dialog-head form {
    display: flex;
    flex: 0 0 auto;
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0;
    gap: 0;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
}

.workbook .wb-dialog-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    min-width: 2rem;
    margin: 0;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: var(--charcoal);
    box-shadow: none;
    flex-shrink: 0;
}

.workbook .wb-dialog-close:hover,
.workbook .wb-dialog-close:focus-visible {
    background: var(--base-soft);
    color: var(--base-hover);
}

.wb-dialog-close svg {
    display: block;
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
}

.wb-dialog-body {
    padding: 0.9rem 1.15rem 1.15rem;
    overflow: auto;
    max-height: calc(min(40rem, 100vh - 2rem) - 3.4rem);
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.5;
}

.wb-dialog-body p,
.wb-dialog-body ul,
.wb-panel-body p,
.wb-panel-body ul {
    margin: 0 0 0.85rem;
}

.wb-dialog-body ul,
.wb-panel-body ul {
    padding-left: 1.2rem;
}

.wb-dialog-body li,
.wb-panel-body li {
    margin: 0.3rem 0;
}

.wb-dialog-body p:last-child,
.wb-dialog-body table:last-child,
.wb-panel-body p:last-child,
.wb-panel-body table:last-child,
.wb-panel-body .wb-help-topic:last-child {
    margin-bottom: 0;
}

.wb-dialog-body code,
.wb-dialog-body kbd,
.wb-panel-body code,
.wb-panel-body kbd {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.88em;
    background: var(--base-soft);
    color: var(--base);
    padding: 0.08em 0.35em;
    border-radius: 4px;
    white-space: nowrap;
}

.wb-dialog-body kbd,
.wb-panel-body kbd {
    color: var(--charcoal);
    background: var(--wb-grid-bg);
    border: 1px solid var(--border);
}

.wb-help-nav {
    position: sticky;
    top: -0.9rem;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem 0.75rem;
    margin: -0.9rem -1.05rem 0.75rem;
    padding: 0.9rem 1.05rem 0.55rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 0.5rem 0.5rem -0.35rem var(--surface);
}

.wb-help-nav a {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--base);
    text-decoration: none;
}

.wb-help-nav a:hover,
.wb-help-nav a:focus-visible {
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

.workbook .wb-help-link {
    display: inline;
    width: auto;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    color: var(--link);
    font: inherit;
    font-weight: 600;
    line-height: inherit;
    text-decoration: underline;
    text-underline-offset: 0.15em;
    cursor: pointer;
}

.workbook .wb-help-link:hover,
.workbook .wb-help-link:focus-visible {
    color: var(--base-hover);
    background: none;
}

.wb-help-topic {
    margin: 0 0 1.1rem;
    scroll-margin-top: 5.75rem;
}

.wb-help-topic:last-child,
.wb-help-topic > :last-child {
    margin-bottom: 0;
}

.wb-panel-body .wb-help-topic h3 {
    margin: 0 0 0.4rem;
    color: var(--charcoal);
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 650;
}

.wb-panel-body .wb-help-topic h4 {
    margin: 0.85rem 0 0.3rem;
    color: var(--muted);
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    scroll-margin-top: 5.75rem;
}

.wb-panel-body .wb-help-topic h3 + p + h4,
.wb-panel-body .wb-help-topic h3 + h4 {
    margin-top: 0.7rem;
}

.wb-panel-body .wb-help-ex {
    width: 100%;
    margin: 0.35rem 0 0.85rem;
    border-collapse: collapse;
}

.wb-panel-body .wb-help-ex th,
.wb-panel-body .wb-help-ex td {
    padding: 0.28rem 0.75rem 0.28rem 0;
    vertical-align: baseline;
    text-align: left;
    font-size: 0.86rem;
}

.wb-panel-body .wb-help-ex th {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.wb-shortcuts {
    width: 100%;
    border-collapse: collapse;
}

.wb-shortcuts th {
    padding: 0.85rem 0.6rem 0.3rem 0;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-align: left;
    text-transform: uppercase;
}

.wb-shortcuts tr:first-child th {
    padding-top: 0.55rem;
}

.wb-shortcuts td {
    padding: 0.28rem 0.75rem 0.28rem 0;
    vertical-align: baseline;
    font-size: 0.86rem;
}

.wb-shortcuts td:first-child {
    width: 42%;
    color: var(--charcoal);
    font-weight: 500;
}

.wb-units-filter-label,
.wb-fns-filter-label {
    display: block;
    margin: 0 0 0.35rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
}

.workbook .wb-units-filter,
.workbook .wb-units-filter:focus,
.workbook .wb-fns-filter,
.workbook .wb-fns-filter:focus {
    display: block;
    width: 100%;
    max-width: none;
    margin: 0 0 0.85rem;
    padding: 0.4rem 0.6rem;
    min-height: 0;
    font-size: 0.9rem;
}

.wb-units-catalog.calculator-units-grid,
.wb-fn-catalog.calculator-units-grid {
    margin-top: 0.15rem;
}

.wb-units-custom {
    margin: -0.35rem 0 0.85rem;
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.35;
}

.wb-panel-body .wb-units-catalog .calculator-units-dim,
.wb-panel-body .wb-fn-catalog .calculator-units-dim {
    background: var(--wb-grid-bg);
}

.wb-panel-body .wb-units-catalog .calculator-units-symbols code {
    padding: 0;
    background: none;
}

.wb-fn-catalog-fns {
    list-style: none;
    margin: 0;
    padding: 0;
}

.wb-fn-catalog-fns li {
    display: flex;
    flex-wrap: wrap;
    gap: 0.15rem 0.65rem;
    align-items: baseline;
    margin: 0 0 0.28rem;
    font-size: 0.86rem;
    line-height: 1.35;
}

.wb-panel-body .wb-fn-catalog-fns code {
    padding: 0;
    background: none;
    font-weight: 600;
}

.wb-fn-catalog-sig {
    color: var(--muted);
    font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, monospace;
    font-size: 0.88em;
}

.wb-panel-body #wb-panel-customunits > p {
    margin-bottom: 0.45rem;
}

.wb-panel-body .wb-custom-units-list {
    list-style: none;
    margin: 0 0 0.4rem;
    padding: 0;
}

.wb-custom-units-list:empty {
    display: none;
    margin: 0;
}

.wb-custom-units-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.45rem;
    padding: 0.2rem 0;
    border-bottom: 1px solid var(--border);
}

.wb-custom-units-row p {
    margin: 0;
    font-size: 0.86rem;
    line-height: 1.35;
}

.wb-custom-units-note {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
}

.workbook .wb-custom-units-row button {
    margin: 0;
    padding: 0.12rem 0.4rem;
    min-height: 0;
    width: auto;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.2;
    background: transparent;
    color: var(--base);
    box-shadow: none;
}

.workbook .wb-custom-units-row button:hover,
.workbook .wb-custom-units-row button:focus-visible {
    background: var(--base-soft);
    color: var(--base-hover);
}

.wb-panel-body #wb-panel-customunits .calculator-units-lead {
    margin-bottom: 0.4rem;
}

.wb-custom-units-form {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) auto minmax(3.2rem, 0.55fr) minmax(0, 1.2fr) auto;
    gap: 0.15rem 0.4rem;
    align-items: end;
}

.wb-custom-units-form label {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    margin: 0;
    min-width: 0;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
}

.wb-custom-units-eq {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 0.15rem;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--muted);
    user-select: none;
}

.wb-custom-units-eq::before {
    content: "";
    font-size: 0.78rem;
    line-height: 1.2;
    height: 1.2em;
}

.workbook .wb-custom-units-form input,
.workbook .wb-custom-units-form input:focus {
    display: block;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0.28rem 0.4rem;
    min-height: 0;
    font-size: 0.86rem;
}

.workbook .wb-custom-units-form button[type="submit"] {
    margin: 0;
    padding: 0.28rem 0.65rem;
    min-height: 0;
    width: auto;
    font-size: 0.86rem;
    line-height: 1.2;
}

.wb-custom-units-error {
    grid-column: 1 / -1;
    margin: 0.1rem 0 0;
    color: #721c24;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.35;
}

.wb-custom-units-error[hidden] {
    display: none;
}

.workbook .wb-custom-units-form input[aria-invalid="true"] {
    border-color: #721c24;
}

.wb-panel-body .calculator-units-lead,
.wb-dialog-body .calculator-units-lead {
    margin-bottom: 0.85rem;
}

.wb-dimcheck-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.wb-panel-body .wb-dimcheck-list {
    padding-left: 0;
}

.workbook .wb-dimcheck-item {
    display: grid;
    grid-template-columns: minmax(4.5rem, auto) minmax(5.5rem, auto) minmax(0, 1fr);
    gap: 0.45rem 0.75rem;
    align-items: baseline;
    width: 100%;
    margin: 0 0 0.35rem;
    padding: 0.45rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--wb-grid-bg);
    color: var(--charcoal);
    font-family: inherit;
    font-size: 0.86rem;
    font-weight: 500;
    line-height: 1.35;
    text-align: left;
    box-shadow: none;
}

.workbook .wb-dimcheck-item:hover,
.workbook .wb-dimcheck-item:focus-visible {
    background: var(--base-soft);
    color: var(--charcoal);
}

.wb-dimcheck-loc {
    font-weight: 600;
}

.wb-dimcheck-kind {
    color: var(--muted);
}

.wb-dialog-body .wb-feedback-form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
}

.wb-feedback-mood {
    margin: 0;
    padding: 0;
    border: 0;
}

.wb-feedback-mood legend {
    padding: 0;
    margin: 0 0 0.4rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
}

.wb-feedback-faces {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.wb-feedback-face {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.25rem;
    height: 3.25rem;
    margin: 0;
    padding: 0;
    border: 1.5px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--charcoal);
    cursor: pointer;
}

.wb-feedback-face input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.wb-feedback-face input:focus {
    border: 0;
    box-shadow: none;
    background: transparent;
    outline: none;
}

.wb-feedback-face svg {
    display: block;
    width: 2.15rem;
    height: 2.15rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.wb-feedback-face .wb-feedback-eye {
    fill: currentColor;
    stroke: none;
}

.wb-feedback-face-happy {
    color: var(--base);
}

.wb-feedback-face-neutral {
    color: var(--muted);
}

.wb-feedback-face-sad {
    color: #b4453a;
}

.wb-feedback-face:hover {
    background: var(--bg);
}

.wb-feedback-face:has(input:checked) {
    border-color: currentColor;
    background: var(--base-soft);
    box-shadow: 0 0 0 2px currentColor;
}

.wb-feedback-face:has(input:focus-visible) {
    outline: 2px solid var(--base);
    outline-offset: 2px;
}

.wb-feedback-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.wb-feedback-field label {
    min-width: 0;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
}

.workbook .wb-feedback-field textarea,
.workbook .wb-feedback-field textarea:focus {
    display: block;
    width: 100%;
    max-width: none;
    min-height: 7.5rem;
    margin: 0;
    padding: 0.45rem 0.55rem;
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.4;
    resize: vertical;
}

.wb-feedback-cells {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    min-width: 0;
    font-weight: 500;
    color: var(--charcoal);
}

.wb-feedback-cells input {
    margin: 0.2rem 0 0;
    flex-shrink: 0;
}

.wb-feedback-error {
    margin: 0;
}

.wb-feedback-error[hidden] {
    display: none;
}

.wb-panel-body #wb-panel-share > p {
    margin-bottom: 0.45rem;
}

.wb-find-form {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.wb-find-form > label {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    margin: 0;
    min-width: 0;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
}

.workbook .wb-find-form input[type="text"],
.workbook .wb-find-form input[type="text"]:focus {
    display: block;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0.28rem 0.4rem;
    min-height: 0;
    font-size: 0.86rem;
}

.wb-find-options,
.wb-find-scope {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.9rem;
    margin: 0;
    padding: 0;
    border: 0;
}

.wb-find-scope legend {
    width: 100%;
    padding: 0;
    margin: 0 0 0.15rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
}

.wb-find-options label,
.wb-find-scope label {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
    font-size: 0.86rem;
    font-weight: 500;
    color: var(--charcoal);
}

.wb-find-scope label:has(input:disabled) {
    color: var(--muted);
}

.wb-find-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.workbook .wb-find-actions button {
    margin: 0;
    padding: 0.28rem 0.65rem;
    min-height: 0;
    width: auto;
    font-size: 0.86rem;
}

.wb-find-status {
    margin: 0;
    min-height: 1.2em;
    font-size: 0.86rem;
    color: var(--muted);
}

.wb-formula-hl .wb-find-mark {
    background: #fff3a0;
    border-radius: 2px;
}

.wb-share-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.15rem 0.4rem;
    align-items: end;
    margin-bottom: 0.85rem;
}

.wb-share-form > label:first-child {
    grid-column: 1 / -1;
}

.wb-share-form label {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    margin: 0;
    min-width: 0;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
}

.workbook .wb-share-form input,
.workbook .wb-share-form input:focus,
.workbook .wb-share-form select,
.workbook .wb-share-form select:focus {
    display: block;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0.28rem 0.4rem;
    min-height: 0;
    font-size: 0.86rem;
}

.workbook .wb-share-form button[type="submit"] {
    margin: 0;
    padding: 0.28rem 0.65rem;
    min-height: 0;
    width: auto;
    font-size: 0.86rem;
    line-height: 1.2;
}

.wb-share-upgrade {
    margin: 0.15rem 0 0;
}

.workbook .wb-share-upgrade button[type="submit"] {
    margin: 0;
    width: auto;
}

.wb-share-error {
    grid-column: 1 / -1;
    margin: 0.1rem 0 0;
    color: #721c24;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.35;
}

.wb-share-error[hidden] {
    display: none;
}

.wb-panel-body #wb-panel-share h3 {
    margin: 0 0 0.45rem;
    color: var(--muted);
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.wb-share-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.wb-panel-body .wb-share-list {
    padding-left: 0;
}

.wb-share-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    column-gap: 0.5rem;
    row-gap: 0.1rem;
    margin: 0;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--border);
}

.wb-share-row:last-child {
    border-bottom: none;
}

.wb-share-who {
    display: contents;
}

.wb-share-who strong {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wb-share-who span {
    grid-column: 1 / -1;
    grid-row: 2;
    min-width: 0;
    color: var(--muted);
    font-size: 0.8rem;
    overflow-wrap: anywhere;
}

.wb-share-who span:empty {
    display: none;
}

.workbook .wb-share-row select {
    grid-column: 2;
    grid-row: 1;
    margin: 0;
    padding: 0.12rem 0.4rem;
    min-height: 0;
    width: auto;
    min-width: 5.5rem;
    font-size: 0.78rem;
}

.workbook .wb-share-row button {
    grid-column: 3;
    grid-row: 1;
    margin: 0;
    padding: 0.12rem 0.4rem;
    min-height: 0;
    width: auto;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.2;
    background: transparent;
    color: var(--base);
    box-shadow: none;
}

.workbook .wb-share-row button:hover,
.workbook .wb-share-row button:focus-visible {
    background: var(--base-soft);
    color: var(--base-hover);
}

.workbook.is-view-only [data-workbook-import-csv],
.workbook.is-view-only [data-workbook-insert-sheet],
.workbook.is-view-only [data-workbook-sheet-add],
.workbook.is-view-only [data-workbook-insert-row-above],
.workbook.is-view-only [data-workbook-insert-row-below],
.workbook.is-view-only [data-workbook-insert-col-left],
.workbook.is-view-only [data-workbook-insert-col-right],
.workbook.is-view-only [data-workbook-delete-rows],
.workbook.is-view-only [data-workbook-delete-cols],
.workbook.is-view-only [data-workbook-custom-units],
.workbook.is-view-only [data-workbook-cut],
.workbook.is-view-only [data-workbook-paste],
.workbook.is-view-only [data-workbook-paste-value],
.workbook.is-view-only [data-workbook-fill-down],
.workbook.is-view-only [data-workbook-fill-right],
.workbook.is-view-only [data-workbook-undo],
.workbook.is-view-only [data-workbook-redo] {
    opacity: 0.45;
}

.wb-dialog-body .wb-feedback-form .form-actions {
    margin-top: 0.15rem;
}

.wb-notice {
    position: fixed;
    top: 0.7rem;
    left: 50%;
    z-index: 50;
    max-width: min(28rem, calc(100% - 2rem));
    padding: 0.55rem 1.1rem;
    border-radius: 8px;
    background: var(--base);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.35;
    text-align: center;
    box-shadow: 0 8px 24px var(--base-shadow-menu);
    pointer-events: none;
    transform: translateX(-50%) translateY(-0.35rem);
    opacity: 0;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.wb-notice.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.wb-dimcheck-item.is-unit .wb-dimcheck-kind {
    color: #721c24;
    font-weight: 600;
}

.wb-dimcheck-detail {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wb-dimcheck-detail code {
    padding: 0;
    background: none;
}

.date-picker {
    position: fixed;
    z-index: 40;
    width: 16rem;
    padding: 0.3rem 0.3rem 0.35rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 8px 24px var(--base-shadow-menu);
    color: var(--charcoal);
    font-size: 0.82rem;
}

.date-picker[hidden] {
    display: none;
}

.date-picker-header {
    display: flex;
    align-items: center;
    gap: 0.1rem;
    margin-bottom: 0.1rem;
}

.date-picker-title {
    flex: 1;
    min-width: 0;
    text-align: center;
    font-weight: 600;
    font-size: 0.88rem;
    line-height: 1.2;
}

.date-picker-nav,
.date-picker-today,
.date-picker-day {
    margin: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    box-shadow: none;
}

.date-picker-nav {
    width: 1.7rem;
    height: 1.7rem;
    padding: 0;
    border-radius: 4px;
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1;
}

.date-picker-nav:hover,
.date-picker-nav:focus-visible,
.date-picker-today:hover,
.date-picker-today:focus-visible,
.date-picker-day:hover,
.date-picker-day:focus-visible {
    background: var(--base-soft);
    color: var(--base);
}

.date-picker-grid {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.date-picker-grid th {
    padding: 0.1rem 0;
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 600;
    text-align: center;
}

.date-picker-grid td {
    padding: 0;
}

.date-picker-day {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 1.5rem;
    padding: 0;
    border-radius: 3px;
    font-size: 0.75rem;
}

.date-picker-day.is-outside {
    color: var(--muted);
    opacity: 0.55;
}

.date-picker-day.is-today {
    box-shadow: inset 0 0 0 1px var(--base);
}

.date-picker-day.is-selected,
.date-picker-day.is-selected:hover,
.date-picker-day.is-selected:focus-visible {
    background: var(--base);
    color: #fff;
}

.date-picker-today {
    display: block;
    width: 100%;
    margin-top: 0.15rem;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    color: var(--base);
    font-weight: 600;
}

.color-picker {
    position: fixed;
    z-index: 40;
    width: 21rem;
    padding: 0.35rem 0.35rem 0.4rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 8px 24px var(--base-shadow-menu);
    color: var(--charcoal);
    font-size: 0.82rem;
}

.color-picker[hidden] {
    display: none;
}

.color-picker-header {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.3rem;
}

.color-picker-title {
    flex: 1;
    min-width: 0;
    font-weight: 600;
    font-size: 0.88rem;
    line-height: 1.2;
}

.color-picker-default,
.color-picker-apply,
.color-picker-swatch {
    margin: 0;
    box-shadow: none;
}

.color-picker-default,
.color-picker-apply {
    padding: 0.15rem 0.45rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: transparent;
    color: var(--base);
    font: inherit;
    font-weight: 600;
    font-size: 0.75rem;
}

.color-picker-default:hover,
.color-picker-default:focus-visible,
.color-picker-apply:hover,
.color-picker-apply:focus-visible {
    background: var(--base-soft);
    color: var(--base);
}

.color-picker-grays,
.color-picker-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 3px;
    margin: 0;
}

.color-picker-grays {
    margin-bottom: 0.4rem;
}

.color-picker-swatch {
    width: 100%;
    aspect-ratio: 1;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 1px;
    background: #fff;
    font-size: 0;
    line-height: 0;
    cursor: pointer;
}

.color-picker-swatch:hover,
.color-picker-swatch:focus-visible {
    outline: 2px solid var(--base);
    outline-offset: 0;
    z-index: 1;
}

.color-picker-swatch.is-selected,
.color-picker-swatch.is-selected:hover,
.color-picker-swatch.is-selected:focus-visible {
    outline: 2px solid var(--charcoal);
    outline-offset: 0;
    z-index: 1;
}

.color-picker-hex-row {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.35rem;
}

.color-picker-preview {
    width: 1.15rem;
    height: 1.15rem;
    flex-shrink: 0;
    border: 1px solid var(--border);
    border-radius: 3px;
    background: var(--surface);
}

.color-picker-preview.is-empty {
    background:
        linear-gradient(to bottom right, transparent calc(50% - 1px), #721c24 calc(50% - 1px),
            #721c24 calc(50% + 1px), transparent calc(50% + 1px)),
        var(--surface);
}

.color-picker-hash {
    color: var(--muted);
    font-weight: 600;
}

.workbook .color-picker-hex,
.workbook .color-picker-hex:focus {
    margin: 0;
    min-width: 0;
    flex: 1;
    min-height: 0;
    padding: 0.2rem 0.35rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
    color: inherit;
    font: inherit;
    font-family: Menlo, Consolas, monospace;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    box-shadow: none;
}

.workbook .color-picker-hex:focus {
    border-color: var(--base);
    box-shadow: 0 0 0 2px var(--base-ring);
}

.color-picker-hex-error {
    margin-top: 0.2rem;
    color: #721c24;
    font-size: 0.72rem;
}

@media (max-width: 768px) {
    .wb-panel {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        z-index: 4;
        box-shadow: 0 16px 40px var(--base-shadow-float);
    }

    .wb-logo {
        height: 2.35rem;
        width: auto;
    }

    .wb-name {
        font-size: 1.3rem;
    }

    body.workbook-page .workbook {
        height: 100%;
    }

    .wb-header {
        flex-wrap: wrap;
        align-items: center;
        padding: 0.75rem 1rem 0;
    }

    .wb-header-main {
        display: contents;
    }

    .wb-titlebar {
        flex: 1;
        min-width: 0;
        padding: 0 0.4rem 0;
    }

    .wb-menubar {
        flex: 1 0 100%;
        width: 100%;
        order: 5;
        padding: 0.15rem 0 0.2rem;
    }

    .wb-chrome .nav-account,
    .wb-chrome .nav-signed-in,
    .wb-guest-login {
        margin-top: 0;
        order: 2;
    }

    .wb-menubar,
    .wb-toolbar {
        flex-wrap: nowrap;
        overflow-x: auto;
        overscroll-behavior: contain;
        touch-action: pan-x;
    }

    .wb-menu-item.is-open,
    .wb-tool-drop.is-open {
        z-index: 30;
    }

    .wb-menu-item.is-open > .wb-menu-dropdown,
    .wb-tool-drop.is-open > .wb-subtoolbar {
        z-index: 40;
    }

    .workbook .wb-formula-input,
    .workbook .wb-formula-input:focus,
    .wb-formula-hl,
    .workbook .wb-name-box,
    .workbook .wb-name-box:focus {
        min-height: var(--wb-formula-h);
        padding: 0 0.5rem;
    }

    .workbook .wb-name-box,
    .workbook .wb-name-box:focus {
        font-size: 16px;
    }

    .workbook .wb-select {
        min-height: 0;
        padding: 0.35rem 0.5rem;
        font-size: 16px;
    }

    .workbook input.wb-sheet-rename:not([hidden]),
    .workbook input.wb-sheet-rename:not([hidden]):focus {
        min-height: 0;
        padding: 0 var(--wb-sheet-tab-pad-x);
        font-size: var(--wb-sheet-tab-font);
    }

    .workbook .sheet-cell-editor,
    .workbook .sheet-cell-editor:focus,
    .sheet-cell-editor-hl {
        font-size: 16px;
        min-height: 100%;
        padding: 0 0.4rem;
    }

    .sheet-grid th,
    .sheet-grid td {
        font-size: 0.78rem;
    }
}

@media (max-width: 480px) {
    .wb-header {
        padding: 0.5rem 0.75rem 0;
    }
}

#wb-print {
    display: none;
}

@media print {
    @page {
        margin: 0.5in;
    }

    html:has(body.workbook-page),
    body.workbook-page {
        position: static;
        inset: auto;
        width: auto;
        height: auto;
        max-height: none;
        min-height: 0;
        overflow: visible;
        padding: 0;
        background: #fff;
    }

    body.workbook-page > *:not(#wb-print) {
        display: none !important;
    }

    #wb-print {
        display: block;
        color: #000;
        background: #fff;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    #wb-print .wb-print-title {
        font-family: Georgia, 'Times New Roman', serif;
        font-size: 14pt;
        font-weight: 400;
        margin: 0 0 0.5rem;
    }

    #wb-print .wb-print-grid {
        width: 100%;
        border-collapse: collapse;
        table-layout: fixed;
        font-size: 10pt;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    }

    #wb-print .wb-print-grid td {
        border: 1px solid #bbb;
        padding: 0.15rem 0.35rem;
        vertical-align: middle;
        white-space: pre-wrap;
        overflow-wrap: anywhere;
    }

    #wb-print .wb-print-cell.is-num,
    #wb-print .wb-print-cell.is-qty {
        text-align: right;
    }

    #wb-print .wb-print-cell.is-ccy {
        text-align: left;
    }

    #wb-print .wb-print-cell.is-bool {
        text-align: center;
    }

    #wb-print .wb-print-cell.is-text,
    #wb-print .wb-print-cell.is-error {
        text-align: left;
    }

    #wb-print .wb-print-cell.is-error {
        color: #b00020;
    }
}
