:root {
    --tb-blue-900: #064f86;
    --tb-blue-700: #0879bd;
    --tb-blue-600: #0a95dc;
    --tb-cyan-500: #2db7df;
    --tb-ink: #1c2836;
    --tb-muted: #667585;
    --tb-line: #d9e2ea;
    --tb-surface: #ffffff;
    --tb-bg: #f3f7fb;
    --tb-soft: #eef6fb;
    --tb-soft-strong: #e2f2fb;
    --tb-input-bg: #fbfdff;
    --tb-table-head: #f8fbfd;
    --tb-chip-bg: #f7fafc;
    --tb-alert-bg: #fff1f0;
    --tb-alert-border: #ffd3d0;
    --tb-login-image-bg: #f2f7fb;
    --tb-login-overlay: rgba(6, 79, 134, 0.56);
    --tb-green: #198754;
    --tb-amber: #b7791f;
    --tb-red: #b42318;
    --tb-danger: #b42318;
    --tb-shadow: 0 10px 24px rgba(18, 54, 89, 0.08);
    color-scheme: light;
}

:root[data-theme="dark"] {
    --tb-blue-900: #8ad8ff;
    --tb-blue-700: #5bc5f5;
    --tb-blue-600: #2db7df;
    --tb-cyan-500: #6ad7f7;
    --tb-ink: #e7eef7;
    --tb-muted: #9fb1c4;
    --tb-line: #244157;
    --tb-surface: #102234;
    --tb-bg: #071522;
    --tb-soft: #0d2c43;
    --tb-soft-strong: #123b5a;
    --tb-input-bg: #0a1d2e;
    --tb-table-head: #0b2032;
    --tb-chip-bg: #0b2032;
    --tb-alert-bg: #3b1518;
    --tb-alert-border: #7f292f;
    --tb-login-image-bg: #071522;
    --tb-login-overlay: rgba(6, 79, 134, 0.58);
    --tb-green: #49c487;
    --tb-amber: #e0a83c;
    --tb-red: #ff8a80;
    --tb-danger: #ff8a80;
    --tb-shadow: 0 14px 30px rgba(0, 0, 0, 0.26);
    color-scheme: dark;
}

:root[data-theme="light"] {
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --tb-blue-900: #8ad8ff;
        --tb-blue-700: #5bc5f5;
        --tb-blue-600: #2db7df;
        --tb-cyan-500: #6ad7f7;
        --tb-ink: #e7eef7;
        --tb-muted: #9fb1c4;
        --tb-line: #244157;
        --tb-surface: #102234;
        --tb-bg: #071522;
        --tb-soft: #0d2c43;
        --tb-soft-strong: #123b5a;
        --tb-input-bg: #0a1d2e;
        --tb-table-head: #0b2032;
        --tb-chip-bg: #0b2032;
        --tb-alert-bg: #3b1518;
        --tb-alert-border: #7f292f;
        --tb-login-image-bg: #071522;
        --tb-login-overlay: rgba(6, 79, 134, 0.58);
        --tb-green: #49c487;
        --tb-amber: #e0a83c;
        --tb-red: #ff8a80;
        --tb-danger: #ff8a80;
        --tb-shadow: 0 14px 30px rgba(0, 0, 0, 0.26);
        color-scheme: dark;
    }
}

:root[data-look="onebit"] {
    --tb-blue-900: #0d0d0d;
    --tb-blue-700: #181818;
    --tb-blue-600: #f0d020;
    --tb-cyan-500: #f0d020;
    --tb-ink: #1b1b1b;
    --tb-muted: #706f6a;
    --tb-line: #e0ded7;
    --tb-surface: #ffffff;
    --tb-bg: #f7f8fa;
    --tb-soft: #f5f5f2;
    --tb-soft-strong: #fff4c4;
    --tb-input-bg: #fcfcfb;
    --tb-table-head: #f8f8f5;
    --tb-chip-bg: #f6f6f3;
    --tb-alert-bg: #fff1f0;
    --tb-alert-border: #ffd3d0;
    --tb-login-image-bg: #f5f5f2;
    --tb-login-overlay: rgba(13, 13, 13, 0.62);
    --tb-green: #148565;
    --tb-amber: #b7791f;
    --tb-red: #b42318;
    --tb-danger: #b42318;
    --tb-shadow: 0 10px 24px rgba(13, 13, 13, 0.08);
    color-scheme: light;
}

:root[data-look="onebit"][data-theme="dark"] {
    --tb-blue-900: #fff1a5;
    --tb-blue-700: #f0d020;
    --tb-blue-600: #ffd93d;
    --tb-cyan-500: #ffd93d;
    --tb-ink: #f4f0e6;
    --tb-muted: #b8b2a4;
    --tb-line: #3a372f;
    --tb-surface: #171613;
    --tb-bg: #0d0d0d;
    --tb-soft: #242119;
    --tb-soft-strong: #352f18;
    --tb-input-bg: #11100e;
    --tb-table-head: #191814;
    --tb-chip-bg: #1f1d18;
    --tb-alert-bg: #3b1518;
    --tb-alert-border: #7f292f;
    --tb-login-image-bg: #0d0d0d;
    --tb-login-overlay: rgba(13, 13, 13, 0.68);
    --tb-green: #58d6ad;
    --tb-amber: #e0a83c;
    --tb-red: #ff8a80;
    --tb-danger: #ff8a80;
    --tb-shadow: 0 14px 30px rgba(0, 0, 0, 0.28);
    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    :root[data-look="onebit"]:not([data-theme="light"]) {
        --tb-blue-900: #fff1a5;
        --tb-blue-700: #f0d020;
        --tb-blue-600: #ffd93d;
        --tb-cyan-500: #ffd93d;
        --tb-ink: #f4f0e6;
        --tb-muted: #b8b2a4;
        --tb-line: #3a372f;
        --tb-surface: #171613;
        --tb-bg: #0d0d0d;
        --tb-soft: #242119;
        --tb-soft-strong: #352f18;
        --tb-input-bg: #11100e;
        --tb-table-head: #191814;
        --tb-chip-bg: #1f1d18;
        --tb-alert-bg: #3b1518;
        --tb-alert-border: #7f292f;
        --tb-login-image-bg: #0d0d0d;
        --tb-login-overlay: rgba(13, 13, 13, 0.68);
        --tb-green: #58d6ad;
        --tb-amber: #e0a83c;
        --tb-red: #ff8a80;
        --tb-danger: #ff8a80;
        --tb-shadow: 0 14px 30px rgba(0, 0, 0, 0.28);
        color-scheme: dark;
    }
}

:root[data-look="onebit"] .button-primary {
    color: #111111;
    background: var(--tb-cyan-500);
    border-color: var(--tb-cyan-500);
}

:root[data-look="onebit"] .button-primary:hover {
    color: #111111;
    background: #e0c028;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
    margin: 0;
    color: var(--tb-ink);
    background: var(--tb-bg);
    font-family: "Aptos", "Segoe UI Variable", "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.45;
    letter-spacing: 0;
}

body {
    overflow-x: hidden;
}

a {
    color: var(--tb-blue-700);
}

h1:focus,
h2:focus {
    outline: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

.erp-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 276px minmax(0, 1fr);
    background: var(--tb-bg);
    transition: grid-template-columns 0.18s ease;
}

.erp-shell.sidebar-collapsed {
    grid-template-columns: 76px minmax(0, 1fr);
}

.erp-sidebar {
    min-height: 100vh;
    position: sticky;
    top: 0;
    z-index: 20;
    align-self: start;
    background: var(--tb-surface);
    border-right: 1px solid var(--tb-line);
    overflow: visible;
}

.erp-main {
    min-width: 0;
    width: 100%;
}

.erp-topbar {
    min-height: 68px;
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 24px;
    background: color-mix(in srgb, var(--tb-surface) 96%, transparent);
    border-bottom: 1px solid var(--tb-line);
}

.sidebar-toggle {
    flex: 0 0 40px;
}

.erp-content {
    width: 100%;
    max-width: none;
    /*padding: clamp(10px, 1.35vw, 34px);*/
    padding: clamp(10px, 0.35vw, 34px);
    margin: 0;
}

.topbar-search {
    width: min(460px, 100%);
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    color: var(--tb-muted);
    background: var(--tb-soft);
    border: 1px solid transparent;
    border-radius: 8px;
}

.topbar-search:focus-within {
    border-color: var(--tb-blue-600);
    background: var(--tb-surface);
}

.topbar-search input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    color: var(--tb-ink);
    background: transparent;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.company-picker {
    width: min(280px, 28vw);
    min-width: 180px;
    height: 42px;
    display: flex;
    align-items: center;
    padding: 0 10px;
    background: var(--tb-surface);
    border: 1px solid var(--tb-line);
    border-radius: 8px;
}

.company-picker select {
    width: 100%;
    min-width: 0;
    color: var(--tb-ink);
    background: transparent;
    border: 0;
    outline: 0;
    font-weight: 700;
    text-overflow: ellipsis;
}

.user-menu {
    position: relative;
}

.user-chip {
    height: 42px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 0 10px;
    background: var(--tb-surface);
    border: 1px solid var(--tb-line);
    border-radius: 8px;
}

.user-menu-button {
    color: inherit;
    cursor: pointer;
    font: inherit;
}

.user-menu-button:hover {
    border-color: var(--tb-blue-600);
}

.user-avatar {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    color: #ffffff;
    background: var(--tb-blue-700);
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
}

.user-avatar.large {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    font-size: 0.9rem;
}

.user-name {
    max-width: 160px;
    overflow: hidden;
    color: var(--tb-ink);
    font-size: 0.9rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-caret {
    width: 7px;
    height: 7px;
    border-right: 2px solid var(--tb-muted);
    border-bottom: 2px solid var(--tb-muted);
    transform: rotate(45deg) translateY(-2px);
}

.user-menu-panel {
    width: 270px;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 30;
    padding: 8px;
    background: var(--tb-surface);
    border: 1px solid var(--tb-line);
    border-radius: 8px;
    box-shadow: var(--tb-shadow);
}

.user-menu-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-bottom: 1px solid var(--tb-line);
    margin-bottom: 6px;
}

.user-menu-header strong,
.user-menu-header span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-header strong {
    max-width: 190px;
    color: var(--tb-ink);
    font-size: 0.92rem;
}

.user-menu-header span {
    max-width: 190px;
    color: var(--tb-muted);
    font-size: 0.8rem;
}

.user-menu-item {
    width: 100%;
    min-height: 38px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 10px;
    color: var(--tb-ink);
    background: transparent;
    border: 0;
    border-radius: 6px;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.user-menu-item:hover {
    background: var(--tb-soft);
}

.user-menu-item.danger {
    color: var(--tb-danger);
}

.user-menu-item:disabled {
    color: var(--tb-muted);
    cursor: default;
    opacity: 0.72;
}

.user-menu-item:disabled:hover {
    background: transparent;
}

.brand-panel {
    min-height: 118px;
    padding: 22px 22px 18px;
    border-bottom: 1px solid var(--tb-line);
}

.brand-link {
    display: block;
    width: 178px;
}

.brand-link img {
    display: block;
    width: 100%;
    height: auto;
}

.erp-shell.sidebar-collapsed .brand-panel {
    min-height: 76px;
    display: grid;
    place-items: center;
    padding: 14px 10px;
}

.erp-shell.sidebar-collapsed .brand-link {
    width: 42px;
    height: 42px;
    position: relative;
    display: grid;
    place-items: center;
    color: #ffffff;
    background: var(--tb-blue-700);
    border-radius: 8px;
}

.erp-shell.sidebar-collapsed .brand-link img {
    display: none;
}

.erp-shell.sidebar-collapsed .brand-link::before {
    content: attr(data-brand-letter);
    font-size: 1.1rem;
    font-weight: 850;
}

.erp-shell.sidebar-collapsed .brand-subtitle,
.erp-shell.sidebar-collapsed .nav-section-title,
.erp-shell.sidebar-collapsed .nav-link span:not(.nav-icon):not(.nav-caret),
.erp-shell.sidebar-collapsed .nav-caret,
.erp-shell.sidebar-collapsed .nav-footer,
.erp-shell.sidebar-collapsed .empty-menu {
    display: none;
}

.brand-subtitle {
    margin-top: 12px;
    color: var(--tb-muted);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0;
}

.navbar-toggler {
    display: none;
}

.nav-scrollable {
    height: calc(100vh - 118px);
    overflow-y: auto;
    /*    padding: 18px 14px;*/
    padding: 4px 3px;
}

.erp-shell.sidebar-collapsed .nav-scrollable {
    height: calc(100vh - 76px);
    overflow: visible;
    padding: 12px 10px;
}

.nav-sections {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.nav-section-title {
    padding: 12px 10px 8px;
    color: var(--tb-muted);
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
}

.nav-item {
    margin-bottom: 4px;
}

.nav-link,
.module-row {
    width: 100%;
    min-height: 32px;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0 6px;
    color: var(--tb-ink);
    background: transparent;
    border: 0;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 500;
    text-align: left;
    text-decoration: none;

    /*width: 100%;
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    color: var(--tb-ink);
    background: transparent;
    border: 0;
    border-radius: 8px;
    font-size: 0.91rem;
    font-weight: 500;
    text-align: left;
    text-decoration: none; */
}

.erp-shell.sidebar-collapsed .nav-link {
    justify-content: center;
    padding: 0;
}

.erp-shell.sidebar-collapsed .nav-group,
.erp-shell.sidebar-collapsed .nav-item {
    margin-bottom: 8px;
}

.nav-link:hover,
.module-row:hover {
    color: var(--tb-blue-900);
    background: var(--tb-soft);
}

.nav-link.active {
    color: var(--tb-blue-900);
    background: var(--tb-soft-strong);
    font-weight: 600;
}

.nav-icon {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    color: var(--tb-blue-700);
    background: var(--tb-soft);
    border-radius: 8px;
}

.nav-icon .tb-icon {
    width: 16px;
    height: 16px;
}

.nav-link {
    padding-left: calc(4px + (var(--level, 0) * 8px));
}

.nav-parent-button {
    cursor: pointer;
    font-weight: 600;
}

.nav-parent-button.expanded {
    color: var(--tb-blue-900);
    background: var(--tb-soft-strong);
}

.nav-caret {
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
    margin-left: auto;
    transition: transform 0.16s ease;
}

.nav-parent-button.expanded .nav-caret {
    transform: rotate(90deg);
}

.nav-group {
    display: grid;
    gap: 4px;
    margin-bottom: 4px;
    position: relative;
}

.nav-children {
    display: grid;
    gap: 4px;
}

.nav-children:not(.expanded) {
    display: none;
}

.erp-shell.sidebar-collapsed .nav-group:hover > .nav-children,
.erp-shell.sidebar-collapsed .nav-group:focus-within > .nav-children {
    min-width: 250px;
    max-height: min(70vh, 640px);
    display: grid;
    position: absolute;
    top: 0;
    left: 54px;
    z-index: 50;
    gap: 4px;
    overflow: auto;
    padding: 8px;
    background: var(--tb-surface);
    border: 1px solid var(--tb-line);
    border-radius: 8px;
    box-shadow: var(--tb-shadow);
}

.erp-shell.sidebar-collapsed .nav-children .nav-link {
    min-height: 38px;
    justify-content: flex-start;
    padding-left: calc(10px + (var(--level, 0) * 10px));
}

.erp-shell.sidebar-collapsed .nav-children .nav-link span:not(.nav-icon):not(.nav-caret),
.erp-shell.sidebar-collapsed .nav-children .nav-caret {
    display: inline-flex;
}

.empty-menu {
    margin: 10px;
    padding: 12px;
    color: var(--tb-muted);
    background: var(--tb-table-head);
    border: 1px dashed var(--tb-line);
    border-radius: 8px;
    font-size: 0.86rem;
    font-weight: 700;
}

.module-row {
    margin-bottom: 6px;
}

.module-code {
    width: 42px;
    height: 24px;
    display: grid;
    place-items: center;
    color: var(--tb-blue-900);
    background: var(--tb-soft-strong);
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 800;
}

.nav-footer {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    padding: 14px 10px 4px;
    color: var(--tb-muted);
    font-size: 0.8rem;
}

.page-heading {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 20px;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--tb-blue-700);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.page-heading h1 {
    margin: 0;
    color: var(--tb-ink);
    font-size: 2rem;
    font-weight: 750;
}

.page-summary {
    max-width: min(920px, 100%);
    margin: 8px 0 0;
    color: var(--tb-muted);
}

.not-found-page {
    min-height: calc(100vh - 116px);
    display: grid;
    grid-template-columns: minmax(180px, 280px) minmax(0, 620px);
    align-items: center;
    justify-content: center;
    gap: 34px;
    padding: 42px 18px;
}

.not-found-mark {
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    color: var(--tb-blue-900);
    background:
        radial-gradient(circle at 32% 26%, color-mix(in srgb, var(--tb-cyan-500) 26%, transparent), transparent 44%),
        var(--tb-soft);
    border: 1px solid var(--tb-line);
    border-radius: 8px;
}nav-section-title

.not-found-mark span {
    font-size: clamp(3.2rem, 9vw, 6.5rem);
    font-weight: 850;
}

.not-found-content h1 {
    margin: 0;
    color: var(--tb-ink);
    font-size: 2rem;
    font-weight: 800;
}

.not-found-path {
    margin: 22px 0;
    padding: 14px 16px;
    background: var(--tb-table-head);
    border: 1px solid var(--tb-line);
    border-radius: 8px;
}

.not-found-path span,
.not-found-path strong {
    display: block;
}

.not-found-path span {
    color: var(--tb-muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.not-found-path strong {
    margin-top: 4px;
    overflow-wrap: anywhere;
    color: var(--tb-ink);
    font-size: 0.96rem;
}

.heading-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.button,
.icon-button {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 700;
}


.button {
    padding: 0 10px;
}

.button-primary {
    color: #ffffff;
    background: var(--tb-blue-700);
    border-color: var(--tb-blue-700);
}

.button-primary:hover {
    background: var(--tb-blue-900);
}

.button-secondary {
    color: var(--tb-blue-900);
    background: var(--tb-surface);
    border-color: var(--tb-line);
}

.button-secondary:hover {
    border-color: var(--tb-blue-600);
}

.button-danger {
    color: #ffffff;
    background: var(--tb-red);
    border-color: var(--tb-red);
}

.button-danger:hover {
    filter: brightness(0.95);
}

.button:disabled,
.icon-button:disabled {
    cursor: not-allowed;
    opacity: 0.56;
}

.icon-button {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    color: var(--tb-muted);
    background: var(--tb-surface);
    border-color: var(--tb-line);
}

.icon-button:hover {
    color: var(--tb-blue-700);
    border-color: var(--tb-blue-600);
}

.icon-button.quiet {
    border-color: transparent;
}

.tb-icon {
    width: 18px;
    height: 18px;
    display: inline-block;
    flex: 0 0 auto;
    color: currentColor;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.metric-card,
.panel {
    background: var(--tb-surface);
    border: 1px solid var(--tb-line);
    border-radius: 8px;
    box-shadow: var(--tb-shadow);
}

.metric-card {
    min-height: 126px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 18px;
}

.metric-label,
.metric-foot {
    color: var(--tb-muted);
    font-size: 0.85rem;
}

.metric-card strong {
    color: var(--tb-ink);
    font-size: 2rem;
    line-height: 1;
}

.positive {
    color: var(--tb-green);
}

.warning {
    color: var(--tb-amber);
}

.workspace-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(320px, 0.75fr);
    gap: 18px;
}

.panel {
    min-width: 0;
    padding: 18px;
}

.panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}

.panel-header h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 750;
}

.panel-header p {
    margin: 5px 0 0;
    color: var(--tb-muted);
    font-size: 0.9rem;
}

.data-table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    min-width: 620px;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 13px 12px;
    border-bottom: 1px solid var(--tb-line);
    text-align: left;
    vertical-align: middle;
}

.data-table th {
    color: var(--tb-muted);
    background: var(--tb-table-head);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.data-table tr:last-child td {
    border-bottom: 0;
}

.status {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 800;
}

.status-ok {
    color: var(--tb-green);
    background: color-mix(in srgb, var(--tb-green) 16%, transparent);
}

.status-review {
    color: var(--tb-amber);
    background: color-mix(in srgb, var(--tb-amber) 18%, transparent);
}

.health-list {
    display: grid;
    gap: 14px;
}

.health-row {
    display: grid;
    grid-template-columns: 12px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
}

.health-row strong,
.health-row span {
    display: block;
}

.health-row strong {
    font-size: 0.92rem;
}

.health-row span {
    color: var(--tb-muted);
    font-size: 0.85rem;
}

.health-dot {
    width: 10px;
    height: 10px;
    margin-top: 5px;
    border-radius: 50%;
}

.health-dot.ok {
    background: var(--tb-green);
}

.health-dot.pending {
    background: var(--tb-amber);
}

.crud-page {
    min-height: calc(100vh - 108px); 
    display: flex;
    flex-direction: column;
    gap: 4px; /*gap: 14px;*/
}

.crud-header,
.crud-filters,
.crud-toolbar,
.crud-grid-panel {
    min-width: 0;
    background: var(--tb-surface);
    border: 1px solid var(--tb-line);
    border-radius: 8px;
    box-shadow: var(--tb-shadow);
}

.crud-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 9px; /*gap: 18px; */
    padding: 9px 10px;
}

.crud-header h1,
.crud-section-head h2,
.crud-dialog-header h2 {
    margin: 0;
    color: var(--tb-ink);
}

.crud-header h1 {
    font-size: 1.55rem;
}

.page-summary {
    margin: 6px 0 0;
    color: var(--tb-muted);
    font-size: 0.94rem;
}

.crud-header-status {
    min-width: 180px;
    display: grid;
    justify-items: end;
    gap: 4px;
    color: var(--tb-muted);
    font-size: 0.85rem;
}

.crud-header-status strong {
    max-width: 280px;
    overflow: hidden;
    color: var(--tb-blue-900);
    font-size: 0.96rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crud-filters {
    padding: 14px;
}

.crud-section-head,
.crud-toolbar,
.crud-grid-footer,
.crud-dialog-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.crud-section-head {
    margin-bottom: 12px;
}

.crud-section-head h2 {
    font-size: 1rem;
}

.crud-section-head span,
.toolbar-paging span,
.grid-subtle {
    color: var(--tb-muted);
    font-size: 0.82rem;
}

.filter-actions,
.toolbar-actions,
.pager-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.filter-strip {
    max-height: 164px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
    overflow: auto;
    padding-right: 4px;
}

.filter-field,
.form-field,
.toolbar-paging label {
    display: grid;
    gap: 6px;
}

.filter-field > span,
.form-field > span {
    color: var(--tb-muted);
    font-size: 0.78rem;
    font-weight: 400;
    text-transform: none;
}

.form-field.required > span {
    color: var(--tb-ink);
    font-weight: 700;
}

.form-field.boolean-field {
    align-content: start;
}

.boolean-check {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--tb-ink);
    font-size: 0.86rem;
}

.form-field.boolean-field .boolean-check input[type="checkbox"] {
    width: 16px;
    min-height: 16px;
    height: 16px;
    padding: 0;
    border-radius: 4px;
    accent-color: var(--tb-blue-700);
}

.toolbar-paging span {
    color: var(--tb-muted);
    font-size: 0.78rem;
    font-weight: 800;
    /*text-transform: uppercase;*/
}

.filter-field input,
.filter-field select,
.form-field input,
.form-field textarea,
.toolbar-paging select {
    width: 100%;
    min-height: 38px;
    color: var(--tb-ink);
    background: var(--tb-input-bg);
    border: 1px solid var(--tb-line);
    border-radius: 8px;
    outline: 0;
}

.filter-field input,
.filter-field select,
.form-field input,
.form-field textarea {
    padding: 8px 10px;
}

.filter-field input:focus,
.filter-field select:focus,
.form-field input:focus,
.form-field textarea:focus,
.toolbar-paging select:focus {
    border-color: var(--tb-blue-600);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--tb-blue-600) 18%, transparent);
}

.crud-toolbar {
    padding: 12px 14px;
}

.toolbar-paging select {
    min-width: 92px;
    padding: 0 8px;
}

.crud-alert {
    margin: 0;
}

.crud-alert-success {
    color: var(--tb-green);
    background: color-mix(in srgb, var(--tb-green) 12%, var(--tb-surface));
    border-color: color-mix(in srgb, var(--tb-green) 32%, var(--tb-line));
}

.crud-grid-panel {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.crud-grid-wrap {
    flex: 1 1 auto;
    min-height: 320px;
    overflow: auto;
}

.crud-grid-wrap:focus {
    outline: 2px solid color-mix(in srgb, var(--tb-blue-600) 42%, transparent);
    outline-offset: -2px;
}

.crud-grid {
    width: 100%;
    min-width: 900px;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.88rem;
}

.crud-grid th,
.crud-grid td {
    padding: 9px 10px;
    border-bottom: 1px solid var(--tb-line);
    text-align: left;
    vertical-align: middle;
}

.crud-grid thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    color: var(--tb-muted);
    background: var(--tb-table-head);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.crud-grid th button {
    width: 100%;
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0;
    color: inherit;
    background: transparent;
    border: 0;
    cursor: pointer;
    font: inherit;
    text-align: left;
    text-transform: inherit;
}

.grid-resize-handle {
    position: absolute;
    top: 0;
    right: -3px;
    width: 7px;
    height: 100%;
    cursor: col-resize;
    touch-action: none;
}

.grid-resize-handle:hover,
.grid-resize-handle:active {
    background: color-mix(in srgb, var(--tb-blue-600) 28%, transparent);
}

.crud-grid tbody tr {
    cursor: pointer;
}

.crud-grid tbody tr:hover,
.crud-grid tbody tr.selected {
    background: var(--tb-soft);
}

.grid-select-col {
    width: 46px;
    min-width: 46px;
    position: sticky;
    left: 0;
    z-index: 3;
    background: var(--tb-surface);
}

.grid-select-col input {
    width: 16px;
    height: 16px;
    accent-color: var(--tb-blue-700);
}

.crud-grid thead .grid-select-col {
    z-index: 6;
    background: var(--tb-table-head);
}

.grid-frozen-col {
    z-index: 3;
    background: var(--tb-surface);
    box-shadow: 1px 0 0 var(--tb-line);
}

.crud-grid thead .grid-frozen-col {
    z-index: 5;
    background: var(--tb-table-head);
}

.crud-grid tbody tr:hover .grid-select-col,
.crud-grid tbody tr:hover .grid-frozen-col,
.crud-grid tbody tr.selected .grid-select-col,
.crud-grid tbody tr.selected .grid-frozen-col {
    background: var(--tb-soft);
}

.grid-actions-col {
    width: 1%;
    text-align: right;
    white-space: nowrap;
}

.grid-actions-col .button,
.grid-actions-col .icon-button {
    vertical-align: middle;
}

.grid-footer-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.grid-subtle {
    display: block;
    margin-top: 4px;
    overflow-wrap: anywhere;
}

.grid-group-row td {
    height: 34px;
    color: var(--tb-blue-700);
    background: color-mix(in srgb, var(--tb-blue-600) 9%, var(--tb-surface));
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
}

.grid-state {
    height: 180px;
    color: var(--tb-muted);
    font-weight: 700;
    text-align: center;
}

.crud-grid-footer {
    padding: 9px 12px;
    color: var(--tb-muted);
    border-top: 1px solid var(--tb-line);
    font-size: 0.84rem;
    font-weight: 600;
}

.pager-prev {
    transform: rotate(135deg);
}

.pager-next {
    transform: rotate(-45deg);
}

.crud-dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(7, 21, 34, 0.48);
}

.crud-dialog {
    width: min(560px, 100%);
    max-height: calc(100vh - 48px);
    overflow: auto;
    background: var(--tb-surface);
    border: 1px solid var(--tb-line);
    border-radius: 8px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.24);
}

.crud-dialog-small {
    width: min(460px, 100%);
}

.crud-dialog-wide {
    width: min(920px, 100%);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.grid-column-settings {
    display: grid;
    gap: 8px;
    padding: 16px 18px;
    overflow: auto;
}

.grid-column-settings-head,
.grid-column-settings-row {
    display: grid;
    grid-template-columns: minmax(160px, 1fr) 72px 92px 72px 82px 104px;
    align-items: center;
    gap: 8px;
}

.grid-column-settings-head {
    color: var(--tb-muted);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.grid-column-settings-row {
    min-height: 38px;
    padding: 6px 0;
    border-top: 1px solid var(--tb-line);
}

.grid-column-settings-row strong {
    color: var(--tb-text);
    font-size: 0.86rem;
    font-weight: 600;
}

.grid-column-settings-row input[type="number"] {
    width: 100%;
    height: 32px;
    padding: 0 8px;
    color: var(--tb-text);
    background: var(--tb-input);
    border: 1px solid var(--tb-line);
    border-radius: 6px;
}

.compact-check {
    display: flex;
    justify-content: center;
}

.compact-check input {
    width: 16px;
    height: 16px;
    accent-color: var(--tb-blue-700);
}

.column-order-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
}

.metadata-editor {
    width: min(1180px, 100%);
}

.metadata-editor-tabs {
    display: flex;
    gap: 6px;
    padding: 14px 18px 0;
    border-bottom: 1px solid var(--tb-line);
}

.metadata-editor-tabs button {
    height: 34px;
    padding: 0 14px;
    color: var(--tb-muted);
    background: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    font-weight: 600;
}

.metadata-editor-tabs button.active {
    color: var(--tb-blue-700);
    border-bottom-color: var(--tb-blue-700);
}

.metadata-main-form {
    padding: 16px 18px;
}

.metadata-columns-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 18px;
    color: var(--tb-muted);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
}

.metadata-columns-grid-wrap {
    margin: 0 18px 16px;
    overflow: auto;
    border: 1px solid var(--tb-line);
    border-radius: 8px;
}

.metadata-columns-grid {
    min-width: 1680px;
    width: 100%;
    border-collapse: collapse;
    font-size: 0.76rem;
}

.metadata-columns-grid th,
.metadata-columns-grid td {
    padding: 6px;
    border-bottom: 1px solid var(--tb-line);
    vertical-align: middle;
}

.metadata-columns-grid th {
    position: sticky;
    top: 0;
    z-index: 1;
    color: var(--tb-muted);
    background: var(--tb-surface-muted);
    font-size: 0.68rem;
    text-align: left;
    text-transform: uppercase;
}

.metadata-columns-grid input,
.metadata-columns-grid select {
    width: 100%;
    height: 30px;
    padding: 0 7px;
    color: var(--tb-text);
    background: var(--tb-input);
    border: 1px solid var(--tb-line);
    border-radius: 6px;
}

.metadata-columns-grid input[type="checkbox"] {
    width: 15px;
    height: 15px;
    padding: 0;
    accent-color: var(--tb-blue-700);
}

.metadata-lookup-input {
    margin-bottom: 4px;
}

.metadata-mini-check {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-right: 8px;
    color: var(--tb-muted);
    font-size: 0.7rem;
}

.crud-dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 18px 0;
}

.crud-dialog-header h2 {
    font-size: 1.2rem;
}

.dialog-subtitle {
    margin: 4px 0 0;
    color: var(--tb-muted);
    font-size: 0.9rem;
}

.assignment-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px 0;
    color: var(--tb-muted);
    font-size: 0.84rem;
    font-weight: 600;
}

.assignment-search {
    min-width: min(360px, 100%);
    min-height: 38px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    color: var(--tb-muted);
    background: var(--tb-input-bg);
    border: 1px solid var(--tb-line);
    border-radius: 8px;
}

.assignment-search:focus-within {
    border-color: var(--tb-blue-600);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--tb-blue-600) 18%, transparent);
}

.assignment-search input {
    width: 100%;
    min-width: 0;
    color: var(--tb-ink);
    background: transparent;
    border: 0;
    outline: 0;
}

.assignment-list {
    margin: 14px 18px 0;
    max-height: min(56vh, 520px);
    overflow: auto;
    border: 1px solid var(--tb-line);
    border-radius: 8px;
}

.assignment-row {
    min-height: 50px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--tb-line);
    cursor: pointer;
}

.assignment-row-command {
    grid-template-columns: auto minmax(0, 1fr) auto;
    cursor: default;
}

.assignment-row:last-child {
    border-bottom: 0;
}

.assignment-row:hover {
    background: var(--tb-soft);
}

.assignment-row input {
    width: 16px;
    height: 16px;
    accent-color: var(--tb-blue-700);
}

.assignment-main {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.assignment-main strong {
    overflow: hidden;
    color: var(--tb-ink);
    font-size: 0.92rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.assignment-main small {
    overflow: hidden;
    color: var(--tb-muted);
    font-size: 0.78rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.assignment-badge {
    align-self: center;
    padding: 4px 8px;
    color: var(--tb-blue-900);
    background: var(--tb-soft);
    border: 1px solid var(--tb-line);
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
}

.assignment-badge.ok {
    color: var(--tb-green);
    background: color-mix(in srgb, var(--tb-green) 12%, var(--tb-surface));
}

.assignment-badge.off {
    color: var(--tb-muted);
    background: var(--tb-chip-bg);
}

.assignment-command {
    min-height: 32px;
    padding-inline: 10px;
    font-size: 0.78rem;
}

.assignment-actions {
    padding: 14px 18px 18px;
}

.crud-dialog-wide .inline-alert {
    margin: 12px 18px 0;
}

.crud-dialog-form,
.delete-copy {
    padding: 18px;
}

.crud-dialog-form {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 14px;
}

.crud-editor-tabs,
.crud-editor-tab-panel,
.crud-editor-panel,
.crud-editor-panel-grid {
    grid-column: 1 / -1;
}

.crud-editor-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 34px;
    border-bottom: 1px solid var(--tb-border);
}

.crud-editor-tabs button {
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--tb-muted);
    min-height: 34px;
    padding: 0 12px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}

.crud-editor-tabs button.active {
    border-bottom-color: var(--tb-primary);
    color: var(--tb-primary);
}

.crud-editor-tab-panel {
    display: grid;
    gap: 12px;
}

.crud-editor-panel {
    border: 1px solid var(--tb-border);
    border-radius: 8px;
    padding: 12px;
    background: var(--tb-surface);
}

.crud-editor-panel h3 {
    margin: 0 0 10px;
    color: var(--tb-ink);
    font-size: 0.82rem;
    font-weight: 700;
}

.crud-editor-panel-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 12px;
}

.crud-editor-panel-grid > .form-field,
.crud-editor-panel-grid > .toggle-field {
    grid-column: span 12;
}

.crud-dialog-form > .form-field,
.crud-dialog-form > .toggle-field {
    grid-column: span 12;
}

.crud-dialog-form > .crud-dialog-actions,
.crud-dialog-form > .crud-dialog-alert,
.crud-dialog-form > .validation-summary-errors,
.crud-dialog-form > .validation-errors {
    grid-column: 1 / -1;
}

.crud-dialog-form > .crud-dialog-alert {
    margin: 0;
}

.crud-dialog > .crud-dialog-alert {
    margin: 0 18px 12px;
}

.form-field textarea {
    min-height: 106px;
    resize: vertical;
}

.toggle-field {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--tb-ink);
    font-weight: 700;
}

.toggle-field input {
    width: 18px;
    height: 18px;
    accent-color: var(--tb-blue-700);
}

.validation-errors {
    margin: 0;
    padding: 10px 12px 10px 30px;
    color: var(--tb-red);
    background: var(--tb-alert-bg);
    border: 1px solid var(--tb-alert-border);
    border-radius: 8px;
    font-size: 0.86rem;
    font-weight: 700;
}

.crud-dialog-actions {
    padding-top: 4px;
}

.delete-copy {
    margin: 0;
    color: var(--tb-muted);
    line-height: 1.5;
}

.delete-copy strong {
    color: var(--tb-ink);
}

.master-detail-section {
    display: grid;
    gap: 10px;
    min-width: 0;
}

.master-detail-page .crud-dialog {
    width: min(1180px, calc(100vw - 32px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.master-detail-page .crud-dialog-form {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    overflow: auto;
}

.accounting-determination-dialog {
    width: min(1180px, calc(100vw - 32px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.accounting-determination-dialog-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: min(560px, calc(100vh - 190px));
    padding: 0 18px 18px;
    overflow: hidden;
}

.accounting-determination-dialog-body .crud-page {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
}

.master-document-shell {
    display: grid;
    grid-template-rows: auto minmax(260px, 1fr) auto;
    gap: 12px;
    min-height: min(620px, calc(100vh - 260px));
    padding: 0 18px;
    overflow: visible;
}

.master-document-header {
    margin: 0;
}

.master-document-shell .master-detail-section {
    min-height: 0;
    border-top: 1px solid var(--tb-border);
}

.master-document-shell .master-detail-grid-wrap {
    min-height: 240px;
    max-height: min(420px, calc(100vh - 520px));
    overflow: auto;
}

.master-document-totals {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    min-height: 46px;
    padding: 10px 0 0;
    border-top: 1px solid var(--tb-border);
}

.master-document-totals > span {
    margin-right: auto;
    color: var(--tb-muted);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.master-document-totals div {
    display: grid;
    gap: 2px;
    min-width: 128px;
    text-align: right;
}

.master-document-totals strong {
    color: var(--tb-muted);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.master-document-totals b {
    color: var(--tb-ink);
    font-size: 0.92rem;
    font-weight: 800;
}

.master-detail-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    min-height: 42px;
    border-bottom: 1px solid var(--tb-border);
}

.detail-quick-search {
    min-width: min(280px, 100%);
    height: 32px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 10px;
    color: var(--tb-muted);
    background: var(--tb-surface);
    border: 1px solid var(--tb-border);
    border-radius: 7px;
}

.detail-quick-search input {
    width: 100%;
    min-width: 0;
    padding: 0;
    color: var(--tb-ink);
    background: transparent;
    border: 0;
    outline: 0;
    font-size: 0.78rem;
}

.detail-paging-size {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--tb-muted);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.detail-paging-size select {
    min-width: 70px;
    height: 32px;
    padding: 0 8px;
    color: var(--tb-ink);
    background: var(--tb-surface);
    border: 1px solid var(--tb-border);
    border-radius: 7px;
}

.master-detail-section-head h2 {
    margin: 0;
    color: var(--tb-ink);
    font-size: 0.92rem;
    font-weight: 700;
}

.master-detail-section-head span {
    color: var(--tb-muted);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.detail-toolbar {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.master-detail-grid-wrap {
    min-height: 220px;
}

.master-detail-grid th,
.master-detail-grid td {
    padding: 5px 8px;
}

.master-detail-grid tbody tr {
    height: 29px;
}

.master-detail-grid-footer {
    flex: 0 0 auto;
}

.master-detail-grid td input:not([type="checkbox"]),
.master-detail-grid td select {
    width: 100%;
    min-height: 30px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--tb-ink);
    font-size: 0.78rem;
}

.master-detail-grid td input:not([type="checkbox"]):focus,
.master-detail-grid td select:focus {
    border-color: var(--tb-primary);
    background: var(--tb-surface);
    outline: none;
}

.master-detail-grid tr.invalid td {
    background: var(--tb-alert-bg);
}

.master-detail-line-error td {
    color: var(--tb-red);
    background: var(--tb-alert-bg);
    font-size: 0.78rem;
    font-weight: 700;
}

.app-loading {
    min-height: 100vh;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 16px;
    color: var(--tb-muted);
    background: var(--tb-bg);
    font-weight: 700;
}

.app-loading img {
    width: 190px;
    height: auto;
}

.inline-alert,
.form-alert {
    color: var(--tb-red);
    background: var(--tb-alert-bg);
    border: 1px solid var(--tb-alert-border);
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 700;
}

.inline-alert {
    margin: 16px 24px 0;
    padding: 10px 12px;
}

.form-alert {
    margin-bottom: 16px;
    padding: 10px 12px;
}

.auth-shell {
    min-height: 100vh;
    background: var(--tb-surface);
}

.login-view {
    width: 100%;
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(360px, 440px) minmax(0, 1fr);
}

.login-left {
    min-height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 42px 44px;
    background: var(--tb-surface);
    border-right: 1px solid var(--tb-line);
}

.login-brand {
    margin-bottom: 34px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.login-brand img {
    width: 210px;
    height: auto;
    margin-bottom: 16px;
}

.brand-slogan {
    margin: 0 0 30px;
    color: var(--tb-blue-900);
    /* font-family: Georgia, "Times New Roman", serif; */
    font-family: "Aptos", "Segoe UI Variable", "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 1.05rem;
    font-style: italic;
}

.login-brand h1 {
    margin: 0;
    color: var(--tb-blue-900);
    font-size: 2.1rem;
}

.login-brand p {
    max-width: 420px;
    margin: 10px 0 0;
    color: var(--tb-muted);
}

.login-brand .brand-slogan {
    margin: 0 0 30px;
    color: var(--tb-blue-900);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.05rem;
    font-style: italic;
}

.login-panel {
    width: 100%;
}

.login-top-actions {
    position: absolute;
    top: 22px;
    right: 24px;
}

.form-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
}

.form-heading h2 {
    margin: 0;
    font-size: 1.35rem;
}

.form-heading span {
    color: var(--tb-blue-900);
    background: var(--tb-soft);
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 0.8rem;
    font-weight: 800;
}

.field {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

.field span {
    color: var(--tb-ink);
    font-size: 0.88rem;
    font-weight: 700;
}

.field input {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    color: var(--tb-ink);
    background: var(--tb-input-bg);
    border: 1px solid var(--tb-line);
    border-radius: 8px;
    outline: 0;
}

.field .validation-message {
    color: var(--tb-red);
    font-size: 0.78rem;
    font-weight: 700;
}

.field input:focus {
    border-color: var(--tb-blue-600);
    background: var(--tb-surface);
    box-shadow: 0 0 0 3px rgba(10, 149, 220, 0.14);
}

.full-width {
    width: 100%;
    min-height: 46px;
}

.login-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

.login-meta span {
    color: var(--tb-muted);
    background: var(--tb-chip-bg);
    border: 1px solid var(--tb-line);
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 0.78rem;
    font-weight: 700;
}

.login-visual {
    min-width: 0;
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 54px;
    overflow: hidden;
    color: #ffffff;
    background: var(--tb-login-image-bg);
}

.login-visual::before {
    content: "";
    position: absolute;
    inset: 0;
    background: url("images/login-operations-bg.png") center / cover no-repeat;
    background-color: var(--tb-login-image-bg);
}

.login-visual::after {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--tb-login-overlay);
    pointer-events: none;
}

.login-visual-content {
    width: min(520px, 100%);
    position: relative;
    z-index: 1;
    text-align: right;
}

.login-visual-content span {
    display: block;
    margin-bottom: 10px;
    color: #d7f4ff;
    font-size: 1.5rem;
    font-weight: 500;
    text-transform: none;
}

    .login-visual-content .visual-slogan {
        display: block;
        margin: 0;
        font-size: clamp(2rem, 3vw, 4.1rem);
        line-height: 1.00;
/*        font-family: Georgia, "Times New Roman", serif; */
        font-family: "Aptos", "Segoe UI Variable", "Segoe UI", Roboto, Arial, sans-serif;
        font-style: italic;
        font-weight: 500;
    }

#blazor-error-ui {
    display: none;
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 1000;
    max-width: 420px;
    padding: 12px 16px;
    color: #ffffff;
    background: var(--tb-red);
    border-radius: 8px;
    box-shadow: var(--tb-shadow);
}

#blazor-error-ui .reload {
    margin-left: 10px;
    color: #ffffff;
    font-weight: 700;
}

#blazor-error-ui .dismiss {
    margin-left: 12px;
    cursor: pointer;
}

.fk-picker {
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(88px, 128px) 40px minmax(120px, 1fr);
    align-items: center;
    gap: 0px; /*6px*/
}

.fk-code {
    width: 100%;
    min-width: 0;

    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}

.fk-readonly {
    width: 100%;
    min-width: 0;
    color: var(--tb-text);
    font-weight: 600;
}

.fk-picker > .fk-readonly {
    grid-column: 1 / -1;
}

.fk-picker > .button {
    width: 32px;
    min-width: 32px;
    height: 32px;
    padding: 0;
    justify-content: center;

    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}


.fk-description {
    min-width: 0;
    overflow: hidden;
    color: var(--tb-muted);
    font-size: 0.84rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-left: .5rem;
}
    
.lookup-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(7, 21, 34, 0.48);
}

.lookup-dialog {
    width: min(980px, 100%);
    height: min(760px, calc(100vh - 48px));
    min-height: min(560px, calc(100vh - 48px));
    display: flex;
    flex-direction: column;
    color: var(--tb-ink);
    background: var(--tb-surface);
    border: 1px solid var(--tb-line);
    border-radius: 8px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.24);
    overflow: hidden;
}

.lookup-dialog-header {
    flex: 0 0 auto;
    border: 0;
    border-bottom: 1px solid var(--tb-line);
    border-radius: 0;
    box-shadow: none;
}

.lookup-dialog-header h1 {
    font-size: 1.24rem;
}

.lookup-dialog .button {
    width: auto;
    min-width: max-content;
    padding: 0 14px;
}

.lookup-filters {
    flex: 0 0 auto;
    border: 0;
    border-top: 1px solid var(--tb-line);
    border-bottom: 1px solid var(--tb-line);
    border-radius: 0;
    box-shadow: none;
}

.lookup-search-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
}

.lookup-alert {
    flex: 0 0 auto;
    margin: 12px 16px 0;
}

.lookup-grid-panel {
    flex: 1 1 auto;
    min-height: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.lookup-grid-wrap {
    min-height: 0;
}

.lookup-grid {
    min-width: 560px;
}

.lookup-grid th,
.lookup-grid td {
    height: 30px;
    padding: 4px 8px;
}

.lookup-grid th button {
    min-height: 22px;
}

.lookup-grid tbody td {
    line-height: 1.2;
}

.lookup-grid .grid-select-col {
    width: 36px;
}

.lookup-grid .grid-select-col input {
    width: 14px;
    height: 14px;
    display: block;
}

.lookup-grid-footer {
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: space-between;
    row-gap: 10px;
}

@media (min-width: 1600px) {
    .erp-shell {
        grid-template-columns: 300px minmax(0, 1fr);
    }

    .erp-shell.sidebar-collapsed {
        grid-template-columns: 76px minmax(0, 1fr);
    }

    .erp-topbar {
        padding-inline: 32px;
    }

    .metric-grid {
        gap: 18px;
    }

    .workspace-grid {
        grid-template-columns: minmax(0, 2.15fr) minmax(360px, 0.85fr);
    }

    .panel,
    .metric-card {
        padding: 22px;
    }
}

@media (max-width: 1060px) {
    .erp-shell {
        grid-template-columns: 232px minmax(0, 1fr);
    }

    .erp-shell.sidebar-collapsed {
        grid-template-columns: 76px minmax(0, 1fr);
    }

    .metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .workspace-grid,
    .login-view {
        grid-template-columns: 1fr;
    }

    .login-left {
        min-height: auto;
        padding: 34px 28px;
        border-right: 0;
    }

    .login-visual {
        min-height: 340px;
        padding: 34px 28px;
    }

    .login-visual-content {
        text-align: left;
    }

    .crud-header,
    .crud-section-head,
    .crud-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .crud-header-status {
        justify-items: start;
    }
}

@media (max-width: 760px) {
    .erp-shell {
        display: block;
    }

    .sidebar-toggle {
        display: none;
    }

    .erp-sidebar {
        min-height: auto;
        position: relative;
    }

    .erp-shell.sidebar-collapsed .brand-panel {
        min-height: 86px;
        display: block;
        padding: 14px 18px;
    }

    .brand-panel {
        min-height: 86px;
        padding: 14px 18px;
    }

    .brand-link {
        width: 150px;
    }

    .erp-shell.sidebar-collapsed .brand-link {
        width: 150px;
        height: auto;
        display: block;
        color: inherit;
        background: transparent;
        border-radius: 0;
    }

    .erp-shell.sidebar-collapsed .brand-link::before {
        content: none;
    }

    .erp-shell.sidebar-collapsed .brand-link img,
    .erp-shell.sidebar-collapsed .brand-subtitle,
    .erp-shell.sidebar-collapsed .nav-section-title,
    .erp-shell.sidebar-collapsed .nav-link span:not(.nav-icon):not(.nav-caret),
    .erp-shell.sidebar-collapsed .nav-caret,
    .erp-shell.sidebar-collapsed .empty-menu {
        display: block;
    }

    .erp-shell.sidebar-collapsed .nav-footer {
        display: flex;
    }

    .navbar-toggler {
        appearance: none;
        display: block;
        width: 42px;
        height: 42px;
        position: absolute;
        top: 18px;
        right: 16px;
        border: 1px solid var(--tb-line);
        border-radius: 8px;
        background: var(--tb-surface);
    }

    .navbar-toggler::before,
    .navbar-toggler::after {
        content: "";
        position: absolute;
        left: 10px;
        width: 20px;
        height: 2px;
        background: var(--tb-blue-700);
    }

    .navbar-toggler::before {
        top: 14px;
        box-shadow: 0 6px 0 var(--tb-blue-700);
    }

    .navbar-toggler::after {
        top: 26px;
    }

    .nav-scrollable {
        display: none;
        height: auto;
        padding-top: 4px;
    }

    .erp-shell.sidebar-collapsed .nav-scrollable {
        height: auto;
        padding: 4px 14px 18px;
    }

    .erp-shell.sidebar-collapsed .nav-link {
        justify-content: flex-start;
        padding-left: calc(12px + (var(--level, 0) * 16px));
    }

    .erp-shell.sidebar-collapsed .nav-children {
        display: grid;
    }

    .navbar-toggler:checked ~ .nav-scrollable {
        display: block;
    }

    .erp-topbar,
    .topbar-actions,
    .page-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .topbar-search,
    .company-picker,
    .user-menu,
    .user-menu-button {
        width: 100%;
    }

    .user-chip {
        justify-content: flex-start;
    }

    .user-menu-panel {
        width: 100%;
        left: 0;
        right: auto;
    }

    .erp-content {
        padding: 18px;
    }

    .metric-grid {
        grid-template-columns: 1fr;
    }

    .crud-page {
        min-height: auto;
    }

    .filter-actions,
    .toolbar-actions,
    .crud-dialog-actions {
        width: 100%;
    }

    .filter-actions .button,
    .toolbar-actions .button,
    .crud-dialog-actions .button {
        flex: 1 1 160px;
    }

    .filter-strip {
        grid-template-columns: 1fr;
        max-height: 220px;
    }

    .crud-grid-wrap {
        min-height: 360px;
    }

    .login-view {
        display: flex;
        flex-direction: column;
        min-height: 100vh;
    }

    .login-left {
        order: 2;
        width: 100%;
    }

    .login-visual {
        order: 1;
        min-height: 240px;
    }

    .login-brand img {
        width: 176px;
    }

    .login-visual-content .visual-slogan {
        font-size: 1.85rem;
    }

    .fk-picker {
        grid-template-columns: minmax(82px, 112px) 40px minmax(0, 1fr);
    }

    .lookup-overlay {
        padding: 16px;
    }
}

/* Density tuning for operational ERP screens */
.crud-page {
    gap: 6px;
}

.crud-header {
    padding: 7px 10px;
}

.crud-header h1 {
    font-size: 1.32rem;
}

.page-summary {
    margin-top: 3px;
    font-size: 0.82rem;
}

.button,
.icon-button {
    min-height: 32px;
    gap: 6px;
    border-radius: 6px;
    font-size: 0.8rem;
}

.button {
    padding: 0 9px;
}

.icon-button {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
}

.tb-icon {
    width: 15px;
    height: 15px;
}

.crud-filters {
    padding: 8px 10px;
}

.crud-section-head {
    margin-bottom: 7px;
}

.crud-section-head h2 {
    font-size: 0.9rem;
}

.filter-actions,
.toolbar-actions,
.pager-actions {
    gap: 6px;
}

.filter-strip {
    max-height: 124px;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 7px;
}

.filter-field,
.form-field,
.toolbar-paging label {
    gap: 4px;
}

.filter-field > span,
.form-field > span {
    font-size: 0.72rem;
}

.filter-field input,
.filter-field select,
.form-field input,
.form-field textarea,
.toolbar-paging select {
    min-height: 31px;
    border-radius: 6px;
    font-size: 0.8rem;
}

.filter-field input,
.filter-field select,
.form-field input,
.form-field textarea {
    padding: 5px 8px;
}

.boolean-check,
.toggle-field {
    min-height: 31px;
    gap: 7px;
    font-size: 0.8rem;
}

.crud-toolbar {
    padding: 8px 10px;
}

.toolbar-paging span,
.grid-subtle {
    font-size: 0.72rem;
}

.toolbar-paging select {
    min-width: 76px;
    padding: 0 6px;
}

.crud-grid {
    font-size: 0.78rem;
}

.crud-grid th,
.crud-grid td {
    padding: 5px 8px;
}

.crud-grid thead th {
    font-size: 0.66rem;
}

.crud-grid th button {
    min-height: 22px;
    gap: 5px;
}

.crud-grid tbody tr {
    height: 29px;
}

.grid-select-col {
    width: 34px;
    min-width: 34px;
}

.grid-select-col input {
    width: 14px;
    height: 14px;
}

.grid-actions-col .button,
.grid-actions-col .icon-button {
    min-height: 28px;
}

.grid-group-row td {
    height: 28px;
    font-size: 0.7rem;
}

.grid-state {
    height: 118px;
}

.crud-grid-footer {
    padding: 6px 10px;
    font-size: 0.76rem;
}

.crud-dialog-backdrop {
    padding: 14px;
}

.crud-dialog {
    max-height: calc(100vh - 28px);
    border-radius: 7px;
}

.crud-dialog-wide {
    width: min(980px, 100%);
}

.crud-dialog-header {
    gap: 12px;
    padding: 12px 14px 0;
}

.crud-dialog-header h2 {
    font-size: 1rem;
}

.dialog-subtitle {
    margin-top: 2px;
    font-size: 0.78rem;
}

.crud-dialog-form,
.delete-copy {
    padding: 12px 14px;
}

.crud-dialog-form {
    gap: 9px;
}

.crud-dialog-wide .inline-alert {
    margin: 8px 14px 0;
}

.crud-dialog > .crud-dialog-alert {
    margin: 0 14px 8px;
}

.crud-dialog-actions {
    gap: 8px;
    padding-top: 2px;
}

.form-field textarea {
    min-height: 76px;
}

.crud-editor-tabs {
    min-height: 29px;
}

.crud-editor-tabs button {
    min-height: 29px;
    padding: 0 9px;
    font-size: 0.72rem;
}

.crud-editor-tab-panel {
    gap: 7px;
}

.crud-editor-panel {
    padding: 8px;
    border-radius: 6px;
}

.crud-editor-panel h3 {
    margin-bottom: 7px;
    font-size: 0.76rem;
}

.crud-editor-panel-grid {
    gap: 8px;
}

.metadata-editor {
    width: min(1120px, 100%);
}

.metadata-editor-tabs {
    gap: 4px;
    padding: 8px 14px 0;
}

.metadata-editor-tabs button {
    height: 29px;
    padding: 0 10px;
    font-size: 0.72rem;
}

.metadata-main-form {
    padding: 10px 14px;
}

.metadata-columns-toolbar {
    gap: 8px;
    padding: 8px 14px;
    font-size: 0.7rem;
}

.metadata-columns-grid-wrap {
    margin: 0 14px 12px;
}

.metadata-columns-grid {
    font-size: 0.7rem;
}

.metadata-columns-grid th,
.metadata-columns-grid td {
    padding: 4px;
}

.metadata-columns-grid th {
    font-size: 0.62rem;
}

.metadata-columns-grid input,
.metadata-columns-grid select {
    height: 25px;
    padding: 0 5px;
    border-radius: 5px;
    font-size: 0.7rem;
}

.metadata-columns-grid input[type="checkbox"] {
    width: 13px;
    height: 13px;
}

.master-detail-section {
    gap: 6px;
}

.master-detail-page .crud-dialog {
    width: min(1180px, calc(100vw - 20px));
}

.master-document-shell {
    grid-template-rows: auto minmax(220px, 1fr) auto;
    gap: 8px;
    min-height: min(560px, calc(100vh - 210px));
    padding: 0 14px;
}

.master-document-shell .master-detail-section {
    border-top-width: 1px;
}

.master-document-shell .master-detail-grid-wrap {
    min-height: 196px;
    max-height: min(380px, calc(100vh - 438px));
}

.master-document-totals {
    gap: 8px;
    min-height: 36px;
    padding-top: 6px;
}

.master-document-totals div {
    min-width: 104px;
}

.master-document-totals strong {
    font-size: 0.62rem;
}

.master-document-totals b {
    font-size: 0.82rem;
}

.master-detail-section-head {
    min-height: 34px;
}

.master-detail-section-head h2 {
    font-size: 0.82rem;
}

.master-detail-section-head span {
    font-size: 0.64rem;
}

.master-detail-grid-wrap {
    min-height: 190px;
}

.master-detail-grid td,
.master-detail-grid th {
    padding: 5px 8px;
}

.master-detail-grid tbody tr {
    height: 29px;
}

.master-detail-line-error td {
    font-size: 0.72rem;
}

.detail-line-editor .crud-editor-panel {
    padding: 7px;
}

.detail-line-editor .crud-editor-panel-grid {
    gap: 7px;
}

.lookup-overlay {
    padding: 12px;
}

.lookup-dialog {
    border-radius: 7px;
}

.lookup-dialog-header {
    min-height: 58px;
    padding: 10px 12px;
}

.lookup-dialog-header h1 {
    font-size: 0.98rem;
}

.lookup-dialog .button {
    min-height: 30px;
}

.lookup-grid th,
.lookup-grid td {
    padding-top: 5px;
    padding-bottom: 5px;
}

.report-launcher-page {
    min-height: calc(100vh - 108px);
}

.report-launcher-shell {
    min-height: 0;
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
    gap: 8px;
}

.report-parameters-panel,
.report-preview-panel {
    min-width: 0;
    min-height: 0;
    background: var(--tb-surface);
    border: 1px solid var(--tb-line);
    border-radius: 8px;
    box-shadow: var(--tb-shadow);
}

.report-parameters-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
}

.report-preview-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 8px;
    padding: 12px;
}

.report-parameter-grid {
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 10px;
    overflow: auto;
    padding-right: 2px;
}

.report-parameter-grid > .form-field {
    grid-column: 1 / -1;
}

.report-parameter-grid input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.report-launcher-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 4px;
}

.report-preview-wrap {
    min-height: 0;
    overflow: auto;
    border: 1px solid var(--tb-line);
    border-radius: 8px;
    background: var(--tb-surface);
}

.report-preview-table {
    width: 100%;
    min-width: 760px;
    border-collapse: separate;
    border-spacing: 0;
    color: var(--tb-ink);
    font-size: 0.78rem;
}

.report-preview-table th,
.report-preview-table td {
    height: 30px;
    padding: 5px 8px;
    border-bottom: 1px solid var(--tb-line);
    white-space: nowrap;
}

.report-preview-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--tb-table-head);
    color: var(--tb-muted);
    font-size: 0.72rem;
    font-weight: 700;
    text-align: left;
}

.report-preview-table tbody tr:hover {
    background: var(--tb-soft);
}

.report-preview-empty {
    min-height: 220px;
    display: grid;
    place-content: center;
    gap: 10px;
    color: var(--tb-muted);
    text-align: center;
}

.report-preview-empty .terabit-icon {
    width: 30px;
    height: 30px;
    justify-self: center;
    color: var(--tb-blue-700);
}

.report-viewer-page {
    min-height: calc(100vh - 32px);
}

.report-viewer-frame {
    min-height: 0;
    height: calc(100vh - 150px);
    border: 1px solid var(--tb-line);
    border-radius: 8px;
    overflow: hidden;
    background: var(--tb-surface);
}

.report-viewer-frame > div {
    height: 100%;
}

.text-end {
    text-align: right;
}

.text-center {
    text-align: center;
}

@media (max-width: 1080px) {
    .report-launcher-shell {
        grid-template-columns: 1fr;
    }
}
