.offline-standalone-shell {
    min-height: 100vh;
}

.offline-standalone-topbar {
    display: grid;
    grid-template-columns: max-content minmax(220px, 1fr) max-content;
    align-items: center;
    gap: 16px;
    min-height: 72px;
    padding: 0 22px;
    border-bottom: 1px solid #dce5e8;
    background: #ffffff;
    color: #5d7078;
}

.offline-header-copy {
    min-width: 0;
}

.offline-header-copy p,
.offline-header-copy h1 {
    margin: 0;
}

.offline-header-copy h1 {
    color: #17202a;
    font-size: 22px;
    font-weight: 800;
}

.offline-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #17202a;
    font-weight: 800;
    text-decoration: none;
}

.offline-balloon-main {
    height: max(680px, calc(100vh - 92px));
    min-height: 0;
    padding: 16px;
}

.offline-balloon-app {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 10px;
    height: 100%;
    min-height: 0;
}

.offline-file-status {
    max-width: min(520px, 50vw);
    overflow: hidden;
    color: #5d7078;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.offline-ribbon {
    grid-row: 1;
    display: flex;
    align-items: stretch;
    gap: 0;
    overflow-x: auto;
    border: 1px solid #cfdce1;
    border-radius: 8px;
    background: linear-gradient(#fbfdfe, #edf3f5);
}

.ribbon-group {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    align-content: stretch;
    gap: 6px;
    min-width: max-content;
    padding: 8px 10px 6px;
    border-right: 1px solid #dce5e8;
}

.ribbon-group h3 {
    order: 2;
    margin: 0;
    color: #5d7078;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
}

.ribbon-controls {
    order: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 78px;
}

.ribbon-command {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 78px;
    min-height: 30px;
    padding: 0 8px;
    border: 1px solid #c9d6da;
    border-radius: 6px;
    background: #ffffff;
    color: #20333a;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

.ribbon-command-large {
    display: grid;
    justify-items: center;
    align-content: center;
    width: 84px;
    min-width: 84px;
    height: 70px;
    min-height: 70px;
    padding: 6px 8px;
    text-align: center;
}

.ribbon-balloon-preview {
    box-sizing: border-box;
    display: grid;
    place-items: center;
    flex: none;
    border-style: solid;
    border-radius: 50%;
    line-height: 1;
    pointer-events: none;
}

.ribbon-icon {
    display: grid;
    place-items: center;
    min-width: 30px;
    height: 30px;
    padding: 0 5px;
    border: 1px solid #c9d6da;
    border-radius: 6px;
    background: #f8fbfc;
    color: #126b7f;
    font-size: 11px;
    font-weight: 800;
}

.ribbon-stack {
    display: grid;
    grid-template-rows: repeat(2, 32px);
    gap: 6px;
}

.ribbon-stack > .ribbon-command {
    box-sizing: border-box;
    height: 32px;
    min-height: 32px;
}

.ribbon-command:hover,
.ribbon-command.is-active {
    border-color: #188098;
    background: #edf9fb;
    color: #126b7f;
}

.ribbon-command:disabled {
    cursor: not-allowed;
    opacity: 0.48;
}

.ribbon-command input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.ribbon-field-grid,
.ribbon-color-grid {
    display: grid;
    grid-template-columns: repeat(3, max-content);
    gap: 6px 8px;
    align-items: end;
}

.ribbon-field-grid-wide {
    grid-template-columns: max-content max-content;
}

.ribbon-toggle-row {
    display: flex;
    align-items: end;
    gap: 6px;
    padding-top: 16px;
}

.ribbon-field-grid label,
.ribbon-color-grid label {
    display: grid;
    gap: 2px;
    color: #5d7078;
    font-size: 11px;
}

.ribbon-field-grid input[type="number"],
.ribbon-field-grid select {
    width: 62px;
    min-height: 30px;
    padding: 0 7px;
    border: 1px solid #c9d6da;
    border-radius: 6px;
}

.ribbon-field-grid select {
    width: 92px;
    background: #ffffff;
}

.ribbon-balloon-rows {
    display: grid;
    align-content: center;
    gap: 7px;
    min-height: 78px;
}

.ribbon-balloon-layout {
    gap: 10px;
}

.ribbon-option-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    width: max-content;
}

.ribbon-option-row label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    color: #5d7078;
    font-size: 11px;
    white-space: nowrap;
}

.ribbon-option-row label > span {
    width: 58px;
    line-height: 1.1;
}

.ribbon-option-row input[type="number"],
.ribbon-option-row select {
    width: 68px;
    min-height: 30px;
    padding: 0 7px;
    border: 1px solid #c9d6da;
    border-radius: 6px;
    background: #ffffff;
}

.characteristic-table-wrap { max-height: 52vh; }
.characteristic-message { min-height: 24px; color: #991b1b; font-size: 13px; }
.characteristic-selection-list { display: grid; gap: 6px; max-height: 42vh; overflow: auto; }
.characteristic-selection-option { width: 100%; padding: 9px 10px; border: 1px solid #c9d6da; border-radius: 6px; background: #fff; color: #20333a; text-align: left; }
.characteristic-selection-option:hover, .characteristic-selection-option.is-selected { border-color: #188098; background: #edf9fb; color: #126b7f; }

.ribbon-option-row select {
    width: 100%;
}

.ribbon-option-row .ribbon-command {
    min-width: 68px;
    min-height: 30px;
    padding: 0 8px;
}

.ribbon-option-font {
    width: 212px;
}

.ribbon-option-font select { width: 148px; }

.ribbon-font-buttons {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 74px;
}

.ribbon-font-buttons .ribbon-command {
    min-width: 34px;
    width: 34px;
    padding: 0;
}

.ribbon-prefix-options {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ribbon-prefix-options[hidden] {
    display: none;
}

.ribbon-prefix-options label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    margin: 0;
    color: #5d7078;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.1;
    white-space: nowrap;
}

.ribbon-prefix-options label > span {
    width: 38px;
    flex: 0 0 38px;
}

.ribbon-prefix-options input[type="text"] {
    width: 58px;
    min-height: 30px;
    padding: 0 7px;
    border: 1px solid #d8d9df;
    border-radius: 8px;
    background: #ffffff;
    color: #323338;
    font: inherit;
    font-size: 11px;
    font-weight: 400;
    line-height: normal;
    text-transform: none;
}

.ribbon-prefix-options > .ribbon-command {
    width: 34px;
    min-width: 34px;
    padding: 0;
    font-size: 16px;
}

.ribbon-apply-style {
    width: 84px;
    min-width: 84px;
    padding: 6px 9px;
    white-space: normal;
}

.ribbon-apply-prefix-stack {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    align-self: stretch;
    gap: 6px;
    width: 142px;
    min-width: 142px;
    min-height: 78px;
}

.ribbon-apply-prefix-stack:has(.ribbon-prefix-options[hidden]) {
    grid-template-rows: minmax(0, 1fr);
    gap: 0;
}

.ribbon-apply-prefix-stack .ribbon-apply-style {
    width: 100%;
    height: auto;
    min-height: 0;
}

.ribbon-apply-style .ribbon-icon {
    font-size: 9px;
}

.ribbon-color-grid-2x2 {
    grid-template-columns: 112px 142px;
    grid-template-rows: repeat(2, 32px);
    gap: 6px 10px;
    align-items: center;
}

.ribbon-color-grid-2x2 label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 7px;
    min-width: 0;
    white-space: nowrap;
}

.ribbon-color-grid-2x2 label > span {
    min-width: 34px;
}

.ribbon-color-grid-2x2 .ribbon-transparency {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 7px;
    color: #5d7078;
    font-size: 11px;
    white-space: nowrap;
}

.ribbon-color-value {
    display: inline-grid;
    place-items: center;
    width: 48px;
    height: 30px;
    padding: 0 5px;
    border: 1px solid #c9d6da;
    border-radius: 6px;
    background: #ffffff;
    color: #20333a;
    font: inherit;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    anchor-name: --fill-transparency-control;
}

.ribbon-color-value:hover {
    border-color: #188098;
    background: #edf9fb;
    color: #126b7f;
}

.ribbon-transparency-menu {
    position: fixed;
    inset: auto;
    top: var(--transparency-popover-top, 96px);
    left: var(--transparency-popover-left, 16px);
    min-width: 230px;
    margin: 6px 0 0;
    padding: 10px 12px;
    border: 1px solid #c9d6da;
    border-radius: 7px;
    background: #ffffff;
    box-shadow: 0 10px 24px rgba(23, 32, 42, 0.16);
}

.ribbon-transparency-menu label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 7px;
    color: #5d7078;
    font-size: 12px;
}

.ribbon-transparency-menu input[type="range"] {
    width: 100%;
    height: 20px;
    margin: 0;
    accent-color: #188098;
    cursor: pointer;
}

.ribbon-transparency-menu output {
    color: #20333a;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.ribbon-color-grid input[type="color"] {
    width: 36px;
    height: 30px;
    padding: 2px;
    border: 1px solid #c9d6da;
    border-radius: 6px;
    background: #ffffff;
}

.offline-alert {
    display: none !important;
    padding: 10px 12px;
    border: 1px solid #f3c77c;
    border-radius: 8px;
    background: #fff7e6;
    color: #6d4700;
}

.offline-alert.is-error {
    border-color: #fecaca;
    background: #fff1f2;
    color: #991b1b;
}

.offline-countdown-toast {
    position: fixed;
    top: 18px;
    left: 50%;
    z-index: 1200;
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: min(560px, calc(100vw - 32px));
    padding: 11px 14px;
    border: 1px solid #9ccbd5;
    border-radius: 8px;
    background: #edf9fb;
    color: #20333a;
    box-shadow: 0 12px 30px rgba(23, 32, 42, 0.22);
    transform: translateX(-50%);
}

.offline-countdown-toast[hidden] {
    display: none;
}

.offline-countdown-toast strong {
    min-width: 24px;
    color: #126b7f;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.offline-countdown-toast.is-error {
    border-color: #fecaca;
    background: #fff1f2;
    color: #991b1b;
}

.offline-countdown-toast.is-error strong {
    color: #991b1b;
}

.offline-workspace {
    grid-row: 2;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 12px;
    height: 100%;
    min-height: 0;
}

.offline-viewer-frame {
    position: relative;
    height: 100%;
    min-width: 0;
    min-height: 0;
}

.offline-pdf-viewer {
    display: block;
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 0;
    border-radius: 8px;
    overflow: hidden;
    overflow-anchor: none;
}

.offline-pdf-viewer.has-pannable-content {
    cursor: grab;
}

.offline-pdf-viewer.is-normal-tool .balloon-overlay:not(.is-drop-target) {
    cursor: crosshair;
}

.offline-pdf-viewer.is-middle-panning {
    cursor: grabbing;
    user-select: none;
    -webkit-user-select: none;
}

.offline-pdf-viewer.is-middle-panning * {
    cursor: grabbing !important;
    user-select: none;
    -webkit-user-select: none;
}

.offline-pdf-pages {
    box-sizing: border-box;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-width: 100%;
    height: 100%;
    min-height: 100%;
    margin: 0;
    padding: 0;
    overflow-anchor: none;
    will-change: transform;
}

.offline-pdf-pages .pdf-page-wrapper {
    position: absolute;
}

.offline-viewer-tools {
    position: absolute;
    top: 12px;
    left: 50%;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px;
    border: 1px solid rgba(210, 221, 225, 0.9);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.94);
    color: #20333a;
    font-size: 13px;
    box-shadow: 0 10px 24px rgba(23, 32, 42, 0.14);
    transform: translateX(-50%);
}

.offline-viewer-tools button {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border: 1px solid #c9d6da;
    border-radius: 999px;
    background: #ffffff;
    color: #20333a;
    font-weight: 800;
}

.offline-viewer-tools button:hover {
    border-color: #188098;
    color: #126b7f;
}

.offline-viewer-tools span {
    min-width: 124px;
    text-align: center;
}

.offline-minimap {
    position: absolute;
    right: 18px;
    bottom: 18px;
    z-index: 35;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 7px;
    width: min(184px, calc(100% - 36px));
    max-height: min(256px, calc(100% - 36px));
    padding: 9px;
    overflow: hidden;
    border: 1px solid rgba(185, 203, 209, 0.92);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 14px 32px rgba(23, 32, 42, 0.18);
}

.offline-minimap-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #5d7078;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.offline-minimap-header strong {
    color: #20333a;
    font-size: 12px;
}

.offline-minimap-stage {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 96px;
    max-height: 214px;
    overflow: hidden;
    border: 1px solid #dce5e8;
    border-radius: 6px;
    background: #dfe8eb;
    cursor: crosshair;
    touch-action: none;
}

.offline-minimap-stage canvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
    height: auto;
    background: #ffffff;
}

.offline-minimap-viewport {
    box-sizing: border-box;
    position: absolute;
    min-width: 0;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 3px;
    background: rgba(24, 128, 152, 0.16);
    box-shadow:
        inset 0 0 0 2px #188098,
        0 0 0 1px rgba(255, 255, 255, 0.86);
    cursor: grab;
}

.offline-minimap-viewport:active {
    cursor: grabbing;
}

.offline-custom-scrollbar {
    position: absolute;
    z-index: 36;
    border: 1px solid rgba(185, 203, 209, 0.84);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.84);
    box-shadow: 0 8px 18px rgba(23, 32, 42, 0.12);
    touch-action: none;
}

.offline-custom-scrollbar-x {
    right: 220px;
    bottom: 16px;
    left: 16px;
    height: 14px;
}

.offline-custom-scrollbar-y {
    top: 56px;
    right: 16px;
    bottom: 280px;
    width: 14px;
}

.offline-custom-scrollbar-thumb {
    position: absolute;
    min-width: 0;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: #188098;
    box-shadow: 0 2px 7px rgba(23, 32, 42, 0.24);
    cursor: grab;
}

.offline-custom-scrollbar-x .offline-custom-scrollbar-thumb {
    top: 2px;
    height: 8px;
    min-height: 8px;
}

.offline-custom-scrollbar-y .offline-custom-scrollbar-thumb {
    left: 2px;
    width: 8px;
    min-width: 8px;
}

.offline-custom-scrollbar-thumb:active {
    cursor: grabbing;
}

.offline-empty-state {
    align-self: center;
    justify-self: center;
    max-width: 440px;
    width: min(520px, calc(100vw - 64px));
    margin: 84px auto 0;
    padding: 34px;
    border: 2px dashed #b9cbd1;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.78);
    color: #5d7078;
    text-align: center;
    transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.offline-empty-state h3 {
    margin: 0 0 8px;
    color: #20333a;
}

.offline-empty-state p {
    margin: 0 0 18px;
}

.offline-empty-state.is-drag-over {
    border-color: #188098;
    background: #edf9fb;
    box-shadow: 0 18px 34px rgba(24, 128, 152, 0.14);
}

.offline-open-large {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 180px;
    min-height: 48px;
    padding: 0 22px;
    border: 1px solid #126b7f;
    border-radius: 6px;
    background: #188098;
    color: #ffffff;
    font-weight: 800;
    cursor: pointer;
}

.offline-open-large:hover {
    background: #126b7f;
}

.offline-open-large input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.offline-drop-hint {
    margin-top: 12px;
    color: #6a7c84;
    font-size: 13px;
}

.offline-sidebar {
    display: grid;
    align-content: start;
    gap: 12px;
    min-height: 0;
    overflow: auto;
}

.offline-sidebar section {
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid #dce5e8;
    border-radius: 8px;
    background: #ffffff;
}

.offline-sidebar h3 {
    margin: 0;
    font-size: 16px;
}

.offline-selected-form {
    display: grid;
    gap: 8px;
}

.offline-selected-form label {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    color: #5d7078;
    font-size: 13px;
}

.offline-selected-form input {
    min-width: 0;
    min-height: 36px;
    padding: 0 10px;
    border: 1px solid #d2dde1;
    border-radius: 6px;
    background: #ffffff;
    color: #20333a;
}

.offline-selected-form input:disabled {
    background: #f4f7f8;
}

.offline-scope-note {
    color: #5d7078;
    font-size: 13px;
}

.offline-balloon-list {
    max-height: 300px;
}

.offline-balloon-list button span {
    font-weight: 700;
}

.offline-balloon-marker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    text-align: center;
    line-height: 0.9;
    white-space: pre-line;
}

.ribbon-balloon-preview {
    white-space: pre-line;
}

.offline-balloon-marker.is-selected {
    outline: 3px solid rgba(24, 128, 152, 0.36);
    outline-offset: 3px;
}

.balloon-overlay.is-drop-target {
    cursor: grabbing;
}

.balloon-overlay.is-drop-target::after {
    position: absolute;
    inset: 0;
    border: 2px dashed rgba(24, 128, 152, 0.24);
    content: "";
    pointer-events: none;
}

.offline-balloon-marker.is-dragging {
    z-index: 20;
    cursor: grabbing;
    opacity: 0.88;
    outline: 4px solid rgba(24, 128, 152, 0.48);
    outline-offset: 4px;
    box-shadow:
        0 0 0 8px rgba(24, 128, 152, 0.12),
        0 12px 28px rgba(17, 24, 39, 0.32);
    transition: none;
}

@media (max-width: 1180px) {
    .offline-balloon-main {
        height: max(680px, calc(100vh - 92px));
    }

    .offline-workspace {
        grid-template-columns: 1fr;
    }

    .offline-pdf-viewer {
        min-height: 640px;
    }
}

/* Monday-inspired application skin -------------------------------------- */
.offline-standalone-shell {
    --balloon-purple: #6161ff;
    --balloon-purple-dark: #5034ff;
    --balloon-purple-soft: #eeeeff;
    --balloon-text: #323338;
    --balloon-muted: #676879;
    --balloon-border: #e6e7eb;
    --balloon-surface: #ffffff;
    color: var(--balloon-text);
}

.offline-standalone-topbar {
    min-height: 82px;
    padding: 14px 30px;
    border-color: var(--balloon-border);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 3px 14px rgba(50, 51, 56, 0.05);
}

.offline-brand,
.offline-header-copy h1 {
    color: var(--balloon-text);
}

.offline-header-copy h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.offline-header-copy .app-kicker,
.offline-file-status {
    color: #9293a3;
}

.offline-balloon-main {
    height: max(680px, calc(100vh - 102px));
    padding: 18px 22px 22px;
}

.offline-ribbon {
    border-color: var(--balloon-border);
    border-radius: 12px;
    background: var(--balloon-surface);
    box-shadow: 0 5px 18px rgba(50, 51, 56, 0.07);
}

.ribbon-group {
    border-color: var(--balloon-border);
    padding: 9px 11px 7px;
}

.ribbon-group h3 {
    color: #9293a3;
    font-weight: 700;
    letter-spacing: 0.045em;
}

.ribbon-command {
    border-color: #d8d9df;
    border-radius: 8px;
    color: #4b4d5c;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(50, 51, 56, 0.04);
    font-weight: 600;
    transition: color 140ms ease, background 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.ribbon-command:hover,
.ribbon-command:focus-visible {
    border-color: #a9a9ff;
    color: var(--balloon-purple-dark);
    background: #f7f7ff;
    box-shadow: 0 4px 10px rgba(97, 97, 255, 0.12);
    outline: none;
}

.ribbon-command:hover {
    transform: translateY(-1px);
}

.ribbon-command.is-active {
    border-color: var(--balloon-purple);
    color: var(--balloon-purple-dark);
    background: var(--balloon-purple-soft);
    box-shadow: inset 0 0 0 1px rgba(97, 97, 255, 0.12), 0 4px 10px rgba(97, 97, 255, 0.12);
}

.ribbon-icon {
    border-color: #dadaff;
    border-radius: 8px;
    color: var(--balloon-purple-dark);
    background: var(--balloon-purple-soft);
}

.ribbon-option-row label,
.ribbon-field-grid label,
.ribbon-color-grid label,
.ribbon-color-grid-2x2 .ribbon-transparency {
    color: var(--balloon-muted);
}

.ribbon-option-row input[type="number"],
.ribbon-option-row select,
.ribbon-field-grid input[type="number"],
.ribbon-field-grid select,
.ribbon-color-grid input[type="color"],
.ribbon-color-value {
    border-color: #d8d9df;
    border-radius: 8px;
    color: var(--balloon-text);
    background-color: #ffffff;
}

.ribbon-option-row input:focus,
.ribbon-option-row select:focus,
.ribbon-color-grid input:focus,
.ribbon-color-value:focus-visible {
    border-color: var(--balloon-purple);
    box-shadow: 0 0 0 3px rgba(97, 97, 255, 0.16);
    outline: none;
}

.ribbon-color-value:hover {
    border-color: #a9a9ff;
    color: var(--balloon-purple-dark);
    background: #f7f7ff;
}

.ribbon-transparency-menu {
    border-color: var(--balloon-border);
    border-radius: 10px;
    box-shadow: 0 14px 34px rgba(50, 51, 56, 0.18);
}

.ribbon-transparency-menu input[type="range"] {
    accent-color: var(--balloon-purple);
}

.offline-viewer-frame,
.offline-sidebar section {
    border: 1px solid var(--balloon-border);
    border-radius: 12px;
    background: var(--balloon-surface);
    box-shadow: 0 5px 18px rgba(50, 51, 56, 0.06);
}

.offline-pdf-viewer {
    border-radius: 11px;
    background: #e9eaf0;
}

.offline-sidebar {
    gap: 14px;
}

.offline-sidebar section {
    padding: 16px;
}

.offline-sidebar h3 {
    color: var(--balloon-text);
    font-size: 15px;
    font-weight: 700;
}

.offline-selected-form label,
.offline-scope-note {
    color: var(--balloon-muted);
}

.offline-selected-form input {
    border-color: #d8d9df;
    border-radius: 8px;
    color: var(--balloon-text);
}

.offline-selected-form input:focus {
    border-color: var(--balloon-purple);
    box-shadow: 0 0 0 3px rgba(97, 97, 255, 0.16);
    outline: none;
}

.offline-selected-form input:disabled {
    color: var(--balloon-muted);
    background: #f6f7fb;
}

.drawing-characteristic-list button,
.characteristic-selection-option {
    border-color: var(--balloon-border);
    border-radius: 9px;
    color: var(--balloon-text);
    background: #f8f8fb;
}

.drawing-characteristic-list button:hover,
.drawing-characteristic-list button.is-active,
.characteristic-selection-option:hover,
.characteristic-selection-option.is-selected {
    border-color: #a9a9ff;
    color: var(--balloon-purple-dark);
    background: var(--balloon-purple-soft);
}

.offline-viewer-tools,
.offline-minimap,
.offline-custom-scrollbar {
    border-color: rgba(216, 217, 223, 0.94);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 10px 26px rgba(50, 51, 56, 0.14);
}

.offline-viewer-tools button {
    border-color: #d8d9df;
    color: #4b4d5c;
}

.offline-viewer-tools button:hover {
    border-color: #a9a9ff;
    color: var(--balloon-purple-dark);
    background: #f7f7ff;
}

.offline-minimap-viewport {
    background: rgba(97, 97, 255, 0.14);
    box-shadow: inset 0 0 0 2px var(--balloon-purple), 0 0 0 1px rgba(255, 255, 255, 0.86);
}

.offline-custom-scrollbar-thumb {
    background: var(--balloon-purple);
    box-shadow: 0 2px 7px rgba(80, 52, 255, 0.25);
}

.offline-empty-state {
    border-color: #c7c8d1;
    border-radius: 12px;
    color: var(--balloon-muted);
    background: rgba(255, 255, 255, 0.88);
}

.offline-empty-state h3 {
    color: var(--balloon-text);
}

.offline-empty-state.is-drag-over {
    border-color: var(--balloon-purple);
    background: var(--balloon-purple-soft);
    box-shadow: 0 18px 34px rgba(97, 97, 255, 0.16);
}

.offline-open-large {
    border-color: var(--balloon-purple);
    border-radius: 9px;
    background: var(--balloon-purple);
    box-shadow: 0 4px 11px rgba(97, 97, 255, 0.2);
}

.offline-open-large:hover {
    border-color: var(--balloon-purple-dark);
    background: var(--balloon-purple-dark);
}

.offline-countdown-toast {
    border-color: #cacaFF;
    border-radius: 10px;
    color: var(--balloon-text);
    background: var(--balloon-purple-soft);
    box-shadow: 0 14px 34px rgba(50, 51, 56, 0.2);
}

.offline-countdown-toast strong {
    color: var(--balloon-purple-dark);
}

.offline-balloon-marker.is-selected {
    outline-color: rgba(97, 97, 255, 0.42);
}

.balloon-overlay.is-drop-target::after {
    border-color: rgba(97, 97, 255, 0.32);
}

.offline-balloon-marker.is-dragging {
    outline-color: rgba(97, 97, 255, 0.54);
    box-shadow: 0 0 0 8px rgba(97, 97, 255, 0.13), 0 12px 28px rgba(50, 51, 56, 0.3);
}

[data-characteristic-manager-modal] .modal-content,
[data-characteristic-selection-modal] .modal-content {
    border-color: var(--balloon-border, #e6e7eb);
    border-radius: 12px;
    box-shadow: 0 24px 60px rgba(50, 51, 56, 0.24);
}

[data-characteristic-manager-modal] .modal-header,
[data-characteristic-manager-modal] .modal-footer,
[data-characteristic-selection-modal] .modal-header,
[data-characteristic-selection-modal] .modal-footer {
    border-color: #ececf1;
}

[data-characteristic-manager-modal] .btn-primary,
[data-characteristic-selection-modal] .btn-primary {
    --bs-btn-bg: #6161ff;
    --bs-btn-border-color: #6161ff;
    --bs-btn-hover-bg: #5034ff;
    --bs-btn-hover-border-color: #5034ff;
    --bs-btn-active-bg: #5034ff;
    --bs-btn-active-border-color: #5034ff;
}

[data-characteristic-manager-modal] .form-control:focus,
[data-characteristic-selection-modal] .form-control:focus {
    border-color: #6161ff;
    box-shadow: 0 0 0 3px rgba(97, 97, 255, 0.16);
}

/* Database-backed document editor integration -------------------------- */
.drawing-editor {
    --balloon-purple: #6161ff;
    --balloon-purple-dark: #5034ff;
    --balloon-purple-soft: #eeeeff;
    --balloon-text: #323338;
    --balloon-muted: #676879;
    --balloon-border: #e6e7eb;
    --balloon-surface: #ffffff;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 10px;
}

.drawing-database-ribbon {
    min-width: 0;
    max-width: 100%;
    margin: 0;
}

.drawing-database-ribbon > .ribbon-group {
    padding-right: 8px;
    padding-left: 8px;
}

.drawing-database-ribbon .ribbon-back-group {
    margin-left: 0;
    border-right: 0;
    border-left: 1px solid var(--balloon-border);
}

.drawing-database-ribbon .ribbon-document-info {
    margin-left: auto;
}

.ribbon-document-info dl {
    display: grid;
    gap: 6px;
    width: 170px;
    margin: 0;
}

.ribbon-document-info dl > div {
    display: grid;
    grid-template-columns: 50px minmax(0, 1fr);
    align-items: center;
    gap: 7px;
    min-height: 30px;
}

.ribbon-document-info dt {
    color: #9293a3;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.ribbon-document-info dd {
    overflow: hidden;
    margin: 0;
    color: var(--balloon-text);
    font-size: 12px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.drawing-database-ribbon a.ribbon-command {
    text-decoration: none;
}

.drawing-database-ribbon .ribbon-command.is-active {
    border-color: var(--balloon-purple);
    color: var(--balloon-purple-dark);
    background: var(--balloon-purple-soft);
}

.drawing-database-ribbon .ribbon-balloon-preview {
    width: 26px;
    height: 26px;
    border: 1px solid #000000;
    color: #000000;
    background: #ffffff;
    font-family: Arial, sans-serif;
    font-size: 12px;
    font-weight: 700;
    line-height: 0.85;
    white-space: pre-line;
}

.drawing-database-ribbon [data-db-tool-preview="special"] {
    background: #ffff00;
    font-size: 10px;
}

.drawing-database-ribbon [data-db-tool-preview="critical"] {
    background: #ffa500;
    font-size: 10px;
}

.drawing-database-ribbon .ribbon-colors-group {
    padding-right: 9px;
    padding-left: 9px;
}

.drawing-database-ribbon .ribbon-colors-group .ribbon-controls {
    gap: 0;
}

.drawing-database-ribbon .ribbon-colors-group .ribbon-color-grid-2x2 {
    grid-template-columns: 72px 94px;
    column-gap: 8px;
}

.drawing-database-ribbon .ribbon-colors-group .ribbon-color-grid-2x2 label,
.drawing-database-ribbon .ribbon-colors-group .ribbon-transparency {
    gap: 6px;
}

.drawing-database-ribbon .ribbon-colors-group .ribbon-color-grid-2x2 label > span {
    min-width: 28px;
}

.drawing-database-ribbon .ribbon-balloon-layout {
    gap: 8px;
}

.drawing-database-ribbon .ribbon-option-row {
    gap: 6px;
}

.drawing-database-ribbon .ribbon-option-row label {
    gap: 5px;
}

.drawing-database-ribbon .ribbon-option-row label > span {
    width: 46px;
}

.drawing-database-ribbon .ribbon-option-row input[type="number"] {
    width: 58px;
}

.drawing-database-ribbon .ribbon-option-font {
    width: 181px;
}

.drawing-database-ribbon .ribbon-option-font select {
    width: 130px;
}

.drawing-database-ribbon .ribbon-font-buttons {
    gap: 4px;
    flex-basis: 64px;
}

.drawing-database-ribbon .ribbon-font-buttons .ribbon-command {
    width: 30px;
    min-width: 30px;
}

.drawing-database-ribbon .ribbon-apply-style {
    width: 78px;
    min-width: 78px;
    padding-right: 6px;
    padding-left: 6px;
}

.drawing-database-ribbon .ribbon-apply-prefix-stack .ribbon-apply-style {
    width: 100%;
}

.drawing-balloon-zoom-overlay {
    top: 12px;
    gap: 4px;
    padding: 5px 7px;
    border-color: rgba(216, 217, 223, 0.88);
    border-radius: 9px;
    opacity: 0.36;
    box-shadow: 0 8px 20px rgba(50, 51, 56, 0.14);
}

.drawing-balloon-zoom-overlay .icon-button,
.drawing-balloon-zoom-overlay .drawing-zoom-fit {
    display: inline-grid;
    width: 30px;
    height: 30px;
    min-height: 30px;
    padding: 0;
    place-items: center;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--balloon-text);
    background: transparent;
    box-shadow: none;
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

.drawing-balloon-zoom-overlay .drawing-zoom-fit {
    width: auto;
    padding: 0 7px;
    font-size: 12px;
}

.drawing-balloon-zoom-overlay .icon-button:hover,
.drawing-balloon-zoom-overlay .icon-button:focus-visible,
.drawing-balloon-zoom-overlay .drawing-zoom-fit:hover,
.drawing-balloon-zoom-overlay .drawing-zoom-fit:focus-visible {
    border-color: #dadaff;
    color: var(--balloon-purple-dark);
    background: var(--balloon-purple-soft);
    outline: none;
}

.drawing-balloon-zoom-overlay .drawing-zoom-percentage {
    min-width: 42px;
    color: var(--balloon-text);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.drawing-balloon-zoom-overlay .drawing-zoom-divider {
    align-self: stretch;
    width: 1px;
    margin: 3px 2px;
    background: var(--balloon-border);
}

.drawing-editor [data-pdf-viewer] {
    scrollbar-color: var(--balloon-purple) rgba(255, 255, 255, 0.75);
    scrollbar-width: thin;
}

.drawing-editor [data-pdf-viewer]::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

.drawing-editor [data-pdf-viewer]::-webkit-scrollbar-track {
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.75);
}

.drawing-editor [data-pdf-viewer]::-webkit-scrollbar-thumb {
    border: 2px solid rgba(255, 255, 255, 0.75);
    border-radius: 999px;
    background: var(--balloon-purple);
}

.drawing-editor [data-pdf-viewer].is-middle-panning,
.drawing-editor [data-pdf-viewer].is-middle-panning * {
    cursor: grabbing !important;
    user-select: none;
}

/* Offline editor bottom workbook layout -------------------------------- */
.offline-standalone-shell .offline-ribbon {
    overflow: visible;
}

.offline-file-menu {
    position: relative;
}

.offline-file-menu > summary {
    list-style: none;
}

.offline-file-menu > summary::-webkit-details-marker {
    display: none;
}

.offline-file-menu[open] > summary {
    border-color: var(--balloon-purple);
    color: var(--balloon-purple-dark);
    background: var(--balloon-purple-soft);
}

.offline-file-menu-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 100;
    display: grid;
    width: 220px;
    padding: 6px;
    border: 1px solid var(--balloon-border);
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 14px 34px rgba(50, 51, 56, 0.18);
}

.offline-file-menu-panel button,
.offline-file-menu-panel label {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 34px;
    margin: 0;
    padding: 0 10px;
    border: 0;
    border-radius: 6px;
    color: var(--balloon-text);
    background: transparent;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.offline-file-menu-panel button:hover,
.offline-file-menu-panel label:hover {
    color: var(--balloon-purple-dark);
    background: var(--balloon-purple-soft);
}

.offline-file-menu-panel input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.offline-workspace.offline-workspace-stacked {
    position: relative;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) clamp(150px, 18vh, 220px);
    gap: 10px;
}

.offline-workspace.offline-workspace-stacked.is-data-panel-collapsed {
    grid-template-rows: minmax(0, 1fr) 0;
    gap: 0;
}

.offline-workspace-stacked.is-data-panel-collapsed .offline-data-panel {
    visibility: hidden;
    pointer-events: none;
}

.offline-data-panel-toggle {
    position: absolute;
    right: 14px;
    bottom: calc(clamp(150px, 18vh, 220px) - 31px);
    z-index: 18;
    min-width: 88px;
    height: 27px;
    padding: 0 10px;
    border: 1px solid #cfd1d8;
    border-radius: 5px;
    color: #4b4d5c;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 7px rgba(50, 51, 56, 0.12);
    font: inherit;
    font-size: 11px;
    font-weight: 700;
    transition: background 120ms ease, border-color 120ms ease, color 120ms ease, bottom 120ms ease;
}

.offline-data-panel-toggle:hover,
.offline-data-panel-toggle:focus-visible {
    border-color: #217346;
    color: #217346;
    background: #ffffff;
    outline: none;
}

.offline-workspace-stacked.is-data-panel-collapsed .offline-data-panel-toggle {
    bottom: 12px;
    opacity: 0.72;
}

.offline-workspace-stacked.is-data-panel-collapsed .offline-data-panel-toggle:hover,
.offline-workspace-stacked.is-data-panel-collapsed .offline-data-panel-toggle:focus-visible {
    opacity: 1;
}

.offline-workspace-stacked > .offline-viewer-frame {
    min-height: 0;
}

.offline-data-panel {
    display: grid;
    grid-template-rows: 34px minmax(0, 1fr);
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border: 1px solid #cfd1d8;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(50, 51, 56, 0.06);
}

.offline-data-tabs {
    display: flex;
    align-items: end;
    gap: 1px;
    padding: 3px 112px 0 6px;
    border-bottom: 1px solid #cfd1d8;
    background: #f5f6f8;
}

.offline-data-tabs button {
    min-height: 30px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-bottom: 0;
    border-radius: 6px 6px 0 0;
    color: #676879;
    background: transparent;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
}

.offline-data-tabs button.is-active {
    border-color: #cfd1d8;
    color: #217346;
    background: #ffffff;
}

.offline-data-tabs button span {
    display: inline-grid;
    min-width: 20px;
    margin-left: 5px;
    padding: 1px 5px;
    place-items: center;
    border-radius: 999px;
    background: #e8f3ec;
    color: #217346;
    font-size: 10px;
}

.offline-data-tab-panel {
    display: none;
    grid-template-rows: auto minmax(0, 1fr);
    min-width: 0;
    min-height: 0;
}

.offline-data-tab-panel.is-active {
    display: grid;
}

.offline-sheet-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 34px;
    padding: 4px 9px;
    border-bottom: 1px solid #dfe1e6;
    background: #ffffff;
    color: #323338;
    font-size: 12px;
}

.offline-sheet-toolbar > div:first-child {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.offline-sheet-toolbar small,
.offline-sheet-toolbar strong {
    color: #676879;
    font-size: 11px;
    font-weight: 500;
}

.offline-sheet-actions,
.offline-sheet-row-actions {
    display: flex;
    align-items: center;
    gap: 5px;
}

.offline-sheet-actions button,
.offline-sheet-row-actions button,
.offline-characteristic-sheet td > button,
.offline-tolerance-sheet td > button {
    min-height: 29px;
    padding: 0 8px;
    border: 1px solid #cfd1d8;
    border-radius: 4px;
    color: #323338;
    background: #ffffff;
    font: inherit;
    font-size: 12px;
    white-space: nowrap;
}

.offline-sheet-actions button:hover,
.offline-sheet-row-actions button:hover,
.offline-characteristic-sheet td > button:hover,
.offline-tolerance-sheet td > button:hover {
    border-color: #217346;
    color: #217346;
    background: #f0f8f3;
}

.offline-sheet-row-actions button.is-danger,
.offline-characteristic-sheet button.is-danger,
.offline-tolerance-sheet button.is-danger {
    color: #c21e56;
}

.offline-sheet-scroll {
    min-width: 0;
    min-height: 0;
    overflow: auto;
}

.offline-sheet-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    color: #323338;
    font-size: 13px;
}

.offline-sheet-table th,
.offline-sheet-table td {
    height: 38px;
    padding: 4px 8px;
    overflow: hidden;
    border-right: 1px solid #dfe1e6;
    border-bottom: 1px solid #dfe1e6;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.offline-sheet-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    height: 34px;
    color: #4b4d5c;
    background: #f1f2f4;
    font-weight: 700;
}

.offline-sheet-table tbody tr:hover,
.offline-sheet-table tbody tr.is-active {
    background: #e8f3ec;
}

.offline-sheet-table input {
    width: 100%;
    height: 29px;
    min-height: 29px;
    padding: 0 7px;
    border: 1px solid transparent;
    border-radius: 2px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 400;
}

.offline-sheet-table select {
    appearance: none;
    width: 100%;
    height: 29px;
    min-height: 29px;
    padding: 0 28px 0 9px;
    border: 1px solid #cfd1d8;
    border-radius: 6px;
    background-color: #ffffff;
    background-image: linear-gradient(45deg, transparent 50%, #676879 50%), linear-gradient(135deg, #676879 50%, transparent 50%);
    background-position: calc(100% - 13px) 11px, calc(100% - 9px) 11px;
    background-repeat: no-repeat;
    background-size: 4px 4px, 4px 4px;
    color: #323338;
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}

.offline-sheet-table input:hover,
.offline-sheet-table input:focus,
.offline-sheet-table select:hover,
.offline-sheet-table select:focus {
    border-color: #6161ff;
    background-color: #ffffff;
    outline: none;
}

.offline-sheet-table select:focus {
    background-image: linear-gradient(45deg, transparent 50%, #5034ff 50%), linear-gradient(135deg, #5034ff 50%, transparent 50%);
    background-position: calc(100% - 13px) 11px, calc(100% - 9px) 11px;
    background-repeat: no-repeat;
    background-size: 4px 4px, 4px 4px;
    box-shadow: 0 0 0 2px rgba(97, 97, 255, 0.14);
}

.offline-sheet-table input:disabled,
.offline-sheet-table select:disabled {
    color: #a4a6b0;
    background: #f5f6f8;
    cursor: not-allowed;
}

.offline-sheet-table input[readonly] {
    color: #676879;
    cursor: default;
}

.offline-data-tab-panel[data-bottom-panel="balloons"] .offline-sheet-table {
    min-width: 1780px;
}

.offline-data-tab-panel[data-bottom-panel="balloons"] th:nth-child(1) { width: 64px; }
.offline-data-tab-panel[data-bottom-panel="balloons"] th:nth-child(2) { width: 72px; }
.offline-data-tab-panel[data-bottom-panel="balloons"] th:nth-child(3) { width: 180px; }
.offline-data-tab-panel[data-bottom-panel="balloons"] th:nth-child(4) { width: 150px; }
.offline-data-tab-panel[data-bottom-panel="balloons"] th:nth-child(5) { width: 100px; }
.offline-data-tab-panel[data-bottom-panel="balloons"] th:nth-child(6),
.offline-data-tab-panel[data-bottom-panel="balloons"] th:nth-child(7),
.offline-data-tab-panel[data-bottom-panel="balloons"] th:nth-child(8),
.offline-data-tab-panel[data-bottom-panel="balloons"] th:nth-child(9) { width: 100px; }
.offline-data-tab-panel[data-bottom-panel="balloons"] th:nth-child(10) { width: 90px; }
.offline-data-tab-panel[data-bottom-panel="balloons"] th:nth-child(11) { width: 390px; }
.offline-data-tab-panel[data-bottom-panel="balloons"] th:nth-child(12) { width: 55px; }
.offline-data-tab-panel[data-bottom-panel="balloons"] th:last-child { width: 215px; }

.offline-characteristic-sheet th:nth-child(1) { width: 110px; }
.offline-characteristic-sheet th:nth-child(2) { width: auto; }
.offline-characteristic-sheet th:nth-child(3) { width: 160px; }
.offline-characteristic-sheet th:nth-child(4) { width: 75px; }

.offline-characteristic-sheet tr.is-characteristic-draft td {
    background: #fafbfc;
}

.offline-characteristic-sheet tr.is-characteristic-draft input {
    border-style: dashed;
    border-color: #cfd1d8;
    background: #ffffff;
}

.offline-characteristic-sheet input[aria-invalid="true"] {
    border-color: #c21e56;
    background: #fff1f5;
}

.offline-tolerance-toolbar {
    justify-content: flex-start;
    white-space: nowrap;
}

.offline-tolerance-toolbar > div:first-child {
    margin-right: auto;
}

.offline-tolerance-toolbar label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    color: #4b4d5c;
    font-size: 12px;
    font-weight: 600;
}

.offline-tolerance-toolbar select,
.offline-tolerance-toolbar button {
    height: 29px;
    padding: 0 9px;
    border: 1px solid #cfd1d8;
    border-radius: 4px;
    color: #323338;
    background: #ffffff;
    font: inherit;
    font-size: 12px;
}

.offline-tolerance-toolbar [data-tolerance-preset] {
    width: 235px;
}

.offline-tolerance-toolbar [data-tolerance-unit] {
    width: 70px;
}

.offline-tolerance-toolbar button {
    color: #217346;
    font-weight: 700;
}

.offline-tolerance-toolbar select:hover,
.offline-tolerance-toolbar select:focus,
.offline-tolerance-toolbar button:hover {
    border-color: #217346;
    outline: none;
}

.offline-tolerance-sheet {
    min-width: 900px;
}

.offline-tolerance-sheet th:nth-child(1),
.offline-tolerance-sheet th:nth-child(2),
.offline-tolerance-sheet th:nth-child(3),
.offline-tolerance-sheet th:nth-child(4) {
    width: 145px;
}

.offline-tolerance-sheet th:nth-child(5) {
    width: auto;
}

.offline-tolerance-sheet th:nth-child(6) {
    width: 85px;
}

.offline-characteristic-attach {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) auto auto;
    align-items: center;
    gap: 5px;
}

.offline-characteristic-attach select {
    height: 25px;
    min-width: 0;
    border: 1px solid #cfd1d8;
    border-radius: 4px;
    background: #ffffff;
    color: #323338;
    font: inherit;
}

.offline-characteristic-attach button:disabled {
    color: #a4a6b0;
    background: #f5f6f8;
    cursor: not-allowed;
}

.offline-balloon-characteristics {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    height: 30px;
    white-space: nowrap;
}

.offline-attached-list {
    display: flex;
    flex: 1 1 auto;
    flex-wrap: nowrap;
    gap: 3px;
    min-width: 55px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
}

.offline-attached-list::-webkit-scrollbar {
    display: none;
}

.offline-attached-chip {
    display: inline-flex;
    overflow: hidden;
    border: 1px solid #9bc8aa;
    border-radius: 4px;
    background: #e8f3ec;
}

.offline-attached-chip button {
    min-height: 24px;
    padding: 0 6px;
    border: 0;
    border-radius: 0;
    color: #17683a;
    background: transparent;
    font: inherit;
    font-weight: 600;
}

.offline-attached-chip button:last-child {
    border-left: 1px solid #b9d8c3;
    color: #c21e56;
}

.offline-no-characteristics {
    color: #a4a6b0;
    line-height: 24px;
}

.offline-characteristic-picker {
    display: grid;
    flex: 0 0 230px;
    grid-template-columns: 96px minmax(0, 1fr);
    align-items: center;
    gap: 4px;
}

.offline-characteristic-picker button {
    height: 29px;
    min-width: 0;
    overflow: hidden;
    padding: 0 24px 0 8px;
    border: 1px solid #cfd1d8;
    border-radius: 6px;
    color: #323338;
    background: #ffffff;
    font: inherit;
    font-weight: 500;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: border-color 120ms ease, box-shadow 120ms ease, color 120ms ease;
}

.offline-characteristic-picker button:hover,
.offline-characteristic-picker button:focus-visible {
    border-color: #6161ff;
    color: #5034ff;
    box-shadow: 0 0 0 2px rgba(97, 97, 255, 0.14);
    outline: none;
}

.offline-characteristic-picker button:disabled {
    color: #a4a6b0;
    background: #f5f6f8;
}

.offline-enhanced-select {
    position: relative;
    width: 100%;
    min-width: 0;
}

select.offline-native-select-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    min-height: 1px !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.offline-table-select-trigger {
    display: flex;
    width: 100%;
    min-width: 0;
    height: 29px;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 10px;
    border: 1px solid #cfd1d8;
    border-radius: 7px;
    color: #323338;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(50, 51, 56, 0.05);
    font: inherit;
    font-size: 12px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: border-color 120ms ease, box-shadow 120ms ease, color 120ms ease, background-color 120ms ease;
}

.offline-table-select-trigger > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.offline-table-select-trigger > i {
    flex: none;
    width: 7px;
    height: 7px;
    margin: -3px 1px 0 0;
    border-right: 2px solid #676879;
    border-bottom: 2px solid #676879;
    transform: rotate(45deg);
    transition: transform 120ms ease, margin 120ms ease, border-color 120ms ease;
}

.offline-table-select-trigger:hover,
.offline-table-select-trigger:focus-visible,
.offline-table-select-trigger[aria-expanded="true"] {
    border-color: #6161ff;
    color: #5034ff;
    background: #fbfaff;
    box-shadow: 0 0 0 3px rgba(97, 97, 255, 0.14);
    outline: none;
}

.offline-table-select-trigger[aria-expanded="true"] > i {
    margin-top: 3px;
    border-color: #5034ff;
    transform: rotate(225deg);
}

.offline-table-select-trigger:disabled {
    color: #9699a6;
    background: #f5f6f8;
    box-shadow: none;
    cursor: not-allowed;
}

.offline-tolerance-toolbar .offline-enhanced-select.is-preset-select {
    width: 220px;
}

.offline-tolerance-toolbar .offline-enhanced-select.is-unit-select {
    width: 82px;
}

.ribbon-option-font .offline-enhanced-select {
    width: 148px;
    flex: none;
}

.ribbon-option-font .offline-table-select-trigger {
    height: 30px;
    border-color: #d8d9df;
    border-radius: 8px;
    font-size: 11px;
}

.offline-table-select-menu {
    position: fixed;
    z-index: 6000;
    display: grid;
    gap: 2px;
    padding: 6px;
    overflow-y: auto;
    border: 1px solid #d0d4e4;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 12px 30px rgba(50, 51, 56, 0.2), 0 3px 8px rgba(50, 51, 56, 0.1);
}

.offline-table-select-option {
    display: flex;
    width: 100%;
    min-height: 34px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 10px;
    border: 0;
    border-radius: 7px;
    color: #323338;
    background: transparent;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
}

.offline-table-select-option:hover,
.offline-table-select-option:focus-visible {
    color: #5034ff;
    background: #f0efff;
    outline: none;
}

.offline-table-select-option.is-selected {
    color: #5034ff;
    background: #f5f4ff;
    font-weight: 700;
}

.offline-table-select-option:disabled {
    color: #b1b3bd;
    background: transparent;
    cursor: not-allowed;
}

.offline-table-select-check {
    flex: none;
    color: #6161ff;
    font-size: 14px;
    font-weight: 800;
}

.offline-characteristic-popup.dropdown-menu {
    position: fixed !important;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    min-width: 260px;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid #cfd1d8;
    border-radius: 7px;
    background: #ffffff;
    box-shadow: 0 12px 32px rgba(50, 51, 56, 0.2);
    font-size: 13px;
}

.offline-characteristic-popup-search {
    flex: 0 0 auto;
    padding: 8px;
    border-bottom: 1px solid #e1e2e6;
    background: #ffffff;
}

.offline-characteristic-popup-search input {
    height: 32px;
    font-size: 13px;
}

.offline-characteristic-popup-options {
    min-height: 0;
    overflow-y: auto;
    padding: 4px 0;
}

.offline-characteristic-popup .dropdown-item {
    display: grid;
    grid-template-columns: minmax(42px, auto) minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    min-height: 34px;
    padding: 5px 10px;
    font-size: 13px;
    white-space: nowrap;
}

.offline-characteristic-popup .dropdown-item:hover,
.offline-characteristic-popup .dropdown-item:focus {
    color: #17683a;
    background: #e8f3ec;
}

.offline-characteristic-popup .dropdown-item span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.offline-characteristic-popup-empty {
    padding: 12px;
    color: #676879;
    text-align: center;
}

/* Compact offline editor chrome ----------------------------------------- */
.offline-standalone-shell .offline-standalone-topbar {
    min-height: 58px;
    padding: 6px 22px;
    gap: 12px;
}

.offline-standalone-shell .offline-header-copy .app-kicker {
    font-size: 10px;
    line-height: 1.1;
}

.offline-standalone-shell .offline-header-copy h1 {
    font-size: 17px;
    line-height: 1.15;
}

.offline-standalone-shell .offline-file-status {
    font-size: 12px;
}

.offline-standalone-shell .offline-balloon-main {
    height: calc(100vh - 58px);
    min-height: 620px;
    padding: 10px 14px 14px;
}

.offline-standalone-shell .offline-balloon-app {
    gap: 10px;
}

.offline-standalone-shell .offline-data-tabs {
    padding-right: 6px;
}

.offline-standalone-shell .ribbon-group {
    gap: 6px;
    padding: 9px 11px 7px;
}

.offline-standalone-shell .ribbon-group h3 {
    font-size: 11px;
    line-height: normal;
}

.offline-standalone-shell .ribbon-controls {
    gap: 8px;
    min-height: 78px;
}

.offline-standalone-shell .ribbon-command {
    min-height: 30px;
    border-radius: 8px;
    font-size: 12px;
}

.offline-standalone-shell .ribbon-command-large {
    width: 84px;
    min-width: 84px;
    height: 70px;
    min-height: 70px;
    padding: 6px 8px;
}

.offline-standalone-shell .ribbon-icon {
    min-width: 30px;
    height: 30px;
    border-radius: 8px;
    font-size: 11px;
}

.offline-standalone-shell .ribbon-stack {
    grid-template-rows: repeat(2, 32px);
    gap: 6px;
}

.offline-standalone-shell .ribbon-stack > .ribbon-command {
    height: 32px;
    min-height: 32px;
}

.offline-standalone-shell .offline-history-controls > .ribbon-command {
    display: flex;
    min-width: 86px;
    align-items: center;
    justify-content: flex-start;
    gap: 7px;
    padding: 0 11px;
}

.offline-standalone-shell .offline-history-controls > .ribbon-command span {
    font-size: 18px;
    line-height: 1;
}

.offline-standalone-shell .ribbon-balloon-rows,
.offline-standalone-shell .ribbon-apply-prefix-stack {
    min-height: 78px;
    gap: 7px;
}

.offline-standalone-shell .ribbon-apply-prefix-stack {
    height: 70px;
    min-height: 70px;
    max-height: 70px;
    align-self: center;
    gap: 6px;
}

.offline-standalone-shell .ribbon-apply-prefix-stack .ribbon-apply-style {
    width: 100%;
    min-width: 0;
    height: auto;
    min-height: 0;
}

.offline-standalone-shell .ribbon-option-row {
    gap: 8px;
}

.offline-standalone-shell .ribbon-option-row label {
    gap: 6px;
    font-size: 11px;
}

.offline-standalone-shell .ribbon-option-row input[type="number"],
.offline-standalone-shell .ribbon-option-row select,
.offline-standalone-shell .ribbon-prefix-options input[type="text"] {
    min-height: 32px;
    height: 32px;
}

.offline-standalone-shell .ribbon-option-row .ribbon-command,
.offline-standalone-shell .ribbon-prefix-options > .ribbon-command {
    min-height: 32px;
    height: 32px;
}

.offline-standalone-shell .ribbon-option-font .offline-table-select-trigger {
    height: 32px;
}

.offline-standalone-shell .ribbon-color-grid-2x2 {
    grid-template-rows: repeat(2, 32px);
    gap: 6px 10px;
}

.offline-standalone-shell .ribbon-color-grid input[type="color"],
.offline-standalone-shell .ribbon-color-value {
    height: 30px;
}

.offline-standalone-shell .offline-data-panel-toggle {
    right: auto;
    left: 16px;
    bottom: calc(clamp(150px, 18vh, 220px) + 5px);
    display: grid;
    width: 40px;
    min-width: 40px;
    height: 40px;
    place-items: center;
    padding: 0;
    border-radius: 50%;
    border: 2px solid #5034ff;
    color: #ffffff;
    background: #6161ff;
    box-shadow: 0 5px 14px rgba(80, 52, 255, 0.32);
    line-height: 1;
}

.offline-standalone-shell .offline-data-panel-toggle svg {
    display: block;
    width: 22px;
    height: 22px;
    overflow: visible;
    fill: none;
    stroke: currentColor;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 140ms ease;
}

.offline-standalone-shell .offline-data-panel-toggle[aria-expanded="false"] svg {
    transform: rotate(180deg);
}

.offline-standalone-shell .offline-workspace-stacked.is-data-panel-collapsed .offline-data-panel-toggle {
    bottom: 10px;
    opacity: 1;
}

.offline-workspace-tabs {
    display: flex;
    min-width: 0;
    align-items: end;
    gap: 1px;
    padding: 3px 112px 0 6px;
    overflow-x: auto;
    overflow-y: hidden;
    border: 1px solid #cfd1d8;
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
    background: #f5f6f8;
}

.offline-workspace-tabs[hidden] {
    display: none;
}

.offline-workspace-tabs button {
    flex: none;
    min-height: 30px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-bottom: 0;
    border-radius: 6px 6px 0 0;
    color: #676879;
    background: transparent;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.offline-workspace-tabs button.is-active {
    border-color: #cfd1d8;
    color: #217346;
    background: #ffffff;
}

.offline-workspace-tabs button span {
    display: inline-grid;
    min-width: 20px;
    margin-left: 5px;
    padding: 1px 5px;
    place-items: center;
    border-radius: 999px;
    color: #217346;
    background: #e8f3ec;
    font-size: 10px;
}

.offline-workspace-stacked.is-tabbed-workspace {
    grid-template-rows: 34px minmax(0, 1fr);
    gap: 0;
}

.offline-workspace-stacked.is-tabbed-workspace > .offline-viewer-frame,
.offline-workspace-stacked.is-tabbed-workspace > .offline-data-panel {
    grid-row: 2;
    border-radius: 0 0 8px 8px;
}

.offline-workspace-stacked.is-tabbed-workspace > .offline-viewer-frame > .offline-pdf-viewer {
    border-radius: 0 0 7px 7px;
}

.offline-workspace-stacked > .offline-viewer-frame[hidden],
.offline-workspace-stacked > .offline-data-panel[hidden] {
    display: none;
}

.offline-workspace-stacked.is-tabbed-workspace > .offline-data-panel {
    grid-template-rows: minmax(0, 1fr);
}

.offline-workspace-stacked.is-tabbed-workspace .offline-data-tabs {
    display: none;
}

.offline-workspace-layout-controls {
    position: absolute;
    left: 16px;
    bottom: calc(clamp(150px, 18vh, 220px) + 5px);
    z-index: 40;
    display: flex;
    gap: 8px;
}

.offline-standalone-shell .offline-workspace-stacked:not(.is-tabbed-workspace) .offline-custom-scrollbar-x {
    left: 116px;
}

.offline-workspace-stacked.is-data-panel-collapsed .offline-workspace-layout-controls {
    bottom: 10px;
}

.offline-workspace-stacked.is-tabbed-workspace .offline-workspace-layout-controls {
    top: 3px;
    right: 10px;
    bottom: auto;
    left: auto;
    gap: 6px;
}

.offline-standalone-shell .offline-workspace-layout-controls .offline-data-panel-toggle,
.offline-standalone-shell .offline-workspace-mode-toggle {
    position: static;
    display: grid;
    width: 40px;
    min-width: 40px;
    height: 40px;
    place-items: center;
    padding: 0;
    border: 2px solid #5034ff;
    border-radius: 50%;
    line-height: 1;
}

.offline-standalone-shell .offline-workspace-mode-toggle {
    color: #5034ff;
    background: #ffffff;
    box-shadow: 0 5px 14px rgba(80, 52, 255, 0.2);
}

.offline-standalone-shell .offline-workspace-mode-toggle[aria-pressed="true"] {
    color: #ffffff;
    background: #6161ff;
}

.offline-standalone-shell .offline-workspace-layout-controls svg {
    display: block;
    width: 22px;
    height: 22px;
    overflow: visible;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.offline-standalone-shell .is-tabbed-workspace .offline-workspace-layout-controls button {
    width: 28px;
    min-width: 28px;
    height: 28px;
    border-width: 1px;
    box-shadow: none;
}

.offline-standalone-shell .is-tabbed-workspace .offline-workspace-layout-controls svg {
    width: 17px;
    height: 17px;
}

/* Balloon context actions and editors ---------------------------------- */
.offline-balloon-context-menu {
    position: fixed;
    z-index: 4000;
    width: 204px;
    padding: 6px;
    border: 1px solid #d0d4e4;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(15, 17, 38, 0.18);
}

.offline-balloon-context-menu[hidden] {
    display: none;
}

.offline-balloon-context-menu button {
    display: flex;
    width: 100%;
    min-height: 36px;
    align-items: center;
    padding: 7px 10px;
    border: 0;
    border-radius: 7px;
    color: #323338;
    background: transparent;
    font-size: 13px;
    font-weight: 500;
    text-align: left;
}

.offline-balloon-context-menu button:hover,
.offline-balloon-context-menu button:focus-visible {
    outline: none;
    background: #f0efff;
    color: #5034ff;
}

.offline-balloon-context-menu button.is-danger {
    color: #d83a52;
}

.offline-balloon-context-menu button.is-danger:hover,
.offline-balloon-context-menu button.is-danger:focus-visible {
    background: #ffebef;
    color: #b63546;
}

.offline-context-divider {
    height: 1px;
    margin: 5px 4px;
    background: #e6e9ef;
}

.offline-balloon-action-modal .modal-content {
    overflow: hidden;
    border: 1px solid #d0d4e4;
    border-radius: 14px;
    box-shadow: 0 18px 50px rgba(15, 17, 38, 0.2);
}

.offline-balloon-action-modal .modal-header,
.offline-balloon-action-modal .modal-footer {
    border-color: #e6e9ef;
}

.offline-balloon-action-modal .modal-header {
    align-items: flex-start;
    padding: 18px 20px;
}

.offline-balloon-action-modal .modal-body {
    padding: 20px;
}

.offline-balloon-action-modal .modal-footer {
    padding: 12px 20px;
}

.offline-balloon-action-modal .modal-kicker {
    margin: 0 0 3px;
    color: #676879;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.offline-balloon-action-modal .modal-title {
    color: #323338;
    font-weight: 700;
}

.offline-balloon-action-modal .btn-primary {
    border-color: #6161ff;
    background: #6161ff;
}

.offline-balloon-action-modal .btn-primary:hover,
.offline-balloon-action-modal .btn-primary:focus {
    border-color: #5034ff;
    background: #5034ff;
}

.offline-dimension-form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.offline-modal-field {
    display: grid;
    gap: 6px;
    min-width: 0;
    color: #323338;
    font-size: 13px;
    font-weight: 600;
}

.offline-modal-field-wide {
    grid-column: span 2;
}

.offline-modal-field .form-control,
.offline-modal-field .form-select {
    min-height: 38px;
    border-color: #c3c6d4;
    border-radius: 7px;
    color: #323338;
    font-size: 14px;
    font-weight: 400;
}

.offline-modal-field .form-control:focus,
.offline-modal-field .form-select:focus {
    border-color: #6161ff;
    box-shadow: 0 0 0 3px rgba(97, 97, 255, 0.14);
}

.offline-modal-field .form-control:disabled,
.offline-modal-field .form-select:disabled {
    color: #9699a6;
    background: #f5f6f8;
}

[data-edit-dimensions-modal] .offline-modal-field .form-control,
[data-edit-dimensions-modal] .offline-modal-field .form-select {
    background-color: #ffffff;
}

[data-edit-dimensions-modal] .offline-modal-field .form-control:disabled,
[data-edit-dimensions-modal] .offline-modal-field .form-select:disabled {
    color: #9699a6;
    background-color: #f1f2f4;
}

.offline-characteristic-modal-search {
    margin-top: 16px;
}

.offline-modal-characteristic-list {
    display: grid;
    max-height: 280px;
    gap: 4px;
    margin-top: 8px;
    padding: 5px;
    overflow-y: auto;
    border: 1px solid #d0d4e4;
    border-radius: 9px;
    background: #ffffff;
}

.offline-modal-characteristic-option {
    display: grid;
    grid-template-columns: minmax(58px, auto) 1fr;
    gap: 10px;
    align-items: center;
    min-height: 40px;
    padding: 8px 10px;
    border: 0;
    border-radius: 7px;
    color: #323338;
    background: transparent;
    font-size: 13px;
    text-align: left;
}

.offline-modal-characteristic-option:hover,
.offline-modal-characteristic-option:focus-visible {
    outline: none;
    background: #f0efff;
    color: #5034ff;
}

.offline-modal-characteristic-option span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.offline-modal-characteristic-empty,
.offline-delete-message {
    margin: 0;
    color: #676879;
    font-size: 14px;
}

.offline-modal-characteristic-empty {
    padding: 18px 12px;
    text-align: center;
}

.ribbon-ocr-icon {
    color: #ffffff;
    background: linear-gradient(145deg, #6161ff, #5034ff);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.offline-standalone-shell [data-start-ocr] {
    grid-template-rows: 24px auto;
    gap: 3px;
    padding: 5px;
    line-height: 1.05;
}

.offline-standalone-shell [data-start-ocr] .ribbon-ocr-icon {
    min-width: 26px;
    height: 24px;
    padding: 0 4px;
    border-radius: 6px;
    font-size: 8px;
}

.offline-standalone-shell [data-start-ocr] > span:last-child {
    max-width: 70px;
    font-size: 10px;
    line-height: 1.1;
    white-space: normal;
}

.offline-ocr-modal .modal-dialog {
    max-width: min(1180px, calc(100vw - 32px));
}

.offline-ocr-status {
    margin-bottom: 14px;
    padding: 10px 12px;
    border: 1px solid #c7c4ff;
    border-radius: 8px;
    color: #4b43a8;
    background: #f0efff;
    font-size: 13px;
    font-weight: 600;
}

.offline-ocr-area-control {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: -2px 0 16px;
    padding: 10px 12px;
    border: 1px solid #e6e9ef;
    border-radius: 9px;
    background: #f8f9fb;
}

.offline-ocr-area-control label {
    display: grid;
    grid-template-columns: max-content minmax(130px, 220px) 42px;
    align-items: center;
    gap: 9px;
    margin: 0;
    color: #323338;
    font-size: 12px;
    font-weight: 600;
}

.offline-ocr-area-control input[type="range"] {
    width: 100%;
    accent-color: #6161ff;
}

.offline-ocr-area-control output {
    color: #5034ff;
    font-weight: 700;
    text-align: right;
}

.offline-ocr-area-control .offline-ocr-rotation-option {
    display: inline-flex;
    grid-template-columns: none;
    min-width: max-content;
    gap: 7px;
    cursor: pointer;
}

.offline-ocr-rotation-option input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: #6161ff;
}

.offline-ocr-area-control small {
    margin-left: auto;
    color: #676879;
    font-size: 11px;
}

.offline-ocr-layout {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 20px;
}

.offline-ocr-source,
.offline-ocr-review {
    min-width: 0;
}

.offline-ocr-section-heading {
    display: flex;
    min-height: 24px;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    color: #323338;
    font-size: 13px;
}

.offline-ocr-section-heading span {
    color: #676879;
    font-size: 11px;
    white-space: nowrap;
}

.offline-ocr-preview {
    position: relative;
    display: flex;
    height: 220px;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    overflow: hidden;
    border: 1px solid #d0d4e4;
    border-radius: 9px;
    background-color: #f5f6f8;
    background-image: linear-gradient(45deg, #eceef3 25%, transparent 25%), linear-gradient(-45deg, #eceef3 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #eceef3 75%), linear-gradient(-45deg, transparent 75%, #eceef3 75%);
    background-position: 0 0, 0 6px, 6px -6px, -6px 0;
    background-size: 12px 12px;
}

.offline-ocr-preview-loading {
    display: grid;
    place-items: center;
    gap: 10px;
    color: #676879;
    font-size: 12px;
    text-align: center;
}

.offline-ocr-preview-loading[hidden] {
    display: none;
}

.offline-ocr-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #d0d4e4;
    border-top-color: var(--balloon-purple, #6161ff);
    border-radius: 50%;
    animation: offline-ocr-spin 0.75s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
    .offline-ocr-spinner { animation-duration: 1.5s; }
}

.offline-ocr-preview img {
    display: block;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    object-fit: contain;
    background: #ffffff;
    pointer-events: none;
}

.offline-ocr-preview img[hidden] {
    display: none;
}

.offline-ocr-source textarea {
    resize: vertical;
}

.offline-ocr-candidates {
    display: grid;
    max-height: 190px;
    gap: 5px;
    margin-bottom: 16px;
    padding: 5px;
    overflow-y: auto;
    border: 1px solid #d0d4e4;
    border-radius: 9px;
    background: #ffffff;
}

.offline-ocr-candidate {
    display: grid;
    grid-template-columns: minmax(100px, 0.65fr) minmax(0, 1.35fr);
    gap: 10px;
    align-items: center;
    min-height: 42px;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 7px;
    color: #323338;
    background: transparent;
    font-size: 12px;
    text-align: left;
}

.offline-ocr-candidate:hover,
.offline-ocr-candidate:focus-visible {
    outline: none;
    background: #f5f6f8;
}

.offline-ocr-candidate.is-selected {
    border-color: #6161ff;
    color: #5034ff;
    background: #f0efff;
}

.offline-ocr-candidate strong,
.offline-ocr-candidate span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.offline-ocr-form {
    gap: 12px;
}

.offline-ocr-footer {
    flex-wrap: nowrap;
}

.offline-ocr-footer [data-ocr-skip] {
    margin-left: auto;
}

@media (max-width: 1100px) {
    .offline-standalone-shell .offline-ribbon {
        overflow-x: auto;
        overflow-y: hidden;
    }

    .offline-sheet-toolbar strong {
        display: none;
    }
}

@media (max-width: 700px) {
    .offline-dimension-form-grid {
        grid-template-columns: 1fr;
    }

    .offline-modal-field-wide {
        grid-column: auto;
    }
}

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

    .offline-ocr-modal .modal-dialog {
        max-width: calc(100vw - 20px);
    }

    .offline-ocr-area-control {
        flex-wrap: wrap;
    }

    .offline-ocr-area-control small {
        width: 100%;
        margin-left: 0;
    }
}
