:root {
    /* Brand Palette */
    --primary: #1E3A8A;
    --primary-dark: #172E6E;
    --primary-light: #E8EEF8;

    /* Semantic Colors */
    --success: #2F9F72;
    --success-light: #E2F4EB;
    --danger: #C93636;
    --danger-light: #FDE9E9;
    --warning: #9A5D00;
    --warning-light: #FFF0D7;
    --deduction: #D77A3C;
    --deduction-light: #FBEBDD;
    --information: #2D64A8;
    --information-light: #E5EFFC;

    /* Dashboard Chart Palette */
    --chart-store: #1E3A8A;
    --chart-warehouse: #0F766E;
    --chart-category-sda: #5B6FBE;
    --chart-category-utility-accessories: #20A779;
    --chart-category-av: #F2A007;
    --chart-category-ict: #3B82B6;
    --chart-category-sim-card: #8C9AAF;
    --chart-category-ha: #D55454;
    --chart-category-stationery: #805AD5;
    --chart-category-freegift: #22A6B3;
    --chart-category-billing-pending: #A35B2D;

    /* Neutrals - Light Mode */
    --bg-color: #F3F5F7;
    --bg-card: #FFFFFF;
    --text-main: #172033;
    --text-muted: #6A7486;
    --border: #DCE2EA;

    /* Sidebar Palette */
    --sidebar-bg: #23334F;
    --sidebar-text: #D0D8E7;
    --sidebar-muted: #9EACC4;
    --sidebar-hover: #2C4265;
    --sidebar-active: #365275;
    --sidebar-active-accent: #70B7D7;
    --sidebar-border: rgba(208, 216, 231, 0.16);

    /* Shadow & Transition */
    --shadow-sm: 0 1px 2px rgba(30, 58, 138, 0.05);
    --shadow-md: 0 4px 8px -2px rgba(30, 58, 138, 0.15), 0 0 1px rgba(30, 58, 138, 0.2);
    --shadow-lg: 0 14px 32px -10px rgba(30, 58, 138, 0.30), 0 0 1px rgba(30, 58, 138, 0.18);
    --transition: all 0.2s ease-in-out;

    /* Shared density */
    --radius-sm: 6px;
    --radius-section: 8px;
    --radius-control: 6px;
    --control-height: 36px;
    --table-font-size: 12px;

    /* Layout */
    --sidebar-width: 250px;
}

body.dark-theme {
    /* Neutrals - Dark Mode */
    --bg-color: #0F172A;
    --bg-card: #1E293B;
    --text-main: #F1F5F9;
    --text-muted: #94A3B8;
    --border: #334155;

    --sidebar-bg: #182842;
    --sidebar-text: #D7E0F0;
    --sidebar-muted: #9EACC4;
    --sidebar-hover: #263C60;
    --sidebar-active: #365275;
    --sidebar-active-accent: #8FC5FF;
    --sidebar-border: rgba(215, 224, 240, 0.16);

    --primary-light: #263B68;
    --success: #5AC392;
    --success-light: #173F32;
    --danger: #F07A7A;
    --danger-light: #54282E;
    --warning: #F2B463;
    --warning-light: #513B1E;
    --deduction: #E4A168;
    --deduction-light: #573923;
    --information: #91BFFF;
    --information-light: #243E62;

    --chart-store: #91BFFF;
    --chart-warehouse: #4FD1C5;
    --chart-category-sda: #A5B4FC;
    --chart-category-utility-accessories: #5DD39E;
    --chart-category-av: #F6C45B;
    --chart-category-ict: #6CB6E8;
    --chart-category-sim-card: #CBD5E1;
    --chart-category-ha: #FF9A9A;
    --chart-category-stationery: #C4B5FD;
    --chart-category-freegift: #67D6E8;
    --chart-category-billing-pending: #E5A46F;

    --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.7);
    --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.56);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    transition: background-color 0.3s ease, color 0.3s ease;
}

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

body.auth-loading .login-screen,
body.authenticated .login-screen,
body.unauthenticated .app-container,
body.auth-loading .app-container {
    display: none;
}

body.unauthenticated .login-screen {
    display: flex;
}

.login-screen {
    position: relative;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 24px;
    overflow: hidden;
    background:
        linear-gradient(135deg, #f6f9ff 0%, #edf4ff 45%, #e7f0ff 100%),
        linear-gradient(115deg, rgba(30, 58, 138, 0.08) 0 1px, transparent 1px 34px),
        radial-gradient(circle, rgba(41, 131, 214, 0.14) 1px, transparent 1px);
    background-size: auto, 34px 34px, 28px 28px;
}

.login-background-art {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.login-art-tile {
    position: absolute;
    display: grid;
    width: 92px;
    height: 92px;
    place-items: center;
    color: rgba(30, 58, 138, 0.72);
    background: rgba(255, 255, 255, 0.42);
    border: 1px solid rgba(96, 165, 250, 0.34);
    border-radius: 22px;
    box-shadow: 0 18px 50px rgba(30, 58, 138, 0.10);
    backdrop-filter: blur(10px);
}

.login-art-tile i {
    font-size: 34px;
}

.login-art-tile-calendar {
    top: 18%;
    left: 18%;
    transform: rotate(-8deg);
}

.login-art-tile-report {
    top: 60%;
    left: 22%;
    transform: rotate(7deg);
}

.login-art-tile-chart {
    top: 22%;
    right: 19%;
    transform: rotate(6deg);
}

.login-art-tile-shield {
    right: 23%;
    bottom: 18%;
    transform: rotate(-7deg);
}

.login-art-panel {
    position: absolute;
    right: 12%;
    bottom: 11%;
    display: grid;
    width: 180px;
    gap: 12px;
    padding: 18px;
    background: rgba(255, 255, 255, 0.30);
    border: 1px solid rgba(96, 165, 250, 0.22);
    border-radius: 24px;
    box-shadow: 0 20px 55px rgba(30, 58, 138, 0.08);
}

.login-art-panel span {
    display: block;
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(30, 58, 138, 0.22), rgba(41, 131, 214, 0.06));
}

.login-art-panel span:nth-child(2) {
    width: 72%;
}

.login-art-panel span:nth-child(3) {
    width: 48%;
}

.login-card {
    position: relative;
    z-index: 1;
    width: min(100%, 420px);
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 24px;
    box-shadow: 0 24px 60px rgba(30, 58, 138, 0.16), 0 1px 2px rgba(30, 58, 138, 0.08);
    padding: 32px;
}

@media (max-width: 900px) {
    .login-art-tile,
    .login-art-panel {
        opacity: 0.42;
        transform: scale(0.82);
    }

    .login-art-tile-calendar {
        left: 4%;
    }

    .login-art-tile-report,
    .login-art-panel {
        display: none;
    }

    .login-art-tile-chart {
        right: 5%;
    }

    .login-art-tile-shield {
        right: 8%;
        bottom: 8%;
    }
}

.login-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 30px;
    text-align: center;
}

.login-logo {
    width: 160px;
    height: auto;
    object-fit: contain;
    margin-bottom: 6px;
}

.login-eyebrow {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.login-brand h1 {
    font-size: 28px;
    line-height: 1.2;
    color: var(--text-main);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.login-password-field {
    position: relative;
}

.login-password-field input {
    padding-right: 48px;
}

.login-password-toggle {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    color: var(--text-muted);
    background: transparent;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
}

.login-password-toggle:hover,
.login-password-toggle.is-visible {
    color: var(--primary);
    background: var(--primary-light);
}

.login-password-toggle i {
    font-size: 20px;
}

.login-submit {
    width: 100%;
    justify-content: center;
    margin-top: 4px;
}

.login-message {
    display: none;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--danger-light);
    color: var(--danger);
    font-size: 13px;
    font-weight: 600;
}

.login-message.show {
    display: block;
}

.login-help {
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
}

.login-help span {
    color: var(--primary);
    font-weight: 700;
}

.user-logout-btn {
    width: calc(100% - 24px);
    margin: 0 12px 12px;
}

.role-hidden,
.role-disabled {
    display: none !important;
}

.role-readonly-control {
    opacity: 0.55;
    pointer-events: none;
}
