:root {
  --primary-color: #007BFF;
  --primary-dark: #FFFFFF;
  --background: #F8F9FA;
  --secondary: #E9ECEF;
  --text-color: #212529;
  --danger: #DC3545;
  --success: #28A745;
  --warning: #FFC107;
  --info: #17A2B8;
  --purple: #6f42c1; /* Warna baru untuk tombol Aksi Cepat */
  --success-light: rgba(40, 167, 69, 0.1);
  --danger-light: rgba(220, 53, 69, 0.1);
}
* { box-sizing: border-box; }
body {
  margin: 0; padding: 0; font-family: 'Roboto', sans-serif;
  background: var(--background); color: var(--text-color);
  font-size: 16px; line-height: 1.5;
}

/* --- HEADER --- */
header {
  background: var(--primary-dark); padding: 15px; display: flex;
  justify-content: space-between; align-items: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1); position: sticky; top: 0; z-index: 100;
}
header .logo-container { display: flex; align-items: center; }
header .logo {
  font-size: 1.2rem; font-weight: bold; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; margin-right: 8px; color: var(--primary-color);
}
.datetime { font-size: 0.8rem; color: #6c757d; }
.logout-btn {
  padding: 5px 10px; background: var(--primary-color); color: white; border: none;
  border-radius: 6px; cursor: pointer; font-weight: bold; font-size: 0.8rem;
  margin-left: 10px; width: auto; height: 30px; display: flex;
  align-items: center; justify-content: center;
}
.user-info { display: flex; align-items: center; }
.user-level {
    font-size: 0.7rem; font-weight: bold; padding: 3px 8px; border-radius: 10px;
    margin-left: 8px; background-color: var(--warning); color: var(--primary-dark);
    text-transform: uppercase;
}
.username {
  margin-right: 10px; font-size: 0.9rem; font-weight: 500; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 150px;
}

/* --- TABS --- */
.tabs {
  display: flex;
  background: var(--primary-dark);
  -webkit-overflow-scrolling: touch;
  border-bottom: 1px solid var(--secondary);
  width: 100%; 
  overflow-x: auto; 
}
.tab {
  padding: 10px 15px; cursor: pointer; font-weight: bold; font-size: 0.9rem;
  flex-grow: 1; 
  text-align: center; color: #6c757d;
  border-bottom: 2px solid transparent; text-transform: uppercase;
  position: relative;
  white-space: nowrap; 
}
.tab.active { color: var(--primary-color); border-bottom: 2px solid var(--primary-color); }

/* --- CONTAINER --- */
.container {
  width: 98%; 
  max-width: none; 
  margin: 15px auto; 
  background: var(--primary-dark);
  padding: 15px; 
  border-radius: 10px; 
  box-shadow: 0 0 15px rgba(0,0,0,0.05);
}

/* --- FORMS --- */
input, button, select, textarea {
  padding: 10px; border-radius: 6px; border: 1px solid #ddd;
  margin: 8px 0; font-size: 1rem; width: 100%; font-family: 'Roboto', sans-serif;
}
textarea { resize: vertical; }
.form-group { margin-bottom: 12px; }
.form-group label { display: block; margin-bottom: 4px; font-size: 0.9rem; color: #6c757d; }
button {
  background: var(--primary-color); color: white; font-weight: bold;
  cursor: pointer; transition: all 0.3s ease; border: none;
}
button:hover { opacity: 0.9; }
button:disabled { background-color: #6c757d; cursor: not-allowed; }
.cancel-edit-btn { background-color: #6c757d; color: white; }

input[readonly] {
    background-color: #e9ecef;
    cursor: not-allowed;
    color: #6c757d;
}

/* --- BUTTONS SPECIAL --- */
.btn-batch-copy {
    background-color: var(--purple);
    color: white;
    border: none;
    font-weight: bold;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: background-color 0.2s, transform 0.1s;
    width: 100%;
}
.btn-batch-copy:hover {
    background-color: #5a32a3; /* Darker purple */
    transform: translateY(-1px);
}
.btn-batch-copy:active {
    transform: translateY(1px);
}
/* Style Saat Tombol Batch Copy Disable (Dipatenkan) */
.btn-batch-copy:disabled {
    background-color: #6c757d; /* Grey */
    cursor: not-allowed;
    opacity: 0.7;
    transform: none;
    box-shadow: none;
}

/* --- TABLES --- */
table {
  width: 100%; margin-top: 15px; border-collapse: collapse; font-size: 0.82rem;
}
th, td {
  border: 1px solid var(--secondary);
  padding: 6px 10px;
  text-align: center;
  word-break: break-word;
  vertical-align: middle;
}
/* Paksa tabel untuk scroll horizontal jika terlalu lebar dan tanggal panjang */
#bankAccountListContainer table th, 
#bankAccountListContainer table td,
#ewalletAccountListContainer table th,
#ewalletAccountListContainer table td,
#simcardTab table th, 
#simcardTab table td { 
    white-space: nowrap;
}

.text-left { text-align: left !important; }
th { background: var(--secondary); font-weight: 700; }
tr:hover { background-color: #f1f1f1; }

.hidden { display: none !important; }

/* --- STATUS BADGES --- */
.status {
  display: inline-block; padding: 4px 10px; border-radius: 12px;
  font-size: 0.75rem; font-weight: bold; white-space: nowrap; color: white;
}
.status-menunggu, .status-inactive, .status-block { background: var(--warning); }
.status-dibayar, .status-active, .status-aktif, .status-checked { background: var(--success); }
.status-ditolak, .status-full-block, .status-unchecked { background: var(--danger); }
.status-belum-diajukan { background-color: #6c757d; }

/* NEW: Clickable Status Style */
.clickable-status {
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
    user-select: none; /* Mencegah teks terblok saat klik cepat */
}
.clickable-status:hover {
    transform: scale(1.1);
    opacity: 0.9;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.status-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
}

/* --- TOAST --- */
#toast {
  visibility: hidden; min-width: 250px; max-width: 90%; background-color: #333;
  color: white; text-align: center; border-radius: 8px; padding: 12px 20px;
  position: fixed; z-index: 9999; bottom: 20px; right: 20px; left: 20px;
  font-weight: bold; box-shadow: 0 0 12px rgba(0,0,0,0.2);
  transition: all 0.5s ease; margin: 0 auto;
}
#toast.show { visibility: visible; bottom: 30px; opacity: 1; }
#toast.danger { background-color: var(--danger); }

/* --- BUTTON SMALL --- */
.btn-small {
    padding: 3px 8px;
    font-size: 0.75rem;
    margin: 2px;
    width: auto;
}

/* --- DROPDOWN --- */
.dropdown { position: relative; display: inline-block; }
.dropdown-content {
  display: none; position: absolute; background-color: var(--primary-dark);
  min-width: 90px;
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
  z-index: 1; border-radius: 4px; right: 0;
  min-width: 120px; 
}
.dropdown-content.show-dropdown { display: block; }
.dropdown-content button {
  color: var(--text-color);
  padding: 6px 10px;
  text-decoration: none; display: block;
  text-align: left; background: transparent; border: none; width: 100%;
  margin: 0;
  font-size: 0.75rem;
}
.dropdown-content button:hover { background-color: var(--secondary); }

/* --- PERMISSION HIDDEN --- */
[data-permission].hidden-by-permission { display: none !important; }

/* --- LOGIN --- */
#loginContainer {
  max-width: 380px; margin: 80px auto 20px; padding: 40px; text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1); border-radius: 12px;
}
#loginContainer h2 { color: var(--primary-color); }

/* --- LAYOUT UTILS --- */
.settings-section { margin-bottom: 30px; border: 1px solid #eee; padding: 15px; border-radius: 8px; }
.settings-section h3 { margin-top: 0; }

.form-grid-aba {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    align-items: flex-end;
}
.form-grid-aba .form-group {
    margin-bottom: 0;
}

/* --- SUB TABS --- */
.account-sub-tabs, .aba-sub-tabs {
    display: flex;
    flex-wrap: wrap;
    border-bottom: 2px solid var(--secondary);
    margin-bottom: 20px;
}
.account-sub-tab, .aba-sub-tab {
    padding: 10px 20px;
    cursor: pointer;
    background-color: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    font-weight: bold;
    color: #6c757d;
    font-size: 0.95rem;
    margin: 0 5px -2px 0;
    width: auto;
}
.account-sub-tab:hover, .aba-sub-tab:hover {
    background-color: #f8f9fa;
}
.account-sub-tab.active, .aba-sub-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* --- MARKETING CARD (EXPANDABLE) --- */
.marketing-card {
    background: #fff;
    border: 1px solid var(--secondary);
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    margin-bottom: 15px;
}
.marketing-card-header {
    margin: 0;
    padding: 15px;
    font-size: 1.1rem;
    color: var(--primary-color);
    border-bottom: 1px solid #eee;
    font-weight: bold;
}
.marketing-card-content {
    padding: 15px;
    overflow-x: auto;
}
.marketing-card table {
    margin-top: 0;
}

/* --- SUMMARY BOXES --- */
.aba-summary-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
    margin: 20px 0;
}
.summary-box-aba {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-left: 5px solid var(--primary-color);
    padding: 15px;
    border-radius: 8px;
}
.summary-box-aba .label {
    font-size: 0.9rem;
    font-weight: bold;
    color: #6c757d;
    margin-bottom: 5px;
    text-transform: uppercase;
}
.summary-box-aba .amount {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-color);
}
.summary-box-aba.total-akhir { border-left-color: var(--info); }
.summary-box-aba.total-akhir .amount { color: var(--info); }

/* --- FILTER CONTAINERS --- */
.simcard-filter-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border: 1px solid var(--secondary);
    border-radius: 8px;
}
.simcard-filter-container .form-group {
    margin-bottom: 0;
    flex-grow: 1;
    min-width: 150px;
}
.simcard-filter-container input,
.simcard-filter-container select {
    margin: 0;
    height: 40px; 
}
.simcard-filter-container button {
    margin: 0;
    height: 40px; 
    flex-grow: 0;
    flex-basis: 120px; 
}

/* --- DETAIL PANEL (SLIDE IN) --- */
.detail-panel {
    position: fixed; top: 0; right: -420px;
    width: 100%; max-width: 400px; height: 100%;
    background-color: white; box-shadow: -4px 0 15px rgba(0,0,0,0.15);
    z-index: 1001; transition: right 0.4s ease-in-out;
    display: flex; flex-direction: column;
}
.detail-panel.show { right: 0; }
.panel-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 15px 20px; background-color: var(--primary-color); color: white;
    flex-shrink: 0;
}
.panel-header h3 { margin: 0; font-size: 1.1rem; }
.panel-header .close-btn {
    background: none; border: none; color: white; font-size: 1.5rem;
    cursor: pointer; padding: 0 5px; line-height: 1;
}
.panel-body {
    padding: 20px; overflow-y: auto; flex-grow: 1;
    word-break: break-word;
}
.detail-list {
    list-style: none; padding: 0; margin: 0; font-size: 0.9rem;
}
.detail-list li {
    padding: 8px 0; border-bottom: 1px solid #eee;
}
.detail-list li:last-child { border-bottom: none; }
.detail-list li strong {
    color: #555; display: inline-block; width: 140px;
}

/* --- MODAL --- */
.modal-backdrop {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex; justify-content: center; align-items: center;
    z-index: 2000;
}
.modal-content {
    background-color: white; padding: 20px; border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2); width: 90%; max-width: 450px;
}
/* NEW: LEBAR MODAL UNTUK HISTORY */
.modal-content.modal-lg {
    max-width: 700px;
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid #eee; padding-bottom: 10px; margin-bottom: 15px;
}
.modal-header h3 { margin: 0; color: var(--primary-color); }
.modal-close-btn {
    background: none; border: none; font-size: 1.5rem;
    cursor: pointer; color: #aaa; padding: 0 5px;
}
.modal-body button { width: 100%; margin-top: 10px; }

/* --- SITE TAGS (BONUS KOMISI) --- */
.site-tag {
    background-color: var(--info); 
    color: white; padding: 4px 10px; border-radius: 15px; 
    font-size: 0.85rem; display: inline-flex; align-items: center; 
    gap: 5px; margin-bottom: 5px; margin-right: 5px;
}
.site-tag span { 
    cursor: pointer; font-weight: bold; margin-left: 5px;
    background: rgba(0,0,0,0.1); border-radius: 50%;
    width: 18px; height: 18px;
    display: flex; align-items: center; justify-content: center;
}
.site-tag span:hover { background: rgba(0,0,0,0.3); color: #fff; }

/* --- RADIO CONTAINER --- */
.radio-container {
    display: flex; align-items: center; gap: 8px; cursor: pointer;
    background: #fff; border: 1px solid #ddd; padding: 8px 15px; 
    border-radius: 4px; transition: all 0.2s;
}
.radio-container:hover { background: #f1f1f1; border-color: var(--primary-color); }
input[type="radio"] { width: auto; margin: 0; transform: scale(1.2); }

/* --- TABLE EXTRAS & NEW FEATURES --- */
.complex-table th, .complex-table td { white-space: nowrap; font-size: 0.85rem; padding: 8px 12px; }
.row-diff { background-color: #ffebee !important; color: #c62828; font-weight: bold; }
.row-diff td { border-color: #ef9a9a; }
.info-box { padding: 10px; background-color: #fff3cd; border: 1px solid #ffeeba; color: #856404; border-radius: 4px; margin-top: 10px; }

/* NEW: CLICKABLE TEXT (FOR HISTORY TRIGGER) */
.clickable-text {
    cursor: pointer;
    color: var(--primary-color);
    font-weight: bold;
    text-decoration: underline;
    transition: color 0.2s;
}
.clickable-text:hover { color: var(--info); }

/* NEW: QRIS THUMBNAIL */
.table-thumbnail {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    background-color: #eee;
}
.table-thumbnail:hover {
    transform: scale(3);
    z-index: 100;
    position: relative;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    border-color: #fff;
}

/* ==========================================================================
   STYLE KHUSUS ADMIN LEVEL & HISTORY TABLE
   ========================================================================== */
.admin-card {
    background: #fff;
    border: 1px solid var(--secondary);
    border-radius: 8px;
    margin-bottom: 15px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: box-shadow 0.2s;
}
.admin-card:hover {
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.admin-header {
    padding: 15px;
    background-color: #f8f9fa;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid transparent;
    cursor: pointer;
    transition: background-color 0.2s;
}
.admin-header:hover {
    background-color: #e9ecef;
}
.admin-header.active {
    border-bottom-color: var(--secondary);
    background-color: #e9ecef;
}

.admin-info {
    flex-grow: 1;
}
.admin-info strong {
    display: block;
    color: var(--text-color);
    font-size: 1rem;
    margin-bottom: 2px;
}
.admin-info span {
    font-size: 0.85rem;
    color: #6c757d;
    background-color: #e2e6ea;
    padding: 2px 6px;
    border-radius: 4px;
}
.admin-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.toggle-icon {
    font-size: 1.2rem;
    color: #6c757d;
    transition: transform 0.3s ease;
}
.admin-header.active .toggle-icon {
    transform: rotate(180deg);
}

.admin-permissions-panel {
    display: none; /* Hidden by default */
    padding: 20px;
    background-color: #fff;
    animation: slideDown 0.3s ease-out;
}
.admin-permissions-panel.show {
    display: block;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.permission-category {
    margin-bottom: 20px;
}
.permission-category:last-child {
    margin-bottom: 0;
}
.permission-category-title {
    font-size: 0.85rem;
    font-weight: bold;
    color: var(--primary-color);
    text-transform: uppercase;
    margin-bottom: 10px;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
    display: block;
}

.permission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.permission-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #555;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.2s;
}
.permission-item:hover {
    background-color: #f8f9fa;
}
.permission-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--primary-color);
}

/* --- HISTORY TABLE (STYLE PENTING UNTUK DENDA STAFF) --- */
.history-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 0.85rem;
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #dee2e6;
}
.history-table th, .history-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid #eee;
}
.history-table th {
    background-color: #e9ecef;
    font-weight: bold;
    color: #495057;
}
.history-table tr:last-child td {
    border-bottom: none;
}
.history-table td.amount {
    text-align: right;
    font-family: monospace;
    font-weight: bold;
}
.history-add-container {
    background-color: #f1f8e9; /* Light green background */
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #c8e6c9;
    margin-top: 15px;
}

/* --- RESPONSIVE --- */
@media (min-width: 768px) {
  .container { padding: 20px; margin: 20px auto; }
  #toast { left: auto; right: 30px; max-width: 350px; }
  .admin-header { padding: 15px 20px; }
  .btn-batch-copy { width: auto; }
}