*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: #f4f6f9;
    color: #2d3748;
}

.vlm-splash {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    font-size: 1.1rem;
    color: #718096;
}

.vlm-splash-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.vlm-spinner {
    width: 18px;
    height: 18px;
    border: 3px solid #e2e8f0;
    border-top: 3px solid #3182ce;
    border-radius: 50%;
    animation: vlm-spin 0.8s linear infinite;
}

.vlm-loading-text {
    font-weight: 500;
}

@keyframes vlm-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.vlm-splash {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.vlm-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.vlm-sidebar {
    width: 240px;
    min-width: 240px;
    background: #1a202c;
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.vlm-sidebar-brand {
    padding: 20px 20px 16px;
    border-bottom: 1px solid #2d3748;
}

    .vlm-sidebar-brand h2 {
        margin: 0;
        font-size: 1.1rem;
        font-weight: 700;
        color: #fff;
        letter-spacing: 0.5px;
    }

    .vlm-sidebar-brand span {
        font-size: 0.75rem;
        color: #718096;
    }

.vlm-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.vlm-nav-section {
    padding: 8px 16px 4px;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #4a5568;
}

.vlm-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    color: #a0aec0;
    text-decoration: none;
    font-size: 0.875rem;
    border-left: 3px solid transparent;
    transition: all 0.15s ease;
}

    .vlm-nav a:hover {
        background: #2d3748;
        color: #fff;
    }

    .vlm-nav a.active {
        background: #2d3748;
        color: #fff;
        border-left-color: #667eea;
    }

.vlm-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.vlm-topbar {
    height: 56px;
    min-height: 56px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}

.vlm-topbar-title {
    font-size: 1rem;
    font-weight: 600;
    color: #2d3748;
}

.vlm-topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #718096;
}

.vlm-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.vlm-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

    .vlm-page-header h3 {
        margin: 0;
        font-size: 1.2rem;
        font-weight: 600;
        color: #2d3748;
    }

    .vlm-page-header p {
        margin: 2px 0 0;
        font-size: 0.8rem;
        color: #718096;
    }

.vlm-card {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 4px rgba(0,0,0,.04);
    overflow: hidden;
}

.vlm-card-body {
    padding: 20px;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.64rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-draft {
    background: #edf2f7;
    color: #4a5568;
}

.badge-pending {
    background: #fefcbf;
    color: #975a16;
}

.badge-approved {
    background: #c6f6d5;
    color: #276749;
}

.badge-rejected {
    background: #fed7d7;
    color: #9b2c2c;
}

.badge-cancelled {
    background: #e9d8fd;
    color: #553c9a;
}

.vlm-section-label {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #718096;
    margin: 20px 0 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid #edf2f7;
}

.vlm-tab-bar {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 20px;
    background: #fff;
    border-radius: 10px 10px 0 0;
    padding: 0 4px;
    border: 1px solid #e2e8f0;
    border-bottom: none;
    overflow: hidden;
}

.vlm-tab {
    padding: 12px 22px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #718096;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

    .vlm-tab:hover {
        color: #2d3748;
        background: #f7fafc;
    }

    .vlm-tab.active {
        color: #667eea;
        border-bottom: 3px solid #667eea;
        background: #fff;
        font-weight: 600;
    }

.vlm-tab-badge {
    background: #e2e8f0;
    color: #4a5568;
    border-radius: 999px;
    padding: 1px 7px;
    font-size: 0.7rem;
    font-weight: 700;
}

.vlm-tab.active .vlm-tab-badge {
    background: #ebf4ff;
    color: #667eea;
}

.vlm-tab-content {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 10px 10px;
    padding: 24px;
    min-height: 400px;
}

.kpi-tree {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

.kpi-tree-header {
    display: grid;
    grid-template-columns: 40px 2fr 2fr 100px 160px 100px;
    background: #f7fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 0;
}

.kpi-tree-header-cell {
    padding: 10px 12px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-right: 1px solid #e2e8f0;
}

    .kpi-tree-header-cell:last-child {
        border-right: none;
    }

.kpi-perspective-row {
    display: grid;
    grid-template-columns: 40px 1fr;
    background: #f0f4ff;
    border-bottom: 1px solid #e2e8f0;
    cursor: pointer;
    transition: background 0.1s;
    user-select: none;
}

    .kpi-perspective-row:hover {
        background: #e8eeff;
    }

.kpi-perspective-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: #667eea;
    padding: 10px;
    transition: transform 0.2s ease;
}

    .kpi-perspective-toggle.expanded {
        transform: rotate(90deg);
    }

.kpi-perspective-name {
    padding: 10px 12px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #3c4a8a;
    display: flex;
    align-items: center;
}

.kpi-children {
    border-bottom: 2px solid #e2e8f0;
}

.kpi-add-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #fafbff;
    border-bottom: 1px solid #edf2f7;
}

.kpi-child-row {
    display: grid;
    grid-template-columns: 40px 2fr 2fr 100px 160px 100px;
    border-bottom: 1px solid #edf2f7;
    min-height: 44px;
    transition: background 0.1s;
}

    .kpi-child-row:hover {
        background: #fafbff;
    }

    .kpi-child-row:last-child {
        border-bottom: none;
    }

.kpi-child-cell {
    padding: 6px 8px;
    display: flex;
    align-items: center;
    border-right: 1px solid #f0f4f8;
}

    .kpi-child-cell:last-child {
        border-right: none;
    }

    .kpi-child-cell:first-child {
        justify-content: center;
    }

    .kpi-child-cell .kpi-child-cell-input.rz-numeric {
        height: 32px !important;
        border: 1px solid #e2e8f0 !important;
    }

        .kpi-child-cell .kpi-child-cell-input.rz-numeric:hover {
            border: 1px solid #e2e8f0 !important;
        }

        .kpi-child-cell .kpi-child-cell-input.rz-numeric input.rz-numeric-input {
            border: none !important;
        }

.kpi-empty-row {
    padding: 14px 12px;
    font-size: 0.82rem;
    color: #a0aec0;
    font-style: italic;
    background: #fafbff;
    text-align: center;
}

.kpi-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    color: #718096;
    transition: all 0.1s;
    font-size: 1rem;
    line-height: 1;
}

    .kpi-action-btn:hover {
        background: #edf2f7;
        color: #2d3748;
    }

    .kpi-action-btn.save:hover {
        color: #48bb78;
    }

    .kpi-action-btn.cancel:hover {
        color: #718096;
    }

    .kpi-action-btn.delete:hover {
        color: #fc8181;
    }

.vlm-weight-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 12px;
    padding: 8px 12px;
    background: #f7fafc;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #718096;
}

.vlm-weight-value {
    font-weight: 700;
    font-size: inherit;
}

.vlm-weight-ok {
    color: #48bb78;
}

.vlm-weight-warn {
    color: #e53e3e;
}

.vlm-weight-warning {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: inherit;
    color: #e53e3e;
}

    .vlm-weight-warning .rzi {
        font-size: 1em;
    }

.rz-datatable {
    border: none !important;
}

.rz-datatable-thead-tr th {
    background: #f7fafc !important;
    font-size: 0.78rem !important;
    font-weight: 600 !important;
    color: #718096 !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rz-datatable-tbody-tr:hover td {
    background: #f7fafc !important;
}

.rz-dialog-wrapper .rz-dialog {
    border-radius: 12px !important;
}

.rz-button.rz-primary {
    background: #667eea !important;
    border-color: #667eea !important;
}

.rz-button.rz-danger {
    background: #fc8181 !important;
    border-color: #fc8181 !important;
}

.kpi-child-cell .rz-textbox,
.kpi-child-cell .rz-numeric input,
.kpi-child-cell .rz-dropdown {
    border: 1px solid #e2e8f0 !important;
    border-radius: 4px !important;
    font-size: 0.82rem !important;
    padding: 4px 8px !important;
    height: 32px !important;
    width: 100% !important;
}
