/* ==========================================================================
   DESIGN SYSTEM - KOPERASI KEUANGAN & PINJAMAN APP
   ========================================================================== */

:root {
    /* Color Palette */
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    --border-color: #334155;
    --border-highlight: #475569;
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --emerald-500: #10b981;
    --emerald-600: #059669;
    --emerald-bg: rgba(16, 185, 129, 0.15);
    
    --teal-500: #14b8a6;
    --teal-bg: rgba(20, 184, 166, 0.15);
    
    --blue-500: #3b82f6;
    --blue-bg: rgba(59, 130, 246, 0.15);
    
    --amber-500: #f59e0b;
    --amber-bg: rgba(245, 158, 11, 0.15);
    
    --rose-500: #f43f5e;
    --rose-bg: rgba(244, 63, 94, 0.15);

    --purple-500: #8b5cf6;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --shadow-soft: 0 10px 30px -5px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(16, 185, 129, 0.2);

    --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

/* LOGIN SCREEN STYLING */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at 50% 30%, #1e293b, #0f172a 70%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 1.5rem;
}

.login-card {
    background: rgba(30, 41, 59, 0.85);
    border: 1px solid var(--border-highlight);
    backdrop-filter: blur(16px);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 440px;
    padding: 2.2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
    animation: fadeIn 0.4s ease;
}

.login-brand {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-brand-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--emerald-500), var(--teal-500));
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: #fff;
    box-shadow: var(--shadow-glow);
    margin-bottom: 0.8rem;
}

.login-brand h2 {
    font-size: 1.4rem;
    font-weight: 800;
    color: #fff;
}

.login-brand p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.demo-login-box {
    background: rgba(15, 23, 42, 0.6);
    border: 1px dashed var(--border-highlight);
    border-radius: var(--radius-md);
    padding: 0.8rem;
    margin-bottom: 1.5rem;
}

.demo-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--emerald-500);
    margin-bottom: 0.5rem;
}

.demo-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.chip {
    flex: 1 1 110px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.45rem 0.6rem;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    transition: all 0.2s ease;
}

.chip:hover {
    border-color: var(--emerald-500);
    background: var(--bg-card-hover);
}

.chip-master { color: var(--amber-500); }
.chip-admin { color: var(--emerald-500); }
.chip-anggota { color: var(--blue-500); }

.input-with-icon {
    position: relative;
}

.input-with-icon i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.input-with-icon .form-control {
    padding-left: 2.6rem;
}

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* App Container Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

.app-container.hidden {
    display: none !important;
}

/* Sidebar Styling */
.sidebar {
    width: 280px;
    background-color: #0b1120;
    border-right: 1px solid var(--border-color);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    top: 0;
    left: 0;
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.brand-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--emerald-500), var(--teal-500));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: #fff;
    box-shadow: var(--shadow-glow);
}

.brand-text h2 {
    font-size: 1.1rem;
    font-weight: 800;
    color: #fff;
}

.brand-text span {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: block;
}

/* User Profile Card */
.user-profile-card {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid var(--border-highlight);
    border-radius: var(--radius-md);
    padding: 0.8rem 0.9rem;
    margin: 1.2rem 0;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.user-avatar {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--blue-500), var(--purple-500));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.1rem;
}

.user-info {
    flex: 1;
    overflow: hidden;
}

.user-info h4 {
    font-size: 0.85rem;
    font-weight: 700;
    color: #fff;
    word-break: break-word;
    line-height: 1.25;
}

.user-info .badge {
    font-size: 0.68rem;
    padding: 0.1rem 0.45rem;
    margin-top: 0.2rem;
}

.btn-logout {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: var(--radius-sm);
}

.btn-logout:hover {
    color: var(--rose-500);
    background: var(--bg-card);
}

/* Navigation Menu */
.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 0.3rem;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    text-align: left;
    position: relative;
}

.nav-item:hover {
    background-color: var(--bg-card);
    color: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(90deg, var(--emerald-bg), rgba(20, 184, 166, 0.05));
    border-left: 3px solid var(--emerald-500);
    color: var(--emerald-500);
}

.nav-item.disabled {
    opacity: 0.4;
    cursor: not-allowed !important;
}

.nav-item i {
    font-size: 1.1rem;
    width: 22px;
}

.nav-badge {
    margin-left: auto;
    background: var(--border-color);
    color: var(--text-primary);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
}

.nav-badge.alert { background: var(--rose-500); color: #fff; }
.nav-badge.secondary { background: var(--blue-500); color: #fff; }

.sidebar-footer {
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* Main Content */
.main-content {
    margin-left: 280px;
    flex: 1;
    padding: 2rem;
    width: calc(100% - 280px);
}

/* Header Top */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.header-title h1 {
    font-size: 1.6rem;
    font-weight: 800;
    color: #fff;
}

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

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.date-chip {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 0.5rem 0.9rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Welcome Banner */
.welcome-banner {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(20, 184, 166, 0.04));
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: var(--radius-lg);
    padding: 1.5rem 1.8rem;
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    box-shadow: var(--shadow-soft);
    position: relative;
    overflow: hidden;
}

.welcome-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, rgba(20, 184, 166, 0.12) 0%, transparent 65%);
    border-radius: 50%;
    pointer-events: none;
}

.welcome-text h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff;
    margin: 0.4rem 0 0.2rem 0;
}

.welcome-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--emerald-500);
    background: rgba(16, 185, 129, 0.12);
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.text-gradient {
    background: linear-gradient(135deg, #ffffff, var(--teal-500));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-text p {
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.welcome-action {
    flex-shrink: 0;
}

.login-session-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    padding: 0.5rem 0.9rem;
    border-radius: var(--radius-md);
}

.login-session-tag strong {
    color: var(--emerald-500);
    font-weight: 700;
}

/* Tab Panels */
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fadeIn 0.3s ease; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Stat Cards Grid - HIGHLY SYMMETRIC & PRECISE GRID SYSTEM */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.1rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.55rem;
    box-shadow: var(--shadow-soft);
    transition: transform 0.2s ease, border-color 0.2s ease;
    min-height: 110px;
    overflow: hidden;
    width: 100%;
}

.stat-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-highlight);
}

.stat-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.accent-blue .stat-icon    { background: var(--blue-bg);    color: var(--blue-500); }
.accent-emerald .stat-icon { background: var(--emerald-bg); color: var(--emerald-500); }
.accent-teal .stat-icon    { background: var(--teal-bg);    color: var(--teal-500); }
.accent-rose .stat-icon    { background: var(--rose-bg);    color: var(--rose-500); }
.accent-amber .stat-icon   { background: var(--amber-bg);   color: var(--amber-500); }

.stat-details {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-width: 0;
    width: 100%;
}

.stat-label {
    font-size: 0.72rem;
    color: var(--text-secondary);
    font-weight: 600;
    white-space: normal;
    line-height: 1.3;
    margin-bottom: 0.1rem;
    word-break: break-word;
}

.stat-value {
    font-size: clamp(0.9rem, 1.4vw, 1.15rem);
    font-weight: 800;
    color: #fff;
    margin: 0.05rem 0;
    white-space: normal;
    word-break: break-word;
    line-height: 1.25;
    width: 100%;
}

.stat-subtext {
    font-size: 0.68rem;
    color: var(--text-muted);
    white-space: normal;
    word-break: break-word;
    line-height: 1.3;
    margin-top: 0.05rem;
}

.text-emerald { color: var(--emerald-500) !important; }
.text-rose { color: var(--rose-500) !important; }
.text-amber { color: var(--amber-500) !important; }
.text-blue { color: var(--blue-500) !important; }

/* Dashboard Charts Grid */
.dashboard-charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

/* Card Component */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

.card-header {
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.card-body { padding: 1.5rem; }
.p-0 { padding: 0 !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }

/* Toolbar & Filters */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-filter-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 280px;
}

.search-box {
    position: relative;
    flex: 1;
    max-width: 380px;
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-box input {
    width: 100%;
    padding: 0.65rem 1rem 0.65rem 2.6rem;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.88rem;
}

.search-box input:focus {
    outline: none;
    border-color: var(--emerald-500);
}

/* Select Control */
.select-control {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    padding: 0.65rem 1rem;
    font-family: inherit;
    font-size: 0.88rem;
    cursor: pointer;
}

.select-control:focus {
    outline: none;
    border-color: var(--emerald-500);
}

/* Form Controls */
.form-control {
    width: 100%;
    padding: 0.65rem 0.9rem;
    background-color: #0f172a;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.88rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--emerald-500);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.form-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.form-label.required::after {
    content: " *";
    color: var(--rose-500);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1rem;
}

.col-12 { grid-column: span 12; }
.col-6 { grid-column: span 6; }
.col-4 { grid-column: span 4; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.2rem;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn-lg {
    padding: 0.85rem 1.5rem;
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--emerald-500), var(--teal-500));
    color: #fff;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.btn-primary:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

.btn-success { background: var(--teal-500); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-primary); }
.btn-outline:hover { background-color: var(--border-color); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background-color: var(--bg-card); color: var(--text-primary); }
.btn-danger { background-color: var(--rose-500); color: #fff; }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.78rem; }
.btn-block { width: 100%; justify-content: center; }
.text-danger { color: var(--rose-500) !important; }

/* Tables */
.table-responsive { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.88rem; }

.table th {
    background-color: #111827;
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1rem 1.2rem;
    border-bottom: 1px solid var(--border-color);
}

.table td {
    padding: 1rem 1.2rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}

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

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-warning { background: var(--amber-bg); color: var(--amber-500); border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-info { background: var(--blue-bg); color: var(--blue-500); border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-success { background: var(--emerald-bg); color: var(--emerald-500); border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-danger { background: var(--rose-bg); color: var(--rose-500); border: 1px solid rgba(244, 63, 94, 0.3); }
.badge-purple { background: rgba(139, 92, 246, 0.15); color: var(--purple-500); border: 1px solid rgba(139, 92, 246, 0.3); }
.badge-secondary { background: var(--bg-card-hover); color: var(--text-secondary); }

/* Calculator Preview Box */
.calculator-preview-box {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(20, 184, 166, 0.03));
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius-md);
    padding: 1.2rem;
}

.calc-header h4 { font-size: 0.9rem; color: var(--emerald-500); margin-bottom: 0.8rem; }
.calc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.calc-item { display: flex; flex-direction: column; }
.calc-item span { font-size: 0.78rem; color: var(--text-secondary); }
.calc-item strong { font-size: 1rem; color: #fff; margin-top: 0.2rem; }
.calc-item.total strong { font-size: 1.15rem; }

/* Approval Header Card & Subtabs */
.approval-header-card {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border: 1px solid var(--border-highlight);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.approval-info h2 { font-size: 1.3rem; color: #fff; }
.approval-info p { font-size: 0.85rem; color: var(--text-secondary); }

.role-notice {
    background-color: var(--bg-card);
    border: 1px dashed var(--emerald-500);
    padding: 0.6rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    color: var(--emerald-500);
}

.tab-subnav {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.subnav-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.6rem 1.2rem;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.subnav-btn:hover { color: #fff; }
.subnav-btn.active { background-color: var(--bg-card); color: var(--emerald-500); border: 1px solid var(--border-color); }
.subpane { display: none; }
.subpane.active { display: block; animation: fadeIn 0.2s ease; }

/* Nasabah Cards Grid */
.nasabah-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.2rem;
}

.nasabah-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.3rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    position: relative;
}

.nasabah-avatar {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--blue-500), var(--purple-500));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    font-size: 1.1rem;
}

.nasabah-meta h4 { font-size: 1rem; color: #fff; }
.nasabah-meta p { font-size: 0.78rem; color: var(--text-muted); }

.nasabah-details-list {
    font-size: 0.82rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    border-top: 1px solid var(--border-color);
    padding-top: 0.8rem;
}

/* Modals */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-backdrop.active { display: flex; animation: fadeIn 0.2s ease; }

.modal-dialog {
    background-color: var(--bg-card);
    border: 1px solid var(--border-highlight);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal-dialog.modal-lg { max-width: 720px; }

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

.modal-header h3 { font-size: 1.1rem; font-weight: 700; color: #fff; display: flex; align-items: center; gap: 0.5rem; }
.modal-close { background: transparent; border: none; color: var(--text-muted); font-size: 1.5rem; cursor: pointer; }
.modal-close:hover { color: #fff; }
.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; gap: 0.8rem; }

.audit-action-card { background-color: #0f172a; border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 1.2rem; }
.audit-buttons { display: flex; gap: 0.8rem; }

.info-card {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: var(--radius-sm);
    padding: 0.8rem;
    font-size: 0.85rem;
}

.hidden { display: none !important; }

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.toast {
    background-color: var(--bg-card);
    border: 1px solid var(--border-highlight);
    border-left: 4px solid var(--emerald-500);
    color: #fff;
    padding: 0.9rem 1.2rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    animation: slideInRight 0.3s ease;
}

.toast.error { border-left-color: var(--rose-500); }
.toast.warning { border-left-color: var(--amber-500); }

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Responsive Media Queries */

/* --- Tablet Landscape (≤ 1280px) --- */
@media (max-width: 1280px) {
    .stats-grid { grid-template-columns: repeat(3, 1fr); }
    .dashboard-charts-grid { grid-template-columns: 1fr; }
    .welcome-banner { flex-direction: column; align-items: flex-start; gap: 1rem; }
}

/* --- Tablet Portrait (≤ 1024px) --- */
@media (max-width: 1024px) {
    .sidebar { width: 72px; padding: 1rem 0.5rem; overflow: visible; }
    .brand-text, .user-info, .sidebar-footer, .nav-item span, .nav-badge { display: none !important; }
    .brand { justify-content: center; gap: 0; border: none; }
    .brand-icon { width: 38px; height: 38px; font-size: 1.1rem; }
    .user-profile-card { justify-content: center; padding: 0.5rem; gap: 0; }
    .nav-item { justify-content: center; padding: 0.7rem 0; gap: 0; border-radius: var(--radius-sm); }
    .nav-item i { font-size: 1.2rem; width: auto; }
    .nav-item.active { border-left: none; border-bottom: 2px solid var(--emerald-500); }
    .main-content { margin-left: 72px; width: calc(100% - 72px); padding: 1.2rem; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
    .header-title h1 { font-size: 1.3rem; }
    .top-header { flex-direction: column; align-items: flex-start; gap: 0.75rem; margin-bottom: 1.2rem; }
    .header-actions { width: 100%; flex-wrap: wrap; gap: 0.5rem; }
    .table th, .table td { padding: 0.6rem 0.7rem; font-size: 0.82rem; }
}

/* --- Handphone (≤ 768px) — Sidebar jadi Bottom Navigation --- */
@media (max-width: 768px) {
    .sidebar {
        width: 100% !important;
        height: auto !important;
        min-height: unset !important;
        position: fixed !important;
        bottom: 2rem !important;
        top: auto !important;
        left: 0 !important;
        right: 0 !important;
        flex-direction: row !important;
        padding: 0 !important;
        border-right: none !important;
        border-top: 1px solid var(--border-color) !important;
        z-index: 500 !important;
        background: rgba(11, 17, 32, 0.97) !important;
        backdrop-filter: blur(16px);
        overflow-x: auto;
        overflow-y: hidden;
        justify-content: space-around;
    }
    .sidebar .brand,
    .sidebar .user-profile-card,
    .sidebar .sidebar-footer { display: none !important; }
    .sidebar .nav-menu {
        flex-direction: row !important;
        flex: 1;
        gap: 0 !important;
        margin: 0 !important;
        justify-content: space-around;
        padding: 0;
    }
    .nav-item {
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0.45rem 0.3rem !important;
        gap: 0.15rem !important;
        min-width: 52px;
        border-radius: 0 !important;
        border-left: none !important;
        border-bottom: none !important;
        color: var(--text-muted) !important;
        flex: 1;
    }
    .nav-item span { display: block !important; font-size: 0.6rem !important; }
    .nav-item i { font-size: 1.05rem !important; width: auto !important; }
    .nav-badge { display: none !important; }
    .nav-item.active {
        color: var(--emerald-500) !important;
        background: rgba(16,185,129,0.08) !important;
        border-top: 2px solid var(--emerald-500) !important;
        border-bottom: none !important;
        border-left: none !important;
    }
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 1rem 0.9rem 9rem !important;
    }
    .top-header { flex-direction: column; align-items: flex-start; gap: 0.6rem; margin-bottom: 1rem; }
    .header-title h1 { font-size: 1.15rem; }
    .header-title p { font-size: 0.78rem; }
    .header-actions { width: 100%; flex-wrap: wrap; gap: 0.4rem; }
    .date-chip { font-size: 0.78rem; padding: 0.35rem 0.6rem; }
    .welcome-banner { padding: 1.1rem; flex-direction: column; gap: 0.8rem; }
    .welcome-text h2 { font-size: 1.1rem; }
    .welcome-text p { font-size: 0.8rem; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 0.7rem; }
    .stat-card { padding: 0.9rem 0.85rem; min-height: 100px; }
    .stat-label { font-size: 0.7rem; }
    .stat-value { font-size: clamp(0.85rem, 3.5vw, 1.05rem); }
    .dashboard-charts-grid { grid-template-columns: 1fr; gap: 1rem; }
    .card { padding: 1rem; margin-bottom: 0.8rem; border-radius: var(--radius-md); }
    .btn { font-size: 0.78rem; padding: 0.45rem 0.75rem; }
    .btn-sm { font-size: 0.72rem; padding: 0.3rem 0.5rem; }
    .form-control, .select-control { font-size: 0.85rem; padding: 0.55rem 0.8rem; }
    .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .table { min-width: 540px; font-size: 0.78rem; }
    .table th { font-size: 0.72rem; padding: 0.5rem 0.6rem; }
    .table td { padding: 0.5rem 0.6rem; }
    .modal-dialog { width: 95vw !important; max-width: 95vw !important; margin: 1rem auto; max-height: 90vh; overflow-y: auto; }
    .modal-header { padding: 1rem; }
    .modal-body { padding: 1rem; }
    .modal-footer { padding: 0.75rem 1rem; flex-wrap: wrap; gap: 0.5rem; }
    .subnav { flex-wrap: wrap; gap: 0.3rem; }
    .subnav-btn { font-size: 0.75rem; padding: 0.4rem 0.7rem; }
    .login-card { padding: 1.5rem 1.2rem; }
    #appFooter { bottom: 2.6rem !important; font-size: 0.64rem !important; padding: 0.3rem 0.5rem !important; gap: 0.35rem !important; }
}

/* --- Handphone Kecil (≤ 420px) --- */
@media (max-width: 420px) {
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 0.6rem; }
    .stat-value { font-size: clamp(0.82rem, 3.8vw, 1rem); }
    .header-title h1 { font-size: 1rem; }
    .main-content { padding: 0.75rem 0.65rem 9rem !important; }
    .nav-item { min-width: 44px; }
    .nav-item span { font-size: 0.55rem !important; }
    .modal-dialog { width: 98vw !important; }
    .btn { font-size: 0.72rem; padding: 0.4rem 0.6rem; }
    .welcome-text h2 { font-size: 0.95rem; }
    .badge { font-size: 0.65rem; }
}

/* --- PC / Desktop besar (≥ 1440px) --- */
@media (min-width: 1440px) {
    .main-content { padding: 2.5rem 3rem; }
    .stats-grid { grid-template-columns: repeat(5, 1fr); }
    .dashboard-charts-grid { grid-template-columns: 2fr 1fr; }
    .header-title h1 { font-size: 1.8rem; }
}
