.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  transition: transform 0.2s, border-color 0.2s;
}
.card:hover { border-color: rgba(var(--primary-rgb), 0.25); }
.card-secondary { background: var(--card-2); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.glass { background: var(--card); border: 1px solid var(--border); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 0 14px;
  border-radius: var(--radius-sm);
  font-weight: 500; font-size: 0.85rem;
  background: var(--card-2); border: 1px solid var(--border);
  transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s, background 0.2s;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0) scale(0.98); }
.btn-primary { background: var(--gradient); color: #ffffff; border: 0; font-weight: 600; }
.btn-primary:hover { background: var(--secondary); }
[data-theme="light"] .btn-primary:hover { background: var(--secondary); }
.btn-outline { background: transparent; border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; border: 0; }
.btn-success { background: var(--success); color: #fff; border: 0; }
.btn-sm { min-height: 32px; padding: 0 11px; font-size: 0.78rem; }
.btn-block { width: 100%; }
.btn-icon { width: 38px; padding: 0; }
.btn:disabled, .btn.is-loading { opacity: 0.6; pointer-events: none; }
.btn.is-loading::after { content: ""; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; }
.btn.is-success { background: var(--success); color: #fff; }
.btn.is-error { background: var(--danger); color: #fff; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 600; background: var(--card-2); color: var(--muted); }
.badge-success { background: rgba(52, 211, 153, 0.15); color: var(--success); }
.badge-warning { background: rgba(251, 191, 36, 0.15); color: var(--warning); }
.badge-danger { background: rgba(248, 113, 113, 0.15); color: var(--danger); }
.badge-info { background: rgba(var(--primary-rgb), 0.15); color: var(--secondary); }
.badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.modal-backdrop { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px); z-index: 100; opacity: 0; pointer-events: none; transition: opacity 0.25s; }
.modal-backdrop.show { opacity: 1; pointer-events: auto; }
.modal { width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; transform: translateY(16px) scale(0.97); transition: transform 0.25s; }
.modal-backdrop.show .modal { transform: none; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }

.toast-stack { position: fixed; top: 16px; right: 16px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast { min-width: 240px; max-width: 360px; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--card-2); border-left: 4px solid var(--primary); box-shadow: var(--shadow); animation: slideIn 0.3s ease; }
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }
.toast.warning { border-color: var(--warning); }

.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 200px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 6px; opacity: 0; visibility: hidden; transform: translateY(-6px); transition: 0.2s; z-index: 70; }
.dropdown.open .dropdown-menu { opacity: 1; visibility: visible; transform: none; }
.dropdown-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 8px; font-size: 0.875rem; text-align: left; }
.dropdown-item:hover { background: var(--card-2); text-decoration: none; }

.tabs { display: flex; gap: 6px; padding: 4px; background: var(--card-2); border-radius: var(--radius-sm); overflow-x: auto; }
.tab { padding: 7px 13px; border-radius: 8px; font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.tab.active { background: var(--card); color: var(--text); box-shadow: var(--shadow); }

[data-tooltip] { position: relative; }
[data-tooltip]:hover::after { content: attr(data-tooltip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); padding: 4px 10px; border-radius: 6px; background: #0a0d13; color: #fff; font-size: 0.72rem; white-space: nowrap; z-index: 80; }

.pagination { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.page-btn { min-width: 36px; height: 36px; border-radius: 8px; background: var(--card-2); border: 1px solid var(--border); }
.page-btn.active { background: var(--gradient); color: #ffffff; border: 0; }
.page-btn:disabled { opacity: 0.4; }

.empty-state { text-align: center; padding: 28px 14px; color: var(--muted); }
.empty-state i { font-size: 2rem; margin-bottom: 12px; opacity: 0.5; }
.skeleton { background: var(--card-2); border-radius: 8px; animation: skeletonPulse 1.4s ease-in-out infinite; min-height: 16px; }
.skeleton-card { height: 110px; border-radius: var(--radius); }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.code-block { position: relative; background: #0a0d13; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; overflow-x: auto; font-size: 0.78rem; color: #cbd5e1; }
.code-block .copy-btn { position: absolute; top: 8px; right: 8px; }
.code-wrap { position: relative; }
.code-wrap .code-block { padding-right: 78px; }
.code-wrap .copy-btn { position: absolute; top: 8px; right: 8px; z-index: 2; background: var(--card-2); }

/* ===== Toast ===== */
.toast-stack { position: fixed; top: calc(14px + env(safe-area-inset-top, 0px)); right: 14px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 28px)); pointer-events: none; }
.toast { position: relative; overflow: hidden; display: flex; align-items: flex-start; gap: 12px; padding: 13px 14px 15px; background: var(--card); color: var(--text); border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: var(--radius-sm); box-shadow: var(--shadow); pointer-events: auto; animation: toastIn 0.28s cubic-bezier(.2,.8,.2,1); }
.toast.leaving { opacity: 0; transform: translateX(24px); transition: opacity 0.2s, transform 0.2s; }
.toast > i { font-size: 1.1rem; margin-top: 2px; color: var(--primary); }
.toast-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 0.88rem; line-height: 1.45; }
.toast-body span { color: var(--muted); font-size: 0.82rem; word-break: break-word; }
.toast-x { background: none; border: 0; color: var(--muted); font-size: 1.3rem; line-height: 1; cursor: pointer; padding: 0 2px; }
.toast-x:hover { color: var(--text); }
.toast-bar { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: currentColor; opacity: 0.55; transform-origin: left; animation: toastBar linear forwards; }
.toast-success { border-left-color: var(--success); color: var(--success); } .toast-success > i { color: var(--success); }
.toast-error { border-left-color: var(--danger); color: var(--danger); } .toast-error > i { color: var(--danger); }
.toast-warning { border-left-color: var(--warning); color: var(--warning); } .toast-warning > i { color: var(--warning); }
.toast-info { color: var(--primary); }
.toast .toast-body strong { color: var(--text); }
@keyframes toastIn { from { opacity: 0; transform: translateX(28px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes toastBar { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ===== Dialog ===== */
.ui-backdrop { position: fixed; inset: 0; z-index: 9998; display: flex; align-items: center; justify-content: center; padding: 18px; background: rgba(0, 0, 0, 0.62); backdrop-filter: blur(3px); opacity: 0; transition: opacity 0.18s; }
.ui-backdrop.show { opacity: 1; }
.ui-modal { width: min(400px, 100%); max-height: 90vh; overflow: auto; background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; transform: translateY(10px) scale(0.97); transition: transform 0.2s cubic-bezier(.2,.8,.2,1); }
.ui-backdrop.show .ui-modal { transform: none; }
.ui-modal-icon { width: 44px; height: 44px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 50%; font-size: 1.25rem; background: rgba(var(--primary-rgb), 0.14); color: var(--primary); }
.ui-modal-icon.warning { background: rgba(251, 191, 36, 0.14); color: var(--warning); }
.ui-modal-icon.error { background: rgba(248, 113, 113, 0.14); color: var(--danger); }
.ui-modal-icon.success { background: rgba(52, 211, 153, 0.14); color: var(--success); }
.ui-modal-title { font-size: 1rem; text-align: center; margin-bottom: 6px; word-break: break-word; }
.ui-modal-text { color: var(--muted); font-size: 0.85rem; text-align: center; line-height: 1.55; }
.ui-modal-body { margin-top: 12px; font-size: 0.9rem; }
.ui-modal-body p { margin: 6px 0; word-break: break-word; }
.ui-modal-error { margin-top: 12px; padding: 8px 12px; border-radius: 8px; background: rgba(248, 113, 113, 0.12); color: var(--danger); font-size: 0.82rem; }
.ui-modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.ui-modal-actions .btn { min-width: 92px; }
.ui-modal .swal2-input, .ui-modal .swal2-textarea, .ui-modal .swal2-select { display: block; width: 100%; margin: 6px 0 0; padding: 10px 12px; background: var(--card-2); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); font: inherit; font-size: 0.9rem; }
.ui-modal .swal2-textarea { min-height: 96px; resize: vertical; }
.ui-modal .swal2-input:focus, .ui-modal .swal2-textarea:focus, .ui-modal .swal2-select:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.2); }

/* ===== Loading layar penuh ===== */
.page-loader { position: fixed; inset: 0; z-index: 10000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: var(--bg); opacity: 0; visibility: hidden; transition: opacity 0.2s, visibility 0.2s; }
.page-loader.show { opacity: 0.97; visibility: visible; }
.loader-ring { width: 42px; height: 42px; border-radius: 50%; border: 4px solid var(--border); border-top-color: var(--primary); animation: spin 0.8s linear infinite; }
.page-loader-text { color: var(--muted); font-size: 0.9rem; letter-spacing: 0.2px; }
@media (prefers-reduced-motion: reduce) { .loader-ring { animation-duration: 1.6s; } .toast { animation: none; } }
