:root {
    /* --- 2005 "OFFICE" PALETTE --- */
    --xp-blue-dark: #204d88;    /* Dark Header Blue */
    --xp-blue-light: #6ea4e9;   /* Lighter Gradient Top */
    --xp-bg: #ece9d8;           /* Classic "Windows" Beige */
    --xp-white: #ffffff;
    
    /* 3D Borders */
    --border-outset: #ffffff #808080 #808080 #ffffff; /* Raised */
    --border-inset: #808080 #ffffff #ffffff #808080;  /* Sunken */
    --border-solid: #7f9db9;    /* Classic XP Blue Border */
    
    --text-main: #000000;
    --text-muted: #444444;
    
    --header-gradient-start: #8caae6;
    --header-gradient-end: #4a6ea8;
}

* { box-sizing: border-box; }

body {
    font-family: Tahoma, Verdana, Arial, sans-serif;
    background-color: var(--xp-bg);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    font-size: 12px; /* Compact authentic size */
    line-height: 1.4;
}

a { text-decoration: none; color: inherit; }

/* --- 1. COMPACT RETRO NAVBAR --- */
.navbar {
    background: linear-gradient(to bottom, var(--header-gradient-start) 0%, var(--header-gradient-end) 100%);
    border-bottom: 2px solid #002d96;
    height: 42px; /* Reduced height */
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-brand {
    font-weight: bold;
    font-size: 14px;
    color: white;
    text-shadow: 1px 1px 0px #204d88;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 15px;
}

.nav-menu {
    display: flex;
    height: 100%;
    align-items: center;
    gap: 2px;
}

/* --- DROPDOWN MENU SYSTEM --- */
.nav-item {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.nav-link {
    color: white;
    font-weight: bold;
    padding: 4px 10px; /* Tighter padding */
    display: flex;
    align-items: center;
    border: 1px solid transparent;
    border-radius: 3px;
    font-size: 11px;
    cursor: pointer;
    white-space: nowrap;
}

.nav-link:hover, .nav-item:hover > .nav-link {
    background-color: #ffe48d; /* Classic Hover Yellow */
    color: black;
    border: 1px solid #000080;
    box-shadow: inset 0 0 2px white;
}

.nav-link.active {
    background-color: white;
    color: black;
    border: 1px solid #204d88;
    box-shadow: inset 1px 1px 2px rgba(0,0,0,0.2);
}

.nav-link-logout {
    margin-left: 5px;
    background: rgba(255,0,0,0.1);
    border: 1px solid rgba(255,255,255,0.3);
}

/* Dropdown Container */
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 150px;
    background-color: white;
    border: 1px solid #808080;
    border-left: 1px solid #ffffff;
    border-top: 1px solid #ffffff;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.4);
    padding: 2px;
    z-index: 5000;
}

.nav-item:hover .dropdown-menu { display: block; }

/* Grey Strip on Left */
.dropdown-menu::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 22px;
    background-color: #e3e3e3;
    border-right: 1px solid #dcdcdc;
    z-index: -1;
}

.dropdown-link {
    display: block;
    padding: 5px 10px 5px 30px; /* Room for icon strip */
    color: black;
    font-size: 11px;
    font-family: Tahoma, sans-serif;
    border: 1px solid transparent;
}

.dropdown-link:hover {
    background-color: #316ac5;
    color: white;
    border: 1px solid #000080;
}

.dropdown-divider {
    height: 1px;
    margin: 2px 2px;
    background-color: #dcdcdc;
    border-bottom: 1px solid white;
}

/* Mobile Toggle */
.menu-toggle {
    display: none;
    cursor: pointer;
    font-size: 18px;
    color: white;
    padding: 2px 5px;
    border: 1px solid transparent;
}
.menu-toggle:active {
    border: 1px solid #ffffff;
    background: rgba(0,0,0,0.2);
    border-radius: 3px;
}

/* --- 2. LAYOUT --- */
.container {
    max-width: 1024px;
    margin: 15px auto;
    padding: 0 10px;
}

/* --- 3. RETRO CARDS (COMPACT) --- */
.kpi-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.kpi-card {
    flex: 1;
    min-width: 180px;
    background: white;
    border: 1px solid #7f9db9;
    padding: 3px;
    box-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.kpi-card-inner {
    border: 1px solid #dcdcdc;
    padding: 8px 12px; /* Tighter padding */
    background: linear-gradient(to bottom, #ffffff 0%, #f7f7f7 100%);
    height: 100%;
}

.kpi-label {
    font-size: 10px;
    color: #555;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.kpi-value {
    font-size: 18px; /* Slightly reduced */
    font-family: 'Trebuchet MS', Tahoma, sans-serif;
    font-weight: bold;
    color: #204d88;
}

/* --- 4. ACTION BAR --- */
.action-bar {
    background: #d4d0c8;
    border-top: 1px solid white;
    border-left: 1px solid white;
    border-right: 1px solid #404040;
    border-bottom: 1px solid #404040;
    padding: 6px; /* Compact */
    margin-bottom: 15px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-action {
    background: linear-gradient(to bottom, #fcfcfe 0%, #ece9d8 100%);
    border-top: 1px solid white;
    border-left: 1px solid white;
    border-right: 1px solid #404040;
    border-bottom: 1px solid #404040;
    padding: 4px 12px; /* Compact buttons */
    font-size: 11px;
    font-weight: bold;
    font-family: Tahoma, sans-serif;
    color: black;
    cursor: pointer;
    display: inline-block;
}

.btn-action:hover {
    background: #ffe48d;
    border-color: #e2c044;
}

.btn-action:active {
    border-top: 1px solid #404040;
    border-left: 1px solid #404040;
    border-right: 1px solid white;
    border-bottom: 1px solid white;
    background: #e0dfd3;
    transform: translate(1px, 1px);
}

/* --- 5. DATA TABLES (DENSE) --- */
.table-wrapper {
    background: white;
    border: 1px solid #7f9db9;
    padding: 1px;
    box-shadow: 2px 2px 0px rgba(0,0,0,0.05);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: linear-gradient(to bottom, #ffffff 0%, #e0e0e0 100%);
    border-right: 1px solid #a0a0a0;
    border-bottom: 1px solid #a0a0a0;
    padding: 6px 8px; /* Tighter header */
    color: black;
    font-size: 11px;
    text-align: left;
}

.data-table td {
    border-right: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
    padding: 5px 8px; /* Tighter cells */
    color: black;
    font-size: 12px;
}

.data-table tr:hover { background-color: #ffffdd; }

.text-right { text-align: right; }
.text-green { color: #008000; }
.text-red { color: #cc0000; }
.text-bold { font-weight: bold; }

/* --- 6. FORMS & INPUTS --- */
.login-input, input[type="text"], input[type="number"], input[type="date"], select, textarea {
    border: 1px solid #7f9db9;
    padding: 3px 5px; /* Dense inputs */
    font-family: Tahoma, sans-serif;
    font-size: 12px;
    box-shadow: inset 1px 1px 2px #eee;
}

.login-label {
    font-size: 11px;
    font-weight: bold;
    color: #444;
    margin-bottom: 3px;
    display: block;
}

/* --- 7. LOGIN PAGE --- */
.login-wrapper {
    background-color: #245c9f;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-card {
    width: 100%;
    max-width: 380px;
    background-color: #ece9d8;
    border-top: 2px solid white;
    border-left: 2px solid white;
    border-right: 2px solid #404040;
    border-bottom: 2px solid #404040;
    padding: 3px;
    box-shadow: 5px 5px 15px rgba(0,0,0,0.3);
}

.login-header {
    background: linear-gradient(to right, #0058e6, #3b8cf7);
    padding: 6px 12px;
    color: white;
    font-weight: bold;
    font-family: Tahoma;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
}

.login-body {
    padding: 20px;
    border: 1px solid #d4d0c8;
}

.btn-login {
    float: right;
    padding: 4px 15px;
    font-size: 12px;
    font-weight: bold;
    background: #f0f0f0;
    border: 2px solid;
    border-color: white #808080 #808080 white;
    cursor: pointer;
}

/* --- MOBILE DRAWER --- */
.mobile-drawer {
    position: fixed;
    top: 0; left: -260px;
    width: 260px;
    height: 100vh;
    background: linear-gradient(to right, #7a96df 0%, #abbce8 100%);
    border-right: 2px solid white;
    transition: transform 0.3s ease;
    z-index: 2000;
    padding-top: 50px;
    box-shadow: 2px 0 10px rgba(0,0,0,0.5);
}

.mobile-drawer.open { transform: translateX(260px); }

.drawer-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 1500; display: none;
}
.drawer-overlay.show { display: block; }

.mobile-link {
    display: block;
    padding: 10px 15px; /* Tighter mobile links */
    color: #003399;
    font-weight: bold;
    font-family: Tahoma;
    border-bottom: 1px solid white;
    border-top: 1px solid #607ec7;
    font-size: 13px;
}

@media (max-width: 768px) {
    .nav-menu { display: none; }
    .menu-toggle { display: block; }
    .action-bar { flex-direction: column; align-items: stretch; }
    .btn-action { text-align: center; margin-bottom: 2px; }
    .table-wrapper { overflow-x: auto; }
}

/* --- RETRO SYSTEM MODAL (MsgBox) --- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.1); /* Very subtle dim */
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.xp-window {
    width: 350px;
    background-color: #ece9d8;
    border: 1px solid #000; /* Windows usually had a simple black border for dialogs */
    box-shadow: 4px 4px 10px rgba(0,0,0,0.3);
    font-family: Tahoma, sans-serif;
    display: flex;
    flex-direction: column;
}

.xp-title-bar {
    background: linear-gradient(to right, #0058e6, #3b8cf7);
    padding: 4px 6px;
    color: white;
    font-weight: bold;
    font-size: 11px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: default;
}

.xp-btn-close {
    width: 16px; height: 16px;
    background-color: #da3e33; /* Red X button background (XP style) */
    border: 1px solid white;
    color: white;
    font-size: 10px;
    line-height: 12px;
    text-align: center;
    cursor: pointer;
    font-family: Arial, sans-serif;
    border-radius: 2px;
}

.xp-body {
    padding: 15px;
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.xp-icon {
    width: 32px; height: 32px;
    background: transparent;
    /* We will use text emoji or simple shapes to simulate icons to avoid images */
    font-size: 24px;
}

.xp-message {
    font-size: 11px;
    color: black;
    margin-top: 5px;
    flex: 1;
}

.xp-footer {
    padding: 10px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.xp-btn {
    min-width: 70px;
    padding: 4px 10px;
    font-size: 11px;
    font-family: Tahoma;
    border: 2px solid;
    border-color: white #808080 #808080 white;
    background-color: #f0f0f0;
    cursor: pointer;
}
.xp-btn:active {
    border-color: #808080 white white #808080;
    transform: translate(1px, 1px);
}

/* --- RETRO CHARTS (Excel 2003 Style) --- */
.chart-container {
    background-color: white;
    border: 2px solid #7f9db9; /* Plot Area Border */
    padding: 20px 10px 10px 10px;
    height: 250px;
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    gap: 15px;
    position: relative;
    
    /* Classic Grid Lines Background */
    background-image: linear-gradient(#ccc 1px, transparent 1px);
    background-size: 100% 50px; /* Grid line every 50px approx */
}

/* Vertical Bar */
.retro-bar-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
    flex: 1;
    max-width: 60px;
}

.retro-bar {
    width: 100%;
    transition: height 0.5s ease;
    border: 1px solid #333;
    position: relative;
    
    /* 3D Bevel Effect */
    border-top: 2px solid rgba(255,255,255,0.6);
    border-left: 2px solid rgba(255,255,255,0.4);
    border-right: 2px solid rgba(0,0,0,0.3);
    border-bottom: 2px solid rgba(0,0,0,0.4);
}

.bar-green { background: linear-gradient(to right, #008000, #00b300); }
.bar-red { background: linear-gradient(to right, #cc0000, #ff3333); }
.bar-blue { background: linear-gradient(to right, #000080, #3333ff); }

.bar-label {
    margin-top: 5px;
    font-size: 10px;
    font-family: Tahoma;
    text-align: center;
    color: #444;
}

.bar-value {
    margin-bottom: 2px;
    font-size: 9px;
    font-weight: bold;
    color: #000;
}

/* Horizontal Bar (Category Breakdown) */
.horz-chart-row {
    margin-bottom: 12px;
}
.horz-bar-track {
    background: #f0f0f0;
    border: 1px solid #999;
    height: 18px;
    width: 100%;
    box-shadow: inset 1px 1px 2px #ccc;
}
.horz-bar-fill {
    height: 100%;
    /* 3D Horizontal Bevel */
    border-top: 1px solid rgba(255,255,255,0.7);
    border-bottom: 1px solid rgba(0,0,0,0.4);
    background: linear-gradient(to bottom, #4a6ea8, #204d88);
}

/* --- CALENDAR VIEW --- */
.calendar-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed; /* Ensures equal column width */
}

.cal-head {
    background: linear-gradient(to bottom, #fff 0%, #e0e0e0 100%);
    border: 1px solid #999;
    padding: 5px;
    text-align: center;
    font-size: 11px;
    color: #333;
    width: 14.28%; /* 100% / 7 */
}

.cal-cell {
    border: 1px solid #999;
    height: 100px; /* Tall cells */
    background: white;
    padding: 5px;
    position: relative;
    vertical-align: top;
}

.cal-cell.empty {
    background: #f0f0f0; /* Grey out non-month days */
}

.cal-cell.today {
    background: #ffffcc; /* Classic Yellow highlight */
    border: 2px solid #ffcc00;
}

.day-num {
    font-weight: bold;
    font-family: Tahoma;
    font-size: 14px;
    color: #888;
    margin-bottom: 5px;
    text-align: right;
}

.cal-cell.today .day-num {
    color: #cc0000;
}

.day-data {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cal-tag {
    font-size: 10px;
    padding: 1px 3px;
    border-radius: 2px;
    font-weight: bold;
}
.cal-tag.inc { background: #dff0d8; color: #006600; border: 1px solid #d6e9c6; }
.cal-tag.exp { background: #f2dede; color: #cc0000; border: 1px solid #ebccd1; }

.cal-link {
    display: block;
    margin-top: 5px;
    font-size: 9px;
    text-align: center;
    color: #204d88;
    text-decoration: underline;
}
.cal-link:hover { background: #eee; }

/* Mobile Calendar Adjustment */
@media (max-width: 600px) {
    .cal-cell { height: 60px; }
    .cal-tag { font-size: 9px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
}