:root {
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --bg-sidebar: #0b1120;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --accent: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.08);
    --radius: 14px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/*.brand {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #818cf8, #34d399);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}*/

.tenant-badge {
    display: inline-block;
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.3);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 28px;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    padding: 12px 14px;
    border-radius: 10px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.92rem;
    font-weight: 500;
}

.nav-item.active, .nav-item:hover {
    background: rgba(99, 102, 241, 0.12);
    color: var(--text-main);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 28px 36px;
    overflow-y: auto;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

.user-switcher {
    display: flex;
    align-items: center;
    gap: 12px;
}

select, input {
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.9rem;
    outline: none;
}

select:focus, input:focus {
    border-color: var(--primary);
}

/* Cards Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
}

/* Panel & Table */
.panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    font-size: 0.88rem;
}

.btn:hover { background: var(--primary-hover); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-outline { background: transparent; border: 1px solid var(--border); }

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    text-align: left;
    padding: 14px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: #f87171; }

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 28px;
    border-radius: var(--radius);
    width: 100%;
    max-width: 440px;
}

.form-group {
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 14px 20px;
    border-radius: 10px;
    background: #1e293b;
    border-left: 4px solid var(--primary);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    display: none;
    z-index: 200;
    font-size: 0.9rem;
}

/* Halaman Autentikasi / Login */
.auth-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: radial-gradient(circle at top right, #1e1b4b, var(--bg-main) 60%);
    padding: 20px;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 36px 32px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.auth-header {
    text-align: center;
    margin-bottom: 26px;
}

.auth-subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 6px;
}

.auth-alert {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.85rem;
    margin-bottom: 18px;
}

.btn-full {
    width: 100%;
    padding: 12px;
    margin-top: 8px;
    font-size: 0.95rem;
}

.demo-accounts {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.8rem;
}

.demo-accounts ul {
    list-style: none;
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.demo-accounts li {
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    transition: 0.2s;
}

.demo-accounts li:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

/* Tambahan Modul RBAC & Tab Navigasi */
.rbac-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

.rbac-checkbox {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.role-pill {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
}
/* Modul Keuangan & Kuitansi */
.finance-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-accent {
    background: var(--accent);
    color: #064e3b;
}

.btn-accent:hover {
    background: #059669;
    color: #ffffff;
}

.receipt-box {
    background: #ffffff;
    color: #0f172a;
    padding: 24px;
    border-radius: 12px;
    font-family: 'Courier New', Courier, monospace;
}

.receipt-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px dashed #cbd5e1;
    font-size: 0.88rem;
}

@media print {
    body * { visibility: hidden; }
    #receiptModal, #receiptModal * { visibility: visible; }
    #receiptModal { position: fixed; inset: 0; background: white; }
    .no-print { display: none !important; }
}
/* =========================================================
   LOGO
   ========================================================= */
.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 20px;
    margin-bottom: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-logo-wrapper {
    position: relative;
    flex-shrink: 0;
}

.brand-logo {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 12px;
    border: 2px solid rgba(129, 140, 248, 0.45);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
    display: block;
}

.brand-text-group {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.brand-title {
    font-size: 21px;
    font-weight: 900;
    letter-spacing: 1.2px;
    color: #ffffff;
    text-transform: uppercase;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.brand-accent {
    background: linear-gradient(135deg, #818cf8 0%, #c084fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-tagline {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 2px;
    color: #94a3b8;
    margin-top: 4px;
    text-transform: uppercase;
}

/* =========================================================
   RESPONSIVE MOBILE MENU (HAMBURGER SIDEBAR & MOBILE CARDS)
   ========================================================= */
.mobile-menu-btn {
    display: none;
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 1.25rem;
    cursor: pointer;
    line-height: 1;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(3px);
    z-index: 80;
}

.sidebar-overlay.active {
    display: block;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    body {
        flex-direction: column;
    }

    .mobile-menu-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        height: 100vh;
        width: 265px;
        z-index: 90;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 15px 0 35px rgba(0, 0, 0, 0.6);
    }

    .sidebar.open {
        left: 0;
    }

    .main-content {
        padding: 18px 16px;
        width: 100%;
    }

    .topbar {
        gap: 12px;
        margin-bottom: 20px;
        padding-bottom: 14px;
    }

    .topbar h2 {
        font-size: 1.15rem;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        margin-bottom: 20px;
    }

    .stat-card {
        padding: 16px 14px;
    }

    .stat-value {
        font-size: 1.35rem;
    }

    .panel {
        padding: 16px 14px;
    }

    .panel-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    th, td {
        padding: 10px 8px;
        font-size: 0.82rem;
        white-space: nowrap;
    }

    .modal-box {
        width: 92%;
        padding: 22px 18px;
        max-height: 90vh;
        overflow-y: auto;
    }
}

@media (max-width: 420px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}


/* =========================================================
   PORTAL DEMO CARDS & MODERN ACTION BUTTONS
   ========================================================= */
.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 22px;
    margin-top: 20px;
}

.app-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
    position: relative;
    overflow: hidden;
}

.app-card:hover {
    transform: translateY(-4px);
    border-color: rgba(99, 102, 241, 0.5);
    box-shadow: 0 15px 30px -10px rgba(0, 0, 0, 0.5);
}

.app-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
}

.app-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 6px;
}

.app-desc {
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.55;
    margin-bottom: 18px;
}

.cred-box {
    background: rgba(15, 23, 42, 0.65);
    border: 1px dashed rgba(148, 163, 184, 0.25);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: #cbd5e1;
}

.cred-code {
    font-family: 'Courier New', Courier, monospace;
    color: #a5b4fc;
    word-break: break-all;
}

.btn-copy {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border: none;
    padding: 5px 9px;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: 0.2s;
}

.btn-copy:hover {
    background: var(--primary);
}

.app-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn-launch {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--primary) 0%, #818cf8 100%);
    color: #ffffff;
    text-decoration: none;
    padding: 11px 16px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.btn-launch:hover {
    filter: brightness(1.1);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-launch.disabled {
    background: #334155;
    color: #94a3b8;
    box-shadow: none;
    pointer-events: none;
}

.btn-delete {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.25);
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: 0.2s;
}

.btn-delete:hover {
    background: var(--danger);
    color: #ffffff;
}

.btn-edit {
    background: rgba(99, 102, 241, 0.12);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.25);
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: 0.2s;
}

.btn-edit:hover {
    background: var(--primary);
    color: #ffffff;
}

.btn-share {
    background: rgba(16, 185, 129, 0.12);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.25);
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-share:hover {
    background: var(--accent);
    color: #064e3b;
}


@media (max-width: 480px) {
    .apps-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   APP CARD LOGO / THUMBNAIL
   ========================================================= */
.app-header-info {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
}

.app-thumb {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(15, 23, 42, 0.8);
    flex-shrink: 0;
}

.app-thumb-placeholder {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(16, 185, 129, 0.2));
    border: 1px solid rgba(99, 102, 241, 0.35);
    color: #a5b4fc;
    font-weight: 800;
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.thumb-preview-box {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 6px;
}

.thumb-preview-img {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid var(--border);
    display: none;
}
