:root {
--primary-color: #2563eb;
--secondary-color: #475569;
--success-color: #10b981;
--danger-color: #ef4444;
--warning-color: #f59e0b;
--background-color: #f8fafc;
--card-bg: #ffffff;
--text-dark: #1e293b;
--text-muted: #64748b;
--border-color: #e2e8f0;
}

{
box-sizing: border-box;
margin: 0;
padding: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
background-color: var(--background-color);
color: var(--text-dark);
line-height: 1.6;
-webkit-font-smoothing: antialiased;
}

.container {
max-width: 1000px;
margin: 0 auto;
padding: 0 15px;
}

/* --- Typography & Utilities --- */
h2, h3 { color: var(--text-dark); }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary-color); }
.text-success { color: var(--success-color); }
.text-danger { color: var(--danger-color); }
.text-warning { color: var(--warning-color); }

/* --- Navbar (Desktop Default) --- */
.navbar {
background-color: var(--card-bg);
box-shadow: 0 2px 10px rgba(0,0,0,0.05);
position: sticky;
top: 0;
z-index: 100;
margin-bottom: 30px;
}

.nav-content {
display: flex;
justify-content: space-between;
align-items: center;
height: 70px;
}

.logo {
color: var(--primary-color);
font-weight: 700;
font-size: 1.5rem;
}

.nav-links {
display: flex;
align-items: center;
gap: 15px;
}

.nav-links a {
text-decoration: none;
color: var(--secondary-color);
font-weight: 500;
font-size: 0.95rem;
transition: color 0.2s, background-color 0.2s;
padding: 8px 12px;
border-radius: 12px; /* Tahap 2: Lebih membulat */
display: flex;
align-items: center;
gap: 6px;
}

.nav-links a i {
font-size: 1.1rem;
}

.nav-links a:hover {
background-color: var(--background-color);
color: var(--primary-color);
}

.nav-links a.active {
color: var(--primary-color);
background-color: #eff6ff;
}

/* --- Layouts & Cards --- */
.grid {
display: grid;
gap: 20px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.card {
background: var(--card-bg);
border-radius: 16px; /* Tahap 2: Lebih empuk /
padding: 24px;
box-shadow: 0 4px 20px rgba(0,0,0,0.03); / Tahap 2: Shadow super lembut */
border: 1px solid rgba(0,0,0,0.02);
margin-bottom: 24px;
}

.stat-card { text-align: center; }
.stat-card h3 { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 10px; font-weight: 600;}
.stat-value { font-size: 2.2rem; font-weight: 700; }

/* --- Buttons --- /
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 0 16px;
height: 48px; / Tahap 2: Tap target minimal 48px /
border-radius: 12px; / Tahap 2: Sudut membulat modern */
border: none;
cursor: pointer;
font-weight: 600;
font-size: 0.95rem;
transition: all 0.2s ease;
gap: 8px;
}

.btn-sm {
height: 36px;
padding: 0 12px;
font-size: 0.85rem;
border-radius: 8px;
}

.btn-primary { background-color: var(--primary-color); color: white; }
.btn-primary:hover { background-color: #1d4ed8; transform: translateY(-1px); }

.btn-secondary { background-color: #f1f5f9; color: var(--text-dark); }
.btn-secondary:hover { background-color: #e2e8f0; }

.btn-danger { background-color: var(--danger-color); color: white; }
.btn-danger:hover { background-color: #dc2626; }

.btn-success { background-color: var(--success-color); color: white; }
.btn-success:hover { background-color: #059669; }

/* --- Forms --- */
.form-group { margin-bottom: 16px; }

.form-group label {
display: block;
margin-bottom: 8px;
font-weight: 500;
font-size: 0.9rem;
color: var(--text-dark);
}

.form-control {
width: 100%;
min-height: 48px; /* Tahap 2: Tap target minimal 48px /
padding: 10px 16px;
border: 1px solid var(--border-color);
border-radius: 12px; / Tahap 2: Lebih membulat /
font-size: 1rem; / Tahap 2: Cegah auto-zoom di iOS */
color: var(--text-dark);
background-color: var(--background-color);
transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
outline: none;
border-color: var(--primary-color);
box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
background-color: white;
}

textarea.form-control {
min-height: 100px;
padding-top: 12px;
resize: vertical;
}

.filter-bar {
display: grid;
grid-template-columns: 2fr 1fr 1fr 1fr;
gap: 12px;
}

/* --- Tables (Desktop Default) --- */
.table-responsive {
overflow-x: auto;
-webkit-overflow-scrolling: touch;
border: 1px solid var(--border-color);
border-radius: 12px;
}

.table {
width: 100%;
border-collapse: collapse;
min-width: 600px;
}

.table th, .table td {
padding: 16px;
text-align: left;
border-bottom: 1px solid var(--border-color);
font-size: 0.95rem;
}

.table th {
background-color: #f8fafc;
font-weight: 600;
color: var(--secondary-color);
white-space: nowrap;
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background-color: #f8fafc; }

/* --- Badges & Alerts --- */
.badge {
display: inline-block;
padding: 4px 10px;
border-radius: 20px;
font-size: 0.75rem;
font-weight: 600;
letter-spacing: 0.3px;
}

.alert {
padding: 16px;
border-radius: 12px;
margin-bottom: 20px;
font-size: 0.95rem;
font-weight: 500;
}

.alert-danger { background-color: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background-color: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-warning { background-color: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.alert-primary { background-color: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* --- Custom Confirm Dialog (Popup) --- */
.custom-confirm-overlay {
position: fixed;
top: 0; left: 0; width: 100%; height: 100%;
background: rgba(15, 23, 42, 0.6);
backdrop-filter: blur(4px);
display: flex;
align-items: center;
justify-content: center;
z-index: 99999;
animation: fadeIn 0.2s ease-out forwards;
padding: 20px;
}

.custom-confirm-modal {
background: white;
width: 100%;
max-width: 400px;
border-radius: 20px;
padding: 24px;
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
transform: scale(0.95);
animation: scaleUp 0.2s ease-out forwards;
}

.custom-confirm-title { font-size: 1.25rem; font-weight: 700; color: var(--text-dark); margin-bottom: 12px; }
.custom-confirm-message { font-size: 0.95rem; color: var(--text-muted); margin-bottom: 24px; line-height: 1.5; }
.custom-confirm-actions { display: flex; gap: 12px; justify-content: flex-end; }
.custom-confirm-actions .btn { flex: 1; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleUp { from { transform: scale(0.95); } to { transform: scale(1); } }

/* ========================================================= /
/ RESPONSIVE MOBILE & APP-LIKE UI (Tahap 1, 2, & 3)         /
/ ========================================================= */
@media screen and (max-width: 768px) {

body {
    padding-bottom: 80px; /* Ruang untuk Bottom Nav agar konten tidak tertutup */
}

.navbar { margin-bottom: 15px; }

.nav-content {
    flex-direction: row;
    justify-content: center;
    height: 60px;
    padding: 0;
}

.logo { font-size: 1.4rem; }

/* TAHAP 1: Transformasi menjadi Bottom Navigation Bar */
.nav-links {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 65px;
    background-color: var(--card-bg);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.08); /* Tahap 2: Soft shadow */
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    padding: 0 5px;
    z-index: 9999;
    flex-wrap: nowrap;
    border-top: none; /* Hilangkan garis kasar */
    gap: 0;
}

.nav-links a {
    flex-direction: column;
    gap: 4px;
    font-size: 0.7rem;
    padding: 6px 0;
    width: 25%;
    background-color: transparent !important;
    border-radius: 0;
}

.nav-links a i { font-size: 1.25rem; margin-right: 0; transition: transform 0.2s; }
.nav-links a.active { background-color: transparent; }
.nav-links a.active i { transform: scale(1.15); color: var(--primary-color); }
.nav-links #logoutBtn { display: none; }

/* TAHAP 2: Penyesuaian Layout & Tombol di HP */
.grid-2, .grid-4 { grid-template-columns: 1fr; }
.filter-bar { grid-template-columns: 1fr; }

#btnTambahPelanggan, #btnAddUser {
    width: 100%;
    margin-bottom: 15px;
}

.custom-confirm-actions {
    flex-direction: column-reverse; /* Tumpuk tombol popup di HP (Batal di bawah) */
}

/* TAHAP 3: Transformasi Tabel Menjadi Mobile Card List */
.table-responsive {
    border: none !important;
    background: transparent !important;
    padding: 0;
    overflow-x: hidden;
    border-radius: 0;
}

.table, .table tbody, .table tr, .table td {
    display: block;
    width: 100%;
}

.table thead {
    display: none; /* Hilangkan header kolom kaku di HP */
}

.table tr {
    background-color: var(--card-bg);
    margin-bottom: 16px; /* Jarak antar kartu */
    border-radius: 16px; /* Sudut membulat ala App */
    box-shadow: 0 4px 15px rgba(0,0,0,0.03); /* Bayangan melayang lembut */
    border: 1px solid rgba(0,0,0,0.02);
    padding: 16px;
}

.table td {
    display: flex;
    justify-content: space-between; /* Judul di kiri, Nilai di kanan */
    align-items: center;
    padding: 12px 0; /* Padding lebih lega */
    border-bottom: 1px dashed var(--border-color); /* Garis pemisah antar info di dalam kartu */
    text-align: right;
    font-size: 0.95rem;
}

.table td:last-child {
    border-bottom: none;
    padding-bottom: 0;
    padding-top: 15px;
    justify-content: center; /* Tombol aksi kumpul di tengah bawah kartu */
    gap: 8px;
    flex-wrap: wrap; /* Jika tombol terlalu banyak, turun ke bawah */
}

/* Memanggil Atribut 'data-label' dari JS sebagai judul di dalam kartu */
.table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--secondary-color);
    font-size: 0.85rem;
    text-transform: uppercase;
    text-align: left;
    margin-right: 15px;
    flex-shrink: 0;
}

/* Pengecualian untuk state Loading / Tabel Kosong */
.table td[colspan] {
    justify-content: center;
    text-align: center;
    font-style: italic;
    color: var(--text-muted);
    border-bottom: none;
}

.table td[colspan]::before {
    display: none;
}


}