/* Import Google Fonts (Inter) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* Global Variables & Themes */
:root, [data-theme="dark"] {
    --bg-primary: #000000; /* True Black */
    --bg-secondary: #050505;
    --bg-glass: rgba(18, 18, 18, 0.7);
    --bg-glass-hover: rgba(28, 28, 28, 0.95);
    --border-glass: rgba(255, 255, 255, 0.08);
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #52525b;
    --color-primary: #6366f1; /* Indigo */
    --color-primary-hover: #4f46e5;
    --color-success: #10b981; /* Emerald */
    --color-success-bg: rgba(16, 185, 129, 0.15);
    --color-danger: #f43f5e; /* Rose */
    --color-danger-bg: rgba(244, 63, 94, 0.15);
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --shadow-premium: 0 15px 35px -10px rgba(0, 0, 0, 0.9);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #f1f5f9;
    --bg-glass: rgba(255, 255, 255, 0.85);
    --bg-glass-hover: rgba(241, 245, 249, 0.95);
    --border-glass: rgba(0, 0, 0, 0.08);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --color-primary: #4f46e5;
    --color-primary-hover: #4338ca;
    --color-success: #059669;
    --color-success-bg: rgba(5, 150, 105, 0.12);
    --color-danger: #e11d48;
    --color-danger-bg: rgba(225, 29, 72, 0.12);
    --shadow-premium: 0 10px 30px -10px rgba(0, 0, 0, 0.06);
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-primary);
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.12) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.08) 0px, transparent 50%),
        radial-gradient(at 50% 0%, rgba(124, 58, 237, 0.1) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Glassmorphism Containers */
.glass-panel {
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    box-shadow: var(--shadow-premium);
    transition: var(--transition-smooth);
}

.glass-panel:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

/* Auth / Login Page Layout */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    padding: 40px;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, #a5b4fc, #6366f1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Typography & Layout elements */
h1, h2, h3, h4 {
    font-weight: 600;
    letter-spacing: -0.025em;
}

/* Inputs & Form Groups */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    transition: var(--transition-smooth);
    outline: none;
}

.form-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
    background: rgba(15, 23, 42, 0.8);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23f3f4f6'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px;
    padding-right: 40px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: var(--transition-smooth);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4f46e5, #4338ca);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid var(--border-glass);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, #f43f5e, #e11d48);
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #e11d48, #be123c);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(244, 63, 94, 0.3);
}

.btn-full {
    width: 100%;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
    border-radius: 6px;
}

/* Alert / Flash Notification styling */
.alert {
    padding: 14px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    animation: alertSlideIn 0.35s ease forwards;
    /* Fixed position so it's always visible on top */
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    min-width: 320px;
    max-width: 600px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.18);
}

@keyframes alertSlideIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-16px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes alertFadeOut {
    from { opacity: 1; transform: translateX(-50%) translateY(0); }
    to   { opacity: 0; transform: translateX(-50%) translateY(-16px); }
}

.alert.dismissing {
    animation: alertFadeOut 0.3s ease forwards;
}

.alert-dismiss-btn {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.6;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0 2px;
    color: inherit;
    transition: opacity 0.2s;
}
.alert-dismiss-btn:hover { opacity: 1; }

/* Dark mode alert colors */
.alert-danger {
    background-color: rgba(220, 38, 38, 0.92);
    border-color: rgba(244, 63, 94, 0.5);
    color: #fff;
}

.alert-success {
    background-color: rgba(5, 150, 105, 0.92);
    border-color: rgba(16, 185, 129, 0.5);
    color: #fff;
}

/* Light mode overrides — ensure full contrast */
[data-theme="light"] .alert-success {
    background-color: #059669;
    border-color: #047857;
    color: #ffffff;
}

[data-theme="light"] .alert-danger {
    background-color: #dc2626;
    border-color: #b91c1c;
    color: #ffffff;
}

/* Dashboard Shell Layout */
.dashboard-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Navbar / Header */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.dashboard-brand h1 {
    font-size: 1.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, #f3f4f6, #9ca3af);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.dashboard-user {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info {
    text-align: right;
}

.user-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.user-role {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Dashboard KPI Card Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.kpi-card {
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.kpi-inflow::before {
    background: var(--color-success);
}

.kpi-outflow::before {
    background: var(--color-danger);
}

.kpi-balance::before {
    background: var(--color-primary);
}

.kpi-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.kpi-value {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 6px;
}

.kpi-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Quick Action Panel & Filters */
.action-filter-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
}

.filter-form {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.filter-form .form-group {
    margin-bottom: 0;
}

.action-buttons {
    display: flex;
    gap: 12px;
}

/* Table Card & Content */
.table-card {
    overflow: hidden;
}

.table-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-header h2 {
    font-size: 1.2rem;
}

.table-wrapper {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.table th {
    padding: 16px 24px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-glass);
    background: rgba(15, 23, 42, 0.3);
}

.table td {
    padding: 16px 24px;
    font-size: 0.95rem;
    border-bottom: 1px solid var(--border-glass);
    vertical-align: middle;
}

.table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Badge styling */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-in {
    background-color: var(--color-success-bg);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-out {
    background-color: var(--color-danger-bg);
    color: #f87171;
    border: 1px solid rgba(244, 63, 94, 0.2);
}

.amount-in {
    color: #34d399;
    font-weight: 600;
}

.amount-out {
    color: #f87171;
    font-weight: 600;
}

[data-theme="light"] .amount-in {
    color: #059669; /* Emerald 600 */
}

[data-theme="light"] .amount-out {
    color: #dc2626; /* Red 600 */
}

/* Modal Overlay & Card */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-card {
    transform: translateY(0);
}

.modal-card form {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}


.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.modal-footer {
    padding: 24px;
    border-top: 1px solid var(--border-glass);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* File upload & preview UI */
.file-upload-wrapper {
    position: relative;
    border: 2px dashed var(--border-glass);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    background: rgba(15, 23, 42, 0.4);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.file-upload-wrapper:hover {
    border-color: var(--color-primary);
    background: rgba(15, 23, 42, 0.6);
}

.file-upload-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-upload-msg {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.preview-container {
    margin-top: 15px;
    display: none;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    max-height: 200px;
    background: rgba(0, 0, 0, 0.4);
}

.preview-img {
    width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: contain;
}

.preview-pdf {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--color-danger);
    font-weight: 500;
}

/* Receipt Display Modal (Large) */
.modal-receipt-large {
    max-width: 800px;
}

.receipt-frame {
    width: 100%;
    min-height: 500px;
    border: none;
    border-radius: 8px;
}

.receipt-image-large {
    width: 100%;
    height: auto;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 8px;
}

/* Empty State */
.empty-state {
    padding: 60px 40px;
    text-align: center;
    color: var(--text-secondary);
}

.empty-state svg {
    margin-bottom: 20px;
    stroke: var(--text-muted);
}

.empty-state h3 {
    margin-bottom: 8px;
    color: var(--text-primary);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .action-filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-form button {
        width: 100%;
    }
    
    .dashboard-header {
        flex-direction: column;
        gap: 20px;
        align-items: flex-start;
    }
    
    .user-info {
        text-align: left;
    }
}

/* Print styles for PDF generation */
@media print {
    body {
        background: #ffffff !important;
        color: #000000 !important;
    }
    
    .dashboard-container {
        padding: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
    }
    
    .dashboard-header,
    .action-filter-bar,
    .modal-overlay,
    form,
    button,
    .btn,
    .sidebar-drawer,
    .sidebar-backdrop,
    .no-print,
    th:nth-child(8), /* Hide receipt column th */
    td:nth-child(8)  /* Hide receipt column td */ {
        display: none !important;
    }
    
    .glass-panel {
        background: none !important;
        backdrop-filter: none !important;
        border: none !important;
        box-shadow: none !important;
    }
    
    .kpi-card {
        border: 1px solid #ccc !important;
        padding: 15px !important;
        border-radius: 8px !important;
        margin-bottom: 20px !important;
        page-break-inside: avoid;
    }
    
    .kpi-value {
        font-size: 1.8rem !important;
    }
    
    .table-card {
        margin-top: 20px !important;
    }
    
    .table-header h2 {
        color: #000000 !important;
        font-size: 1.4rem !important;
    }
    
    .table {
        width: 100% !important;
        border-collapse: collapse !important;
    }
    
    .table th {
        background: #f3f4f6 !important;
        color: #000000 !important;
        border-bottom: 2px solid #000000 !important;
        font-size: 0.75rem !important;
        padding: 10px !important;
    }
    
    .table td {
        border-bottom: 1px solid #e5e7eb !important;
        color: #000000 !important;
        font-size: 0.85rem !important;
        padding: 10px !important;
    }

    .badge {
        border: 1px solid #000 !important;
        color: #000 !important;
        background: none !important;
    }
    
    .amount-in, .amount-out {
        color: #000000 !important;
    }
}

/* Light mode background adjustment */
[data-theme="light"] body {
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.04) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.02) 0px, transparent 50%);
}

/* Theme Toggle Button Styling */
.theme-toggle-btn {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
    outline: none;
}
.theme-toggle-btn:hover {
    background: var(--bg-glass-hover);
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.2);
}
[data-theme="light"] .theme-toggle-btn:hover {
    border-color: rgba(0, 0, 0, 0.15);
}

/* Table Row Action Buttons (Edit/Delete) */
.btn-action {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    color: var(--text-secondary);
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    outline: none;
}
.btn-action:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}
[data-theme="light"] .btn-action:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}
.btn-action-edit:hover {
    color: #60a5fa !important; /* Light blue for edit */
}
.btn-action-delete:hover {
    color: var(--color-danger) !important; /* Red/Rose for delete */
}

/* Form inputs styling for Light Mode select/options */
[data-theme="light"] select.form-input option {
    background-color: #ffffff;
    color: #0f172a;
}
[data-theme="light"] .form-input {
    background-color: rgba(255, 255, 255, 0.9);
    color: #0f172a;
    border: 1px solid rgba(0, 0, 0, 0.15);
}
[data-theme="light"] .form-input:focus {
    background-color: #ffffff;
    border-color: var(--color-primary);
}
[data-theme="light"] .file-upload-wrapper {
    background-color: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.1);
}
[data-theme="light"] .file-upload-wrapper:hover {
    background-color: rgba(0, 0, 0, 0.04);
}
[data-theme="light"] .preview-container {
    background-color: rgba(0, 0, 0, 0.05);
}
[data-theme="light"] .modal-body {
    background-color: #ffffff;
}
[data-theme="light"] .modal-header,
[data-theme="light"] .modal-footer {
    background-color: #f8fafc;
}

/* ================================================
   FLOATING SIDEBAR OVERLAY SYSTEM
   ================================================ */

/* Full-width main content area */
.dashboard-container {
    padding: 30px;
    max-width: 1600px;
    margin: 0 auto;
}

.dashboard-fullwidth {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ── Backdrop ── */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 300;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-backdrop.active {
    opacity: 1;
    pointer-events: all;
}

/* ── Floating MENU Pill Button ── */
.menu-pill-btn {
    position: fixed;
    top: 24px;
    left: 24px;
    z-index: 400;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px 10px 14px;
    border-radius: 50px;
    border: 1.5px solid var(--border-glass);
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35), 0 1px 0 rgba(255,255,255,0.06) inset;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.menu-pill-btn:hover {
    background: var(--bg-glass-hover);
    border-color: var(--color-primary);
    box-shadow: 0 6px 30px rgba(99,102,241,0.35);
    transform: translateY(-1px);
}

.menu-pill-btn:active {
    transform: translateY(0px);
}

.menu-pill-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
    transition: transform 0.3s ease;
}

.menu-pill-btn.open .menu-pill-icon {
    transform: rotate(90deg);
}

.menu-pill-text {
    line-height: 1;
}

.menu-pill-plus {
    font-size: 1.1rem;
    line-height: 1;
    font-weight: 300;
    color: var(--text-secondary);
    transition: transform 0.3s ease, color 0.2s;
}

.menu-pill-btn.open .menu-pill-plus {
    transform: rotate(45deg);
    color: var(--color-danger);
}

/* ── Floating Sidebar Drawer ── */
.sidebar-drawer {
    position: fixed;
    top: 20px;
    left: 20px;
    bottom: 20px;
    width: 300px;
    height: auto;
    z-index: 350;
    display: flex;
    flex-direction: column;
    /* Extra top padding so content clears the pill button (which is at top:24px) */
    padding: 72px 28px 28px;
    border-radius: 24px;
    overflow-y: auto;
    transform: translateX(calc(-100% - 24px)) scale(0.95);
    opacity: 0;
    transition:
        transform 0.42s cubic-bezier(0.34, 1.56, 0.64, 1),
        opacity   0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        0 20px 60px rgba(0,0,0,0.45),
        0 4px  20px rgba(0,0,0,0.3),
        0 0   0 1px rgba(255,255,255,0.06) inset;
}

.sidebar-drawer.open {
    transform: translateX(0) scale(1);
    opacity: 1;
}

/* ── Close Button inside Drawer ── */
.sidebar-close-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 16px 7px 12px;
    border-radius: 50px;
    border: 1.5px solid var(--border-glass);
    background: var(--bg-glass);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    align-self: flex-start;
    margin-bottom: 32px;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.sidebar-close-btn:hover {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.5);
    color: #f87171;
    transform: scale(1.03);
}

/* ── Brand & Profile inside Drawer ── */
.sidebar-brand-drawer {
    font-size: 1.35rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-glass);
}

.sidebar-profile-drawer {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-glass);
}

.profile-avatar-drawer {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-success));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.profile-name-drawer {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.role-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.role-badge-owner {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.role-badge-staff {
    background: rgba(16, 185, 129, 0.15);
    color: #a7f3d0;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Light mode: make badges use dark, readable text */
[data-theme="light"] .role-badge-owner {
    background: rgba(99, 102, 241, 0.12);
    color: #4338ca;
    border: 1px solid rgba(99, 102, 241, 0.35);
}

[data-theme="light"] .role-badge-staff {
    background: rgba(5, 150, 105, 0.12);
    color: #047857;
    border: 1px solid rgba(5, 150, 105, 0.35);
}

/* ── Navigation Items ── */
.sidebar-nav-drawer {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-grow: 1;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 10px;
    border-radius: 10px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 1.15rem;       /* Larger text like Brethren */
    letter-spacing: 0.02em;
    cursor: pointer;
    border: 1px solid transparent;
    user-select: none;
    position: relative;
    z-index: 1;               /* Establish z-index stack */

    /* Staggered fade+slide-up animation (hidden by default) */
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

/* When drawer is open: staggered slide-up per item */
.sidebar-drawer.open .sidebar-nav-item { opacity: 1; transform: translateY(0); }

/* Hover: separate pseudo-element background so transform doesn't break */
.sidebar-nav-item::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 10px;
    background: var(--bg-glass-hover);
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: -1;              /* Force background behind the text/icon */
}


.sidebar-nav-item:hover::before { opacity: 1; }
.sidebar-nav-item:hover { color: var(--text-primary); }

.sidebar-nav-item.active {
    background: var(--color-success-bg);
    color: var(--color-success);
    border-color: rgba(16, 185, 129, 0.2);
    font-weight: 700;
}

/* Light mode: stronger active contrast */
[data-theme="light"] .sidebar-nav-item.active {
    background: rgba(5, 150, 105, 0.15);
    color: #047857;
    border-color: rgba(5, 150, 105, 0.35);
    font-weight: 700;
}

[data-theme="light"] .sidebar-nav-item.active svg {
    stroke: #047857;
}

.sidebar-nav-item.active::before { opacity: 0; }


/* ── Logout Button inside Drawer ── */
.sidebar-logout-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid var(--border-glass);
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.sidebar-logout-btn:hover {
    background: var(--color-danger-bg);
    border-color: var(--color-danger);
    color: var(--color-danger);
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .menu-pill-btn {
        top: 16px;
        left: 16px;
        padding: 8px 14px 8px 10px;
        font-size: 0.72rem;
    }
    .sidebar-drawer {
        width: 280px;
    }
    .dashboard-container {
        padding: 20px 16px;
    }
}

/* ── Monospaced Transaction Number Helper ── */
.tx-number {
    font-family: monospace;
    font-weight: 600;
    color: var(--text-secondary) !important;
    white-space: nowrap;
    font-size: 0.88rem;
    letter-spacing: -0.01em;
}

/* ── Chrome-Style Sub-Tab Bar (Transaksi / Settlement / Cash Advance) ── */
.chrome-tab-container {
    margin-bottom: 24px;
}

.sub-tab-bar {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    padding: 0 12px;
    border-bottom: 1px solid var(--border-glass);
    background: rgba(0, 0, 0, 0.15);
    border-radius: 8px 8px 0 0;
    height: 48px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

[data-theme="light"] .sub-tab-bar {
    background: rgba(0, 0, 0, 0.03);
}

.sub-tab-item {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    height: 38px;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    transition: all 0.15s ease;
    outline: none;
    white-space: nowrap;
}

.sub-tab-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .sub-tab-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

.sub-tab-item.active {
    color: var(--color-primary);
    background: var(--bg-glass);
    font-weight: 600;
    border: 1px solid var(--border-glass);
    border-bottom: 1px solid var(--bg-primary); /* Overrides the tab bar's border-bottom */
    margin-bottom: -1px; /* Blends tab into the content card below */
    box-shadow: 0 -3px 10px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .sub-tab-item.active {
    background: var(--bg-glass);
    border-bottom: 1px solid #f8fafc; /* Matches light theme bg-primary */
}

.sub-tab-icon {
    flex-shrink: 0;
    width: 16px !important;
    height: 16px !important;
    opacity: 0.7;
    transition: opacity 0.15s ease;
}

.sub-tab-item.active .sub-tab-icon {
    opacity: 1;
    color: var(--color-primary);
}

.sub-tab-panel {
    display: none;
}

.sub-tab-panel.active {
    display: block;
}

@media (max-width: 768px) {
    .sub-tab-bar {
        padding: 0 6px;
        height: 42px;
    }
    .sub-tab-item {
        padding: 6px 12px;
        height: 32px;
        font-size: 0.8rem;
    }
    .sub-tab-icon {
        width: 14px !important;
        height: 14px !important;
    }
}

/* ── General Ledger (Buku Besar) Styles ── */
.ledger-print-header {
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 16px;
    margin-bottom: 24px;
}

@media print {
    .ledger-print-header {
        border-bottom: 2px solid #000000 !important;
        color: #000000 !important;
    }
    .ledger-print-header * {
        color: #000000 !important;
    }
    .table td, .table th {
        color: #000000 !important;
        border-color: #e5e7eb !important;
    }
}
