﻿@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@300;400;500;600&display=swap');

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    color: #1d2733;
    background: #e8edf3;
}

.core-shell.theme-dark {
    --erp-bg-shell: #080c12;
    --erp-bg-header: #0d1219;
    --erp-bg-left: #111720;
    --erp-bg-main: #0f1520;
    --erp-bg-surface: #16202e;
    --erp-bg-raised: #1d2b3a;
    --erp-bg-input: #1a2535;
    --erp-border: #243044;
    --erp-border-2: #2e3f57;
    --erp-text: #dde5f0;
    --erp-text-2: #8fa4be;
    --erp-text-3: #546880;
    --erp-accent: #3b82f6;
    --erp-accent-dim: #1d4ed8;
    --erp-accent-glow: rgba(59, 130, 246, 0.15);
    color: var(--erp-text);
    background: var(--erp-bg-shell);
    border-color: var(--erp-border);
}

.core-shell.theme-dark .core-shell__top-row,
.core-shell.theme-dark .toolbar-row,
.core-shell.theme-dark .core-shell__footer {
    background: var(--erp-bg-header);
    border-color: var(--erp-border);
}

.core-shell.theme-dark .core-shell__logo-bar,
.core-shell.theme-dark .left-panel,
.core-shell.theme-dark .company-region,
.core-shell.theme-dark .context-region,
.core-shell.theme-dark .user-region {
    background: var(--erp-bg-left);
    border-color: var(--erp-border);
    color: var(--erp-text);
}

.core-shell.theme-dark .core-shell__logo-bar {
    background: #061A33;
    border-right: 1px solid #0b1e2f;
}

.core-shell.theme-dark .core-shell__meta-bar,
.core-shell.theme-dark .form-container,
.core-shell.theme-dark .main-grid-shell,
.core-shell.theme-dark .field-column-wrapper,
.core-shell.theme-dark .field-edit-grid-area,
.core-shell.theme-dark .secondary-grid-panel {
    background: var(--erp-bg-main);
    border-color: var(--erp-border);
    color: var(--erp-text);
}

.core-shell.theme-dark .company-picker,
.core-shell.theme-dark .form-field input[type="text"],
.core-shell.theme-dark .form-field input[type="date"],
.core-shell.theme-dark .form-field input[type="number"],
.core-shell.theme-dark .form-field textarea.metadata-long-text,
.core-shell.theme-dark .reference-field__input,
.core-shell.theme-dark .line-cell-input,
.core-shell.theme-dark .workflow-comment {
    background: var(--erp-bg-input);
    border-color: var(--erp-border);
    color: var(--erp-text);
}

.core-shell.theme-dark .form-field input[type="number"],
.core-shell.theme-dark .line-cell-input[type="number"] {
    color-scheme: dark;
}

.core-shell.theme-dark .form-field input[readonly]:not(.picker-field-value) {
    color: #92a7be;
}

.core-shell.theme-dark .context-region {
    font-weight: 400;
    font-size: 0.78rem;
}

.context-bc-item {
    color: var(--erp-text-2);
    font-size: 0.78rem;
    font-weight: 400;
}

.context-bc-sep {
    color: var(--erp-text-3);
    margin: 0 0.35rem;
}

.context-bc-item--active {
    color: var(--erp-text);
    font-weight: 600;
}

.core-shell.theme-dark .left-panel {
    background: var(--erp-bg-left);
    border-right-color: var(--erp-border);
    padding: 0;
}

.core-shell.theme-dark .left-panel__top-icons {
    border-bottom: 1px solid var(--erp-border);
    gap: 0;
    margin: 0;
    padding: 0;
    height: 38px;
}

.core-shell.theme-dark .left-panel__icon-button {
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: transparent;
    color: var(--erp-text-3);
    min-height: 36px;
    height: 36px;
}

.core-shell.theme-dark .left-panel__icon-button--active {
    color: var(--erp-accent);
    background: var(--erp-accent-glow);
    border-bottom-color: var(--erp-accent);
    box-shadow: none;
}

.core-shell.theme-dark .left-panel-flyout {
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 6px 0;
}

.core-shell.theme-dark .panel-drawer__title,
.core-shell.theme-dark .left-panel-menu__group-title {
    background: transparent;
    border: 0;
    color: var(--erp-text-3);
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.core-shell.theme-dark .left-panel-menu__item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 0;
    border-left: 2px solid transparent;
    border-radius: 0;
    color: var(--erp-text-2);
    margin: 0;
    padding: 0.38rem 0.72rem;
}

.core-shell.theme-dark .left-panel-menu__item:hover {
    background: var(--erp-bg-raised);
    color: var(--erp-text);
    border-color: transparent;
}

.core-shell.theme-dark .left-panel-menu__item--selected {
    background: var(--erp-accent-glow);
    color: var(--erp-accent);
    border-left-color: var(--erp-accent);
}

/* Shared left-panel structure baseline for both themes; only colors should differ. */
.core-shell.theme-dark .left-panel,
.core-shell.theme-light .left-panel {
    padding: 0;
}

.core-shell.theme-dark .left-panel__top-icons,
.core-shell.theme-light .left-panel__top-icons {
    gap: 0;
    margin: 0;
    padding: 0;
    height: 38px;
}

.core-shell.theme-dark .left-panel__icon-button,
.core-shell.theme-light .left-panel__icon-button {
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: transparent;
    min-height: 36px;
    height: 36px;
    box-shadow: none;
}

.core-shell.theme-dark .left-panel-flyout,
.core-shell.theme-light .left-panel-flyout {
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 6px 0;
}

html.core-shell-navigating .left-panel-flyout {
    visibility: hidden !important;
}

.core-shell.theme-dark .panel-drawer__title,
.core-shell.theme-dark .left-panel-menu__group-title,
.core-shell.theme-light .panel-drawer__title,
.core-shell.theme-light .left-panel-menu__group-title {
    background: transparent;
    border: 0;
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.core-shell.theme-dark .left-panel-menu__item,
.core-shell.theme-light .left-panel-menu__item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 0;
    border-left: 2px solid transparent;
    border-radius: 0;
    margin: 0;
    padding: 0.38rem 0.72rem;
}

.left-nav-icon {
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.left-nav-icon--emoji {
    font-size: 0.95rem;
    line-height: 1;
}

.left-nav-icon svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.left-nav-icon--tile {
    width: 18px;
    height: 18px;
    padding: 2px;
    box-sizing: border-box;
}

.left-nav-icon--circle {
    border-radius: 999px;
}

.left-nav-icon--square {
    border-radius: 4px;
}

.left-nav-icon--tile svg {
    width: 100%;
    height: 100%;
    stroke-width: 2;
}

.left-nav-icon .lucide-icon-host {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.left-nav-icon .lucide-icon-host svg {
    width: 100%;
    height: 100%;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.left-nav-text {
    min-width: 0;
    background: transparent;
    line-height: 1.24;
    overflow: visible;
    text-overflow: clip;
}

.left-nav-shortcut {
    margin-left: auto;
    margin-right: -0.56rem;
    min-width: 1rem;
    height: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.2rem;
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1;
}

.core-shell.theme-dark .left-nav-shortcut {
    color: #b8c9dc;
    border: 1px solid #2e4a67;
    background: #162b44;
}

.core-shell.theme-light .left-nav-shortcut {
    color: #2f567c;
    border: 1px solid #b8cae0;
    background: #eaf2fb;
}

.action-icon {
    display: inline-block;
    width: 12px;
    margin-right: 5px;
    color: var(--erp-text-2);
    font-weight: 600;
}

.core-shell.theme-dark .action-menu .toolbar-button {
    color: var(--erp-text-2);
    border: 1px solid transparent;
    border-radius: 3px;
}

.core-shell.theme-dark .action-menu .toolbar-button:hover:not(:disabled) {
    color: var(--erp-text);
    background: var(--erp-bg-raised);
    border-color: var(--erp-border-2);
}

.core-shell.theme-dark .action-menu .toolbar-button:disabled {
    color: #6f8299;
    border-color: transparent;
    background: transparent;
    opacity: 0.6;
}

.core-shell.theme-dark .utility-icons {
    border-left: 0;
    padding: 0;
    gap: 0;
    align-items: stretch;
}

.doc-icon-btn {
    box-sizing: border-box;
    flex: 0 0 52px;
    width: 52px;
    min-width: 52px;
    align-self: stretch;
    border: 0;
    border-left: 1px solid var(--erp-border);
    background: transparent;
    color: var(--erp-text-2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 0;
}

.doc-icon-btn:hover {
    background: var(--erp-bg-raised);
    color: var(--erp-accent);
}

.doc-icon-btn--templates:focus,
.doc-icon-btn--templates:focus-visible {
    outline: none;
    box-shadow: none;
}

.doc-icon-btn--disabled {
    color: var(--erp-text-2);
    opacity: 0.45;
    cursor: default;
}

.doc-icon-btn--disabled:hover {
    background: transparent;
    color: var(--erp-text-2);
    opacity: 0.45;
    cursor: default;
}

.doc-icon-btn--active,
.doc-icon-btn--active:not(:disabled):hover {
    color: #f59e0b;
}

.doc-icon-btn__icon {
    width: 15px;
    height: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.doc-icon-btn__icon svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.doc-icon-btn--active .doc-icon-btn__icon svg {
    fill: currentColor;
}

.doc-icon-btn__label {
    font-size: 0.54rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.core-shell.theme-dark .form-container,
.core-shell.theme-dark .form-container * {
    font-family: inherit;
}

.core-shell.theme-dark .main-grid td,
.core-shell.theme-dark .line-cell-input,
.core-shell.theme-dark .reference-field__input,
.core-shell.theme-dark .status-text,
.core-shell.theme-dark .status-history-time {
    font-family: inherit;
}

.core-shell.theme-dark .main-grid th,
.core-shell.theme-dark .main-grid td {
    border-color: var(--erp-border);
}

.core-shell.theme-dark .main-grid th {
    background: var(--erp-bg-surface);
    color: #c5d3e4;
}

.core-shell.theme-dark .main-grid-row--selected td,
.core-shell.theme-dark .field-edit-grid-row--selected td {
    background: rgba(59, 130, 246, 0.12);
    color: var(--erp-text);
}

.core-shell.theme-dark .tab-strip {
    background: var(--erp-bg-surface);
    border-bottom-color: var(--erp-border);
}

.core-shell.theme-dark .tab-button {
    background: #182230;
    border-color: var(--erp-border);
    color: var(--erp-text-2);
}

.core-shell.theme-dark .tab-button:disabled {
    opacity: 0.6;
    color: #7f8ea2;
    background: #131b27;
    border-color: #314356;
    cursor: not-allowed;
}

.core-shell.theme-dark .tab-button--active {
    color: var(--erp-text);
    border-color: var(--erp-border);
    background: var(--erp-bg-main);
    border-bottom-color: var(--erp-bg-main);
    font-weight: 600;
}

.core-shell.theme-dark .status-region {
    position: relative;
    color: var(--erp-text-2);
    background: transparent;
    border-left-color: var(--erp-border);
    overflow: visible;
}

.status-text {
    flex: 1 1 auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.status-history-button {
    margin-left: auto;
    border: 1px solid var(--erp-border-2);
    background: transparent;
    color: var(--erp-text-3);
    border-radius: 2px;
    font-size: 0.66rem;
    padding: 1px 6px;
}

.status-history-button:hover {
    color: var(--erp-text-2);
    background: var(--erp-bg-raised);
}

.status-history-menu {
    position: absolute;
    right: 6px;
    bottom: calc(100% + 4px);
    width: 320px;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--erp-border-2);
    background: var(--erp-bg-surface);
    border-radius: 4px;
    z-index: 5200;
}

.core-shell.theme-light .status-history-menu {
    border: 1px solid #b9c8d9;
    background: #f8fbff;
    border-radius: 6px;
    box-shadow: 0 10px 24px rgba(21, 38, 57, 0.22);
}

.status-history-entry {
    display: flex;
    gap: 8px;
    padding: 5px 8px;
    border-bottom: 1px solid var(--erp-border);
}

.core-shell.theme-light .status-history-entry {
    border-bottom: 1px solid #d9e4f1;
}

.core-shell.theme-light .status-history-entry:hover {
    background: #edf3fb;
}

.status-history-entry:last-child {
    border-bottom: 0;
}

.status-history-time {
    color: var(--erp-text-3);
    flex: 0 0 auto;
    font-size: 0.65rem;
}

.core-shell.theme-light .status-history-time {
    color: #5a6f86;
}

.status-history-message {
    color: var(--erp-text-2);
    font-size: 0.68rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.core-shell.theme-light .status-history-message {
    color: #1f3347;
}

.core-shell.theme-dark .status-region--ok-text {
    color: #22c55e;
}

.core-shell.theme-dark .status-region--error-text {
    color: #ef4444;
}

.core-shell.theme-dark .status-region--workflow-text {
    color: #a78bfa;
}

.core-shell.theme-dark .status-region--progress-text {
    color: #ffffff;
    font-weight: 700;
    text-shadow: 0 1px 2px #000000, 0 0 1px #000000;
}

.status-current-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex: 0 0 auto;
    margin-right: 4px;
}

.status-current-dot--ok {
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
}

.status-current-dot--error {
    background: #ef4444;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.5);
}

.status-current-dot--workflow {
    background: #8b5cf6;
    box-shadow: 0 0 6px rgba(139, 92, 246, 0.55);
}

.status-current-dot--tip {
    background: #f97316;
    box-shadow: 0 0 6px rgba(249, 115, 22, 0.6);
}

.core-shell.theme-dark .status-current-dot--tip {
    background: #facc15;
    box-shadow: 0 0 6px rgba(250, 204, 21, 0.6);
}

.status-history-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    flex: 0 0 auto;
    margin-top: 4px;
}

.status-history-dot--ok {
    background: #22c55e;
}

.status-history-dot--error {
    background: #ef4444;
}

.status-history-dot--workflow {
    background: #8b5cf6;
}

.core-shell.theme-dark .grid-sort {
    color: var(--erp-text-2);
    font-weight: 500;
}

.core-shell.theme-dark .form-field label {
    color: var(--erp-text-2);
}

.core-shell.theme-dark .field-description {
    color: var(--erp-text-3);
}

.core-shell.theme-dark .left-panel__badge {
    top: 2px;
    right: 1px;
    min-width: 24px;
    height: 16px;
    border-radius: 8px;
    font-size: 0.54rem;
    padding: 0 5px;
}

.core-shell.theme-light .left-panel__badge {
    top: 2px;
    right: 1px;
    min-width: 24px;
    height: 16px;
    border-radius: 8px;
    font-size: 0.54rem;
    padding: 0 5px;
}

.core-shell.theme-dark .main-grid th,
.core-shell.theme-dark .line-edit-grid th {
    color: var(--erp-text-2);
    background: var(--erp-bg-surface);
}

.core-shell.theme-dark .field-edit-grid-title {
    background: var(--erp-bg-surface);
    border-bottom-color: var(--erp-border);
    color: var(--erp-text-2);
}

.core-shell.theme-dark .line-edit-grid-shell,
.core-shell.theme-dark .secondary-grid-shell {
    background: var(--erp-bg-main);
}

.core-shell.theme-dark .process-actions .toolbar-button {
    border: 1px solid var(--erp-border-2);
    background: rgba(22, 32, 46, 0.6);
    color: #c7d8ea;
}

.core-shell.theme-dark .process-actions .toolbar-button:hover:not(:disabled) {
    background: var(--erp-bg-raised);
    border-color: #4a6a8f;
    color: #f0f6ff;
}

.core-shell.theme-dark .process-actions .toolbar-button:disabled {
    border: 1px solid #3a4b61;
    background: rgba(18, 25, 36, 0.7);
    color: #778ea8;
    opacity: 1;
}

::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-thumb {
    border-radius: 4px;
}

.core-shell.theme-dark .left-panel-flyout::-webkit-scrollbar,
.core-shell.theme-dark .form-scroll-area::-webkit-scrollbar,
.core-shell.theme-dark .main-grid-shell::-webkit-scrollbar,
.core-shell.theme-dark .line-edit-grid-shell::-webkit-scrollbar,
.core-shell.theme-dark .secondary-grid-shell::-webkit-scrollbar,
.core-shell.theme-dark .status-history-menu::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

.core-shell.theme-light .left-panel-flyout::-webkit-scrollbar,
.core-shell.theme-light .form-scroll-area::-webkit-scrollbar,
.core-shell.theme-light .main-grid-shell::-webkit-scrollbar,
.core-shell.theme-light .line-edit-grid-shell::-webkit-scrollbar,
.core-shell.theme-light .secondary-grid-shell::-webkit-scrollbar,
.core-shell.theme-light .status-history-menu::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

.core-shell.theme-dark .left-panel-flyout::-webkit-scrollbar-thumb,
.core-shell.theme-dark .form-scroll-area::-webkit-scrollbar-thumb,
.core-shell.theme-dark .main-grid-shell::-webkit-scrollbar-thumb,
.core-shell.theme-dark .line-edit-grid-shell::-webkit-scrollbar-thumb,
.core-shell.theme-dark .secondary-grid-shell::-webkit-scrollbar-thumb,
.core-shell.theme-dark .status-history-menu::-webkit-scrollbar-thumb {
    background: transparent;
}

.core-shell.theme-light .left-panel-flyout::-webkit-scrollbar-thumb,
.core-shell.theme-light .form-scroll-area::-webkit-scrollbar-thumb,
.core-shell.theme-light .main-grid-shell::-webkit-scrollbar-thumb,
.core-shell.theme-light .line-edit-grid-shell::-webkit-scrollbar-thumb,
.core-shell.theme-light .secondary-grid-shell::-webkit-scrollbar-thumb,
.core-shell.theme-light .status-history-menu::-webkit-scrollbar-thumb {
    background: transparent;
}

.core-shell.theme-dark .left-panel-flyout:hover::-webkit-scrollbar-thumb,
.core-shell.theme-dark .form-scroll-area:hover::-webkit-scrollbar-thumb,
.core-shell.theme-dark .main-grid-shell:hover::-webkit-scrollbar-thumb,
.core-shell.theme-dark .line-edit-grid-shell:hover::-webkit-scrollbar-thumb,
.core-shell.theme-dark .secondary-grid-shell:hover::-webkit-scrollbar-thumb,
.core-shell.theme-dark .status-history-menu:hover::-webkit-scrollbar-thumb {
    background: #6f88a4;
}

.core-shell.theme-light .left-panel-flyout:hover::-webkit-scrollbar-thumb,
.core-shell.theme-light .form-scroll-area:hover::-webkit-scrollbar-thumb,
.core-shell.theme-light .main-grid-shell:hover::-webkit-scrollbar-thumb,
.core-shell.theme-light .line-edit-grid-shell:hover::-webkit-scrollbar-thumb,
.core-shell.theme-light .secondary-grid-shell:hover::-webkit-scrollbar-thumb,
.core-shell.theme-light .status-history-menu:hover::-webkit-scrollbar-thumb {
    background: #8ea8c4;
}

.core-shell.theme-dark .left-panel-flyout:hover::-webkit-scrollbar,
.core-shell.theme-dark .form-scroll-area:hover::-webkit-scrollbar,
.core-shell.theme-dark .main-grid-shell:hover::-webkit-scrollbar,
.core-shell.theme-dark .line-edit-grid-shell:hover::-webkit-scrollbar,
.core-shell.theme-dark .secondary-grid-shell:hover::-webkit-scrollbar,
.core-shell.theme-dark .status-history-menu:hover::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

.core-shell.theme-light .left-panel-flyout:hover::-webkit-scrollbar,
.core-shell.theme-light .form-scroll-area:hover::-webkit-scrollbar,
.core-shell.theme-light .main-grid-shell:hover::-webkit-scrollbar,
.core-shell.theme-light .line-edit-grid-shell:hover::-webkit-scrollbar,
.core-shell.theme-light .secondary-grid-shell:hover::-webkit-scrollbar,
.core-shell.theme-light .status-history-menu:hover::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

.core-shell.theme-dark .left-panel-flyout:focus-within::-webkit-scrollbar,
.core-shell.theme-dark .form-scroll-area:focus-within::-webkit-scrollbar,
.core-shell.theme-dark .main-grid-shell:focus-within::-webkit-scrollbar,
.core-shell.theme-dark .line-edit-grid-shell:focus-within::-webkit-scrollbar,
.core-shell.theme-dark .secondary-grid-shell:focus-within::-webkit-scrollbar,
.core-shell.theme-dark .status-history-menu:focus-within::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

.core-shell.theme-light .left-panel-flyout:focus-within::-webkit-scrollbar,
.core-shell.theme-light .form-scroll-area:focus-within::-webkit-scrollbar,
.core-shell.theme-light .main-grid-shell:focus-within::-webkit-scrollbar,
.core-shell.theme-light .line-edit-grid-shell:focus-within::-webkit-scrollbar,
.core-shell.theme-light .secondary-grid-shell:focus-within::-webkit-scrollbar,
.core-shell.theme-light .status-history-menu:focus-within::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

.core-shell.theme-dark .left-panel-flyout:focus-within::-webkit-scrollbar-thumb,
.core-shell.theme-dark .form-scroll-area:focus-within::-webkit-scrollbar-thumb,
.core-shell.theme-dark .main-grid-shell:focus-within::-webkit-scrollbar-thumb,
.core-shell.theme-dark .line-edit-grid-shell:focus-within::-webkit-scrollbar-thumb,
.core-shell.theme-dark .secondary-grid-shell:focus-within::-webkit-scrollbar-thumb,
.core-shell.theme-dark .status-history-menu:focus-within::-webkit-scrollbar-thumb {
    background: #6f88a4;
}

.core-shell.theme-light .left-panel-flyout:focus-within::-webkit-scrollbar-thumb,
.core-shell.theme-light .form-scroll-area:focus-within::-webkit-scrollbar-thumb,
.core-shell.theme-light .main-grid-shell:focus-within::-webkit-scrollbar-thumb,
.core-shell.theme-light .line-edit-grid-shell:focus-within::-webkit-scrollbar-thumb,
.core-shell.theme-light .secondary-grid-shell:focus-within::-webkit-scrollbar-thumb,
.core-shell.theme-light .status-history-menu:focus-within::-webkit-scrollbar-thumb {
    background: #8ea8c4;
}

/* Metadata grids commonly exceed the available form width. Keep their
   horizontal scrollbars visible and consistently sized. */
.core-shell.theme-dark .main-grid-shell::-webkit-scrollbar,
.core-shell.theme-dark .line-edit-grid-shell::-webkit-scrollbar,
.core-shell.theme-light .main-grid-shell::-webkit-scrollbar,
.core-shell.theme-light .line-edit-grid-shell::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.core-shell.theme-dark .main-grid-shell::-webkit-scrollbar-thumb,
.core-shell.theme-dark .main-grid-shell:hover::-webkit-scrollbar-thumb,
.core-shell.theme-dark .main-grid-shell:focus-within::-webkit-scrollbar-thumb,
.core-shell.theme-dark .line-edit-grid-shell::-webkit-scrollbar-thumb,
.core-shell.theme-dark .line-edit-grid-shell:hover::-webkit-scrollbar-thumb,
.core-shell.theme-dark .line-edit-grid-shell:focus-within::-webkit-scrollbar-thumb {
    background: #6f88a4;
}

.core-shell.theme-light .main-grid-shell::-webkit-scrollbar-thumb,
.core-shell.theme-light .main-grid-shell:hover::-webkit-scrollbar-thumb,
.core-shell.theme-light .main-grid-shell:focus-within::-webkit-scrollbar-thumb,
.core-shell.theme-light .line-edit-grid-shell::-webkit-scrollbar-thumb,
.core-shell.theme-light .line-edit-grid-shell:hover::-webkit-scrollbar-thumb,
.core-shell.theme-light .line-edit-grid-shell:focus-within::-webkit-scrollbar-thumb {
    background: #8ea8c4;
}

.core-shell.theme-dark .main-grid-shell,
.core-shell.theme-dark .line-edit-grid-shell {
    scrollbar-width: auto;
    scrollbar-color: #6f88a4 transparent;
}

.core-shell.theme-light .main-grid-shell,
.core-shell.theme-light .line-edit-grid-shell {
    scrollbar-width: auto;
    scrollbar-color: #8ea8c4 transparent;
}

.core-shell.theme-dark .main-grid-shell::-webkit-scrollbar-corner,
.core-shell.theme-dark .line-edit-grid-shell::-webkit-scrollbar-corner,
.core-shell.theme-dark .secondary-grid-shell::-webkit-scrollbar-corner {
    background: transparent;
}

.left-panel-flyout,
.form-scroll-area,
.main-grid-shell,
.line-edit-grid-shell,
.secondary-grid-shell,
.status-history-menu {
    scrollbar-gutter: stable;
}

button,
input,
select {
    font: inherit;
}

.core-shell {
    --left-panel-width: 227px;
    --ai-assistant-width: 420px;
    height: 100vh;
    height: var(--core-viewport-height, 100dvh);
    min-height: 0;
    display: grid;
    grid-template-rows: 50px minmax(0, 1fr);
    border: 1px solid #b6c4d3;
    background: #f7f9fc;
    overflow: hidden;
}

.core-shell__top-row {
    display: grid;
    grid-template-columns: var(--left-panel-width) 1fr;
    border-bottom: 1px solid #b6c4d3;
    min-height: 0;
}

.core-shell__logo-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 2px;
    background: #ffffff;
    border-right: 1px solid #b6c4d3;
    overflow: hidden;
}

.core-shell__logo {
    display: block;
    width: 88%;
    max-width: none;
    height: auto;
    object-fit: contain;
}

.core-shell__meta-bar {
    display: grid;
    grid-template-columns: max-content 1fr max-content;
    background: #d9e4ef;
    font-size: 0.78rem;
    min-width: 0;
}

.company-region,
.context-region,
.user-region {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.55rem;
    border-right: 1px solid #b6c4d3;
    min-width: 0;
}

.user-region {
    border-right: 0;
    justify-content: flex-start;
    width: max-content;
    max-width: 100%;
}

.user-region__id {
    white-space: nowrap;
    margin-right: 0.35rem;
}

.company-picker {
    border: 1px solid #9fb2c5;
    background: #ffffff;
    color: #1d2733;
    padding: 0.2rem 0.35rem;
    border-radius: 4px;
    font-family: inherit;
    width: calc(38ch + 2.4rem);
    min-width: calc(38ch + 2.4rem);
    max-width: calc(38ch + 2.4rem);
    height: 29px;
}

.company-picker--tenants,
.company-picker--tenants option {
    font-variant-numeric: tabular-nums;
    white-space: pre;
}

.company-picker option {
    background: #ffffff;
    color: #1d2733;
}

.core-shell.theme-dark .company-picker option {
    background: #111a27;
    color: #dde5f0;
}

.company-display {
    font-weight: 600;
    color: #1f3347;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.context-region {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
    font-size: 0.9rem;
}

.core-shell__body {
    position: relative;
    display: grid;
    grid-template-columns: var(--left-panel-width) minmax(0, 1fr);
    min-height: 0;
    overflow: hidden;
}

.core-shell__body--assistant-open {
    grid-template-columns: var(--left-panel-width) minmax(0, 1fr);
}

.core-shell__body--assistant-open .form-container {
    width: calc(100% - var(--ai-assistant-width) - 1.6rem);
    min-width: 0;
    margin-right: 0.55rem;
}

.core-shell__body--assistant-open .tab-strip {
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
}

.left-panel {
    position: relative;
    z-index: 30;
    border-right: 1px solid #cfd8e3;
    border-bottom: 1px solid #b6c4d3;
    background: linear-gradient(180deg, #eef3f9 0%, #e8eef6 100%);
    display: grid;
    grid-template-rows: auto 1fr;
    align-items: stretch;
    padding: 0.55rem 0.5rem 0.5rem;
    min-height: 0;
    overflow: hidden;
    height: 100%;
}

.left-panel__top-icons {
    width: 100%;
    display: flex;
    align-items: stretch;
    gap: 0.35rem;
    margin-bottom: 0.45rem;
    padding-bottom: 0;
}

.left-panel__icon-button {
    position: relative;
    border: 1px solid #c8d4e2;
    background: #ffffff;
    border-radius: 10px;
    flex: 1 1 0;
    min-width: 0;
    padding: 0.38rem 0.18rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #2a3f56;
    box-shadow: 0 1px 3px rgba(14, 31, 54, 0.08);
}

.left-panel__icon-button:hover {
    background: #f6f9fd;
    border-color: #afc2d8;
}

.left-panel__icon-button--active {
    border-color: #2d6fa8;
    background: linear-gradient(180deg, #edf5ff 0%, #dcecff 100%);
    color: #1e4f79;
    box-shadow: 0 2px 8px rgba(28, 86, 134, 0.2);
}

.left-panel__icon-button--favourite .left-panel__icon svg {
    fill: #ffffff;
    stroke: #2a3f56;
}

.left-panel__icon-button--favourite.left-panel__icon-button--active .left-panel__icon svg {
    fill: #c11a2b;
    stroke: #9b0f21;
}

.left-panel__icon {
    width: 20px;
    height: 20px;
    transform: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.left-panel__icon svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.left-panel__icon-label {
    display: none;
}

.left-panel__badge {
    position: absolute;
    top: -1px;
    right: -3px;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: #c11a2b;
    color: #ffffff;
    font-size: 0.6rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 1px solid #ffffff;
}

.left-panel-flyout {
    position: relative;
    width: 100%;
    border: 1px solid #ccd8e6;
    border-radius: 10px;
    background: #ffffff;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    max-height: 100%;
    pointer-events: auto;
    box-shadow: none;
    padding: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.left-panel-flyout::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

.core-shell.theme-dark .left-panel-flyout::-webkit-scrollbar,
.core-shell.theme-light .left-panel-flyout::-webkit-scrollbar,
.core-shell.theme-dark .left-panel-flyout:hover::-webkit-scrollbar,
.core-shell.theme-light .left-panel-flyout:hover::-webkit-scrollbar,
.core-shell.theme-dark .left-panel-flyout:focus-within::-webkit-scrollbar,
.core-shell.theme-light .left-panel-flyout:focus-within::-webkit-scrollbar {
    width: 0 !important;
    height: 0 !important;
}

.core-shell.theme-dark .left-panel-flyout::-webkit-scrollbar-thumb,
.core-shell.theme-light .left-panel-flyout::-webkit-scrollbar-thumb,
.core-shell.theme-dark .left-panel-flyout:hover::-webkit-scrollbar-thumb,
.core-shell.theme-light .left-panel-flyout:hover::-webkit-scrollbar-thumb,
.core-shell.theme-dark .left-panel-flyout:focus-within::-webkit-scrollbar-thumb,
.core-shell.theme-light .left-panel-flyout:focus-within::-webkit-scrollbar-thumb {
    background: transparent !important;
}

.left-panel-menu__item {
    width: 100%;
    border: 1px solid transparent;
    background: #ffffff;
    border-radius: 8px;
    padding: 0.28rem 0.42rem;
    text-align: left;
    font-size: 0.74rem;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    margin-bottom: 0.04rem;
}

.left-panel-menu__item--module {
    font-size: 0.92rem;
    line-height: 1.18;
    font-weight: 600;
}

.left-panel-menu__item:hover {
    background: #f2f7fd;
    border-color: #cfddec;
}

.left-panel-menu__item--selected {
    background: #e6f1ff;
    border-color: #9db8d6;
}

.left-panel-menu__item--note {
    font-family: inherit;
    white-space: normal;
    font-size: 0.68rem;
    line-height: 1.08;
    text-align: left;
}

.left-panel-menu__item--note div {
    display: block;
    width: 100%;
    max-width: none;
    margin: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.left-panel-menu__item--note div + div {
    margin-top: 0.18rem;
}

.left-panel-menu__item--note .notification-reason {
    white-space: pre-wrap;
}

.left-panel-menu__item--note .notification-reason span {
    font-weight: 600;
}

.core-shell.theme-dark .left-panel-menu__item.left-panel-menu__item--note,
.core-shell.theme-light .left-panel-menu__item.left-panel-menu__item--note {
    display: block !important;
    width: 100%;
    max-width: 100%;
    align-items: initial !important;
    gap: 0 !important;
    padding-top: 0.42rem;
    padding-bottom: 0.42rem;
}

.core-shell.theme-dark .left-panel-menu__item.left-panel-menu__item--note > div,
.core-shell.theme-light .left-panel-menu__item.left-panel-menu__item--note > div {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
}

.left-panel-empty {
    padding: 0.55rem;
    font-size: 0.72rem;
    color: #5a6f84;
}

.panel-drawer__title--with-hint {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-right: 0 !important;
}

.panel-drawer__hint {
    font-size: 0.56rem;
    letter-spacing: 0.08em;
    opacity: 0.9;
    margin-left: auto;
    margin-right: 4px;
}

.left-panel-actions {
    margin-top: auto;
    display: flex;
    gap: 0.3rem;
    padding: 0.35rem;
    border-top: 1px solid #d9e2ec;
    background: #f6f9fd;
}

.left-panel-actions .toolbar-button {
    flex: 1 1 0;
    width: auto;
    font-weight: 700;
    font-size: 0.82rem;
    text-transform: uppercase;
}

.core-shell.theme-dark .panel-drawer__title.panel-drawer__title--module,
.core-shell.theme-light .panel-drawer__title.panel-drawer__title--module {
    font-size: 0.78rem;
    overflow-wrap: anywhere;
}

.core-shell.theme-light .left-panel-actions .toolbar-button {
    border: 1px solid #a9bbcd;
    background: #ffffff;
    color: #1f3347;
    border-radius: 4px;
    padding: 0.2rem 0.45rem;
    font-size: 0.72rem;
}

.core-shell.theme-light .left-panel-actions .toolbar-button:hover:not(:disabled) {
    background: #eef4fa;
}

.core-shell.theme-light .left-panel-actions .toolbar-button:disabled {
    background: #f2f5f8;
    color: #8795a6;
}

.core-shell.theme-dark .left-panel-actions {
    border-top: 1px solid var(--erp-border);
    background: var(--erp-bg-panel);
}

.core-shell.theme-dark .left-panel-actions .toolbar-button {
    border: 1px solid var(--erp-border-2);
    background: var(--erp-bg-input);
    color: var(--erp-text);
    border-radius: 4px;
    padding: 0.2rem 0.45rem;
    font-size: 0.72rem;
}

.core-shell.theme-dark .left-panel-actions .toolbar-button:hover:not(:disabled) {
    background: var(--erp-bg-raised);
    border-color: var(--erp-border-2);
}

.core-shell.theme-dark .left-panel-actions .toolbar-button:disabled {
    background: var(--erp-bg-panel);
    color: #6f8299;
    border-color: var(--erp-border);
    opacity: 0.6;
}

.work-area {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 40px;
    min-width: 0;
    min-height: 0;
}

.panel-drawer__title {
    padding: 0.4rem 0.45rem;
    font-size: 0.74rem;
    font-weight: 700;
    border-bottom: 1px solid #dde6f0;
    background: #f6f9fd;
    border-radius: 8px;
    margin-bottom: 0.28rem;
}

.left-panel-menu__group-title {
    padding: 0.28rem 0.45rem;
    font-size: 0.72rem;
    font-weight: 700;
    background: #f6f9fd;
    border-top: 1px solid #e4ebf3;
    border-bottom: 1px solid #e4ebf3;
    border-radius: 6px;
    margin: 0.3rem 0 0.2rem;
}

.work-area-main {
    display: grid;
    grid-template-rows: 38px 1fr;
    min-height: 0;
}

.toolbar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    align-items: stretch;
    border-bottom: 1px solid #b6c4d3;
    background: #f7f9fc;
    min-height: 0;
}

.action-menu {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.45rem;
    overflow-x: visible;
    min-height: 0;
}

.action-menu {
    flex: 1;
}

.action-menu .toolbar-button {
    width: 98px;
    text-align: center;
    font-weight: 700;
    font-size: 0.82rem;
    border: 0;
    background: transparent;
    border-radius: 3px;
    color: #1f3347;
    padding: 0.22rem 0.3rem;
    transition: background-color 120ms ease, color 120ms ease;
}

.action-menu .toolbar-button:hover:not(:disabled) {
    background: #d0dae5;
    color: #132739;
    text-decoration: none;
}

.action-menu .toolbar-button:disabled {
    background: transparent;
    color: #8795a6;
}

.action-menu .toolbar-button.toolbar-button--back-reference {
    width: fit-content;
    min-width: 98px;
    flex: 0 0 auto;
    max-width: none;
    margin-left: auto;
    white-space: nowrap;
    padding-left: 0.55rem;
    padding-right: 0.55rem;
}

.module-menu-dropdown {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    width: 220px;
    border: 1px solid #9fb2c5;
    background: #ffffff;
    box-shadow: 0 6px 16px rgba(7, 22, 38, 0.16);
    z-index: 3000;
}

.module-menu-dropdown__item {
    width: 100%;
    border: 0;
    border-bottom: 1px solid #e1e7ef;
    background: #ffffff;
    padding: 0.42rem 0.48rem;
    text-align: left;
    font-size: 0.72rem;
}

.module-menu-dropdown__item:hover {
    background: #edf3fa;
}

.utility-icons {
    position: relative;
    display: flex;
    align-items: stretch;
    gap: 0;
    padding: 0;
    border-left: 0;
}

.utility-icons__dropdown {
    left: auto;
    right: 0;
    top: calc(100% + 1px);
    width: 180px;
}

.top-icon-button {
    width: 30px;
    height: 28px;
    border: 1px solid #a9bbcd;
    background: #ffffff;
    color: #26435d;
    border-radius: 4px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.top-icon-button__glyph {
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.top-icon-button__glyph svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ai-agent-toggle {
    width: 32px;
    height: 30px;
    color: #61758b;
    border-color: #aebdcc;
    background: linear-gradient(180deg, #ffffff 0%, #edf3f9 100%);
    transition: color 140ms ease, background 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.ai-agent-toggle:hover {
    color: #334e68;
    border-color: #7f95aa;
    box-shadow: 0 2px 7px rgba(26, 54, 82, 0.18);
    transform: translateY(-1px);
}

.ai-agent-toggle--active {
    color: #ffffff;
    border-color: #6d3bd1;
    background: linear-gradient(135deg, #7338d5 0%, #3669dc 48%, #00a6a6 100%);
    box-shadow: 0 0 0 1px rgba(112, 72, 214, 0.18), 0 3px 10px rgba(56, 87, 190, 0.35);
}

.ai-agent-toggle--active:hover {
    color: #ffffff;
    border-color: #5828be;
    background: linear-gradient(135deg, #642bc8 0%, #2f5fd0 48%, #009694 100%);
}

.ai-agent-toggle__glyph {
    width: 18px;
    height: 18px;
}

.ai-assistant-drawer {
    position: absolute;
    z-index: 45;
    top: calc(38px + 0.45rem);
    right: 0.55rem;
    bottom: calc(40px + 0.5rem);
    width: var(--ai-assistant-width);
    min-width: 0;
    min-height: 0;
    height: auto;
    margin: 0;
    overflow: hidden;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    color: #1c2d3d;
    background: #f7f9fc;
    border-left: 1px solid #aebdcd;
    box-shadow: -8px 0 22px rgba(24, 43, 64, 0.12);
}

.ai-assistant-resizer {
    position: absolute;
    z-index: 3;
    top: 0;
    bottom: 0;
    left: -4px;
    width: 9px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: col-resize !important;
    touch-action: none;
}

.ai-assistant-resizer span {
    position: absolute;
    top: 50%;
    left: 3px;
    width: 3px;
    height: 58px;
    border-radius: 3px;
    background: #9aadc0;
    transform: translateY(-50%);
    opacity: 0.48;
    transition: opacity 120ms ease, background 120ms ease;
    cursor: col-resize !important;
}

.ai-assistant-resizer:hover span,
.ai-assistant-resizer:focus-visible span {
    background: #4d70c9;
    opacity: 1;
}

.ai-assistant-header {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) 30px;
    align-items: center;
    gap: 0.55rem;
    min-height: 58px;
    padding: 0.55rem 0.65rem 0.55rem 0.8rem;
    border-bottom: 1px solid #c8d4df;
    background: linear-gradient(135deg, #eef2ff 0%, #edf8fb 100%);
}

.ai-assistant-header__icon,
.ai-assistant-message__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    border-radius: 10px;
    background: linear-gradient(135deg, #7338d5 0%, #3669dc 48%, #00a6a6 100%);
    box-shadow: 0 3px 10px rgba(56, 87, 190, 0.28);
}

.ai-assistant-header__icon {
    width: 36px;
    height: 36px;
    padding: 7px;
}

.ai-assistant-header__icon svg,
.ai-assistant-message__avatar svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ai-assistant-header__copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.08rem;
}

.ai-assistant-header__copy strong {
    font-size: 0.88rem;
    color: #1a2f48;
}

.ai-assistant-header__copy span {
    font-size: 0.67rem;
    font-weight: 700;
    color: #087f7b;
}

.core-shell .ai-assistant-header__copy span.ai-assistant-status--disabled,
.core-shell.theme-dark .ai-assistant-header__copy span.ai-assistant-status--disabled {
    color: #dc2626;
}

.ai-assistant-close {
    width: 28px;
    height: 28px;
    padding: 0 0 2px;
    border: 1px solid transparent;
    border-radius: 50%;
    color: #5b6f84;
    background: transparent;
    font-size: 1.3rem;
    line-height: 1;
}

.ai-assistant-close:hover {
    color: #23384e;
    border-color: #bac8d5;
    background: rgba(255, 255, 255, 0.75);
}

.ai-assistant-conversation {
    min-height: 0;
    overflow-y: auto;
    padding: 0.8rem 0.7rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.ai-assistant-message {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 0.55rem;
    padding: 0.7rem;
    border: 1px solid #d2dce7;
    border-radius: 12px 12px 12px 4px;
    background: #ffffff;
    box-shadow: 0 3px 12px rgba(28, 48, 68, 0.07);
}

.ai-assistant-message__avatar {
    width: 30px;
    height: 30px;
    padding: 6px;
    border-radius: 9px;
}

.ai-assistant-message strong {
    display: block;
    margin-bottom: 0.18rem;
    color: #28435e;
    font-size: 0.72rem;
}

.ai-assistant-message p {
    margin: 0;
    color: #43586d;
    font-size: 0.72rem;
    line-height: 1.48;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.ai-assistant-message--user {
    grid-template-columns: minmax(0, 1fr) 30px;
    border-radius: 12px 12px 4px 12px;
    border-color: #bfd2e8;
    background: #edf5ff;
}

/* Assistant output formatting is scoped to answers, never metadata fields or user input. */
.ai-assistant-rich-text {
    min-width: 0;
    color: #43586d;
    font-size: 0.72rem;
    line-height: 1.48;
    overflow-wrap: anywhere;
}

.ai-assistant-rich-text p {
    margin: 0 0 0.6em;
    white-space: normal;
    color: inherit;
}

.ai-assistant-rich-text strong {
    display: inline;
    margin: 0;
    font-size: inherit;
    color: inherit;
}

.ai-assistant-rich-text :is(h1, h2, h3, h4, h5, h6) {
    margin: 0.8em 0 0.35em;
    font-size: 1.08em;
    color: inherit;
}

.ai-assistant-rich-text :is(ul, ol) { margin: 0 0 0.6em; padding-left: 1.6em; }
.ai-assistant-rich-text li + li { margin-top: 0.25em; }
.ai-assistant-rich-text > :last-child { margin-bottom: 0; }
.ai-assistant-rich-text a { color: #2369ad; text-decoration: underline; }
.ai-assistant-rich-text code { color: inherit; font-size: 0.95em; }
.ai-assistant-rich-text pre { overflow-x: auto; white-space: pre; padding: 0.5em; background: #edf2f7; }
.ai-assistant-rich-text blockquote { margin: 0 0 0.6em; padding-left: 0.65em; border-left: 3px solid #bfd2e8; }
.ai-assistant-table-scroll { max-width: 100%; overflow-x: auto; margin: 0.6em 0; }
.ai-assistant-table-scroll:focus-visible { outline: 2px solid #458ed2; outline-offset: -2px; }
.ai-assistant-rich-text table { border-collapse: collapse; width: 100%; }
.ai-assistant-rich-text :is(th, td) { border: 1px solid #cbd6e1; padding: 0.4em 0.55em; text-align: left; vertical-align: top; min-width: 7em; }
.ai-assistant-rich-text th { background: #edf2f7; font-weight: 700; }
.core-shell.theme-dark .ai-assistant-rich-text { color: #aebed0; }
.core-shell.theme-dark .ai-assistant-rich-text a { color: #85baf0; }
.core-shell.theme-dark .ai-assistant-rich-text :is(th, pre) { background: #1d2b3c; }
.core-shell.theme-dark .ai-assistant-rich-text :is(th, td) { border-color: #34475c; }

.ai-assistant-message--user > .ai-assistant-message__avatar {
    grid-column: 2;
    grid-row: 1;
    color: #ffffff;
    background: #3769aa;
    font-size: 0.7rem;
    font-weight: 800;
}

.ai-assistant-message--user > div {
    grid-column: 1;
    grid-row: 1;
}

.ai-assistant-message--working {
    opacity: 0.86;
}

.ai-assistant-message__avatar--working svg {
    animation: core-assistant-working 1.1s linear infinite;
}

@keyframes core-assistant-working {
    to {
        transform: rotate(360deg);
    }
}

.ai-assistant-composer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.45rem;
    padding: 0.65rem 0.7rem;
    border-top: 1px solid #cbd6e1;
    background: #ffffff;
}

.ai-assistant-composer textarea {
    min-width: 0;
    resize: none;
    padding: 0.48rem 0.55rem;
    border: 1px solid #bdcbd9;
    border-radius: 8px;
    color: #24394e;
    background: #ffffff;
    font: inherit;
    font-size: 0.7rem;
}

.ai-assistant-composer button {
    align-self: stretch;
    padding: 0.25rem 0.65rem;
    border: 1px solid #a9b9c9;
    border-radius: 7px;
    color: #ffffff;
    border-color: #315f9f;
    background: #3769aa;
    font-size: 0.68rem;
    font-weight: 700;
}

.ai-assistant-composer small {
    grid-column: 1 / -1;
    color: #7a8b9c;
    font-size: 0.6rem;
    display: none;
}

.ai-assistant-composer button:disabled {
    color: #8190a0;
    border-color: #a9b9c9;
    background: #e8edf3;
    cursor: default;
}

.ai-assistant-composer textarea:focus {
    outline: 2px solid rgba(55, 105, 170, 0.2);
    border-color: #3769aa;
}

.core-shell.theme-dark .ai-agent-toggle {
    color: #8294a9;
    border-color: #3a4b5f;
    background: linear-gradient(180deg, #172334 0%, #101a29 100%);
}

.core-shell.theme-dark .ai-agent-toggle:hover {
    color: #c3d2e1;
    border-color: #62758b;
}

.core-shell.theme-dark .ai-agent-toggle--active {
    color: #ffffff;
    border-color: #8861e7;
    background: linear-gradient(135deg, #7338d5 0%, #3669dc 48%, #00a6a6 100%);
}

.core-shell.theme-dark .ai-assistant-drawer {
    color: #dbe5ef;
    border-left-color: #2b3a4d;
    background: #0c1420;
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.38);
}

.core-shell.theme-dark .ai-assistant-header {
    border-bottom-color: #304156;
    background: linear-gradient(135deg, #1c203b 0%, #102d34 100%);
}

.core-shell.theme-dark .ai-assistant-header__copy strong {
    color: #f1f5fa;
}

.core-shell.theme-dark .ai-assistant-header__copy span {
    color: #54d8cf;
}

.core-shell.theme-dark .ai-assistant-close {
    color: #9fb0c3;
}

.core-shell.theme-dark .ai-assistant-close:hover {
    color: #ffffff;
    border-color: #40536a;
    background: #1d2b3c;
}

.core-shell.theme-dark .ai-assistant-message strong {
    color: #cbd8e6;
}

.core-shell.theme-dark .ai-assistant-message {
    border-color: #2a3b4f;
    background: #131f2e;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.24);
}

.core-shell.theme-dark .ai-assistant-message p {
    color: #aebed0;
}

.core-shell.theme-dark .ai-assistant-message--user {
    border-color: #315078;
    background: #172b43;
}

.core-shell.theme-dark .ai-assistant-composer {
    border-top-color: #2b3b4e;
    background: #101a28;
}

.core-shell.theme-dark .ai-assistant-composer textarea {
    color: #dce7f2;
    border-color: #34475c;
    background: #0c1521;
}

.core-shell.theme-dark .ai-assistant-composer button {
    color: #ffffff;
    border-color: #5c76c8;
    background: #4266bd;
}

.core-shell.theme-dark .ai-assistant-composer button:disabled {
    color: #778a9e;
    border-color: #33465a;
    background: #182536;
}

.core-shell.theme-dark .ai-assistant-composer small {
    color: #718398;
}

.core-ai-assistant-resizing,
.core-ai-assistant-resizing * {
    cursor: col-resize !important;
    user-select: none !important;
}

.core360-ai-cursor {
    position: fixed;
    z-index: 4800;
    left: calc(100vw - 48px);
    top: 86px;
    width: 31px;
    height: 38px;
    pointer-events: none;
    opacity: 0;
    transform: translate(-3px, -2.5px) scale(0.86);
    transition:
        left 1.05s cubic-bezier(0.22, 0.8, 0.3, 1),
        top 1.05s cubic-bezier(0.22, 0.8, 0.3, 1),
        opacity 0.16s ease,
        transform 0.16s ease;
    filter: drop-shadow(0 3px 4px rgba(3, 18, 38, 0.38));
}

.core360-ai-cursor--visible {
    opacity: 1;
    transform: translate(-3px, -2.5px) scale(1);
}

.core360-ai-cursor > svg {
    width: 27px;
    height: 34px;
    overflow: visible;
}

.core360-ai-cursor > svg path {
    fill: #ffffff;
    stroke: #155ec9;
    stroke-width: 2.1;
    stroke-linejoin: round;
}

.core360-ai-cursor__badge {
    position: absolute;
    left: -29px;
    top: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    color: #ffffff;
    background: linear-gradient(135deg, #7338d5 0%, #3669dc 48%, #00a6a6 100%);
    box-shadow: 0 3px 10px rgba(56, 87, 190, 0.28);
}

.core360-ai-cursor__badge svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.core360-ai-cursor__label {
    position: absolute;
    left: 34px;
    top: 22px;
    max-width: 220px;
    padding: 0.28rem 0.46rem;
    border: 1px solid #7aa7e8;
    border-radius: 5px;
    color: #102c50;
    background: #f5f9ff;
    box-shadow: 0 5px 15px rgba(16, 44, 80, 0.22);
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.15;
    white-space: nowrap;
}

.core360-ai-cursor--clicking > svg {
    animation: core360-ai-cursor-click 0.62s ease-out;
}

.core360-ai-target {
    outline: 2px solid #4d91f0 !important;
    outline-offset: 2px;
    box-shadow: 0 0 0 5px rgba(77, 145, 240, 0.22) !important;
}

.core-shell.theme-dark .core360-ai-cursor > svg path {
    fill: #fff4a8;
    stroke: #163a69;
}

.core-shell.theme-dark .core360-ai-cursor__badge {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.9);
    background: linear-gradient(135deg, #7338d5 0%, #3669dc 48%, #00a6a6 100%);
}

.core-shell.theme-dark .core360-ai-cursor__label {
    color: #fff5ad;
    border-color: #8ca4c0;
    background: #102034;
}

@keyframes core360-ai-cursor-click {
    0% {
        transform: scale(1);
    }
    42% {
        transform: scale(0.78) translate(2px, 2px);
    }
    100% {
        transform: scale(1);
    }
}

.top-icon-button--favourite-active {
    color: #b2242f;
}

.top-icon-button--favourite-active .top-icon-button__glyph svg {
    fill: #b2242f;
}

.toolbar-button {
    border: 1px solid #a9bbcd;
    background: #ffffff;
    color: #1f3347;
    border-radius: 4px;
    padding: 0.2rem 0.45rem;
    font-size: 0.72rem;
    white-space: nowrap;
}

.toolbar-button:hover:not(:disabled) {
    background: #eef4fa;
}

.toolbar-button:disabled {
    background: #f2f5f8;
    color: #8795a6;
}

.toolbar-button--active {
    border-color: #2d6fa8;
    background: #dcecf9;
    font-weight: 600;
}

.toolbar-button--warn {
    border-color: #ab5722;
    color: #8a3f10;
    background: #f8e8dc;
}

.toolbar-button.toolbar-button--ai {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.32rem;
    border-color: #6d4ad0;
    background: linear-gradient(135deg, #5032a8 0%, #7353d8 58%, #9365dc 100%);
    color: #ffffff;
    font-weight: 700;
    letter-spacing: 0.015em;
    box-shadow: 0 1px 3px rgba(72, 44, 145, 0.28);
}

.toolbar-button.toolbar-button--ai:hover:not(:disabled) {
    border-color: #5835bd;
    background: linear-gradient(135deg, #432594 0%, #6544ca 58%, #8253cf 100%);
}

.toolbar-button.toolbar-button--ai:disabled {
    border-color: #a89bd2;
    background: linear-gradient(135deg, #e5e0f5 0%, #ddd5f2 58%, #eadcf1 100%);
    color: #655887;
    opacity: 1;
    box-shadow: none;
}

.toolbar-button--ai__icon,
.toolbar-button--ai__icon .lucide-icon-host {
    display: inline-flex;
    width: 0.9rem;
    height: 0.9rem;
    align-items: center;
    justify-content: center;
}

.toolbar-button--ai__icon .lucide-icon-host svg {
    width: 0.9rem;
    height: 0.9rem;
    stroke-width: 2.2;
}

.toolbar-button--ai__core-spinner {
    display: inline-block;
    position: relative;
    flex: 0 0 auto;
    width: 0.92rem;
    height: 0.92rem;
    border-radius: 50%;
    overflow: hidden;
    background: #061a33;
}

.toolbar-button--ai__core-spinner img {
    position: absolute;
    top: -0.66rem;
    left: -1.71rem;
    display: block;
    width: auto;
    max-width: none;
    height: 2.33rem;
}

.form-container {
    margin: 0.45rem 0.55rem 0.5rem;
    border: 1px solid #b6c4d3;
    background: #ffffff;
    display: grid;
    grid-template-rows: 38px 1fr;
    min-height: 0;
    overflow: hidden;
}

.tab-strip {
    display: flex;
    align-items: flex-end;
    gap: 0.3rem;
    padding: 0.35rem 0.45rem 0;
    border-bottom: 1px solid #c6d2de;
    background: #edf3fa;
}

.tab-button {
    border: 1px solid #a9bbcd;
    border-bottom: 0;
    background: linear-gradient(#ffffff, #f8fbff);
    border-radius: 7px 7px 0 0;
    padding: 0.34rem 0.68rem 0.3rem;
    font-size: 0.72rem;
    color: #2f455c;
    margin-bottom: -1px;
}

.tab-button:disabled {
    opacity: 0.55;
    color: #6f8295;
    background: linear-gradient(#f4f7fa, #eef3f8);
    border-color: #c3cfdb;
    cursor: not-allowed;
}

.tab-button--active {
    background: #ffffff;
    border-color: #2d6fa8;
    color: #1f3347;
    font-weight: 600;
}

.form-scroll-area {
    overflow-y: scroll;
    overflow-x: hidden;
    padding: 0.45rem;
}

.main-grid-area {
    margin-bottom: 0.6rem;
    position: relative;
    z-index: 1;
}

.main-grid-shell {
    border: 1px solid #c6d2de;
    background: #ffffff;
    overflow-x: auto;
    overflow-y: auto;
    max-height: 220px;
    position: relative;
    z-index: 1;
}

.main-grid {
    border-collapse: collapse;
    min-width: 1080px;
    width: 100%;
    font-size: 0.72rem;
}

.main-grid--metadata {
    min-width: 0;
    width: max-content;
}

.main-grid-col--status {
    width: 24px;
    min-width: 24px;
}

.main-grid th,
.main-grid td {
    border: 1px solid #d8e1eb;
    padding: 0.25rem 0.35rem;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.main-grid th:last-child,
.main-grid td:last-child {
    min-width: 80px;
}

.line-edit-grid th:last-child,
.line-edit-grid td:last-child {
    min-width: 0 !important;
}

.main-grid tbody tr {
    cursor: pointer;
}

.main-grid-row--selected td {
    background: #dcecf9;
}

.main-grid tbody tr.workflow-pending-row td {
    font-weight: 600;
}

.core-shell.theme-light .main-grid tbody tr.workflow-pending-row--new td {
    color: #16803c;
}

.core-shell.theme-light .main-grid tbody tr.workflow-pending-row--edit td {
    color: #b45309;
}

.core-shell.theme-light .main-grid tbody tr.workflow-pending-row--delete td {
    color: #c62828;
}

.core-shell.theme-light .main-grid tbody tr.workflow-pending-row--post td,
.core-shell.theme-light .main-grid tbody tr.workflow-pending-row--run td {
    color: #7e22ce;
}

.core-shell.theme-dark .main-grid tbody tr.workflow-pending-row--new td {
    color: #6ee7b7;
}

.core-shell.theme-dark .main-grid tbody tr.workflow-pending-row--edit td {
    color: #fbbf24;
}

.core-shell.theme-dark .main-grid tbody tr.workflow-pending-row--delete td {
    color: #fca5a5;
}

.core-shell.theme-dark .main-grid tbody tr.workflow-pending-row--post td,
.core-shell.theme-dark .main-grid tbody tr.workflow-pending-row--run td {
    color: #d8b4fe;
}

.main-grid th {
    background: #f2f6fb;
    position: sticky;
    top: 0;
    z-index: 2;
    overflow: hidden;
    background-clip: padding-box;
}

.main-grid th::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: inherit;
    pointer-events: none;
    z-index: 1;
}

.main-grid-header-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.25rem;
    padding-right: 4px;
    position: relative;
    top: 0;
    z-index: 2;
}

.grid-sort {
    border: 0;
    background: transparent;
    padding: 0;
    font-size: 0.72rem;
    font-weight: 600;
    color: #1f3347;
    text-align: left;
    max-width: calc(100% - 24px);
}

.grid-filter-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border: 1px solid #9fb2c5;
    border-radius: 3px;
    background: #ffffff;
    color: #486279;
    padding: 0;
    position: relative;
    z-index: 3;
}

.grid-filter-trigger svg {
    width: 11px;
    height: 11px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.grid-filter-trigger--active {
    border-color: #b02733;
    background: #ffe8eb;
    color: #b02733;
}

.status-filter-trigger {
    display: flex;
    width: 16px;
    min-width: 16px;
    height: 16px;
    margin-inline: auto;
}

.grid-filter-menu.status-filter-menu {
    width: max-content;
    min-width: 0;
    z-index: 6300;
    isolation: isolate;
}

.status-filter-option {
    width: auto;
    display: grid;
    grid-template-columns: 13px 10px max-content;
    align-items: center;
    gap: 0.28rem;
    border: 0;
    border-bottom: 1px solid #e1e7ef;
    background: #ffffff;
    color: #233a50;
    padding: 0.27rem 0.3rem;
    text-align: left;
    font-size: 0.7rem;
    white-space: nowrap;
}

.status-filter-option:last-child {
    border-bottom: 0;
}

.status-filter-option:hover {
    background: #edf3fa;
}

.status-filter-option__toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 13px;
    height: 13px;
    border: 1px solid #8094a7;
    border-radius: 1px;
    color: transparent;
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1;
}

.status-filter-option--selected .status-filter-option__toggle {
    border-color: #1f6fae;
    background: #1f6fae;
    color: #ffffff;
}

.status-filter-option__label {
    line-height: 1.1;
}

.value-filter-option {
    grid-template-columns: 13px max-content;
}

.value-filter-bulk-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    border-bottom: 1px solid #cbd6e1;
    color: #64788b;
    padding: 0.2rem 0.3rem 0.3rem;
    font-size: 0.68rem;
    font-weight: 700;
}

.value-filter-bulk-actions button {
    border: 0;
    background: transparent;
    color: #1f6fae;
    padding: 0;
    font: inherit;
    cursor: pointer;
}

.value-filter-bulk-actions button:hover {
    color: #b02733;
    text-decoration: underline;
}

.value-filter-empty {
    color: #52687c;
    font-size: 0.7rem;
    padding: 0.27rem 0.3rem;
    white-space: nowrap;
}

.grid-filter-menu {
    width: 200px;
    border: 1px solid #9fb2c5;
    background: #ffffff;
    box-shadow: 0 6px 16px rgba(7, 22, 38, 0.16);
    padding: 0.45rem;
}

.grid-filter-menu--floating {
    position: fixed;
    z-index: 5000;
}

.floating-context-menu {
    position: fixed;
    width: max-content;
    border: 1px solid #9fb2c5;
    background: #ffffff;
    box-shadow: 0 6px 16px rgba(7, 22, 38, 0.16);
    z-index: 5200;
}

.transient-menu-backdrop {
    position: fixed;
    inset: 0;
    border: 0;
    background: transparent;
    z-index: 5190;
    padding: 0;
    margin: 0;
    cursor: default;
}

.floating-context-menu__item {
    width: 100%;
    border: 0;
    border-bottom: 1px solid #e1e7ef;
    background: #ffffff;
    padding: 0.42rem 0.5rem;
    text-align: left;
    font-size: 0.72rem;
    white-space: nowrap;
}

.floating-context-menu__item:last-child {
    border-bottom: 0;
}

.floating-context-menu__item:hover {
    background: #edf3fa;
}

.floating-context-menu__item--active {
    background: #e3edf9;
    color: #0b3868;
    font-weight: 700;
}

.floating-context-menu--compact .floating-context-menu__item {
    width: auto;
    display: block;
}

.main-grid-shell--paged {
    overflow-y: auto;
}

.core-shell.theme-dark .floating-context-menu {
    border-color: #31455f;
    background: #0f1c2b;
    box-shadow: 0 8px 20px rgba(2, 6, 23, 0.45);
}

.core-shell.theme-dark .floating-context-menu__item {
    border-bottom-color: #1f3249;
    background: #0f1c2b;
    color: #d7e7fb;
}

.core-shell.theme-dark .floating-context-menu__item:hover {
    background: #163253;
}

.core-shell.theme-dark .floating-context-menu__item--active {
    background: rgba(59, 130, 246, 0.22);
    color: #e8f2ff;
}

.user-settings-menu {
    right: 0.5rem;
    top: 3.2rem;
    left: auto;
}

.grid-filter-label {
    display: block;
    font-size: 0.68rem;
    color: #324a61;
    margin-bottom: 0.18rem;
}

.grid-filter-select,
.grid-filter-input {
    width: 100%;
    height: 28px;
    border: 1px solid #b8c8d8;
    border-radius: 4px;
    padding: 0 0.35rem;
    font-size: 0.7rem;
    background: #ffffff;
    margin-bottom: 0.4rem;
}

.grid-filter-actions {
    display: flex;
    gap: 0.3rem;
    justify-content: flex-end;
}

.grid-filter-actions__pa {
    margin-right: auto;
}

.pending-approval-filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    color: #1f6fae;
    font: inherit;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}

.pending-approval-filter-toggle input {
    width: 13px;
    height: 13px;
    margin: 0;
    accent-color: #b02733;
    cursor: pointer;
}

.col-resize-handle {
    position: absolute;
    top: 0;
    right: 0;
    width: 8px;
    height: 100%;
    cursor: col-resize;
    border-right: 2px solid #8fa4b7;
    z-index: 2;
}

.col-resize-handle:hover {
    border-right-color: #2d6fa8;
}

.amount {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.logical-fields {
    --core-logical-column-min-width: 180px;
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    align-items: start;
    gap: 0.55rem 0.7rem;
    position: relative;
    z-index: 6;
}

.field-column-wrapper {
    border: 1px solid #d4dee8;
    background: #fbfcfe;
    border-radius: 4px;
    padding: 0.42rem;
}

.ocr-review-layout {
    --ocr-review-summary-height: 26.25rem;
    align-items: stretch;
    grid-template-rows: var(--ocr-review-summary-height);
}

.ocr-review-layout > .field-column-wrapper {
    min-height: 0;
    overflow: auto;
}

.ocr-review-layout > .ocr-review-field-column {
    border: 1px solid var(--erp-border);
}

.ocr-review-document-panel {
    grid-column: 3 / span 2;
    grid-row: 1;
    align-self: stretch;
    display: flex;
    flex-direction: column;
}

.ocr-review-document-viewport {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

.core-shell.theme-dark .ocr-review-document-viewport,
.core-shell.theme-light .ocr-review-document-viewport {
    scrollbar-width: auto;
}

.core-shell.theme-dark .ocr-review-document-viewport {
    scrollbar-color: #6f88a4 transparent;
}

.core-shell.theme-light .ocr-review-document-viewport {
    scrollbar-color: #8ea8c4 transparent;
}

.core-shell.theme-dark .ocr-review-document-viewport::-webkit-scrollbar,
.core-shell.theme-light .ocr-review-document-viewport::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

.core-shell.theme-dark .ocr-review-document-viewport::-webkit-scrollbar-thumb {
    background: #6f88a4;
}

.core-shell.theme-light .ocr-review-document-viewport::-webkit-scrollbar-thumb {
    background: #8ea8c4;
}

.core-shell.theme-dark .ocr-review-document-viewport::-webkit-scrollbar-corner,
.core-shell.theme-light .ocr-review-document-viewport::-webkit-scrollbar-corner {
    background: transparent;
}

.ocr-review-document-content {
    width: 100%;
    border: 0;
}

.ocr-review-document-content--image {
    display: block;
    height: auto;
    max-width: none;
}

.ocr-review-document-content--pdf {
    display: block;
    height: 100%;
    min-height: 100%;
}

.field-edit-grid-area {
    margin-top: 0.65rem;
    border: 1px solid #c7d3de;
    background: #ffffff;
    position: relative;
    z-index: 1;
}

.secondary-grid-pair {
    margin-top: 0.65rem;
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: 0.55rem 0.7rem;
    position: relative;
    z-index: 1;
}

.secondary-grid-panel {
    border: 1px solid #c7d3de;
    background: #ffffff;
}

.secondary-grid-shell {
    margin: 0;
    border: 0;
    max-height: 220px;
}

.secondary-grid {
    min-width: 100%;
    width: 100%;
}

.field-edit-grid-title {
    padding: 0.35rem 0.5rem;
    font-size: 0.72rem;
    font-weight: 600;
    border-bottom: 1px solid #d6e0ea;
    background: #f2f6fb;
}

.line-edit-grid-shell {
    margin: 0;
    border: 0;
    max-height: 572px;
}

.line-grid-totals {
    position: sticky;
    bottom: 0;
    z-index: 12;
    font-weight: 700;
}
.line-edit-grid td.line-total-currency-cell {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-size: 0.71rem;
}
.line-total-currency-cell .line-cell-input {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.line-total-display {
    display: flex;
    justify-content: flex-end;
    align-items: baseline;
    gap: 0.65em;
    padding: 0 0.22rem;
}
.line-total-value {
    display: block;
    padding: 0 0.22rem;
}
.line-total-currency {
    order: -1;
    margin-right: auto;
    text-align: left;
}
.main-grid .line-grid-totals td {
    background: #e8eef5;
    color: #000;
    border-top: 2px solid #8295aa;
    text-align: right;
    white-space: nowrap;
}
.core-shell.theme-dark .main-grid .line-grid-totals td {
    background: #26364a;
    color: #fff;
}

.line-edit-grid-shell::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: #f2f6fb;
    z-index: 10;
    pointer-events: none;
}

.core-shell.theme-dark .line-edit-grid-shell::before {
    background: var(--erp-bg-surface);
}

.line-edit-grid {
    width: max-content;
    min-width: max-content;
    border-collapse: separate;
    border-spacing: 0;
}

.line-grid-scope-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0.2rem 0.35rem;
}

.line-grid-scope-row label {
    font-size: 0.67rem;
    font-weight: 600;
    color: #334a61;
}

.line-grid-scope-select {
    height: 24px;
    border: 1px solid #b8c8d8;
    border-radius: 4px;
    background: #ffffff;
    color: #1d2733;
    padding: 0 0.35rem;
    font-size: 0.69rem;
    font-family: inherit;
}

.core-shell.theme-dark .line-grid-scope-row label {
    color: var(--erp-text-2);
}

.core-shell.theme-dark .line-grid-scope-select {
    background: var(--erp-bg-input);
    border-color: var(--erp-border);
    color: var(--erp-text);
}

.line-edit-grid tbody tr {
    cursor: pointer;
}

.line-edit-grid th,
.line-edit-grid td {
    padding: 0.2rem 0.24rem;
}

.line-edit-grid th {
    position: sticky;
    top: 0;
    z-index: 3;
}

.field-edit-grid-row--selected td {
    background: #dcecf9;
}

.line-drop-target td {
    border-top: 2px solid #2d6fa8 !important;
}

.line-drag-source td {
    opacity: 0.7;
}

.line-drag-col {
    width: 34px;
    min-width: 34px !important;
    cursor: pointer;
}

.line-edit-grid col.line-drag-col {
    width: 34px !important;
    min-width: 34px !important;
    max-width: 34px !important;
}

.line-status-col {
    width: 24px;
    min-width: 24px !important;
    text-align: center;
}

.line-edit-grid col.line-status-col {
    width: 24px !important;
    min-width: 24px !important;
    max-width: 24px !important;
}

.line-delete-col {
    width: 39px;
    min-width: 39px !important;
    text-align: center;
    padding: 0;
}

.line-edit-grid col.line-delete-col {
    width: 39px !important;
    min-width: 39px !important;
    max-width: 39px !important;
}

.line-edit-grid th.line-drag-col,
.line-edit-grid td.line-drag-cell {
    width: 34px !important;
    min-width: 34px !important;
    max-width: 34px !important;
}

.line-edit-grid th.line-status-col,
.line-edit-grid td.line-status-cell {
    width: 24px !important;
    min-width: 24px !important;
    max-width: 24px !important;
}

.main-grid th.line-status-col,
.main-grid td.line-status-cell {
    width: 24px !important;
    min-width: 24px !important;
    max-width: 24px !important;
    padding: 0 !important;
}

.line-edit-grid th.line-delete-col,
.line-edit-grid td.line-delete-col {
    width: 39px !important;
    min-width: 39px !important;
    max-width: 39px !important;
    padding: 0 !important;
    vertical-align: middle;
}

.line-drag-cell {
    text-align: center;
    padding: 0;
}

.line-status-cell {
    text-align: center;
    padding: 0;
    vertical-align: middle;
}

.line-status-cell .row-status-dot {
    display: block;
    margin: 0 auto;
}

.row-status-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    display: inline-block;
    border: 1px solid #9caab8;
    background: #ffffff;
}

.row-status-dot--white {
    background: #ffffff;
}

.row-status-dot--red {
    background: #be2d38;
    border-color: #96222b;
}

.row-status-dot--blue {
    background: #2f6db1;
    border-color: #275894;
}

.row-status-dot--purple {
    background: #7b50b6;
    border-color: #654296;
}

.row-status-dot--green {
    background: #2d8c4e;
    border-color: #21693a;
}

.line-drag-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 22px;
    cursor: pointer;
    color: #50657a;
    user-select: none;
    font-size: 11px;
    line-height: 1;
}

.line-drag-handle:active {
    cursor: pointer;
}

.line-drag-handle::before {
    content: "\22EE\22EE";
}

.line-drag-handle--disabled {
    cursor: default;
    opacity: 0.4;
}

.line-delete-button {
    border: 1px solid #d94b4b;
    background: #fff0f0;
    width: 100%;
    height: 22px;
    min-height: 22px;
    padding: 0;
    margin: 0;
    color: #b91c1c;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.line-delete-button .lucide-icon-host {
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.line-delete-button .lucide-icon-host svg {
    width: 14px;
    height: 14px;
}

.line-delete-button:hover:not(:disabled) {
    background: #ffdede;
    border-color: #c73333;
    color: #991b1b;
}

.line-delete-button:disabled {
    opacity: 0.45;
    cursor: default;
}

.core-shell.theme-dark .line-delete-button {
    border-color: #ef6b6b;
    background: #4a1f24;
    color: #ff8a8a;
}

.core-shell.theme-dark .line-delete-button:hover:not(:disabled) {
    background: #5d242b;
    border-color: #ff8a8a;
    color: #ffb3b3;
}

.metadata-line-draft-row td {
    background: rgba(90, 122, 152, 0.08);
}

.line-cell-input {
    width: 100%;
    border: 0;
    outline: none;
    background: transparent;
    min-height: 22px;
    padding: 0 0.22rem;
    margin: 0;
    font-size: 0.71rem;
    box-sizing: border-box;
}

.document-template-layout {
    --document-template-area-height: clamp(10rem, calc(100dvh - 33.75rem), 29.375rem);
    margin-top: 0.65rem;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 0.65rem;
    align-items: start;
}

.field-edit-grid-area__content {
    display: contents;
}

.document-template-assignment-grid {
    min-width: 0;
    margin-top: 0;
}

.document-template-preview {
    min-width: 0;
    height: var(--document-template-area-height);
    max-height: var(--document-template-area-height);
    border: 1px solid #c7d3de;
    background: #f2f6fb;
    display: grid;
    grid-template-rows: 2rem minmax(0, 1fr);
    overflow: hidden;
}

.document-template-preview__heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0 0.65rem;
    border-bottom: 1px solid #d6e0ea;
    color: #334a61;
    font-size: 0.72rem;
    font-weight: 600;
}

.document-template-preview__name {
    min-width: 0;
    overflow: hidden;
    color: #61768b;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.document-template-preview__viewport {
    min-height: 0;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.document-template-preview__empty {
    max-width: 18rem;
    color: #6b7f93;
    font-size: 0.74rem;
    line-height: 1.35;
    text-align: center;
}

.document-template-preview__empty--error {
    color: #a83232;
}

.document-template-preview__pdf {
    width: 100%;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.document-template-preview__pdf-page {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.document-template-preview__pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.25rem;
    font-size: 0.75rem;
}

.document-template-preview__stage {
    position: relative;
    flex: 0 0 auto;
    overflow: visible;
}

.document-template-preview__frame {
    position: absolute;
    inset: 0 auto auto 0;
    display: block;
    border: 0;
    background: transparent;
    pointer-events: none;
    transform-origin: top left;
}

.document-template-preview__page {
    --document-accent: #173a5e;
    --document-surface: #eef3f7;
    --document-text: #182230;
    --document-muted: #667085;
    --document-background: #ffffff;
    position: relative;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: 210 / 297;
    padding: 0.7rem;
    box-sizing: border-box;
    border: 1px solid #aebdcc;
    border-radius: 2px;
    background: var(--document-background);
    box-shadow: 0 4px 16px rgba(28, 46, 66, 0.18);
    color: var(--document-text);
    display: flex;
    flex-direction: column;
    gap: 0.27rem;
    overflow: hidden;
}

.document-template-preview__page--landscape {
    aspect-ratio: 297 / 210;
    max-width: 100%;
    height: auto;
}

.document-template-preview__region {
    position: relative;
    min-height: 0;
    padding: 0.28rem 0.34rem;
    border-radius: 2px;
    overflow: hidden;
    flex: 1 1 auto;
}

.document-template-preview__region--header {
    flex-grow: 1.5;
}

.document-template-preview__region--party,
.document-template-preview__region--details {
    flex-grow: 1.35;
}

.document-template-preview__region--amount {
    flex-grow: 0.9;
}

.document-template-preview__region--footer {
    flex-grow: 0.55;
}

.document-template-preview__region-name {
    display: block;
    margin-bottom: 0.15rem;
    color: var(--document-muted);
    font-size: 0.36rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.document-template-preview__slots {
    min-height: 0;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 0.12rem 0.28rem;
}

.document-template-preview__slot {
    color: var(--document-text);
    font-size: 0.39rem;
    line-height: 1.25;
}

.document-template-preview__slot--companylogo {
    padding: 0.16rem 0.28rem;
    border: 1px solid currentColor;
    border-radius: 2px;
    font-weight: 700;
}

.document-template-preview__slot--companyname,
.document-template-preview__slot--documenttitle,
.document-template-preview__slot--counterpartyname {
    font-size: 0.48rem;
    font-weight: 700;
}

.document-template-preview__slot--amount {
    color: var(--document-accent);
    font-size: 0.8rem;
    font-weight: 800;
}

.document-template-preview__slot--standardmessage {
    line-height: 1.35;
}

.document-template-preview__surface--tint,
.document-template-preview__surface--whitecard,
.document-template-preview__surface--boxed {
    background: var(--document-surface);
}

.document-template-preview__surface--accent {
    background: var(--document-accent);
    color: #ffffff;
}

.document-template-preview__surface--accent .document-template-preview__region-name,
.document-template-preview__surface--accent .document-template-preview__slot {
    color: #ffffff;
}

.document-template-preview__surface--ruled,
.document-template-preview__surface--toprule {
    border-top: 2px solid var(--document-accent);
    border-radius: 0;
}

.document-template-preview__layout--twocolumn .document-template-preview__slots,
.document-template-preview__layout--threecolumn .document-template-preview__slots,
.document-template-preview__layout--fourcellgrid .document-template-preview__slots,
.document-template-preview__layout--compactgrid .document-template-preview__slots {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.document-template-preview__layout--threecolumn .document-template-preview__slots {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.document-template-preview__layout--fourcellgrid .document-template-preview__slots {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.document-template-preview__layout--centered .document-template-preview__slots,
.document-template-preview__layout--hero .document-template-preview__slots,
.document-template-preview__layout--centeredbrand .document-template-preview__slots,
.document-template-preview__layout--certificatetitle .document-template-preview__slots,
.document-template-preview__layout--centeredmedallion .document-template-preview__slots,
.document-template-preview__layout--centeredparty .document-template-preview__slots,
.document-template-preview__layout--centeredfooter .document-template-preview__slots {
    align-items: center;
    justify-content: center;
    text-align: center;
}

.document-template-preview__layout--band,
.document-template-preview__layout--accentnote,
.document-template-preview__layout--righttotal,
.document-template-preview__layout--statementline,
.document-template-preview__layout--centeredmedallion {
    background: var(--document-surface);
}

.document-template-preview__layout--righttotal .document-template-preview__slots {
    justify-content: flex-end;
    text-align: right;
}

.document-template-preview__page--sidebar {
    display: grid;
    grid-template-columns: 31% minmax(0, 1fr);
    grid-template-rows: repeat(5, minmax(0, 1fr));
}

.document-template-preview__page--sidebar .document-template-preview__layout--sidebarbrand {
    grid-column: 1;
    grid-row: 1 / -1;
    background: var(--document-accent);
    color: #ffffff;
}

.document-template-preview__page--sidebar .document-template-preview__layout--sidebarbrand .document-template-preview__region-name,
.document-template-preview__page--sidebar .document-template-preview__layout--sidebarbrand .document-template-preview__slot {
    color: #ffffff;
}

.document-template-preview__page--sidebar .document-template-preview__region:not(.document-template-preview__layout--sidebarbrand) {
    grid-column: 2;
}

.document-template-preview__paper {
    position: absolute;
    right: 0.36rem;
    bottom: 0.18rem;
    color: var(--document-muted);
    font-size: 0.31rem;
}

.core-shell.theme-dark .document-template-preview {
    border-color: var(--erp-border);
    background: var(--erp-bg-surface);
}

.core-shell.theme-dark .document-template-preview__heading {
    border-color: var(--erp-border);
    color: var(--erp-text);
}

.core-shell.theme-dark .document-template-preview__name,
.core-shell.theme-dark .document-template-preview__empty {
    color: var(--erp-text-muted);
}

@media (max-width: 980px) {
    .document-template-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .document-template-preview {
        display: none;
    }
}

.line-cell-input[type="number"] {
    appearance: auto;
    -webkit-appearance: auto;
    -moz-appearance: auto;
}

.core-shell.theme-light .line-cell-input {
    background: #eaf1f9;
    border: 1px solid #cdd9e6;
    border-radius: 3px;
}

.core-shell.theme-light .line-cell-select {
    background: #eaf1f9;
    border: 1px solid #cdd9e6;
    border-radius: 3px;
}

.line-cell-input:focus {
    background: #eef6ff;
}

.reference-field__input {
    width: 100%;
    height: 28px;
    border: 1px solid #b8c8d8;
    border-radius: 4px;
    padding: 0 0.35rem;
    font-size: 0.72rem;
    background: #ffffff;
    appearance: auto;
}

/* Align dropdown text inset with normal text/date/number fields */
select.reference-field__input {
    -webkit-appearance: auto;
    -moz-appearance: auto;
    appearance: auto;
    padding-left: 0.12rem !important;
    padding-inline-start: 0.12rem;
    padding-right: 0.35rem;
    text-indent: 0;
}

.reference-field__input:focus {
    background: #eef6ff;
}

/* Combo fields remain text-editable, but should look like standard dropdowns */
input.combo-like-select {
    padding-right: 1.45rem;
    background-image: none;
}

.combo-field-wrap {
    position: relative;
    z-index: 6200;
}

.combo-field-toggle {
    position: absolute;
    top: 1px;
    right: 1px;
    width: 1.2rem;
    height: calc(100% - 2px);
    border: 0;
    background: transparent;
    border-radius: 3px;
    cursor: pointer;
    z-index: 2;
    color: #334a61;
}

.combo-field-toggle::before {
    content: "▾";
    position: absolute;
    left: 50%;
    top: 49%;
    transform: translate(-50%, -50%);
    font-size: 0.66rem;
    font-weight: 700;
    line-height: 1;
}

.combo-field-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 2px);
    z-index: 6200;
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid #9fb2c5;
    border-radius: 4px;
    background: #ffffff;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.18);
}

.combo-field-option {
    display: block;
    width: 100%;
    border: 0;
    background: transparent;
    color: #1f2937;
    text-align: left;
    font-size: 0.72rem;
    line-height: 1.2;
    padding: 0.4rem 0.45rem;
    cursor: pointer;
}

.combo-field-option:hover,
.combo-field-option:focus-visible {
    background: #e9f2ff;
    outline: none;
}

.combo-field-empty {
    padding: 0.42rem 0.45rem;
    font-size: 0.7rem;
    color: #5c6f84;
}

.core-shell.theme-dark .combo-field-dropdown {
    border-color: #31455f;
    background: #0f1c2b;
    box-shadow: 0 8px 20px rgba(2, 6, 23, 0.45);
}

.core-shell.theme-dark .combo-field-option {
    color: #d7e7fb;
}

.core-shell.theme-dark .combo-field-option:hover,
.core-shell.theme-dark .combo-field-option:focus-visible {
    background: #163253;
}

.core-shell.theme-dark .combo-field-empty {
    color: #9bb4cf;
}

.core-shell.theme-dark .combo-field-toggle {
    color: #d7e7fb;
}

/* Dark-mode date picker icon visibility */
.core-shell.theme-dark .form-field input[type="date"]::-webkit-calendar-picker-indicator,
.core-shell.theme-dark .reference-field__input[type="date"]::-webkit-calendar-picker-indicator,
.core-shell.theme-dark .line-cell-input[type="date"]::-webkit-calendar-picker-indicator,
.core-shell.theme-dark .template-import-grid input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1) brightness(2.8) contrast(2) drop-shadow(0 0 0 #fff);
    opacity: 1;
    cursor: pointer;
}

.core-shell.theme-dark .picker-field-toggle {
    color: #d7e7fb;
}

.core-shell.theme-dark .picker-field-toggle:hover {
    background: rgba(215, 231, 251, 0.1);
}

.core-shell.theme-dark .picker-field-wrap input[type="text"]::placeholder {
    color: #d7e7fb;
    opacity: 1;
}

.activity-type-select {
    display: block;
    min-height: 28px;
    padding-right: 1.4rem;
    position: relative;
    z-index: 5;
}

.activities-field-column {
    position: relative;
    z-index: 4;
}

.activities-scroll-area {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.activities-form-fill {
    grid-row: 1 / span 2;
}

.dashboard-runtime-fill {
    grid-row: 1 / span 2;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.activities-lock-scope {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.activities-grid-area {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.activities-grid-shell {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
}

.dashboard-runtime-area {
    display: block;
    flex: 1 1 auto;
    min-height: 0;
}

.dashboard-runtime-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--erp-text-1);
    margin: 0.05rem 0.1rem 0.55rem;
}

.dashboard-runtime-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: 0.55rem 0.7rem;
}

.dashboard-kpi-card {
    border: 1px solid var(--dashboard-card-border, var(--erp-border));
    background: var(--erp-panel);
    border-radius: 8px;
    padding: 0.65rem 0.7rem;
    display: flex;
    flex-direction: column;
    gap: 0.42rem;
    min-height: 132px;
}

.dashboard-kpi-card--clickable {
    cursor: pointer;
}

.dashboard-kpi-card--clickable:hover {
    border-color: var(--erp-accent);
}

.dashboard-kpi-card--clickable:focus-visible {
    outline: 2px solid var(--erp-accent);
    outline-offset: 1px;
}

.dashboard-kpi-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--dashboard-card-text, var(--erp-text-1));
}

.dashboard-kpi-main-value {
    font-size: 2.05rem;
    line-height: 1.05;
    font-weight: 800;
    color: var(--dashboard-card-text, var(--erp-text-1));
    letter-spacing: -0.02em;
}

.dashboard-kpi-main-line {
    display: flex;
    align-items: baseline;
    gap: 0.45rem;
    margin-top: 0.18rem;
}

.dashboard-kpi-scope {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--dashboard-card-subtext, var(--erp-text-2));
    white-space: nowrap;
}

.dashboard-kpi-sub-list {
    display: flex;
    flex-direction: column;
    gap: 0.24rem;
    margin-top: 0.16rem;
}

.dashboard-kpi-sub-item {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.72rem;
}

.dashboard-kpi-sub-label {
    color: var(--dashboard-card-subtext, var(--erp-text-2));
    font-size: 0.92rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-kpi-sub-value {
    color: var(--dashboard-card-text, var(--erp-text-1));
    font-weight: 700;
    font-size: 0.95rem;
    white-space: nowrap;
}

.dashboard-kpi-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.2rem;
}

.dashboard-kpi-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.28rem;
    margin-top: 0.42rem;
}

.dashboard-kpi-chip {
    font-size: 0.66rem;
    line-height: 1;
    padding: 0.2rem 0.36rem;
    border-radius: 999px;
    border: 1px solid var(--dashboard-card-border, var(--erp-border));
    color: var(--dashboard-card-subtext, var(--erp-text-2));
    background: color-mix(in srgb, var(--dashboard-card-border, var(--erp-border)) 28%, transparent);
}

.dashboard-kpi-chip--warning {
    color: #f59e0b;
    border-color: rgba(245, 158, 11, 0.45);
    background: rgba(245, 158, 11, 0.12);
}

.dashboard-kpi-chip--quality,
.dashboard-kpi-chip--confidence {
    font-weight: 600;
}

.dashboard-kpi-chip--filter {
    opacity: 0.96;
}

.dashboard-kpi-chip--filter-more {
    opacity: 0.86;
}

.dashboard-kpi-chip--trend {
    font-weight: 700;
}

.dashboard-kpi-chip--trend-up {
    color: #16a34a;
    border-color: rgba(22, 163, 74, 0.40);
    background: rgba(22, 163, 74, 0.14);
}

.dashboard-kpi-chip--trend-down {
    color: #dc2626;
    border-color: rgba(220, 38, 38, 0.40);
    background: rgba(220, 38, 38, 0.14);
}

.dashboard-kpi-chip--trend-flat {
    color: var(--dashboard-card-subtext, var(--erp-text-2));
}

.dashboard-kpi-agg {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--dashboard-card-subtext, var(--erp-text-2));
    border: 1px solid var(--dashboard-card-border, var(--erp-border));
    border-radius: 999px;
    padding: 0.08rem 0.32rem;
}

.dashboard-kpi-sub-agg {
    margin-left: 0.28rem;
    font-size: 0.62rem;
    opacity: 0.92;
}

.dashboard-kpi-sub-contribution {
    margin-left: 0.28rem;
    font-size: 0.68rem;
    color: var(--dashboard-card-subtext, var(--erp-text-2));
}

.dashboard-kpi-chart-scope {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--dashboard-card-subtext, var(--erp-text-2));
    margin-top: -0.18rem;
}

.dashboard-kpi-chart-empty {
    font-size: 0.74rem;
    color: var(--dashboard-card-subtext, var(--erp-text-2));
    margin-top: 0.35rem;
}

.dashboard-kpi-chart {
    margin-top: 0.3rem;
}

.dashboard-kpi-chart--canvas {
    height: 170px;
    position: relative;
}

.dashboard-kpi-chart-canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

.dashboard-kpi-chart--graph.dashboard-kpi-chart--canvas {
    height: 190px;
}

.dashboard-kpi-graph-canvas {
    border-radius: 10px;
    background:
        radial-gradient(80% 80% at 20% 15%, color-mix(in srgb, var(--dashboard-card-text, var(--erp-accent)) 8%, transparent), transparent 72%),
        linear-gradient(180deg, color-mix(in srgb, var(--dashboard-card-border, var(--erp-border)) 28%, transparent), transparent 40%);
}

.dashboard-kpi-chart--bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(28px, 1fr));
    align-items: end;
    gap: 0.45rem;
    min-height: 86px;
}

.dashboard-kpi-bar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.22rem;
    min-width: 0;
}

.dashboard-kpi-bar-track {
    width: 100%;
    height: 64px;
    border: 1px solid var(--dashboard-card-border, var(--erp-border));
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: end;
    overflow: hidden;
}

.dashboard-kpi-bar-fill {
    width: 100%;
    background: var(--dashboard-card-text, var(--erp-accent));
    opacity: 0.95;
}

.dashboard-kpi-bar-label {
    font-size: 0.66rem;
    color: var(--dashboard-card-subtext, var(--erp-text-2));
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-kpi-chart--line {
    min-height: 86px;
}

.dashboard-kpi-line-svg {
    width: 100%;
    height: 54px;
    display: block;
}

.dashboard-kpi-line-path {
    fill: none;
    stroke: var(--dashboard-card-text, var(--erp-accent));
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.dashboard-kpi-area-fill {
    fill: color-mix(in srgb, var(--dashboard-card-text, var(--erp-accent)) 28%, transparent);
}

.dashboard-kpi-line-labels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(28px, 1fr));
    gap: 0.45rem;
    margin-top: 0.1rem;
}

.dashboard-kpi-line-label {
    font-size: 0.66rem;
    color: var(--dashboard-card-subtext, var(--erp-text-2));
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-kpi-chart--pie {
    display: grid;
    grid-template-columns: 82px 1fr;
    gap: 0.5rem;
    align-items: start;
}

.dashboard-kpi-pie {
    width: 82px;
    height: 82px;
    border-radius: 50%;
    border: 1px solid var(--dashboard-card-border, var(--erp-border));
}

.dashboard-kpi-pie--donut {
    position: relative;
}

.dashboard-kpi-pie--donut::after {
    content: "";
    position: absolute;
    inset: 23%;
    border-radius: 50%;
    background: color-mix(in srgb, var(--erp-panel) 75%, transparent);
    border: 1px solid var(--dashboard-card-border, var(--erp-border));
}

.dashboard-kpi-pie-legend {
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
    min-width: 0;
}

.dashboard-kpi-pie-legend-item {
    display: grid;
    grid-template-columns: 10px 1fr auto;
    gap: 0.28rem;
    align-items: center;
    min-width: 0;
}

.dashboard-kpi-pie-legend-swatch {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    border: 1px solid color-mix(in srgb, var(--dashboard-card-border, var(--erp-border)) 80%, transparent);
}

.dashboard-kpi-pie-legend-label {
    font-size: 0.66rem;
    color: var(--dashboard-card-subtext, var(--erp-text-2));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-kpi-pie-legend-value {
    font-size: 0.64rem;
    color: var(--dashboard-card-text, var(--erp-text-1));
    font-weight: 700;
}

.color-palette-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(18px, 1fr));
    gap: 0.28rem;
}

.color-palette-swatch {
    width: 100%;
    aspect-ratio: 1 / 1;
    min-height: 18px;
    border-radius: 4px;
    border: 1px solid #9fb2c5;
    cursor: pointer;
    transition: transform 0.08s ease, border-color 0.08s ease;
}

.color-palette-swatch:hover {
    transform: translateY(-1px);
    border-color: #637f9a;
}

.color-palette-swatch--selected {
    box-shadow: 0 0 0 2px #1f6ec9;
    border-color: #1f6ec9;
}

.core-shell.theme-dark .color-palette-swatch {
    border-color: #3f5878;
}

.core-shell.theme-dark .color-palette-swatch:hover {
    border-color: #5d7ea8;
}

.core-shell.theme-dark .color-palette-swatch--selected {
    box-shadow: 0 0 0 2px #6aa8ff;
    border-color: #6aa8ff;
}

@media (max-width: 620px) {
    .dashboard-runtime-grid {
        grid-template-columns: repeat(2, minmax(140px, 1fr));
    }
}

.line-grid-empty-state {
    padding: 0.4rem 0.55rem 0.2rem;
    font-size: 0.7rem;
    color: #5c6f84;
}

.core-shell.theme-dark .line-grid-empty-state {
    color: var(--erp-text-2);
}

.modulegen-runtime-fill {
    grid-row: 1 / span 2;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.modulegen-runtime-area {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    gap: 1rem;
    padding: 1rem;
    position: relative;
    z-index: 2;
}

.modulegen-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    gap: 1rem;
    align-items: flex-start;
}

.modulegen-header__summary {
    min-width: 0;
}

.modulegen-header__chips {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    gap: 0.5rem;
    align-items: flex-end;
    min-width: max-content;
}

.modulegen-subtitle {
    font-size: 0.92rem;
    opacity: 0.8;
    margin-top: 0.25rem;
}

.modulegen-subtitle--tenant {
    max-width: 100%;
    overflow: visible;
    white-space: normal;
    overflow-wrap: anywhere;
}

.modulegen-status-chip {
    border-radius: 999px;
    padding: 0.45rem 0.8rem;
    font-weight: 700;
    font-size: 0.84rem;
    border: 1px solid transparent;
    white-space: nowrap;
}

.modulegen-status-chip--enabled {
    background: rgba(16, 185, 129, 0.16);
    border-color: rgba(16, 185, 129, 0.38);
    color: #047857;
}

.modulegen-status-chip--disabled {
    background: rgba(239, 68, 68, 0.14);
    border-color: rgba(239, 68, 68, 0.38);
    color: #b91c1c;
}

.modulegen-layout,
.modulegen-main {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modulegen-layout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
}

.modulegen-layout > .modulegen-panel,
.modulegen-layout > .modulegen-scope-area,
.modulegen-layout .modulegen-scope-area__top,
.modulegen-layout .modulegen-scope-panel {
    height: 100%;
    box-sizing: border-box;
}

.modulegen-layout .modulegen-scope-area__top {
    flex: 1 1 auto;
}

.modulegen-panel {
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(255, 255, 255, 0.68);
    padding: 1rem;
}

.core-shell.theme-dark .modulegen-panel {
    background: rgba(15, 23, 42, 0.78);
}

.modulegen-panel__title {
    font-weight: 700;
    margin-bottom: 0.8rem;
}

.modulegen-panel__title--actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.modulegen-scope-area {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.modulegen-scope-area__top {
    display: block;
}

.modulegen-scope-panel {
    position: relative;
    width: 100%;
    min-width: 0;
    background: #ffffff;
    border: 1px solid #b8c8d8;
    font-family: inherit;
}

.core-shell.theme-dark .modulegen-scope-panel {
    background: var(--erp-bg-input);
    border-color: var(--erp-border);
    color: var(--erp-text);
}

.modulegen-panel__title--discovery {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding-right: 76px;
}

.modulegen-discovery-question__area,
.modulegen-discovery-question__text,
.modulegen-discovery-checkpoint > :first-child {
    padding-right: 76px;
}

.modulegen-discovery-panel__avatar {
    position: absolute;
    top: 0.05rem;
    right: 0.05rem;
    width: 84px;
    height: 84px;
    flex: 0 0 84px;
}

.modulegen-discovery-panel__avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 6px 12px rgba(15, 23, 42, 0.10));
}

.modulegen-discovery-question,
.modulegen-discovery-checkpoint {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

details.modulegen-discovery-checkpoint {
    margin-top: 0.9rem;
}

.modulegen-discovery-question__area {
    color: #6d28d9;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.modulegen-discovery-question__text {
    color: #17202a;
    font-size: 0.98rem;
    font-weight: 750;
    line-height: 1.4;
}

.modulegen-discovery-question__reason,
.modulegen-discovery-question__recommendation,
.modulegen-discovery-checkpoint p {
    margin: 0;
    color: #52677d;
    font-size: 0.8rem;
    line-height: 1.45;
}

.modulegen-discovery-question__recommendation {
    padding: 0.55rem 0.65rem;
    border-left: 3px solid #8b5cf6;
    background: #f5f3ff;
}

.modulegen-discovery-options {
    display: grid;
    gap: 0.45rem;
}

.modulegen-discovery-option {
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr);
    gap: 0.55rem;
    align-items: start;
    width: 100%;
    padding: 0.55rem 0.65rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #ffffff;
    color: #1f2937;
    text-align: left;
    cursor: pointer;
}

.modulegen-discovery-option:hover:not(:disabled) {
    border-color: #8b5cf6;
    background: #faf8ff;
}

.modulegen-discovery-option--recommended {
    border-color: #7c3aed;
    background: #f1ecff;
    box-shadow: inset 4px 0 0 #7c3aed;
}

.modulegen-discovery-option--selected,
.modulegen-discovery-option--selected:hover:not(:disabled) {
    border-color: #2563eb;
    background: #dbeafe;
    box-shadow: inset 4px 0 0 #2563eb, 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.modulegen-discovery-option--selected .modulegen-discovery-option__code {
    background: #2563eb;
    color: #ffffff;
}

.modulegen-discovery-option__code {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #ede9fe;
    color: #5b21b6;
    font-weight: 800;
}

.modulegen-discovery-option small {
    display: block;
    margin-top: 0.14rem;
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 400;
}

.modulegen-discovery-answer,
.modulegen-discovery-revise {
    display: grid;
    gap: 0.5rem;
}

.modulegen-discovery-answer__input,
.modulegen-discovery-revise textarea {
    min-height: 64px;
    resize: vertical;
}

.modulegen-discovery-answer__input,
.modulegen-discovery-revise textarea {
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 400;
}

.modulegen-discovery-submit,
.modulegen-discovery-revise .toolbar-button {
    justify-self: end;
}

.modulegen-discovery-submit,
.modulegen-discovery-checkpoint .toolbar-button,
.modulegen-discovery-back {
    font-weight: 800;
}

.modulegen-discovery-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    margin-top: 0.9rem;
    padding-top: 0.7rem;
    border-top: 1px solid #dbe3eb;
    color: #60758b;
    font-size: 0.72rem;
}

.modulegen-discovery-checkpoint--error {
    padding: 0.7rem;
    border: 1px solid #fca5a5;
    background: #fff1f2;
    color: #991b1b;
}

.core-shell.theme-dark .modulegen-discovery-question__text,
.core-shell.theme-dark .modulegen-discovery-option {
    color: var(--erp-text);
}

.core-shell.theme-dark .modulegen-discovery-option,
.core-shell.theme-dark .modulegen-discovery-question__recommendation {
    background: #172033;
    border-color: #46566d;
}

.core-shell.theme-dark .modulegen-discovery-option--recommended {
    border-color: #a78bfa;
    background: #28203f;
    box-shadow: inset 4px 0 0 #a78bfa;
}

.core-shell.theme-dark .modulegen-discovery-option--selected,
.core-shell.theme-dark .modulegen-discovery-option--selected:hover:not(:disabled) {
    border-color: #60a5fa;
    background: #17335c;
    box-shadow: inset 4px 0 0 #60a5fa, 0 0 0 2px rgba(96, 165, 250, 0.24);
}

.core-shell.theme-dark .modulegen-discovery-option--selected .modulegen-discovery-option__code {
    background: #60a5fa;
    color: #0f172a;
}

.modulegen-scope-panel .modulegen-details-grid > div {
    font-family: inherit;
}

.modulegen-scope-sidecards {
    display: grid;
    grid-auto-rows: max-content;
    align-content: start;
    gap: 0.9rem;
    min-width: 0;
}

.modulegen-scope-area__bottom {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(102px, 116px) minmax(82px, 92px);
    gap: 0.9rem;
    align-items: stretch;
}

.modulegen-scope-area__bottom > .modulegen-summary-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.modulegen-form-grid {
    display: grid;
    grid-template-columns: minmax(88px, 110px) minmax(0, 1fr);
    gap: 0.9rem;
}

.modulegen-form-grid .line-edit-input,
.modulegen-form-grid .reference-field__input {
    width: 100%;
    border: 1px solid #b8c8d8;
    border-radius: 4px;
    padding: 0 0.4rem;
    font-size: 0.72rem;
    font-family: inherit;
    background: #ffffff;
    color: #1d2733;
}

.modulegen-form-grid input.line-edit-input,
.modulegen-form-grid .reference-field__input {
    height: 28px;
}

.modulegen-form-grid .line-edit-input[readonly],
.modulegen-form-grid .line-edit-input:disabled,
.modulegen-form-grid .reference-field__input:disabled {
    color: #6f8398;
}

.core-shell.theme-dark .modulegen-form-grid .line-edit-input,
.core-shell.theme-dark .modulegen-form-grid .reference-field__input {
    background: var(--erp-bg-input);
    border-color: var(--erp-border);
    color: var(--erp-text);
}

.core-shell.theme-dark .modulegen-form-grid .line-edit-input[readonly],
.core-shell.theme-dark .modulegen-form-grid .line-edit-input:disabled,
.core-shell.theme-dark .modulegen-form-grid .reference-field__input:disabled {
    color: #92a7be;
}

.modulegen-label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.modulegen-label--full {
    grid-column: 1 / -1;
}

.modulegen-label--module-id {
    min-width: 0;
}

.modulegen-label--module-name {
    min-width: 0;
}

.modulegen-textarea {
    min-height: 90px;
    resize: vertical;
}

.modulegen-toggle {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-weight: 600;
}

.modulegen-production-row {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-width: 0;
}

.modulegen-production-row .modulegen-toggle {
    flex: 0 0 auto;
}

.modulegen-production-select {
    flex: 1 1 auto;
    min-width: 0;
}

.modulegen-actions {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modulegen-actions--controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
}

.modulegen-control-button {
    width: 100%;
    font-family: inherit;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.modulegen-primary-button {
    font-family: inherit;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.modulegen-actions--full {
    width: 100%;
}

.modulegen-primary-wide {
    width: 100%;
}

.modulegen-designed-menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 2400;
    background: rgba(2, 6, 23, 0.58);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.modulegen-designed-menu-modal {
    width: min(1180px, calc(100vw - 3rem));
    height: min(86vh, 900px);
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid rgba(148, 163, 184, 0.34);
    border-radius: 22px;
    box-shadow: 0 28px 64px rgba(15, 23, 42, 0.34);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modulegen-designed-menu-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.2rem 0.9rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.24);
    background: rgba(241, 245, 249, 0.88);
}

.modulegen-designed-menu-modal__title {
    font-size: 1rem;
    font-weight: 800;
    color: #0f172a;
}

.modulegen-designed-menu-modal__frame {
    width: 100%;
    height: 100%;
    border: 0;
    background: #ffffff;
    flex: 1 1 auto;
}

.modulegen-clarification-list,
.modulegen-timeline {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.modulegen-agent-card__name,
.modulegen-clarification-card__title,
.modulegen-timeline__title {
    font-weight: 700;
}

.modulegen-agent-card__meta,
.modulegen-timeline__when {
    font-size: 0.86rem;
    opacity: 0.78;
    margin-top: 0.2rem;
}

.modulegen-summary-grid {
    display: grid;
    gap: 0.9rem;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.modulegen-summary-card--compact {
    min-width: 0;
    padding: 0.72rem 0.7rem;
}

.modulegen-summary-card--wide {
    min-width: 0;
}

.modulegen-summary-card,
.modulegen-clarification-card {
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    background: rgba(255, 255, 255, 0.68);
    padding: 1rem;
}

.modulegen-agent-card {
    --modulegen-agent-card-base-bg: rgba(255, 255, 255, 0.68);
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    background: var(--modulegen-agent-card-base-bg);
    padding: 0.78rem 0.85rem;
    position: relative;
}

.core-shell.theme-dark .modulegen-summary-card,
.core-shell.theme-dark .modulegen-agent-card,
.core-shell.theme-dark .modulegen-clarification-card {
    background: rgba(15, 23, 42, 0.78);
}

.modulegen-summary-card--ready {
    border-color: rgba(22, 163, 74, 0.42);
    background: linear-gradient(180deg, rgba(220, 252, 231, 0.9) 0%, rgba(187, 247, 208, 0.82) 100%);
    box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.12);
}

.core-shell.theme-dark .modulegen-summary-card--ready {
    border-color: rgba(74, 222, 128, 0.46);
    background: linear-gradient(180deg, rgba(20, 83, 45, 0.92) 0%, rgba(22, 101, 52, 0.88) 100%);
    box-shadow: inset 0 0 0 1px rgba(74, 222, 128, 0.18);
}

.core-shell.theme-dark .modulegen-agent-card {
    --modulegen-agent-card-base-bg: rgba(15, 23, 42, 0.78);
}

.modulegen-summary-card__label {
    font-size: 0.84rem;
    opacity: 0.7;
}

.modulegen-summary-card__value {
    margin-top: 0.45rem;
    font-size: 1.05rem;
    font-weight: 700;
}

.modulegen-summary-card__value--compact {
    font-size: 0.88rem;
    line-height: 1.2;
    white-space: nowrap;
}

.modulegen-agent-flow {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(0, 1.2fr);
    gap: 1rem;
    align-items: stretch;
}

.modulegen-tester-viewer {
    border: 1px solid #b8c8d8;
    border-radius: 6px;
    background: #ffffff;
    padding: 0.85rem;
}

.core-shell.theme-dark .modulegen-tester-viewer {
    border-color: var(--erp-border);
    background: #0f172a;
}

.modulegen-tester-viewer__header,
.modulegen-tester-viewer__controls,
.modulegen-tester-viewer__meta {
    display: flex;
    align-items: center;
}

.modulegen-tester-viewer__header {
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.7rem;
}

.modulegen-tester-viewer__header .modulegen-panel__title {
    margin-bottom: 0.12rem;
}

.modulegen-tester-viewer__subtitle,
.modulegen-tester-viewer__meta {
    color: #60758b;
    font-size: 0.78rem;
}

.core-shell.theme-dark .modulegen-tester-viewer__subtitle,
.core-shell.theme-dark .modulegen-tester-viewer__meta {
    color: #9fb2c7;
}

.modulegen-tester-viewer__controls {
    gap: 0.5rem;
    flex: 0 0 auto;
}

.modulegen-tester-viewer__live {
    color: #b42318;
    font-size: 0.72rem;
    font-weight: 800;
}

.modulegen-tester-viewer__live::before {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 0.35rem;
    border-radius: 50%;
    background: #d92d20;
    box-shadow: 0 0 0 3px rgba(217, 45, 32, 0.12);
}

.modulegen-tester-viewer__nav {
    width: 30px;
    min-width: 30px;
    height: 30px;
    padding: 0;
    font-size: 1.25rem;
    line-height: 1;
}

.modulegen-tester-viewer__count {
    min-width: 54px;
    text-align: center;
    font-size: 0.76rem;
    font-weight: 700;
}

.modulegen-tester-viewer__viewport {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: 620px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid #cbd5e1;
    background: #eef2f6;
}

.core-shell.theme-dark .modulegen-tester-viewer__viewport {
    border-color: #334155;
    background: #020617;
}

.modulegen-tester-viewer__viewport img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    opacity: 1;
    transition: opacity 120ms ease;
}

.modulegen-tester-viewer__viewport img.is-loading {
    opacity: 0;
}

.modulegen-tester-viewer__waiting {
    color: #52677d;
    font-size: 0.84rem;
}

.modulegen-tester-viewer__loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eef2f6;
    color: #334155;
    font-size: 0.9rem;
    font-weight: 700;
}

.modulegen-tester-viewer__loading--error {
    color: #b42318;
}

.core-shell.theme-dark .modulegen-tester-viewer__loading {
    background: #020617;
    color: #cbd5e1;
}

.core-shell.theme-dark .modulegen-tester-viewer__loading--error {
    color: #fca5a5;
}

.modulegen-tester-viewer__meta {
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.55rem;
    min-width: 0;
}

.modulegen-tester-viewer__meta span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modulegen-agent-card--orchestrator {
    grid-column: 1 / -1;
    padding-right: 0.85rem;
}

.modulegen-agent-flow__right {
    display: grid;
    grid-template-rows: repeat(3, minmax(0, 1fr));
    gap: 0.85rem;
    min-height: 100%;
}

.modulegen-agent-row {
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr);
    gap: 0.85rem;
    align-items: stretch;
}

.modulegen-agent-card__status {
    margin-top: 0.22rem;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.76rem;
    letter-spacing: 0.03em;
}

.modulegen-agent-card__task {
    margin: 0.45rem 0 0.52rem;
    font-size: 0.92rem;
    line-height: 1.28;
}

.modulegen-agent-card__name {
    font-size: 0.97rem;
}

.modulegen-agent-card__avatar {
    position: absolute;
    top: 0.05rem;
    right: 0.05rem;
    width: 84px;
    height: 84px;
    border-radius: 16px;
    background-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modulegen-agent-card__avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 6px 12px rgba(15, 23, 42, 0.10));
}

.core-shell.theme-dark .modulegen-agent-card__avatar {
    background-color: transparent;
}

.core-shell.theme-dark .modulegen-agent-card__avatar img {
    filter: drop-shadow(0 6px 12px rgba(15, 23, 42, 0.10));
}

.modulegen-agent-card__meta {
    font-size: 0.82rem;
    line-height: 1.24;
}

.modulegen-agent-card--flow {
    height: 100%;
    padding-right: 1rem;
}

.modulegen-agent-card--director {
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    padding-bottom: 4.9rem;
}

.modulegen-agent-card--orchestrator .modulegen-agent-card__task {
    margin-bottom: 0;
}

.modulegen-agent-card--running {
    border-color: rgba(37, 99, 235, 0.38);
}

.modulegen-agent-card--waiting {
    border-color: rgba(245, 158, 11, 0.38);
}

.modulegen-agent-card--blocked {
    border-color: rgba(220, 38, 38, 0.38);
}

.modulegen-agent-card--completed {
    border-color: rgba(22, 163, 74, 0.38);
}

.modulegen-agent-card--working {
    animation: modulegen-agent-working 1.1s ease-in-out infinite;
    box-shadow:
        0 0 0 2px rgba(37, 99, 235, 0.24),
        0 0 24px rgba(37, 99, 235, 0.24),
        inset 0 0 0 1px rgba(96, 165, 250, 0.22);
}

.modulegen-agent-card--flash-a {
    animation: modulegen-agent-card-flash-blue-a 4s ease-in-out;
}

.modulegen-agent-card--flash-b {
    animation: modulegen-agent-card-flash-blue-b 4s ease-in-out;
}

.modulegen-agent-card--working.modulegen-agent-card--flash-a {
    animation:
        modulegen-agent-working 1.1s ease-in-out infinite,
        modulegen-agent-card-flash-blue-a 4s ease-in-out;
}

.modulegen-agent-card--working.modulegen-agent-card--flash-b {
    animation:
        modulegen-agent-working 1.1s ease-in-out infinite,
        modulegen-agent-card-flash-blue-b 4s ease-in-out;
}

.modulegen-connector {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    position: relative;
    color: #64748b;
    opacity: 0.92;
    overflow: visible;
}

.modulegen-connector__pass-count {
    position: absolute;
    top: 50%;
    left: 50%;
    min-width: 30px;
    height: 30px;
    padding: 0 0.45rem;
    transform: translate(-50%, calc(-50% - 26px));
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(255, 255, 255, 0.92);
    color: #1f2937;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1;
    box-shadow:
        0 8px 18px rgba(15, 23, 42, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.75);
    z-index: 2;
}

.modulegen-connector::before {
    content: "";
    position: absolute;
    left: 10px;
    right: 18px;
    top: 50%;
    height: 6px;
    transform: translateY(-50%);
    border-radius: 999px;
    background:
        linear-gradient(90deg,
            rgba(148, 163, 184, 0.12) 0%,
            rgba(100, 116, 139, 0.85) 46%,
            rgba(148, 163, 184, 0.12) 100%);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.08),
        0 0 0 1px rgba(148, 163, 184, 0.14),
        0 0 14px rgba(100, 116, 139, 0.18);
}

.modulegen-connector::after {
    content: "";
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 9px solid transparent;
    border-bottom: 9px solid transparent;
    border-left: 14px solid rgba(100, 116, 139, 0.92);
    filter: drop-shadow(0 0 8px rgba(51, 65, 85, 0.26));
}

.modulegen-connector__icon {
    position: absolute;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    left: 10px;
    top: 50%;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    font-size: 0;
    line-height: 1;
    color: transparent;
    background: linear-gradient(180deg, rgba(226, 232, 240, 0.96), rgba(148, 163, 184, 0.92));
    box-shadow:
        0 0 0 2px rgba(148, 163, 184, 0.22),
        0 0 12px rgba(148, 163, 184, 0.24);
    transform: translateY(-50%);
}

.modulegen-connector--reverse::after {
    right: auto;
    left: 4px;
    border-left: 0;
    border-right: 14px solid rgba(100, 116, 139, 0.92);
}

.modulegen-connector--reverse .modulegen-connector__icon {
    left: auto;
    right: 10px;
}

.modulegen-connector--active {
    color: #60a5fa;
    opacity: 1;
}

.modulegen-connector--active::before {
    background:
        linear-gradient(90deg,
            rgba(59, 130, 246, 0.15) 0%,
            rgba(59, 130, 246, 0.75) 24%,
            rgba(147, 197, 253, 1) 50%,
            rgba(59, 130, 246, 0.75) 76%,
            rgba(59, 130, 246, 0.15) 100%);
    box-shadow:
        inset 0 0 0 1px rgba(219, 234, 254, 0.18),
        0 0 0 1px rgba(96, 165, 250, 0.3),
        0 0 18px rgba(59, 130, 246, 0.32),
        0 0 34px rgba(37, 99, 235, 0.22);
    animation: modulegen-connector-stream 1.05s linear infinite;
}

.modulegen-connector--active::after {
    border-left-color: rgba(96, 165, 250, 1);
    filter: drop-shadow(0 0 10px rgba(59, 130, 246, 0.5));
}

.modulegen-connector--active.modulegen-connector--reverse::after {
    border-left-color: transparent;
    border-right-color: rgba(96, 165, 250, 1);
}

.modulegen-connector--active .modulegen-connector__icon {
    background: radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 1), rgba(147, 197, 253, 0.98) 45%, rgba(37, 99, 235, 0.98) 100%);
    box-shadow:
        0 0 0 2px rgba(96, 165, 250, 0.32),
        0 0 18px rgba(59, 130, 246, 0.55),
        0 0 32px rgba(37, 99, 235, 0.28);
    animation: modulegen-connector-flow 1.05s ease-in-out infinite;
}

.modulegen-connector--active.modulegen-connector--reverse .modulegen-connector__icon {
    animation-name: modulegen-connector-flow-reverse;
}

.modulegen-connector--active .modulegen-connector__pass-count {
    border-color: rgba(96, 165, 250, 0.5);
    color: #1d4ed8;
    box-shadow:
        0 10px 22px rgba(37, 99, 235, 0.18),
        0 0 0 2px rgba(147, 197, 253, 0.16),
        inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.core-shell.theme-dark .modulegen-connector__pass-count {
    background: rgba(15, 23, 42, 0.94);
    border-color: rgba(148, 163, 184, 0.24);
    color: #e2e8f0;
    box-shadow:
        0 10px 22px rgba(2, 6, 23, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.core-shell.theme-dark .modulegen-connector--active .modulegen-connector__pass-count {
    border-color: rgba(96, 165, 250, 0.42);
    color: #93c5fd;
    box-shadow:
        0 10px 24px rgba(30, 64, 175, 0.28),
        0 0 0 2px rgba(59, 130, 246, 0.14),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.modulegen-user-connector {
    position: absolute;
    left: 50%;
    bottom: 0.65rem;
    transform: translateX(-50%);
    width: 42px;
    height: 74px;
}

.modulegen-user-connector::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 8px;
    bottom: 18px;
    width: 6px;
    transform: translateX(-50%);
    border-radius: 999px;
    background:
        linear-gradient(180deg,
            rgba(148, 163, 184, 0.12) 0%,
            rgba(100, 116, 139, 0.85) 46%,
            rgba(148, 163, 184, 0.12) 100%);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.08),
        0 0 0 1px rgba(148, 163, 184, 0.14),
        0 0 14px rgba(100, 116, 139, 0.18);
}

.modulegen-user-connector::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 4px;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 16px solid rgba(100, 116, 139, 0.92);
    filter: drop-shadow(0 0 8px rgba(51, 65, 85, 0.26));
}

.modulegen-user-connector__icon {
    position: absolute;
    left: 50%;
    top: 8px;
    width: 18px;
    height: 18px;
    transform: translateX(-50%);
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(226, 232, 240, 0.96), rgba(148, 163, 184, 0.92));
    box-shadow:
        0 0 0 2px rgba(148, 163, 184, 0.22),
        0 0 12px rgba(148, 163, 184, 0.24);
}

.modulegen-user-connector--active::before {
    background:
        linear-gradient(180deg,
            rgba(59, 130, 246, 0.15) 0%,
            rgba(59, 130, 246, 0.75) 24%,
            rgba(147, 197, 253, 1) 50%,
            rgba(59, 130, 246, 0.75) 76%,
            rgba(59, 130, 246, 0.15) 100%);
    box-shadow:
        inset 0 0 0 1px rgba(219, 234, 254, 0.18),
        0 0 0 1px rgba(96, 165, 250, 0.3),
        0 0 18px rgba(59, 130, 246, 0.32),
        0 0 34px rgba(37, 99, 235, 0.22);
    animation: modulegen-connector-stream 1.05s linear infinite;
}

.modulegen-user-connector--active::after {
    border-top-color: rgba(96, 165, 250, 1);
    filter: drop-shadow(0 0 10px rgba(59, 130, 246, 0.5));
}

.modulegen-user-connector--active .modulegen-user-connector__icon {
    background: radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 1), rgba(147, 197, 253, 0.98) 45%, rgba(37, 99, 235, 0.98) 100%);
    box-shadow:
        0 0 0 2px rgba(96, 165, 250, 0.32),
        0 0 18px rgba(59, 130, 246, 0.55),
        0 0 32px rgba(37, 99, 235, 0.28);
    animation: modulegen-user-connector-flow 1.05s ease-in-out infinite;
}

.modulegen-details-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.7rem;
}

.modulegen-details-grid > div {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: normal;
}

.modulegen-details-grid__full {
    grid-column: 1 / -1;
}

.modulegen-two-column {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    padding-bottom: 0.5rem;
}

.modulegen-scroll-panel {
    max-height: 320px;
    overflow-y: auto;
    padding-right: 0.15rem;
}

.modulegen-clarification-list.modulegen-scroll-panel {
    max-height: none;
    overflow: visible;
    padding-right: 0;
}

.modulegen-timeline.modulegen-scroll-panel {
    height: 320px;
    max-height: 320px;
    overflow-y: scroll;
    scrollbar-gutter: stable;
    padding-bottom: 0.85rem;
    box-sizing: border-box;
}

.core-shell.theme-dark .modulegen-timeline::-webkit-scrollbar,
.core-shell.theme-light .modulegen-timeline::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

.core-shell.theme-dark .modulegen-timeline::-webkit-scrollbar-thumb {
    background: #6f88a4;
}

.core-shell.theme-light .modulegen-timeline::-webkit-scrollbar-thumb {
    background: #8ea8c4;
}

.modulegen-timeline-panel {
    padding-bottom: 1.35rem;
    margin-bottom: 0.5rem;
}

.modulegen-timeline__item:last-child {
    margin-bottom: 1rem;
}

.modulegen-clarification-card--active {
    border-color: rgba(124, 58, 237, 0.38);
}

.modulegen-clarification-field {
    display: grid;
    gap: 0.25rem;
    margin-top: 0.65rem;
}

.modulegen-clarification-field:first-of-type {
    margin-top: 0.45rem;
}

.modulegen-clarification-field--compact {
    margin-top: 0.5rem;
}

.modulegen-clarification-field__label {
    font-weight: 700;
    color: #41556c;
}

.modulegen-clarification-field__value {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    line-height: 1.45;
    color: #1d2733;
}

.core-shell.theme-dark .modulegen-clarification-field__label {
    color: #aab6c4;
}

.core-shell.theme-dark .modulegen-clarification-field__value {
    color: var(--erp-text);
}

.modulegen-clarification-reply {
    margin-top: 0.9rem;
    padding-top: 0.8rem;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
}

.modulegen-clarification-textarea {
    min-height: 96px;
}

.modulegen-clarification-feedback {
    margin-top: 0.9rem;
}

.modulegen-clarification-reply .line-edit-input {
    width: 100%;
    border: 1px solid #b8c8d8;
    border-radius: 4px;
    padding: 0.4rem 0.5rem;
    font-size: 0.72rem;
    font-family: inherit;
    background: #ffffff;
    color: #1d2733;
}

.core-shell.theme-dark .modulegen-clarification-reply .line-edit-input {
    background: var(--erp-bg-input);
    border-color: var(--erp-border);
    color: var(--erp-text);
}

.modulegen-actions--clarification {
    margin-top: 0.7rem;
    justify-content: flex-end;
}

.modulegen-timeline__item {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 0.85rem;
    align-items: start;
}

.modulegen-timeline__details {
    margin-top: 0.2rem;
}

@media (max-width: 1280px) {
    .modulegen-two-column,
    .modulegen-summary-grid,
    .modulegen-details-grid,
    .modulegen-scope-area__top,
    .modulegen-scope-area__bottom {
        grid-template-columns: 1fr;
    }

    .modulegen-agent-flow {
        grid-template-columns: 1fr;
    }

    .modulegen-agent-flow__right {
        grid-template-rows: none;
    }

    .modulegen-agent-row {
        grid-template-columns: 1fr;
    }

    .modulegen-scope-sidecards {
        grid-template-rows: none;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .modulegen-connector {
        min-height: 52px;
    }

    .modulegen-connector::before {
        left: 50%;
        right: auto;
        top: 10px;
        bottom: 18px;
        width: 6px;
        height: auto;
        transform: translateX(-50%);
        background:
            linear-gradient(180deg,
                rgba(148, 163, 184, 0.12) 0%,
                rgba(100, 116, 139, 0.85) 46%,
                rgba(148, 163, 184, 0.12) 100%);
    }

    .modulegen-connector::after {
        right: auto;
        left: 50%;
        top: auto;
        bottom: 4px;
        transform: translateX(-50%);
        border-top: 14px solid rgba(100, 116, 139, 0.92);
        border-right: 9px solid transparent;
        border-left: 9px solid transparent;
        border-bottom: 0;
    }

    .modulegen-connector--active::after {
        border-top-color: rgba(96, 165, 250, 1);
        border-left-color: transparent;
    }

    .modulegen-connector__icon {
        left: 50%;
        top: 10px;
        transform: translate(-50%, 0);
    }

    .modulegen-connector--reverse::after {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        border-right: 9px solid transparent;
        border-left: 9px solid transparent;
        border-top: 14px solid rgba(100, 116, 139, 0.92);
        border-bottom: 0;
    }

    .modulegen-connector--reverse .modulegen-connector__icon {
        left: 50%;
        right: auto;
    }

    .modulegen-connector--active.modulegen-connector--reverse::after {
        border-right-color: transparent;
        border-top-color: rgba(96, 165, 250, 1);
    }
}

@keyframes modulegen-connector-flow {
    0% {
        left: 10px;
        transform: translateY(-50%) scale(0.92);
        opacity: 0.72;
    }

    50% {
        left: calc(100% - 28px);
        transform: translateY(-50%) scale(1.08);
        opacity: 1;
    }

    100% {
        left: 10px;
        transform: translateY(-50%) scale(0.92);
        opacity: 0.72;
    }
}

@keyframes modulegen-connector-flow-reverse {
    0% {
        right: 10px;
        transform: translateY(-50%) scale(0.92);
        opacity: 0.72;
    }

    50% {
        right: calc(100% - 28px);
        transform: translateY(-50%) scale(1.08);
        opacity: 1;
    }

    100% {
        right: 10px;
        transform: translateY(-50%) scale(0.92);
        opacity: 0.72;
    }
}

@keyframes modulegen-user-connector-flow {
    0% {
        top: 8px;
        transform: translateX(-50%) scale(0.92);
        opacity: 0.72;
    }

    50% {
        top: calc(100% - 36px);
        transform: translateX(-50%) scale(1.08);
        opacity: 1;
    }

    100% {
        top: 8px;
        transform: translateX(-50%) scale(0.92);
        opacity: 0.72;
    }
}

@keyframes modulegen-connector-stream {
    0% {
        filter: brightness(0.92);
        background-position: 0% 50%;
    }

    50% {
        filter: brightness(1.15);
        background-position: 100% 50%;
    }

    100% {
        filter: brightness(0.92);
        background-position: 0% 50%;
    }
}

@keyframes modulegen-agent-working {
    0% {
        border-color: rgba(59, 130, 246, 0.38);
        box-shadow:
            0 0 0 2px rgba(37, 99, 235, 0.16),
            0 0 10px rgba(37, 99, 235, 0.12),
            inset 0 0 0 1px rgba(96, 165, 250, 0.14);
    }

    50% {
        border-color: rgba(59, 130, 246, 0.98);
        box-shadow:
            0 0 0 3px rgba(59, 130, 246, 0.34),
            0 0 30px rgba(59, 130, 246, 0.3),
            inset 0 0 0 1px rgba(147, 197, 253, 0.26);
    }

    100% {
        border-color: rgba(59, 130, 246, 0.38);
        box-shadow:
            0 0 0 2px rgba(37, 99, 235, 0.16),
            0 0 10px rgba(37, 99, 235, 0.12),
            inset 0 0 0 1px rgba(96, 165, 250, 0.14);
    }
}

@keyframes modulegen-agent-card-flash-blue-a {
    0% {
        background-color: var(--modulegen-agent-card-base-bg);
        filter: brightness(1) saturate(1);
        transform: scale(1);
    }

    8% {
        background-color: rgba(59, 130, 246, 0.30);
        filter: brightness(1.16) saturate(1.08);
        transform: scale(1.012);
    }

    16% {
        filter: brightness(1.08) saturate(1.04);
        background-color: rgba(59, 130, 246, 0.18);
        transform: scale(1.006);
    }

    26% {
        background-color: rgba(59, 130, 246, 0.30);
        filter: brightness(1.16) saturate(1.08);
        transform: scale(1.012);
    }

    34% {
        background-color: rgba(59, 130, 246, 0.18);
        filter: brightness(1.08) saturate(1.04);
        transform: scale(1.006);
    }

    44% {
        background-color: rgba(59, 130, 246, 0.30);
        filter: brightness(1.16) saturate(1.08);
        transform: scale(1.012);
    }

    52% {
        background-color: rgba(59, 130, 246, 0.18);
        filter: brightness(1.08) saturate(1.04);
        transform: scale(1.006);
    }

    62% {
        background-color: rgba(59, 130, 246, 0.30);
        filter: brightness(1.16) saturate(1.08);
        transform: scale(1.012);
    }

    70% {
        background-color: rgba(59, 130, 246, 0.18);
        filter: brightness(1.08) saturate(1.04);
        transform: scale(1.006);
    }

    80% {
        background-color: rgba(59, 130, 246, 0.30);
        filter: brightness(1.16) saturate(1.08);
        transform: scale(1.012);
    }

    88% {
        background-color: rgba(59, 130, 246, 0.18);
        filter: brightness(1.08) saturate(1.04);
        transform: scale(1.006);
    }

    100% {
        background-color: var(--modulegen-agent-card-base-bg);
        filter: brightness(1) saturate(1);
        transform: scale(1);
    }
}

@keyframes modulegen-agent-card-flash-blue-b {
    0% {
        background-color: var(--modulegen-agent-card-base-bg);
        filter: brightness(1) saturate(1);
        transform: scale(1);
    }

    8% {
        background-color: rgba(59, 130, 246, 0.30);
        filter: brightness(1.16) saturate(1.08);
        transform: scale(1.012);
    }

    16% {
        filter: brightness(1.08) saturate(1.04);
        background-color: rgba(59, 130, 246, 0.18);
        transform: scale(1.006);
    }

    26% {
        background-color: rgba(59, 130, 246, 0.30);
        filter: brightness(1.16) saturate(1.08);
        transform: scale(1.012);
    }

    34% {
        background-color: rgba(59, 130, 246, 0.18);
        filter: brightness(1.08) saturate(1.04);
        transform: scale(1.006);
    }

    44% {
        background-color: rgba(59, 130, 246, 0.30);
        filter: brightness(1.16) saturate(1.08);
        transform: scale(1.012);
    }

    52% {
        background-color: rgba(59, 130, 246, 0.18);
        filter: brightness(1.08) saturate(1.04);
        transform: scale(1.006);
    }

    62% {
        background-color: rgba(59, 130, 246, 0.30);
        filter: brightness(1.16) saturate(1.08);
        transform: scale(1.012);
    }

    70% {
        background-color: rgba(59, 130, 246, 0.18);
        filter: brightness(1.08) saturate(1.04);
        transform: scale(1.006);
    }

    80% {
        background-color: rgba(59, 130, 246, 0.30);
        filter: brightness(1.16) saturate(1.08);
        transform: scale(1.012);
    }

    88% {
        background-color: rgba(59, 130, 246, 0.18);
        filter: brightness(1.08) saturate(1.04);
        transform: scale(1.006);
    }

    100% {
        background-color: var(--modulegen-agent-card-base-bg);
        filter: brightness(1) saturate(1);
        transform: scale(1);
    }
}

.line-cell-select {
    -webkit-appearance: auto;
    -moz-appearance: auto;
    appearance: auto;
    padding-left: 0.08rem !important;
    padding-inline-start: 0.08rem;
    padding-right: 0.2rem;
    text-indent: 0;
}

.line-cell-input.combo-like-select {
    padding-right: 1.1rem;
    background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
    background-position: calc(100% - 0.58rem) 52%, calc(100% - 0.43rem) 52%;
    background-size: 0.24rem 0.24rem, 0.24rem 0.24rem;
    background-repeat: no-repeat;
}

.line-boolean-toggle {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    min-height: 22px;
}

.line-boolean-toggle__btn {
    flex: 0 0 auto;
    width: var(--option-btn-width, auto);
    min-width: var(--option-btn-width, 0);
    min-height: 22px;
    border: 1px solid #9fb2c5;
    border-radius: 4px;
    background: #ffffff;
    color: #30485f;
    font-size: 0.67rem;
    font-weight: 600;
    padding: 0 0.2rem;
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
    cursor: pointer;
}

.line-boolean-toggle__btn:hover:not(:disabled) {
    background: #eef6ff;
    border-color: #7e9bb7;
}

.line-boolean-toggle__btn--active {
    background: #dcecf9;
    border-color: #6b8faf;
    color: #13324e;
}

.line-boolean-toggle__btn:disabled {
    cursor: default;
    opacity: 0.55;
}

.core-shell.theme-dark .line-boolean-toggle__btn {
    border-color: #355070;
    background: #111a27;
    color: #9fb4ca;
}

.core-shell.theme-dark .line-boolean-toggle__btn:hover:not(:disabled) {
    background: #172436;
    border-color: #47688f;
}

.core-shell.theme-dark .line-boolean-toggle__btn--active {
    background: rgba(59, 130, 246, 0.16);
    border-color: #4b75a8;
    color: #d7e6f8;
}

.metadata-option-toggle {
    display: flex;
    flex-wrap: wrap;
    gap: 0.22rem;
}

.metadata-option-toggle--line {
    min-height: 22px;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    align-items: center;
}

.metadata-option-toggle--form {
    display: grid;
    grid-template-columns: repeat(var(--option-cols, 1), minmax(0, 1fr));
    justify-content: stretch;
    align-items: start;
}

.metadata-option-toggle--stacked {
    flex-direction: column;
    align-items: stretch;
}

.metadata-option-toggle--stacked .metadata-option-toggle__btn {
    width: 100%;
    min-width: 0;
}

.metadata-option-toggle__btn {
    width: var(--option-btn-width, auto);
    min-width: var(--option-btn-width, 0);
    min-height: 22px;
    border: 1px solid #9fb2c5;
    border-radius: 4px;
    background: #ffffff;
    color: #30485f;
    font-size: 0.67rem;
    font-weight: 600;
    padding: 0 0.1rem;
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
    cursor: pointer;
}

.metadata-option-toggle--form .metadata-option-toggle__btn {
    width: 100%;
    min-width: 0;
}

.metadata-option-toggle__btn:hover:not(:disabled) {
    background: #eef6ff;
    border-color: #7e9bb7;
}

.metadata-option-toggle__btn--active {
    background: #dcecf9;
    border-color: #6b8faf;
    color: #13324e;
}

.metadata-option-toggle__btn:disabled {
    cursor: default;
    opacity: 0.55;
}

.core-shell.theme-dark .metadata-option-toggle__btn {
    border-color: #355070;
    background: #111a27;
    color: #9fb4ca;
}

.core-shell.theme-dark .metadata-option-toggle__btn:hover:not(:disabled) {
    background: #172436;
    border-color: #47688f;
}

.core-shell.theme-dark .metadata-option-toggle__btn--active {
    background: rgba(59, 130, 246, 0.16);
    border-color: #4b75a8;
    color: #d7e6f8;
}

.form-field {
    padding: 0;
}

.form-field + .form-field {
    margin-top: 0.42rem;
    padding-top: 0.42rem;
}

.form-field label {
    display: block;
    font-size: 0.69rem;
    font-weight: 600;
    margin-bottom: 0.28rem;
    color: #334a61;
}

.form-field input[type="text"],
.form-field input[type="date"],
.form-field input[type="number"],
.form-field textarea.metadata-long-text {
    width: 100%;
    height: 28px;
    border: 1px solid #b8c8d8;
    border-radius: 4px;
    padding: 0 0.4rem;
    font-size: 0.72rem;
    font-family: inherit;
    background: #ffffff;
}

.form-field input[type="number"],
.line-cell-input[type="number"] {
    color-scheme: light;
}

.form-field input[readonly]:not(.picker-field-value) {
    color: #6f8398;
}

/* Form-only long text: four text lines in the existing 84px container; grids are unchanged. */
.form-field textarea.metadata-long-text {
    display: block;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    height: 84px;
    padding: 5px 0.4rem;
    line-height: 18px;
    border: 1px solid #b8c8d8;
    border-radius: 4px;
    background: #ffffff;
    color: inherit;
    resize: none;
    overflow-y: auto;
    overflow-x: hidden;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    scrollbar-width: thin;
    scrollbar-color: #8ea8c4 transparent;
}
.core-shell.theme-dark .metadata-long-text {
    scrollbar-color: #6f88a4 transparent;
}

/* Actual runtime state drives the surface, including ISREADONLY calculations and
   controls disabled by an enclosing fieldset. Picker value displays are always
   readonly to prevent typing; their disabled state follows picker availability. */
.core-shell {
    --erp-field-disabled-bg: #e5e7eb;
    --erp-field-disabled-text: #000000;
}
.core-shell.theme-dark {
    --erp-field-disabled-bg: #3b4149;
    --erp-field-disabled-text: #e0e5eb;
}
.core-shell :is(.form-field, .mobile-form-field, .line-edit-grid-shell, .mobile-line-grid)
    :is(input:not([type=hidden]), textarea, select):is(:disabled, [readonly]:not(.picker-field-value)),
.core-shell :is(.metadata-option-toggle__btn, .line-boolean-toggle__btn, .picker-field-toggle, .mobile-themed-select-trigger):disabled,
.core-shell .mobile-option-toggle button:disabled {
    background-color: var(--erp-field-disabled-bg) !important;
    color: var(--erp-field-disabled-text) !important;
    -webkit-text-fill-color: var(--erp-field-disabled-text);
    opacity: 1;
    cursor: default;
}
/* Keep the selected Yes/No or option identifiable after both buttons turn grey. */
.core-shell :is(.metadata-option-toggle__btn--active, .line-boolean-toggle__btn--active, .mobile-option-toggle--selected):disabled {
    box-shadow: inset 0 0 0 1px currentColor;
}
.core-shell :is(.form-field, .mobile-form-field, .line-edit-grid-shell, .mobile-line-grid)
    :is(input, textarea):is(:disabled, [readonly]:not(.picker-field-value)):-webkit-autofill {
    box-shadow: 0 0 0 1000px var(--erp-field-disabled-bg) inset;
}

.core-shell input:-webkit-autofill,
.core-shell input:-webkit-autofill:hover,
.core-shell input:-webkit-autofill:focus,
.core-shell textarea:-webkit-autofill,
.core-shell textarea:-webkit-autofill:hover,
.core-shell textarea:-webkit-autofill:focus {
    -webkit-text-fill-color: inherit;
    caret-color: inherit;
    transition: background-color 999999s ease-out 0s;
    box-shadow: 0 0 0 1000px #ffffff inset;
}

.core-shell.theme-dark input:-webkit-autofill,
.core-shell.theme-dark input:-webkit-autofill:hover,
.core-shell.theme-dark input:-webkit-autofill:focus,
.core-shell.theme-dark textarea:-webkit-autofill,
.core-shell.theme-dark textarea:-webkit-autofill:hover,
.core-shell.theme-dark textarea:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--erp-text);
    box-shadow: 0 0 0 1000px var(--erp-bg-input) inset;
}

.picker-field-wrap {
    position: relative;
}

.picker-field-wrap input[type="text"] {
    padding-right: 1.9rem;
}

.picker-field-toggle {
    position: absolute;
    top: 1px;
    right: 1px;
    width: 1.65rem;
    height: calc(100% - 2px);
    border: 0;
    background: transparent;
    border-radius: 3px;
    cursor: pointer;
    z-index: 2;
    color: #334a61;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.picker-field-toggle:hover {
    background: #eef4fa;
}

.picker-field-toggle:disabled {
    cursor: default;
    opacity: 0.45;
}

.picker-field-toggle:disabled:hover {
    background: transparent;
}

.picker-field-toggle .top-icon-button__glyph {
    width: 14px;
    height: 14px;
}

.picker-field-native {
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    border: 0;
    padding: 0;
}

.picker-field-wrap input[type="text"]::placeholder {
    color: #334a61;
    opacity: 1;
}

.metadata-image-field {
    display: grid;
    gap: 0.4rem;
}

.metadata-image-field__controls {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
}

.metadata-image-field__choose {
    height: 28px;
    border: 1px solid #b8c8d8;
    border-radius: 4px;
    background: #ffffff;
    color: #334a61;
    font: 600 0.69rem/26px inherit;
    padding: 0 0.55rem;
    cursor: pointer;
    white-space: nowrap;
}

.form-field label.metadata-image-field__choose {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1;
}

.metadata-image-field__choose input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.metadata-image-field__choose:hover {
    background: #eef4fa;
}

.metadata-image-field__choose--disabled {
    cursor: default;
    opacity: 0.5;
}

.metadata-image-field__name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #334a61;
    font-size: 0.69rem;
}

.metadata-image-field__error {
    color: #b42318;
    font-size: 0.67rem;
}

.metadata-image-field__preview {
    height: 132px;
    border: 1px solid #d2dde8;
    border-radius: 4px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    overflow: hidden;
}

.metadata-image-field__preview img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.core-shell.theme-dark .metadata-image-field__choose,
.core-shell.theme-dark .metadata-image-field__preview {
    background: var(--erp-bg-input);
    border-color: var(--erp-border);
    color: var(--erp-text);
}

.core-shell.theme-dark .metadata-image-field__preview {
    background: #ffffff;
}

.field-description {
    margin-top: 0.25rem;
    font-size: 0.66rem;
    color: #5c6f84;
}

.option-group {
    display: flex;
    gap: 0.65rem;
    flex-wrap: wrap;
    font-size: 0.72rem;
}

.option-group--multi {
    display: grid;
    gap: 0.2rem;
}

.option-group label {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.option-group input[type="radio"],
.option-group input[type="checkbox"] {
    margin: 0;
}

.core-shell__footer {
    border-top: 1px solid #b6c4d3;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    background: #e1e9f2;
    min-height: 0;
}

.process-actions,
.status-region {
    display: flex;
    align-items: center;
    gap: var(--process-gap);
    padding: 0.3rem 0.55rem;
    min-width: 0;
}

.process-actions {
    --process-button-width: 78px;
    --process-gap: 0.35rem;
}

.process-actions .toolbar-button {
    width: var(--process-button-width);
    text-align: center;
    font-weight: 700;
    font-size: 0.82rem;
    border: 0;
    background: transparent;
    border-radius: 3px;
    color: #1f3347;
    transition: background-color 120ms ease, color 120ms ease;
}

.process-actions .toolbar-button:hover:not(:disabled) {
    background: #d0dae5;
    color: #132739;
    text-decoration: none;
}

.process-actions .toolbar-button:disabled {
    background: transparent;
    color: #8795a6;
}

.workflow-comment {
    width: calc((var(--process-button-width) * 4) + (var(--process-gap) * 3));
    height: 28px;
    border: 1px solid #b8c8d8;
    border-radius: 4px;
    padding: 0 0.45rem;
    font-size: 0.72rem;
    background: #ffffff;
    flex: 0 0 calc((var(--process-button-width) * 4) + (var(--process-gap) * 3));
}

.status-region {
    position: relative;
    justify-content: flex-start;
    border-left: 1px solid #b6c4d3;
    font-size: 0.74rem;
    color: #1f3347;
    white-space: nowrap;
    overflow: visible;
    text-overflow: ellipsis;
    min-width: 0;
}

.status-progress-track {
    position: absolute;
    inset: 2px 4px;
    border-radius: 3px;
    background: #4b5563;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.status-progress-fill {
    height: 100%;
    width: 0;
    background: #000000;
    transition: width 120ms linear;
}

.status-current-dot,
.status-text,
.status-history-button {
    position: relative;
    z-index: 1;
}

.form-lock-scope {
    border: 0;
    margin: 0;
    padding: 0;
    min-width: 0;
}

.status-region--error-text {
    color: #9b1d2a;
    font-weight: 600;
}

.status-region--workflow-text {
    color: #6d28d9;
    font-weight: 600;
}

.status-region--tip-text {
    color: #c2410c;
    font-weight: 700;
}

.core-shell.theme-dark .status-region--tip-text {
    color: #facc15;
}

.status-region--progress-text {
    color: #ffffff;
    font-weight: 700;
    text-shadow: 0 1px 2px #000000, 0 0 1px #000000;
}

.status-region--ai-text {
    color: #6d28d9;
    font-weight: 800;
}

.status-region--ai-text .status-progress-fill {
    background: #6d28d9;
}

.status-region--ai-text .status-history-button {
    color: #6d28d9;
    border-color: #6d28d9;
}

.core-shell.theme-dark .status-region--ai-text {
    color: #22d3ee;
}

.core-shell.theme-dark .status-region--ai-text .status-progress-fill {
    background: #0e7490;
}

.core-shell.theme-dark .status-region--ai-text .status-history-button {
    color: #22d3ee;
    border-color: #22d3ee;
}

/* AI progress text crosses both the filled and unfilled parts of the track. */
.status-region--ai-text:has(.status-progress-track),
.core-shell.theme-dark .status-region--ai-text:has(.status-progress-track) {
    color: #ffffff;
    text-shadow: 0 1px 2px #000000, 0 0 1px #000000;
}

.status-region--ai-text:has(.status-progress-track) .status-history-button,
.core-shell.theme-dark .status-region--ai-text:has(.status-progress-track) .status-history-button {
    color: #ffffff;
    border-color: #9ca3af;
}

.status-region--progress-text .status-history-button {
    color: #ffffff;
    border-color: #9ca3af;
}

.status-region--flash-success {
    animation: status-flash-success 2s ease-in-out;
}

.status-region--flash-error {
    animation: status-flash-error 2s ease-in-out;
}

.status-region--flash-workflow {
    animation: status-flash-workflow 2s ease-in-out;
}

.status-region--flash-tip {
    animation: status-flash-tip 560ms ease-in-out 3;
}

.core-shell.theme-dark .status-region--flash-tip {
    animation-name: status-flash-tip-dark;
}

@keyframes status-flash-success {
    0% { background: transparent; }
    25% { background: #d8f4df; }
    50% { background: #b9ebc7; }
    75% { background: #d8f4df; }
    100% { background: transparent; }
}

@keyframes status-flash-error {
    0% { background: transparent; }
    25% { background: #ffd9de; }
    50% { background: #ffb8c0; }
    75% { background: #ffd9de; }
    100% { background: transparent; }
}

@keyframes status-flash-workflow {
    0% { background: transparent; }
    25% { background: #ece4ff; }
    50% { background: #ddd0ff; }
    75% { background: #ece4ff; }
    100% { background: transparent; }
}

@media (max-width: 1150px) {
    .core-shell__meta-bar {
        grid-template-columns: max-content 1fr max-content;
    }
}

@media (max-width: 860px) {
    .core-shell {
        grid-template-rows: auto 1fr;
    }

    .core-shell__top-row {
        grid-template-columns: 1fr;
    }

    .core-shell__logo-bar {
        border-right: 0;
        border-bottom: 1px solid #0b1e2f;
    }

    .core-shell__meta-bar {
        grid-template-columns: 1fr;
    }

    .company-region,
    .context-region,
    .user-region {
        border-right: 0;
        border-bottom: 1px solid #b6c4d3;
    }

    .user-region {
        justify-content: flex-start;
        border-bottom: 0;
    }

    .core-shell__body {
        grid-template-columns: 1fr;
    }

    .left-panel {
        border-right: 0;
        border-bottom: 1px solid #b6c4d3;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 0.3rem;
    }

    .left-panel__top-icons {
        display: flex;
    }

    .left-panel-flyout {
        position: relative;
        left: auto;
        right: auto;
        top: auto;
        bottom: auto;
        width: 100%;
        max-height: 220px;
        border-right: 0;
        border-bottom: 1px solid #b6c4d3;
    }

    .work-area {
        grid-template-columns: 1fr;
    }

    .toolbar-row {
        flex-direction: column;
        align-items: stretch;
    }

    .work-area-main {
        grid-template-rows: auto 1fr;
    }

    .action-menu {
        border-left: 0;
        border-top: 1px solid #c7d3de;
    }

    .module-menu-dropdown {
        width: 100%;
        left: 0;
        right: 0;
    }

    .core-shell__footer {
        grid-template-columns: 1fr;
    }

    .status-region {
        border-left: 0;
        border-top: 1px solid #b6c4d3;
        justify-content: flex-start;
    }
}

@media (max-width: 620px) {
    .logical-fields {
        --core-logical-column-min-width: 140px;
        grid-template-columns: repeat(2, minmax(140px, 1fr));
    }

    .secondary-grid-pair {
        grid-template-columns: repeat(2, minmax(140px, 1fr));
    }

    .company-picker {
        min-width: 180px;
    }
}

.startup-dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 5000;
    background: rgba(8, 12, 18, 0.56);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.startup-dialog {
    min-width: 0;
    max-width: min(520px, calc(100vw - 2rem));
    width: fit-content;
    border: 1px solid #1f2f45;
    border-radius: 8px;
    background: #f8fbff;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.38);
    padding: 1rem 1.1rem;
    display: grid;
    gap: 0.85rem;
}

.startup-dialog__title {
    font-weight: 700;
    color: #0d1a2a;
}

.startup-dialog__message {
    color: #1e2938;
    font-weight: 500;
}

.startup-dialog__actions {
    display: flex;
    justify-content: flex-end;
}

.startup-dialog__actions--confirm {
    justify-content: center;
    gap: 1rem;
}

.startup-dialog__button {
    min-width: 120px;
    text-align: center;
}

@keyframes status-flash-tip {
    0%, 100% {
        background: transparent;
        color: #c2410c;
        box-shadow: none;
    }
    45%, 55% {
        background: #f97316;
        color: #ffffff;
        box-shadow: inset 0 0 0 2px #c2410c, 0 0 8px rgba(249, 115, 22, 0.8);
    }
}

@keyframes status-flash-tip-dark {
    0%, 100% {
        background: transparent;
        color: #facc15;
        box-shadow: none;
    }
    45%, 55% {
        background: #facc15;
        color: #111827;
        box-shadow: inset 0 0 0 2px #eab308, 0 0 8px rgba(250, 204, 21, 0.8);
    }
}

.integration-storage-folder-dialog {
    width: min(640px, 92vw);
    max-width: min(640px, calc(100vw - 2rem));
    max-height: 82vh;
}

.integration-storage-folder-dialog__context {
    font-size: 12px;
    overflow-wrap: anywhere;
}

.integration-storage-folder-dialog__navigation {
    display: flex;
    gap: 8px;
}

.integration-storage-folder-dialog__navigation .startup-dialog__button {
    min-width: 84px;
}

.integration-storage-folder-dialog__list {
    min-height: 170px;
    max-height: 330px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    border: 1px solid #b9c6d6;
    border-radius: 5px;
    background: #ffffff;
}

.integration-storage-folder-dialog__folder {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: #15263a;
    cursor: pointer;
    text-align: left;
}

.integration-storage-folder-dialog__folder:hover {
    border-color: #9cb4cf;
    background: #eef4fa;
}

.integration-storage-folder-dialog__folder--selected {
    border-color: #4779ad;
    background: #e4eef8;
}

.integration-storage-folder-dialog__folder-icon {
    display: inline-flex;
    width: 17px;
    height: 17px;
    color: #496b91;
}

.integration-storage-folder-dialog__folder-icon svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.integration-storage-folder-dialog__empty {
    padding: 10px;
    color: #52657a;
    font-size: 12px;
}

.integration-storage-folder-dialog__create {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.integration-storage-folder-dialog__create input {
    min-width: 0;
}

.integration-storage-folder-dialog__create .startup-dialog__button {
    min-width: 90px;
}

.integration-storage-folder-dialog__actions {
    gap: 8px;
    flex-wrap: wrap;
}

.documents-output-dialog {
    width: min(420px, calc(100vw - 2rem));
}

.documents-output-dialog__methods {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 14px;
}

.documents-output-dialog__option {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #0d1a2a;
    font-weight: 600;
    cursor: pointer;
}

.documents-output-dialog__option input {
    width: 16px;
    height: 16px;
}

.documents-output-dialog__option--disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.documents-output-dialog__option small {
    font-weight: 500;
}

.attachments-dialog {
    width: min(980px, 92vw);
    max-height: 82vh;
    overflow-y: auto;
    overflow-x: hidden;
}

.attachments-dialog__context {
    font-size: 12px;
    opacity: 0.85;
}

.attachments-dialog__actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.attachments-dialog__list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
    width: 100%;
    overflow: hidden;
}

.attachments-dialog__pending-title {
    font-size: 12px;
    font-weight: 600;
    opacity: 0.9;
    margin: 2px 0 6px 0;
}

.attachments-dialog__empty {
    font-size: 12px;
    font-weight: 500;
    opacity: 0.9;
    margin: 0;
    align-self: flex-start;
}

.attachments-dialog__row {
    display: flex;
    flex-direction: column;
    gap: 10px;
    border: 1px solid rgba(120, 145, 180, 0.35);
    border-radius: 8px;
    padding: 8px;
    width: 100%;
    box-sizing: border-box;
}

.attachments-dialog__row--selected {
    border-color: rgba(123, 92, 246, 0.7);
}

.attachments-dialog__row-main {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    flex: 1;
    width: 100%;
    min-width: 0;
    background: transparent;
    border: 0;
    text-align: left;
    color: inherit;
}

.attachments-dialog__row-main--static {
    cursor: default;
    pointer-events: none;
}

.attachments-dialog__name {
    font-size: 13px;
    font-weight: 600;
}

.attachments-dialog__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 11px;
    opacity: 0.95;
}

.attachments-dialog__meta--singleline {
    flex-wrap: nowrap;
    overflow: hidden;
    width: 100%;
    min-width: 0;
}

.attachments-dialog__meta--singleline span {
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    min-width: 0;
}

.attachments-dialog__token--wide {
    flex: 1 1 0;
}

.attachments-dialog__row-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.attachments-dialog__row-actions--below {
    justify-content: flex-start;
    flex-wrap: wrap;
}

.attachments-dialog .startup-dialog__button {
    min-width: 88px;
}

.attachments-preview {
    border-top: 1px solid rgba(120, 145, 180, 0.35);
    padding-top: 10px;
}

.attachments-preview__title {
    font-weight: 600;
    margin-bottom: 8px;
}

.attachments-preview__folder-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 220px;
    overflow: auto;
    margin-bottom: 10px;
}

.attachments-preview__folder-file {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-width: 0;
    padding: 6px 8px;
    border: 1px solid rgba(120, 145, 180, 0.35);
    border-radius: 6px;
    background: transparent;
    color: inherit;
    text-align: left;
}

.attachments-preview__folder-file-name {
    min-width: 0;
    flex: 1 1 auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attachments-preview__folder-file-size {
    white-space: nowrap;
    opacity: 0.85;
    font-size: 11px;
}

.attachments-preview__folder-file--selected {
    border-color: #8ca5ff;
}

.attachments-preview__image {
    max-width: 100%;
    max-height: 380px;
    border-radius: 6px;
}

.attachments-preview__pdf {
    width: 100%;
    height: 420px;
    border: 1px solid rgba(120, 145, 180, 0.35);
    border-radius: 6px;
}

.attachments-preview__html {
    width: 100%;
    height: 420px;
    border: 1px solid rgba(120, 145, 180, 0.35);
    border-radius: 6px;
    background: #fff;
}

.attachments-preview__text {
    max-height: 360px;
    overflow: auto;
    border: 1px solid rgba(120, 145, 180, 0.35);
    border-radius: 6px;
    padding: 10px;
    white-space: pre-wrap;
    font-size: 12px;
    color: #0f172a;
    background: #f8fbff;
}

.attachments-preview__empty {
    border: 1px solid rgba(120, 145, 180, 0.35);
    border-radius: 6px;
    padding: 10px;
    font-size: 12px;
    color: #334155;
    background: #f8fbff;
}

.templates-dialog {
    width: min(1100px, 92vw);
    max-height: 88vh;
    overflow: auto;
}

.templates-dialog__menu {
    display: flex;
    gap: 0.4rem;
    margin: 0.4rem 0 0.6rem 0;
}

.templates-dialog__row {
    display: grid;
    grid-template-columns: auto minmax(180px, 1fr) auto 140px;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.templates-dialog__filters {
    border: 1px solid var(--erp-border, #29435d);
    border-radius: 6px;
    padding: 0.45rem;
    margin-bottom: 0.5rem;
}

.templates-dialog__filter-row {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 110px minmax(120px, 1fr) 90px auto;
    gap: 0.4rem;
    margin-bottom: 0.35rem;
    align-items: center;
}

.templates-dialog__list {
    max-height: 42vh;
    overflow: auto;
    border: 1px solid var(--erp-border, #29435d);
    border-radius: 6px;
    padding: 0.35rem;
    margin-bottom: 0.5rem;
}

.busy-overlay {
    position: fixed;
    inset: 0;
    z-index: 4900;
    background: rgba(8, 12, 18, 0.32);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.busy-dialog {
    width: min(340px, calc(100vw - 2rem));
    border: 1px solid #355070;
    border-radius: 8px;
    background: #061a33;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
    padding: 0.25rem;
    overflow: hidden;
    pointer-events: auto;
}

.core-shell--busy-scroll-only {
    pointer-events: none;
    user-select: none;
}

.core-shell--busy-scroll-only .left-panel-flyout *,
.core-shell--busy-scroll-only .form-scroll-area *,
.core-shell--busy-scroll-only .main-grid-shell *,
.core-shell--busy-scroll-only .line-edit-grid-shell *,
.core-shell--busy-scroll-only .secondary-grid-shell *,
.core-shell--busy-scroll-only .status-history-menu * {
    pointer-events: none;
}

.core-shell--busy-scroll-only .left-panel-flyout,
.core-shell--busy-scroll-only .form-scroll-area,
.core-shell--busy-scroll-only .main-grid-shell,
.core-shell--busy-scroll-only .line-edit-grid-shell,
.core-shell--busy-scroll-only .secondary-grid-shell,
.core-shell--busy-scroll-only .status-history-menu {
    pointer-events: auto;
}

.busy-logo {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
}

.busy-stop-button {
    display: block;
    min-width: 140px;
    margin: 0.25rem auto 0.65rem;
    border-color: #ff6b6b;
    color: #fff;
    background: #9f1d2d;
    font-weight: 800;
}

.busy-stop-button:hover:not(:disabled) {
    background: #c92a3c;
    border-color: #ff8787;
}

.busy-stop-button:disabled {
    color: #ffe3e3;
    background: #6b2530;
    border-color: #a65b66;
}

.core-shell.theme-light + .busy-overlay .busy-dialog {
    background: #ffffff;
    border-color: #b6c4d3;
}

.core-shell.theme-dark + .startup-dialog-backdrop .startup-dialog {
    background: #111a27;
    border-color: #355070;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.62);
}

.core-shell.theme-dark + .startup-dialog-backdrop .startup-dialog__title {
    color: #e8f0fb;
}

.core-shell.theme-dark + .startup-dialog-backdrop .startup-dialog__message {
    color: #c6d3e5;
}

.core-shell.theme-dark + .startup-dialog-backdrop .documents-output-dialog__option {
    color: #d9e7f8;
}

.core-shell.theme-dark + .startup-dialog-backdrop .integration-storage-folder-dialog__list {
    border-color: rgba(130, 166, 214, 0.45);
    background: rgba(10, 20, 36, 0.8);
}

.core-shell.theme-dark + .startup-dialog-backdrop .integration-storage-folder-dialog__folder {
    color: #d9e7f8;
}

.core-shell.theme-dark + .startup-dialog-backdrop .integration-storage-folder-dialog__folder:hover {
    border-color: #688ab2;
    background: rgba(50, 78, 112, 0.52);
}

.core-shell.theme-dark + .startup-dialog-backdrop .integration-storage-folder-dialog__folder-icon {
    color: #9fc1e8;
}

.core-shell.theme-dark + .startup-dialog-backdrop .integration-storage-folder-dialog__empty {
    color: #c6d3e5;
}

.core-shell.theme-dark + .startup-dialog-backdrop .attachments-dialog__context,
.core-shell.theme-dark + .startup-dialog-backdrop .attachments-dialog__pending-title,
.core-shell.theme-dark + .startup-dialog-backdrop .attachments-dialog__empty,
.core-shell.theme-dark + .startup-dialog-backdrop .attachments-dialog__meta {
    color: #d9e7f8;
    opacity: 1;
}

.core-shell.theme-dark + .startup-dialog-backdrop .attachments-dialog__row {
    border-color: rgba(130, 166, 214, 0.45);
    background: rgba(12, 24, 40, 0.72);
}

.core-shell.theme-dark + .startup-dialog-backdrop .attachments-dialog__row--selected {
    border-color: #8ca5ff;
}

.core-shell.theme-dark + .startup-dialog-backdrop .attachments-preview {
    border-top-color: rgba(130, 166, 214, 0.45);
}

.core-shell.theme-dark + .startup-dialog-backdrop .attachments-preview__title {
    color: #e8f0fb;
}

.core-shell.theme-dark + .startup-dialog-backdrop .attachments-preview__folder-file {
    border-color: rgba(130, 166, 214, 0.45);
    background: rgba(12, 24, 40, 0.68);
    color: #d9e7f8;
}

.core-shell.theme-dark + .startup-dialog-backdrop .attachments-preview__text {
    color: #eef6ff;
    background: rgba(10, 20, 36, 0.92);
    border-color: rgba(130, 166, 214, 0.45);
}

/* Keep #09 structure/behavior same across modes; light mode keeps light background. */
.core-shell.theme-light .left-panel {
    background: linear-gradient(180deg, #eef3f9 0%, #e8eef6 100%);
    border-right-color: #cfd8e3;
    padding: 0;
}

.core-shell.theme-light .left-panel__top-icons {
    border-bottom: 1px solid #cfd8e3;
    gap: 0;
    margin: 0;
    padding: 0;
    height: 38px;
}

.core-shell.theme-light .left-panel__icon-button {
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: transparent;
    color: #56708c;
    min-height: 36px;
    height: 36px;
    box-shadow: none;
}

.core-shell.theme-light .left-panel__icon-button:hover {
    background: #dfe9f4;
    color: #1e3e62;
    border-color: transparent;
}

.core-shell.theme-dark .left-panel__icon-button:hover {
    background: var(--erp-bg-raised);
    color: var(--erp-text);
    border-color: transparent;
}

.core-shell.theme-light .left-panel__icon-button--active {
    color: #2f7ad9;
    background: rgba(59, 130, 246, 0.14);
    border-bottom-color: #2f7ad9;
    box-shadow: none;
}

.core-shell.theme-light .left-panel-flyout {
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 6px 0;
}

.core-shell.theme-light .panel-drawer__title,
.core-shell.theme-light .left-panel-menu__group-title {
    background: transparent;
    border: 0;
    color: #5a7390;
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.core-shell.theme-light .left-panel-menu__item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 0;
    border-left: 2px solid transparent;
    border-radius: 0;
    color: #2e4964;
    margin: 0;
    padding: 0.38rem 0.72rem;
}

.core-shell.theme-light .left-panel-menu__item:hover {
    background: #dfe9f4;
    color: #132b44;
    border-color: transparent;
}

.core-shell.theme-light .left-panel-menu__item--selected {
    background: rgba(59, 130, 246, 0.14);
    color: #2f7ad9;
    border-left-color: #2f7ad9;
}

.line-grid-record-count {
    margin-top: 0.25rem;
    padding: 0 0.2rem;
    font-size: 0.7rem;
    color: #334a61;
}

.core-shell.theme-dark .line-grid-record-count {
    color: #9fb4cf;
}

.grid-action-button:not(:disabled) {
    font-weight: 700;
}

.grid-action-button:disabled {
    font-weight: 400;
}

.integration-report-action {
    min-width: 118px;
    white-space: nowrap;
}
/* Shared desktop/mobile digital document completion surface. */
.document-completion-backdrop { position:fixed; inset:0; z-index:12000; background:#0008; display:flex; justify-content:center; padding:16px; }
.document-completion { background:#fff; color:#222; width:min(1050px,100%); display:flex; flex-direction:column; min-height:0; padding:12px; border-radius:6px; position:relative; font-family:Segoe UI,Tahoma,Arial,sans-serif; }
.document-completion__page { border-top:1px solid #bbb; margin-top:20px; padding-top:12px; }
.document-completion__paragraph { white-space:pre-wrap; }
.document-completion__field { margin:12px 0; }
.document-completion__field label { display:block; font-weight:600; margin-bottom:5px; }
.document-completion__field input:not([type=checkbox]), .document-completion__field textarea, .document-completion__field select { width:100%; box-sizing:border-box; padding:8px; border:1px solid #aaa; background:white; color:#111; }
.document-completion__field [readonly] { background:#f3f3f3!important; }
.document-completion__field canvas { display:block; width:min(100%,540px); aspect-ratio:3; height:auto; touch-action:none; border:1px solid #888; background:white; }
.document-completion header h2 { font-size:1.1rem; margin:0; }
.document-completion header p { font-size:.85rem; margin:4px 0 8px; }
.document-completion .process-actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap; flex-shrink:0; }
.document-completion .process-actions .toolbar-button { width:auto; min-width:78px; font-family:inherit; }
.document-window.core-shell { display:block; height:100vh; height:100dvh; min-height:0; overflow:hidden; box-sizing:border-box; -webkit-text-size-adjust:none; text-size-adjust:none; }
.document-window > .document-completion { width:100%; height:100%; box-sizing:border-box; border-radius:0; background:inherit; color:inherit; }
.document-window .document-completion__actions { background:inherit; }
.document-window.theme-dark .document-completion__sign-pad { background:var(--erp-bg-surface); color:var(--erp-text); }
.document-completion__nav { padding-bottom:8px; font-size:.85rem; }
.document-completion__viewport { flex:1; overflow:auto; min-height:120px; background:#ddd; padding:16px; }
.document-completion__paper { position:relative; margin:0 auto; background:white; box-shadow:0 1px 6px #0004; flex-shrink:0; }
.document-completion__background { width:100%; height:100%; display:block; }
.document-completion__ink { position:absolute; box-sizing:border-box; margin:0!important; border:1px solid #337ab744!important; border-radius:0; background:#d8ecff66!important; color:#111!important; padding:0 2px!important; font-family:Arial,sans-serif!important; font-size:calc(var(--doc-font,10px) * var(--doc-scale))!important; line-height:calc(var(--doc-leading,12px) * var(--doc-scale))!important; min-width:0; min-height:0; resize:none; accent-color:#2268a0; }
.document-completion__ink:focus { outline:2px solid #337ab7; background:#edf6ff!important; }
.document-completion__ink[type=checkbox],.document-completion__ink[type=radio] { padding:0!important; cursor:pointer; }
.document-completion__signature { text-align:left; cursor:pointer; }
.document-completion__signature canvas { width:100%; height:100%; display:block; }
.document-completion__ink:is(input:not([type=checkbox]):not([type=radio]),select,textarea) { appearance:none; -webkit-appearance:none; max-width:none; max-height:none; }
.document-completion__ink[type=date]::-webkit-date-and-time-value { text-align:left; padding:0; min-height:0; }
.document-completion__date { display:flex; padding:0!important; }
.document-completion__date > input[type=text] { flex:1; width:0; min-width:0; padding:0 2px; border:0; border-radius:0; background:transparent; color:#111; font:inherit; line-height:inherit; }
.document-completion__date > button { flex:0 0 calc(20px * var(--doc-scale)); padding:0; border:0; border-left:1px solid #337ab744; background:transparent; color:#111; font:inherit; cursor:pointer; }
.document-completion__date > input.document-completion__date-native { position:absolute; right:0; bottom:0; width:1px; height:1px; opacity:0; pointer-events:none; }
/* Data Generator proposal presentation only; other line grids are unchanged. */
.data-generator-grid-shell .line-edit-grid td { vertical-align:top; height:auto; }
.data-generator-grid-shell .line-edit-grid td.data-generator-multiline-cell { white-space:normal; overflow-wrap:anywhere; }
.core-shell .data-generator-grid-shell .line-edit-grid td:not(.data-generator-multiline-cell) input.line-cell-input[readonly] { background-color:transparent !important; border-color:transparent; }
.data-generator-grid-shell .line-edit-grid td.line-status-cell { position:relative; }
.data-generator-grid-shell .line-edit-grid th.line-status-col { vertical-align:middle; }
.data-generator-grid-shell .line-status-cell .row-status-dot { position:absolute; inset:0; width:auto; height:auto; margin:0; border:0; border-radius:0; }
.data-generator-grid-shell .data-generator-cell-text { white-space:pre-wrap; max-width:340px; font-size:0.71rem; padding:calc((22px - 1.5em) / 2) 0.22rem; line-height:1.5; min-height:5.6em; }
.data-generator-grid-shell .data-generator-instruction { display:block; box-sizing:border-box; width:100%; min-width:0; min-height:6.5em; height:auto; field-sizing:content; resize:vertical; white-space:pre-wrap; overflow-wrap:anywhere; font:inherit; line-height:1.4; padding:6px 4px; }

.document-completion__date > input[aria-invalid=true] { outline:1px solid #c00; }
.document-completion__actions { background:white; padding-top:8px; }
.document-completion__actions p { margin:0; flex-basis:100%; font-size:.85rem; }
.document-completion__sign-pad { position:absolute; z-index:2; left:50%; top:50%; transform:translate(-50%,-50%); width:min(560px,95%); box-sizing:border-box; padding:12px; background:white; border:1px solid #777; box-shadow:0 4px 30px #0006; }
.document-completion__sign-pad canvas { width:100%; aspect-ratio:3; display:block; background:#f3f8fc; border:1px solid #888; touch-action:none; margin:8px 0; }
@media(max-width:600px) { .document-completion-backdrop { padding:0; } .document-completion { border-radius:0; padding:8px; } }
@media(pointer:coarse) {
    .document-completion .process-actions .toolbar-button,
    .document-completion__nav select { min-height:44px; }
    /* Controls stay at template coordinates; use page zoom, not oversized field boxes. */
    .document-completion__viewport { touch-action:pan-x pan-y pinch-zoom; }
}
