:root {
    --primary-color: #10b981;
    --primary-hover: #059669;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --sidebar-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --success: #10b981;
    --error: #f43f5e;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);
}

html.dark-mode {
    --bg-color: #090d16;
    --card-bg: #111827;
    --sidebar-bg: #0d131f;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #1e293b;
    --shadow: 0 4px 12px -1px rgb(0 0 0 / 0.35);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    transition: background-color 0.3s, color 0.3s;
}

/* ==========================================================================
   Modern App Shell & Sidebar Layout
   ========================================================================== */
.app-layout-body {
    min-height: 100vh;
    overflow-x: hidden;
}

.app-shell {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Left Sidebar */
.app-sidebar {
    width: 270px;
    min-width: 270px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 50;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Sidebar Brand */
.sidebar-brand {
    padding: 1.5rem 1.5rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-brand-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    text-decoration: none;
}

.sidebar-logo-img {
    width: 42px;
    height: 42px;
    border-radius: 0.75rem;
    object-fit: cover;
    border: 2px solid rgba(16, 185, 129, 0.4);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title-text {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.brand-sub-badge {
    font-size: 0.65rem;
    font-weight: 800;
    color: #10b981;
    letter-spacing: 0.08em;
    margin-top: 0.1rem;
}

/* Sidebar Nav Scroll Container */
.sidebar-nav-container {
    flex: 1;
    padding: 1.5rem 1rem;
    overflow-y: auto;
}

.sidebar-nav-container::-webkit-scrollbar {
    width: 4px;
}
.sidebar-nav-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.nav-section-label {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    margin-bottom: 0.5rem;
    padding: 0 0.75rem;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 0.95rem;
    border-radius: 0.85rem;
    color: var(--text-muted);
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-nav-item .nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: inherit;
    transition: transform 0.2s;
}

.sidebar-nav-item:hover {
    background: var(--bg-color);
    color: var(--text-main);
    transform: translateX(4px);
}

.sidebar-nav-item:hover .nav-icon {
    transform: scale(1.1);
}

.sidebar-nav-item.active {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(5, 150, 105, 0.18) 100%);
    color: #059669;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.12);
}

html.dark-mode .sidebar-nav-item.active {
    background: rgba(16, 185, 129, 0.18);
    color: #34d399;
}

.text-emerald { color: #10b981 !important; }
.text-rose { color: #f43f5e !important; }

/* Sidebar Dropdown Accordion */
.sidebar-dropdown-group {
    list-style: none;
    position: relative;
}

.sidebar-dropdown-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 0.95rem;
    border-radius: 0.85rem;
    color: var(--text-muted);
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    text-align: left;
}

.sidebar-dropdown-btn:hover {
    background: var(--bg-color);
    color: var(--text-main);
    transform: translateX(4px);
}

.sidebar-dropdown-btn:hover .nav-icon {
    transform: scale(1.1);
}

.sidebar-dropdown-group.active > .sidebar-dropdown-btn {
    color: #059669;
    font-weight: 700;
}

html.dark-mode .sidebar-dropdown-group.active > .sidebar-dropdown-btn {
    color: #34d399;
}

.dropdown-chevron {
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-dropdown-group.open > .sidebar-dropdown-btn .dropdown-chevron {
    transform: rotate(180deg);
}

.sidebar-submenu {
    list-style: none;
    margin: 0;
    padding: 0 0 0 1.5rem;
    max-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    position: relative;
    transition: max-height 0.3s cubic-bezier(0.16, 1, 0.3, 1), padding 0.25s ease;
}

.sidebar-dropdown-group.open .sidebar-submenu {
    max-height: 250px;
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
}

.sidebar-sub-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.85rem;
    border-radius: 0.7rem;
    color: var(--text-muted);
    font-size: 0.86rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.sidebar-sub-link .sub-link-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    opacity: 0.4;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.sidebar-sub-link:hover {
    background: var(--bg-color);
    color: var(--text-main);
    transform: translateX(3px);
}

.sidebar-sub-link:hover .sub-link-dot {
    background: #059669;
    opacity: 1;
    transform: scale(1.3);
}

.sidebar-sub-link.active {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(5, 150, 105, 0.18) 100%);
    color: #059669;
    font-weight: 700;
}

.sidebar-sub-link.active .sub-link-dot {
    background: #059669;
    opacity: 1;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

html.dark-mode .sidebar-sub-link.active {
    background: rgba(16, 185, 129, 0.18);
    color: #34d399;
}

html.dark-mode .sidebar-sub-link.active .sub-link-dot {
    background: #34d399;
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.6);
}

/* Sidebar Footer Profile Area */
.sidebar-footer-card {
    padding: 1.15rem 1.25rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    background: var(--sidebar-bg);
}

.sidebar-user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.sidebar-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-color);
    flex-shrink: 0;
}

.sidebar-user-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar-user-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.725rem;
    color: var(--text-muted);
}

.sidebar-logout-btn {
    background: none;
    border: none;
    padding: 0.5rem;
    border-radius: 0.5rem;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.sidebar-logout-btn:hover {
    background: rgba(244, 63, 94, 0.15);
    color: #f43f5e;
    transform: scale(1.1);
}

/* Right Main Area */
.app-main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg-color);
}

/* Top App Bar */
.app-topbar {
    height: 68px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2.5rem;
    position: sticky;
    top: 0;
    z-index: 40;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.mobile-toggle-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    padding: 0.4rem;
}

.topbar-live-time {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 0.4rem 0.85rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 2rem;
}

.status-pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #10b981;
    box-shadow: 0 0 8px #10b981;
    animation: pulse 2s infinite;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.theme-mode-btn {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-main);
    transition: all 0.2s ease;
}

.theme-mode-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: scale(1.05);
}

.topbar-user-badge {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.35rem 0.85rem 0.35rem 0.4rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 2rem;
    text-decoration: none;
    color: var(--text-main);
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.topbar-user-badge:hover {
    border-color: var(--primary-color);
}

.topbar-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid var(--primary-color);
}

/* App Main Content Body */
.app-content-body {
    flex: 1;
    padding: 1.25rem 1.75rem 2.5rem;
    overflow-y: auto;
}

.full-width-view {
    width: 100%;
    max-width: 100%;
}


/* Mobile Responsiveness */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 45;
}

@media (max-width: 900px) {
    .app-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        transform: translateX(-100%);
        z-index: 50;
        box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
    }

    .app-sidebar.open {
        transform: translateX(0);
    }

    .sidebar-backdrop.open {
        display: block;
    }

    .mobile-toggle-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .app-topbar {
        padding: 0 1.25rem;
    }

    .app-content-body {
        padding: 1.5rem 1rem 3rem;
    }
}


nav a {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 500;
    margin-left: 1.5rem;
    transition: color 0.2s;
}

nav a:hover {
    color: var(--primary-color);
}

.nav-btn {
    background: none;
    border: none;
    color: var(--text-main);
    font-weight: 500;
    margin-left: 1.5rem;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
}

.nav-btn:hover {
    color: var(--primary-color);
}

/* Buttons */
.btn-primary {
    background-color: var(--primary-color);
    color: #fff !important;
    padding: 0.5rem 1.25rem;
    border-radius: 0.5rem;
    transition: background-color 0.2s;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-block {
    display: block;
    width: 100%;
    text-align: center;
    border: none;
    cursor: pointer;
}

/* Full-Page Modern Background Themes & Luxury Login */
.login-page-bg {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 160px);
    padding: 2.5rem 1rem;
    overflow: hidden;
    border-radius: 1.5rem;
    margin: 0 auto 2.5rem;
    transition: background 0.5s ease;
}

/* Background Color Presets */
.login-page-bg.bg-emerald {
    background: radial-gradient(circle at 50% 15%, #0d4a38 0%, #062b20 45%, #051a14 100%);
}

.login-page-bg.bg-midnight {
    background: radial-gradient(circle at 50% 15%, #1e3a8a 0%, #0f172a 50%, #020617 100%);
}

.login-page-bg.bg-sunset {
    background: radial-gradient(circle at 50% 15%, #78350f 0%, #291809 50%, #0c0a09 100%);
}

.login-page-bg.bg-obsidian {
    background: radial-gradient(circle at 50% 15%, #334155 0%, #0f172a 50%, #030712 100%);
}

/* Glowing Background Light Orbs */
.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    pointer-events: none;
    z-index: 0;
    opacity: 0.55;
    animation: orbFloat 14s infinite alternate ease-in-out;
}

.orb-emerald {
    width: 380px;
    height: 380px;
    background: #10b981;
    top: 5%;
    left: 8%;
    animation-delay: 0s;
}

.orb-teal {
    width: 420px;
    height: 420px;
    background: #06b6d4;
    bottom: 5%;
    right: 8%;
    animation-delay: -5s;
}

.orb-amber {
    width: 280px;
    height: 280px;
    background: #f59e0b;
    top: 35%;
    right: 30%;
    opacity: 0.25;
    animation-delay: -9s;
}

@keyframes orbFloat {
    0% { transform: translate(0px, 0px) scale(1); }
    50% { transform: translate(35px, -30px) scale(1.1); }
    100% { transform: translate(-30px, 40px) scale(0.92); }
}

/* Centered Luxury Glassmorphism Card */
.luxury-login-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    padding: 2.5rem 2.25rem;
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
    animation: luxuryCardPop 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    color: #f8fafc;
}

@keyframes luxuryCardPop {
    from { opacity: 0; transform: scale(0.96) translateY(12px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Palette Switcher Bar */
.theme-palette-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.65rem;
    margin-bottom: 1.25rem;
}

.palette-label {
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 500;
}

.palette-options {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.palette-btn {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.palette-btn:hover {
    transform: scale(1.2);
}

.palette-btn.active {
    border-color: #ffffff;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.7);
    transform: scale(1.15);
}

/* Brand Header */
.card-brand-header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.logo-glow-ring {
    display: inline-flex;
    padding: 4px;
    border-radius: 1rem;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.4), rgba(6, 182, 212, 0.4));
    box-shadow: 0 0 24px rgba(16, 185, 129, 0.35);
    margin-bottom: 0.85rem;
    transition: transform 0.3s ease;
}

.logo-glow-ring:hover {
    transform: scale(1.05) rotate(2deg);
}

.brand-logo-card {
    width: 56px;
    height: 56px;
    border-radius: 0.75rem;
    object-fit: cover;
    display: block;
}

.brand-title {
    font-size: 1.65rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #ffffff;
    margin-bottom: 0.25rem;
    background: linear-gradient(135deg, #ffffff 0%, #6ee7b7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-tagline {
    font-size: 0.85rem;
    color: #94a3b8;
}

/* Alert Box */
.luxury-alert-box {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.75rem 1rem;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.35);
    border-radius: 0.75rem;
    color: #fca5a5;
    font-size: 0.85rem;
    margin-bottom: 1.35rem;
}

/* Form Fields */
.luxury-input-field {
    margin-bottom: 1.25rem;
}

.luxury-input-field label {
    display: block;
    font-size: 0.825rem;
    font-weight: 600;
    color: #cbd5e1;
    margin-bottom: 0.45rem;
}

.field-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.input-glow-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.field-icon {
    position: absolute;
    left: 0.95rem;
    color: #64748b;
    display: flex;
    align-items: center;
    pointer-events: none;
    transition: color 0.2s ease;
}

.input-glow-wrapper input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.85rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    border-radius: 0.75rem;
    font-size: 0.925rem;
    font-family: inherit;
    color: #ffffff;
    transition: all 0.25s ease;
}

.input-glow-wrapper input:focus {
    outline: none;
    border-color: #10b981;
    background: rgba(15, 23, 42, 0.85);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
}

.input-glow-wrapper:focus-within .field-icon {
    color: #10b981;
}

.field-eye-btn {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 0.35rem;
    display: flex;
    align-items: center;
    border-radius: 0.35rem;
    transition: color 0.2s ease;
}

.field-eye-btn:hover {
    color: #f1f5f9;
}

/* Checkbox & Meta */
.luxury-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 1.15rem 0 1.5rem;
}

.modern-check-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.825rem;
    color: #94a3b8;
    cursor: pointer;
    user-select: none;
}

.modern-check-label input {
    cursor: pointer;
    accent-color: #10b981;
    width: 16px;
    height: 16px;
}

/* Submit Button */
.luxury-btn-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.85rem 1.5rem;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 700;
    border: none;
    border-radius: 0.85rem;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.luxury-btn-submit:hover {
    background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.55);
    transform: translateY(-2px);
}

.luxury-btn-submit:active {
    transform: translateY(0);
}

/* Footer & Status */
.luxury-card-footer {
    margin-top: 1.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.status-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.76rem;
    color: #64748b;
}

.live-pulse {
    width: 7px;
    height: 7px;
    background-color: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
    animation: statusPulse 2s infinite;
}

@keyframes statusPulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}


/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.alert-success {
    background-color: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error,
.alert-danger {
    background-color: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Profile */
.profile-section {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 1rem;
    border: 1px solid var(--border-color);
}

.profile-img {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--primary-color);
}

.profile-content {
    flex: 1;
}

/* Footer */
.footer {
    margin-top: 4rem;
    padding: 2rem 0;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-muted);
}

/* ==========================================================================
   Modern SaaS Dashboard Styles
   ========================================================================== */
.dashboard-wrapper {
    max-width: 1200px;
    margin: 0 auto 3rem;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Welcome Header */
.dash-welcome-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.date-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.85rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 2rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.65rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.welcome-text h1 {
    font-size: 1.85rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-main);
    line-height: 1.2;
}

.gradient-name {
    background: linear-gradient(135deg, #10b981 0%, #2563eb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.dash-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 0.35rem;
}

.dash-quick-btns {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.btn-dash-action {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.15rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.btn-dash-action:hover {
    transform: translateY(-2px);
}

.btn-income {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff !important;
}

.btn-income:hover {
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.35);
}

.btn-expense {
    background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
    color: #ffffff !important;
}

.btn-expense:hover {
    box-shadow: 0 6px 16px rgba(244, 63, 94, 0.35);
}

.btn-report {
    background: var(--card-bg);
    color: var(--text-main) !important;
    border: 1px solid var(--border-color);
}

.btn-report:hover {
    background: var(--bg-color);
    border-color: var(--primary-color);
}

/* 4 KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.kpi-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 1.25rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px -6px rgba(0, 0, 0, 0.1);
}

.kpi-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.kpi-icon-box {
    width: 44px;
    height: 44px;
    border-radius: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-emerald { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.icon-rose { background: rgba(244, 63, 94, 0.15); color: #f43f5e; }
.icon-blue { background: rgba(37, 99, 235, 0.15); color: #2563eb; }
.icon-purple { background: rgba(147, 51, 234, 0.15); color: #9333ea; }

.kpi-tag {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.65rem;
    border-radius: 2rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tag-green { background: rgba(16, 185, 129, 0.12); color: #059669; }
.tag-rose { background: rgba(244, 63, 94, 0.12); color: #e11d48; }
.tag-blue { background: rgba(37, 99, 235, 0.12); color: #2563eb; }
.tag-purple { background: rgba(147, 51, 234, 0.12); color: #9333ea; }

.kpi-amount {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-main);
    margin-bottom: 0.35rem;
}

.kpi-amount.text-negative {
    color: #f43f5e;
}

.amount-unit {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-muted);
}

.kpi-footer {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.kpi-link {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.2s;
}

.kpi-link:hover {
    text-decoration: underline;
}

/* Main Dashboard Analytics Grid */
.dash-main-grid {
    display: grid;
    grid-template-columns: 1.8fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.dash-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 1.25rem;
    padding: 1.75rem;
    box-shadow: var(--shadow);
}

.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.card-title-sm {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 1.25rem;
}

.card-sub {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.chart-legend-custom {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.825rem;
    font-weight: 600;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-muted);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dot-green { background-color: #10b981; }
.dot-red { background-color: #f43f5e; }

.chart-canvas-wrapper {
    height: 300px;
    position: relative;
}

/* Side Column Widgets */
.dash-side-col {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.ratio-card {
    flex: 1;
}

.flow-progress-box {
    margin-bottom: 1.25rem;
}

.flow-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.flow-bar-container {
    height: 10px;
    background: var(--bg-color);
    border-radius: 1rem;
    overflow: hidden;
    display: flex;
    gap: 2px;
}

.flow-bar-fill.fill-income { background: #10b981; }
.flow-bar-fill.fill-expense { background: #f43f5e; }

.quick-stat-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.q-stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid var(--border-color);
}

.q-stat-label { color: var(--text-muted); font-weight: 500; }
.q-stat-val { font-weight: 700; }
.text-green { color: #10b981; }
.text-rose { color: #f43f5e; }

.btn-manage-cats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1rem;
    border-radius: 0.75rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-manage-cats:hover {
    background: var(--border-color);
    color: var(--primary-color);
}

/* Profile Mini Card */
.profile-mini-header {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 1rem;
}

.profile-mini-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-color);
}

.profile-mini-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-main);
}

.profile-mini-email {
    font-size: 0.775rem;
    color: var(--text-muted);
}

.btn-profile-edit {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.85rem;
    background: var(--bg-color);
    border-radius: 0.65rem;
    color: var(--text-main);
    font-size: 0.825rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-profile-edit:hover {
    color: var(--primary-color);
    padding-right: 0.65rem;
}

/* Modern Recent Transactions Table */
.recent-tx-card {
    margin-top: 2rem;
}

.btn-view-all {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--primary-color);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: gap 0.2s ease;
}

.btn-view-all:hover {
    gap: 0.75rem;
    text-decoration: underline;
}

.modern-table-responsive {
    overflow-x: auto;
}

.dash-modern-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.dash-modern-table th {
    padding: 0.85rem 1rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

.dash-modern-table td {
    padding: 1rem;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
}

.dash-modern-table tbody tr {
    transition: background-color 0.15s ease;
}

.dash-modern-table tbody tr:hover {
    background-color: rgba(37, 99, 235, 0.03);
}

html.dark-mode .dash-modern-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

.tx-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    border-radius: 2rem;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-inc { background: rgba(16, 185, 129, 0.15); color: #059669; }
.badge-exp { background: rgba(244, 63, 94, 0.15); color: #e11d48; }

.tx-title-text { font-weight: 600; color: var(--text-main); }
.tx-date-text { color: var(--text-muted); font-size: 0.85rem; }
.tx-details-text { color: var(--text-muted); font-size: 0.825rem; }

.tx-amount-val {
    font-weight: 700;
    font-size: 0.95rem;
}

.amount-plus { color: #10b981; }
.amount-minus { color: #f43f5e; }

/* Table Action Buttons */
.dash-action-group {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    justify-content: center;
}

.btn-row-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    background: #ffffff;
    color: #64748b;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    position: relative;
}

.btn-row-action svg {
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-row-action:hover {
    transform: translateY(-2px);
}

.btn-row-action:active {
    transform: translateY(0) scale(0.94);
}

.btn-row-action.action-edit {
    background: rgba(239, 246, 255, 0.6);
    border-color: rgba(191, 219, 254, 0.8);
    color: #2563eb;
}

.btn-row-action.action-edit:hover {
    color: #1d4ed8;
    background: #eff6ff;
    border-color: #3b82f6;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.18);
}

.btn-row-action.action-edit:hover svg {
    transform: rotate(-8deg) scale(1.1);
}

.btn-row-action.action-delete {
    background: rgba(254, 242, 242, 0.6);
    border-color: rgba(254, 202, 202, 0.8);
    color: #ef4444;
}

.btn-row-action.action-delete:hover {
    color: #dc2626;
    background: #fef2f2;
    border-color: #ef4444;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.18);
}

.btn-row-action.action-delete:hover svg {
    transform: scale(1.12);
}

/* Dark Mode Action Buttons */
html.dark-mode .btn-row-action {
    background: rgba(30, 41, 59, 0.8);
    border-color: rgba(255, 255, 255, 0.08);
}

html.dark-mode .btn-row-action.action-edit {
    background: rgba(30, 58, 138, 0.25);
    border-color: rgba(59, 130, 246, 0.3);
    color: #60a5fa;
}

html.dark-mode .btn-row-action.action-edit:hover {
    color: #93c5fd;
    background: rgba(37, 99, 235, 0.35);
    border-color: rgba(96, 165, 250, 0.6);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

html.dark-mode .btn-row-action.action-delete {
    background: rgba(136, 19, 55, 0.25);
    border-color: rgba(244, 63, 94, 0.3);
    color: #f87171;
}

html.dark-mode .btn-row-action.action-delete:hover {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.35);
    border-color: rgba(248, 113, 113, 0.6);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
}

.empty-state-dash {
    text-align: center;
    padding: 3rem 1rem;
}

.empty-icon-circle {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.empty-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-main);
}

.empty-sub {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.empty-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* ==========================================================================
   Finance & Ledger Module Styles
   ========================================================================== */
.form-page-container {
    max-width: 600px;
    margin: 2rem auto 4rem;
    animation: fadeIn 0.4s ease-out;
}

.form-luxury-card {
    padding: 2.25rem 2rem;
}

.form-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.form-title-icon {
    width: 52px;
    height: 52px;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.form-header-sub {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.modern-finance-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-row-dual {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.modern-field {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.modern-field label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
}

.modern-input-group {
    display: flex !important;
    align-items: stretch !important;
    width: 100% !important;
    height: 38px !important;
    background: var(--card-bg) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 0.5rem !important;
    overflow: hidden !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
    position: relative !important;
}

.modern-input-group:focus-within {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2) !important;
}

.modern-input-group .group-icon {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 0.75rem !important;
    background: var(--bg-surface-soft, rgba(0, 0, 0, 0.04)) !important;
    border-right: 1px solid var(--border-color) !important;
    color: var(--text-muted) !important;
    font-weight: 700 !important;
    font-size: 0.8rem !important;
    flex-shrink: 0 !important;
    position: static !important;
    height: 100% !important;
    user-select: none;
}

.modern-input-group input,
.modern-input-group input.compact-input {
    flex: 1 1 auto !important;
    width: 100% !important;
    height: 100% !important;
    min-height: unset !important;
    padding: 0 0.75rem !important;
    border: none !important;
    background: transparent !important;
    color: var(--text-main) !important;
    font-size: 0.85rem !important;
    outline: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

.modern-field select,
.modern-field input[type="text"],
.modern-field input[type="date"],
.modern-field textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    color: var(--text-main);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.modern-field select:focus,
.modern-field input[type="text"]:focus,
.modern-field input[type="date"]:focus,
.modern-field textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
}

.field-error-text {
    color: #f43f5e;
    font-size: 0.8rem;
    font-weight: 500;
}

.field-help-text {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.form-btn-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

.badge-qty {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.tx-unit-text {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.tx-balance-val {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 0.95rem;
}

/* Modern Pagination Bar */
.modern-pagination-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color);
}

.page-nav-btn {
    padding: 0.45rem 0.95rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 0.6rem;
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.page-nav-btn:hover:not(.disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.page-nav-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-indicator {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.page-indicator strong {
    color: var(--text-main);
}

/* Manage Categories & Sources */
.cat-list-wrapper {
    margin-bottom: 1.5rem;
}

.cat-styled-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    min-height: 80px;
    align-content: flex-start;
}

.cat-name-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.85rem;
    border-radius: 2rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.chip-green {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.chip-rose {
    background: rgba(244, 63, 94, 0.12);
    color: #e11d48;
    border: 1px solid rgba(244, 63, 94, 0.25);
}

.empty-cat-note {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-style: italic;
    padding: 1rem 0;
}

.add-cat-form {
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color);
}

/* Financial Filter & Statement */
/* Financial Filter & Statement */
.filter-flex-form {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.filter-date-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-input-date {
    padding: 0.5rem 0.75rem;
    background: var(--bg-color, #f8fafc);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 0.825rem;
    outline: none;
    width: 100%;
}

.filter-chip-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-color, #f1f5f9);
    border: 1px solid var(--border-color, #e2e8f0);
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.filter-chip-btn:hover {
    color: var(--text-main);
    border-color: #cbd5e1;
    background: #e2e8f0;
    transform: translateY(-1px);
}

.filter-chip-btn.active {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.active-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    background: rgba(37, 99, 235, 0.08);
    border: 1px solid rgba(37, 99, 235, 0.2);
    color: #2563eb;
    font-size: 0.75rem;
}

html.dark-mode .filter-chip-btn {
    background: rgba(30, 41, 59, 0.7);
    border-color: rgba(255, 255, 255, 0.1);
    color: #94a3b8;
}

html.dark-mode .filter-chip-btn:hover {
    background: rgba(51, 65, 85, 0.8);
    color: #f1f5f9;
}

html.dark-mode .filter-chip-btn.active {
    background: #3b82f6;
    color: #ffffff;
    border-color: #3b82f6;
}

html.dark-mode .active-pill {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
    color: #93c5fd;
}

.btn-pdf-export {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: #ffffff !important;
}

.btn-pdf-export:hover {
    box-shadow: 0 6px 16px rgba(5, 150, 105, 0.35);
}

/* Category Breakdown List */
.breakdown-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 0.85rem;
    background: var(--bg-color);
    border-radius: 0.65rem;
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
}

.breakdown-label {
    font-weight: 600;
    color: var(--text-main);
}

.breakdown-val {
    font-weight: 700;
}

/* Detailed Category Analytics & Itemized Drilldowns */
.detailed-cat-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cat-detail-card {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 1.15rem 1.25rem;
    transition: all 0.2s ease;
}

.cat-detail-card:hover {
    border-color: rgba(16, 185, 129, 0.4);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.cat-detail-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.cat-detail-name {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
}

.cat-detail-meta {
    display: block;
    font-size: 0.775rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.cat-detail-amount {
    display: block;
    font-size: 1.1rem;
    font-weight: 800;
}

.cat-detail-pct {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 0.1rem;
}

.cat-progress-track {
    height: 7px;
    background: var(--border-color);
    border-radius: 1rem;
    overflow: hidden;
    margin-bottom: 0.85rem;
}

.cat-progress-bar {
    height: 100%;
    border-radius: 1rem;
    transition: width 0.4s ease;
}

.bar-green { background: linear-gradient(90deg, #10b981, #059669); }
.bar-rose { background: linear-gradient(90deg, #f43f5e, #e11d48); }

/* Drilldown Accordion */
.cat-drilldown {
    border-top: 1px dashed var(--border-color);
    padding-top: 0.65rem;
}

.cat-drilldown-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-color);
    cursor: pointer;
    user-select: none;
    list-style: none;
}

.cat-drilldown-summary::-webkit-details-marker {
    display: none;
}

.cat-drilldown-summary:hover {
    text-decoration: underline;
}

.cat-drilldown-body {
    margin-top: 0.75rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.65rem;
    padding: 0.5rem 0.75rem;
    overflow-x: auto;
}

.drilldown-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.drilldown-table th {
    text-align: left;
    padding: 0.4rem 0.5rem;
    color: var(--text-muted);
    font-weight: 700;
    border-bottom: 1px solid var(--border-color);
}

.drilldown-table td {
    padding: 0.45rem 0.5rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
}

.drilldown-table tr:last-child td {
    border-bottom: none;
}

/* Category Full Analytics Page Styles */
.cat-full-card {
    padding: 1.75rem 2rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cat-full-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.cat-full-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
}

.cat-full-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.02em;
    margin-bottom: 0.35rem;
}

.cat-full-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.cat-full-totals {
    text-align: right;
}

.cat-full-amount {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.cat-full-pct {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 0.2rem;
}

/* Compact High-Density View Styles */
.compact-view {
    padding-bottom: 2rem;
}

.compact-header {
    margin-bottom: 1.25rem;
}

.compact-chip {
    padding: 0.2rem 0.65rem;
    font-size: 0.725rem;
    margin-bottom: 0.35rem;
}

.compact-title {
    font-size: 1.35rem;
    margin-bottom: 0.2rem;
}

.compact-sub {
    font-size: 0.825rem;
}

.btn-compact {
    padding: 0.45rem 0.85rem;
    font-size: 0.825rem;
    border-radius: 0.6rem;
    gap: 0.4rem;
}

.compact-card {
    border-radius: 0.85rem;
}

.compact-field label {
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
}

.compact-input {
    padding: 0.45rem 0.75rem;
    font-size: 0.825rem;
    border-radius: 0.5rem;
}

.compact-kpi-grid {
    gap: 1rem;
}

.compact-kpi-card {
    padding: 0.9rem 1.15rem;
    border-radius: 0.85rem;
}

.compact-icon-box {
    width: 34px !important;
    height: 34px !important;
    border-radius: 0.6rem !important;
}

.compact-tag {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
}

.compact-amount {
    font-size: 1.25rem;
}

.compact-card-title {
    font-size: 1.05rem;
}

.compact-table th {
    padding: 0.6rem 0.75rem;
    font-size: 0.75rem;
}

.compact-table td {
    padding: 0.6rem 0.75rem;
    font-size: 0.825rem;
}

.compact-badge {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
}

.compact-qty {
    font-size: 0.75rem;
    padding: 0.15rem 0.45rem;
}

.compact-pagination {
    margin-top: 1rem;
    padding-top: 0.75rem;
}

.compact-cat-card {
    padding: 1.15rem 1.35rem;
    border-radius: 0.85rem;
}

.compact-cat-title {
    font-size: 1.05rem;
    margin-bottom: 0.25rem;
}

.compact-cat-amount {
    font-size: 1.15rem;
}

.compact-cat-pct {
    font-size: 0.725rem;
}

/* ==========================================================================
   Modern Category & Sub-Category Management UI
   ========================================================================== */
.mgmt-select-styled {
    width: 100%;
    padding: 0.5rem 0.85rem;
    font-size: 0.85rem;
    font-family: inherit;
    color: var(--text-main);
    background-color: var(--card-bg);
    border: 1.5px solid var(--border-color);
    border-radius: 0.65rem;
    outline: none;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 14px;
    appearance: none;
    -webkit-appearance: none;
    padding-right: 2rem;
}

.mgmt-select-styled:focus {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

html.dark-mode .mgmt-select-styled {
    background-color: #162032;
    border-color: #27354a;
    color: #f1f5f9;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

.mgmt-tab-container {
    display: flex;
    background: var(--bg-surface-elevated, rgba(255, 255, 255, 0.05));
    padding: 0.25rem;
    border-radius: 0.65rem;
    border: 1px solid var(--border-color);
    gap: 0.25rem;
    margin-bottom: 0.85rem;
}

.mgmt-tab-btn {
    flex: 1;
    padding: 0.45rem 0.75rem;
    font-size: 0.775rem;
    font-weight: 700;
    font-family: inherit;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    background: transparent;
    color: var(--text-muted);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.mgmt-tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.04);
}

.mgmt-tab-btn.active-tab-green {
    background: var(--card-bg);
    color: var(--accent-emerald, #10b981);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.mgmt-tab-btn.active-tab-rose {
    background: var(--card-bg);
    color: var(--accent-rose, #ef4444);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
}

html.dark-mode .mgmt-tab-btn.active-tab-green {
    background: #1b263b;
    border-color: rgba(16, 185, 129, 0.35);
}

html.dark-mode .mgmt-tab-btn.active-tab-rose {
    background: #25161c;
    border-color: rgba(239, 68, 68, 0.35);
}

.hierarchy-card-item {
    background: var(--bg-surface-soft, rgba(255, 255, 255, 0.02));
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 0.85rem 1rem;
    transition: all 0.2s ease;
}

.hierarchy-card-item:hover {
    border-color: rgba(16, 185, 129, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.hierarchy-card-item.item-rose:hover {
    border-color: rgba(239, 68, 68, 0.4);
}

.hierarchy-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.725rem;
    padding: 0.25rem 0.55rem;
    border-radius: 6px;
    font-weight: 600;
    transition: all 0.15s ease;
}

.hierarchy-pill-green {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.hierarchy-pill-green:hover {
    background: rgba(16, 185, 129, 0.2);
}

.hierarchy-pill-rose {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.hierarchy-pill-rose:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn-pill-del {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    transition: opacity 0.15s, transform 0.15s;
}

.btn-pill-del:hover {
    opacity: 1;
    transform: scale(1.2);
}

/* ==========================================================================
   Sub-Category Accounting Summary Table & Section Styles
   ========================================================================== */
.subcat-summary-box {
    background: var(--bg-surface-soft, rgba(0, 0, 0, 0.02));
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 0.85rem;
    margin-bottom: 1rem;
    transition: all 0.2s ease;
}

html.dark-mode .subcat-summary-box {
    background: rgba(255, 255, 255, 0.02);
}

.subcat-summary-box.box-rose {
    border-color: rgba(239, 68, 68, 0.2);
}

.subcat-summary-box.box-green {
    border-color: rgba(16, 185, 129, 0.2);
}

.subcat-summary-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.65rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.subcat-summary-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.subcat-summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.76rem;
}

.subcat-summary-table th {
    padding: 0.45rem 0.6rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    background: transparent;
}

.subcat-summary-table td {
    padding: 0.45rem 0.6rem;
    border-bottom: 1px dashed var(--border-color);
    vertical-align: middle;
    color: var(--text-main);
}

.subcat-summary-table tbody tr:hover {
    background: var(--bg-surface-hover, rgba(0, 0, 0, 0.02));
}

html.dark-mode .subcat-summary-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.subcat-summary-table tfoot td {
    border-top: 2px solid var(--border-color);
    border-bottom: none;
    font-weight: 800;
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
    background: var(--bg-surface-soft, rgba(0, 0, 0, 0.02));
}

html.dark-mode .subcat-summary-table tfoot td {
    background: rgba(255, 255, 255, 0.03);
}

.subcat-pct-cell {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.subcat-mini-track {
    flex: 1;
    min-width: 35px;
    height: 4px;
    background: var(--border-color);
    border-radius: 999px;
    overflow: hidden;
}

.subcat-mini-bar {
    height: 100%;
    border-radius: 999px;
}

.item-log-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.item-log-toggle-btn:hover {
    color: var(--text-main);
    background: var(--bg-surface-soft, rgba(0,0,0,0.04));
}

/* ==========================================================================
   Filter Toolbar & Compact Inputs Component
   ========================================================================== */
.filter-card-container {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.85rem;
}

.filter-inputs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.65rem;
    align-items: flex-end;
}

.compact-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.compact-field label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.compact-input,
.modern-field select.compact-input,
.modern-field input.compact-input {
    width: 100% !important;
    height: 36px !important;
    min-height: 36px !important;
    padding: 0 0.65rem !important;
    font-size: 0.8rem !important;
    line-height: 36px !important;
    background-color: var(--card-bg) !important;
    color: var(--text-main) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 0.5rem !important;
    outline: none !important;
    box-sizing: border-box !important;
    display: block !important;
    appearance: auto !important;
    -webkit-appearance: auto !important;
}

.compact-input:focus,
.modern-field select.compact-input:focus,
.modern-field input.compact-input:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2) !important;
}

.compact-input option {
    background-color: var(--card-bg);
    color: var(--text-main);
    padding: 4px 8px;
}

.filter-chip-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 0.4rem;
    background: var(--bg-surface-soft, rgba(0,0,0,0.04));
    color: var(--text-muted);
    text-decoration: none;
    border: 1px solid var(--border-color);
    transition: all 0.15s ease;
}

.filter-chip-btn:hover {
    color: var(--text-main);
    background: var(--bg-surface-hover, rgba(0,0,0,0.08));
}

.filter-chip-btn.active {
    background: var(--primary-color);
    color: #ffffff;
    border-color: var(--primary-color);
}

.active-pill {
    display: inline-flex;
    align-items: center;
    background: var(--bg-surface-soft, rgba(0,0,0,0.04));
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
    font-size: 0.7rem;
    color: var(--text-main);
}






