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

/* Critical: general hidden rule (was missing, caused login+home overlap) */
.hidden { display: none !important; }

:root {
  --bg: #050810;
  --surface: #0f1626;
  --surface-2: #161f33;
  --border: #1f2a44;
  --border-bright: #2c3a5c;
  --text: #e8eef9;
  --text-dim: #8b97b1;
  --text-muted: #5f6a85;
  --primary: #25d366;
  --primary-glow: rgba(37, 211, 102, 0.2);
  --gradient: linear-gradient(135deg, #25d366 0%, #128c4e 50%, #6366f1 100%);
  --danger: #ef4444;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  position: relative;
  /* Flex column biar footer bisa stay di bawah pakai margin-top:auto
     dan content (login-wrap / home-wrap) bisa di-scroll natural */
  display: flex;
  flex-direction: column;
}

/* Animated gradient background */
.login-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 20% 30%, rgba(37, 211, 102, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(99, 102, 241, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(168, 85, 247, 0.08) 0%, transparent 50%);
  animation: bgShift 20s ease-in-out infinite;
}

@keyframes bgShift {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.1) rotate(2deg); }
}

.login-wrap {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;  /* fill available space dalam body flex-column */
  animation: fadeInUp 0.5s cubic-bezier(0.34, 1.2, 0.64, 1);
}

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

.login-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 2rem 2rem 1.75rem;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--gradient);
  background-size: 200% 100%;
  animation: gradientSlide 4s linear infinite;
}

@keyframes gradientSlide {
  to { background-position: 200% 0; }
}

/* Brand */
.brand {
  text-align: center;
  margin-bottom: 1.75rem;
}

.brand-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 0.875rem;
  background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(37, 211, 102, 0.35);
  animation: bounce 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s backwards;
}

.brand-icon svg {
  width: 38px;
  height: 38px;
}

@keyframes bounce {
  from { opacity: 0; transform: scale(0.5); }
  to { opacity: 1; transform: scale(1); }
}

.brand h1 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.brand-subtitle {
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* Form fields */
.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 0.4rem;
  letter-spacing: 0.01em;
}

.field input {
  width: 100%;
  padding: 0.75rem 0.875rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0.625rem;
  color: var(--text);
  font-size: 0.925rem;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.field input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface-2);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.field input::placeholder { color: var(--text-muted); }

/* Error box */
.error-box {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  padding: 0.6rem 0.875rem;
  border-radius: 0.5rem;
  font-size: 0.825rem;
  margin-bottom: 1rem;
  animation: shake 0.4s ease;
}

.error-box.hidden { display: none; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* Submit button */
.btn-submit {
  width: 100%;
  padding: 0.85rem 1rem;
  background: var(--gradient);
  background-size: 150% 150%;
  color: white;
  border: none;
  border-radius: 0.625rem;
  font-size: 0.925rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: transform 0.15s, box-shadow 0.15s, background-position 0.4s;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  background-position: 100% 50%;
  box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-submit:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-submit:disabled { opacity: 0.6; cursor: wait; }

.btn-loader {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn-loader.hidden { display: none; }
.btn-text.hidden { display: none; }

@keyframes spin { to { transform: rotate(360deg); } }

/* App shortcuts (post-login) */
.app-shortcuts.hidden { display: none; }

.shortcuts-title {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.shortcuts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.625rem;
  margin-bottom: 1rem;
}

.shortcut-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1rem 0.625rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 0.625rem;
  text-decoration: none;
  color: inherit;
  transition: all 0.15s;
  cursor: pointer;
}

.shortcut-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  background: var(--bg);
}

.shortcut-icon { font-size: 1.75rem; margin-bottom: 0.5rem; }
.shortcut-name { font-weight: 600; font-size: 0.875rem; margin-bottom: 0.2rem; }
.shortcut-desc { font-size: 0.7rem; color: var(--text-dim); }

.btn-logout {
  width: 100%;
  padding: 0.6rem;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  font-size: 0.825rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.btn-logout:hover {
  color: var(--danger);
  border-color: var(--danger);
}

/* Footer */
.footer {
  margin-top: 1.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

/* Responsive */
@media (max-width: 480px) {
  .login-card { padding: 1.5rem 1.25rem 1.25rem; }
  .shortcuts-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   HOME / DASHBOARD VIEW (post-login)
   ============================================================ */
.home-wrap {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2rem;  /* bottom padding biar gak nempel footer */
  position: relative;
  z-index: 1;
  flex: 1 1 auto;  /* fills available space dalam body flex-column */
}

.home-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.home-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.home-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.25);
}

.home-icon svg {
  width: 28px;
  height: 28px;
}

.home-brand h1 {
  font-size: 1.1rem;
  font-weight: 700;
}

.home-brand p {
  font-size: 0.825rem;
  color: var(--text-dim);
  margin-top: 2px;
}

.role-tag {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 4px;
  margin-left: 0.4rem;
  vertical-align: middle;
}
.role-tag.role-admin { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.role-tag.role-operator { background: rgba(99, 102, 241, 0.2); color: #818cf8; }

.home-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-bright);
  color: var(--text);
  padding: 0.5rem 0.875rem;
  border-radius: 8px;
  font-size: 0.825rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.btn-ghost:hover { background: var(--surface-2); border-color: var(--text-dim); }
.btn-danger-outline { border-color: rgba(239, 68, 68, 0.4); color: #fca5a5; }
.btn-danger-outline:hover { background: rgba(239, 68, 68, 0.1); border-color: var(--danger); }

.welcome-banner {
  background: linear-gradient(135deg, rgba(37, 211, 102, 0.1) 0%, rgba(99, 102, 241, 0.1) 100%);
  border: 1px solid var(--border-bright);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.welcome-banner h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.welcome-banner p {
  color: var(--text-dim);
  font-size: 0.9rem;
}

.section { display: none; }
.section.active { display: block; animation: fadeIn 0.25s ease-out; }

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

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
}

.section-head h2 {
  font-size: 1.15rem;
  font-weight: 700;
  flex: 1;
  text-align: center;
}

.btn-back {
  background: transparent;
  border: 1px solid var(--border-bright);
  color: var(--text-dim);
  padding: 0.5rem 0.875rem;
  border-radius: 8px;
  font-size: 0.825rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.btn-back:hover { background: var(--surface-2); color: var(--text); }

.btn-primary {
  background: var(--gradient);
  color: white;
  border: none;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.25);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(37, 211, 102, 0.35); }

/* Shortcuts grid */
.shortcuts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.shortcut-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.shortcut-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 0%, transparent 60%, rgba(255,255,255,0.03) 100%);
  pointer-events: none;
}

.shortcut-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-bright);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

.shortcut-card .card-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  flex-shrink: 0;
}

.shortcut-card.grad-purple .card-icon { background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%); }
.shortcut-card.grad-green .card-icon { background: linear-gradient(135deg, #25d366 0%, #16a34a 100%); }
.shortcut-card.grad-blue .card-icon { background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%); }
.shortcut-card.grad-orange .card-icon { background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%); }

.card-body { flex: 1; min-width: 0; }
.card-body h3 { font-size: 1rem; font-weight: 700; margin-bottom: 0.2rem; }
.card-body p { font-size: 0.8rem; color: var(--text-dim); line-height: 1.4; }

.card-arrow {
  font-size: 1.4rem;
  color: var(--text-muted);
  transition: transform 0.2s, color 0.2s;
}
.shortcut-card:hover .card-arrow { transform: translateX(4px); color: var(--primary); }

/* Card panel (used for users, stats, profile) */
.card-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem;
}

.card-panel.max-md { max-width: 580px; margin: 0 auto; }

/* Users stats mini */
.users-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.stat-mini {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
}

.stat-mini .stat-label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-dim);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stat-mini .stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 0.2rem;
}

/* Users table */
.table-wrap { overflow-x: auto; }

.users-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.875rem;
}

.users-table thead { background: var(--surface-2); }
.users-table th {
  text-align: left;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 0.625rem 0.875rem;
  border-bottom: 1px solid var(--border);
}

.users-table td {
  padding: 0.875rem;
  border-bottom: 1px solid var(--border);
}
.users-table tbody tr:last-child td { border-bottom: none; }
.users-table tbody tr:hover { background: var(--surface-2); }

.col-action { width: 1%; white-space: nowrap; text-align: right; }
.empty {
  text-align: center;
  padding: 2rem !important;
  color: var(--text-dim);
  font-style: italic;
}
.empty.error { color: #fca5a5; }

.user-cell {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.user-avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.user-name { font-weight: 600; }
.user-id { font-size: 0.7rem; color: var(--text-muted); }
.mono { font-family: 'SF Mono', Monaco, Consolas, monospace; }

.badge-me {
  background: rgba(37, 211, 102, 0.2);
  color: var(--primary);
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  margin-left: 0.25rem;
}

.role-pill {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.role-pill.role-admin { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.role-pill.role-operator { background: rgba(99, 102, 241, 0.15); color: #818cf8; }

.action-btns { display: flex; gap: 0.4rem; justify-content: flex-end; }

.btn-icon {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-icon:hover { background: var(--surface); border-color: var(--border-bright); }
.btn-danger-icon:hover { background: rgba(239, 68, 68, 0.15); border-color: var(--danger); }

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.875rem;
}

.stat-block {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  text-align: center;
}

.stat-block-value {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stat-block-label {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 0.4rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* Profile */
.profile-info {
  margin-bottom: 1rem;
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}
.info-row:last-child { border-bottom: none; }
.info-row span { color: var(--text-dim); }

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.25rem 0;
}

.card-panel h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.875rem;
}

.card-panel .field { margin-bottom: 0.875rem; }
.card-panel .field label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-bottom: 0.4rem;
  font-weight: 500;
}
.card-panel .field input,
.card-panel .field select {
  width: 100%;
  padding: 0.625rem 0.875rem;
  background: var(--bg);
  border: 1px solid var(--border-bright);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.card-panel .field input:focus,
.card-panel .field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.card-panel .field small {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.card-panel .btn-submit {
  background: var(--gradient);
  color: white;
  border: none;
  padding: 0.7rem 1.25rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}
.card-panel .btn-submit:hover { transform: translateY(-1px); }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
  backdrop-filter: blur(6px);
  animation: fadeIn 0.2s ease-out;
}
.modal.hidden { display: none; }

.modal-content {
  background: var(--surface);
  border: 1px solid var(--border-bright);
  border-radius: 16px;
  padding: 1.75rem;
  max-width: 460px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  animation: modalPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.modal-content h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.modal-subtitle {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 1.25rem;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
}

.modal-actions .btn-submit { padding: 0.55rem 1rem; }

/* Toast */
.toast {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background: var(--surface);
  border: 1px solid var(--border-bright);
  border-radius: 8px;
  padding: 0.75rem 1.125rem;
  font-size: 0.85rem;
  z-index: 200;
  max-width: 320px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  animation: toastIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.toast.hidden { display: none; }
.toast.success { border-left: 3px solid var(--primary); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid #6366f1; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@media (max-width: 600px) {
  .home-header { flex-direction: column; align-items: stretch; }
  .home-actions { justify-content: flex-end; }
  .shortcuts-grid { grid-template-columns: 1fr; }
  .shortcut-card { padding: 1rem; }
  .shortcut-card .card-icon { width: 48px; height: 48px; font-size: 1.5rem; }
  .users-table th:nth-child(3),
  .users-table td:nth-child(3),
  .users-table th:nth-child(4),
  .users-table td:nth-child(4) { display: none; }
}

/* ============================================================
   WARNA GROUP BRANDING (text-only, dark theme preserved)
   ============================================================ */
.warna-tagline {
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 1rem;
  text-align: center;
}

.home-brand .warna-tagline {
  text-align: left;
  margin-bottom: 0.3rem;
}

.warna-banner {
  display: flex;
  align-items: baseline;
  gap: 0.625rem;
  flex-wrap: wrap;
}

.warna-name {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.warna-sub {
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  text-transform: uppercase;
}

.field-hint {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Footer watermark — pakai mono font biar match feel image 2 */
.footer {
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-align: center;
  color: var(--text-muted);
  margin-top: 2rem;
  padding: 1.25rem 1rem 1.25rem;
  line-height: 1.8;
  border-top: 1px solid var(--border);
}

/* Login footer doesn't need top margin (login-wrap centers everything) */
.login-wrap .footer {
  margin-top: 1.5rem;
  border-top: none;
  padding: 0 1rem;
}

.footer strong {
  background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 800;
}

/* Login form labels — uppercase mono untuk match feel */
.login-card .field label {
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 600;
}

/* ============================================================
   THEME TOGGLE BUTTON (floating top-right)
   ============================================================ */
.theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border-bright);
  background: var(--surface);
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: transform 0.2s, background 0.2s, border-color 0.2s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.theme-toggle:hover {
  transform: scale(1.08) rotate(15deg);
  border-color: var(--primary);
}

/* Icon swap */
.theme-toggle .theme-icon-dark,
.theme-toggle .theme-icon-light {
  line-height: 1;
}
.theme-toggle .theme-icon-dark { display: inline !important; }
.theme-toggle .theme-icon-light { display: none !important; }
[data-theme="dark"] .theme-toggle .theme-icon-dark { display: none !important; }
[data-theme="dark"] .theme-toggle .theme-icon-light { display: inline !important; }

/* ============================================================
   LIGHT THEME OVERRIDES (login page is dark by default)
   ============================================================ */
[data-theme="light"] {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f9fafc;
  --border: #e6e9ef;
  --border-bright: #d4d9e2;
  --text: #1a1f2e;
  --text-dim: #6b7488;
  --text-muted: #9ca3b3;
  --primary-glow: rgba(37, 211, 102, 0.18);
}

[data-theme="light"] body {
  background: var(--bg);
  color: var(--text);
}

[data-theme="light"] .login-bg {
  background:
    radial-gradient(circle at 20% 50%, rgba(37, 211, 102, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 80% 30%, rgba(99, 102, 241, 0.1) 0%, transparent 40%),
    linear-gradient(180deg, #f5f7fb 0%, #e0e7ef 100%);
}

[data-theme="light"] .login-card {
  background: var(--surface);
  border-color: var(--border);
  box-shadow:
    0 20px 60px rgba(15, 23, 42, 0.12),
    0 0 0 1px rgba(15, 23, 42, 0.04) inset;
}

[data-theme="light"] .field input {
  background: var(--surface-2);
  border-color: var(--border-bright);
  color: var(--text);
}

[data-theme="light"] .field input:focus {
  border-color: var(--primary);
}

[data-theme="light"] .home-header,
[data-theme="light"] .card-panel,
[data-theme="light"] .modal-content {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
}

[data-theme="light"] .stat-mini,
[data-theme="light"] .stat-block,
[data-theme="light"] .shortcut-card {
  background: var(--surface-2);
  border-color: var(--border);
}

[data-theme="light"] .shortcut-card:hover {
  background: var(--surface);
  border-color: var(--border-bright);
}

[data-theme="light"] .users-table thead {
  background: var(--surface-2);
}

[data-theme="light"] .users-table th,
[data-theme="light"] .users-table td {
  border-color: var(--border);
}

[data-theme="light"] .users-table tbody tr:hover {
  background: var(--surface-2);
}

[data-theme="light"] .btn-icon,
[data-theme="light"] .btn-back,
[data-theme="light"] .btn-ghost {
  background: var(--surface-2);
  border-color: var(--border);
}

[data-theme="light"] .btn-icon:hover,
[data-theme="light"] .btn-back:hover,
[data-theme="light"] .btn-ghost:hover {
  background: var(--surface);
  border-color: var(--border-bright);
}

[data-theme="light"] .welcome-banner {
  background: linear-gradient(135deg, rgba(37, 211, 102, 0.08) 0%, rgba(99, 102, 241, 0.08) 100%);
  border-color: var(--border);
}

[data-theme="light"] .card-panel .field input,
[data-theme="light"] .card-panel .field select {
  background: var(--surface-2);
  border-color: var(--border-bright);
  color: var(--text);
}

[data-theme="light"] .info-row { border-color: var(--border); }
[data-theme="light"] .divider { border-color: var(--border); }

[data-theme="light"] .modal {
  background: rgba(15, 23, 42, 0.4);
}

[data-theme="light"] .toast {
  background: var(--surface);
  border-color: var(--border-bright);
}

[data-theme="light"] .footer {
  color: var(--text-dim);
}

[data-theme="light"] .warna-tagline {
  color: var(--text-dim);
}

/* Banned card icon gradient */
.shortcut-card.grad-red .card-icon { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); }

/* ============================================================
   BANNED PAGE — Stats grid & config rows
   ============================================================ */
.banned-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.875rem;
  margin-bottom: 1rem;
}

.banned-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem 1.125rem;
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.banned-stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.banned-stat-content { flex: 1; min-width: 0; }
.banned-stat-label {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.banned-stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 0.15rem;
  line-height: 1;
}
.banned-stat-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

/* Config rows */
.config-detail {
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 0.5rem 0.875rem;
}
.config-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 0.5rem;
}
.config-row:last-child { border-bottom: none; }
.config-label {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-weight: 600;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.config-value {
  font-size: 0.85rem;
  color: var(--text);
  text-align: right;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  justify-content: flex-end;
}
.config-value.mono { font-family: 'SF Mono', Monaco, Consolas, monospace; font-size: 0.78rem; }

.topic-badge {
  background: rgba(37, 211, 102, 0.12);
  color: #16a34a;
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.action-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-small {
  padding: 0.4rem 0.75rem !important;
  font-size: 0.78rem !important;
}

/* Banned table tweaks */
.banned-table th { white-space: nowrap; }

@media (max-width: 600px) {
  .banned-stats-grid { grid-template-columns: 1fr; }
  .config-row { flex-direction: column; align-items: flex-start; }
  .config-value { text-align: left; justify-content: flex-start; }
}

/* Light theme: topic badge */
[data-theme="light"] .topic-badge {
  background: rgba(34, 197, 94, 0.15);
  color: #15803d;
}

/* Light theme: config-detail surface */
[data-theme="light"] .config-detail {
  background: var(--surface-2);
}

/* ============================================================
   ANALYTICS DASHBOARD
   ============================================================ */
.analytics-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.range-toggle {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 3px;
  gap: 2px;
}
.range-btn {
  background: transparent;
  border: none;
  padding: 0.4rem 0.875rem;
  border-radius: 99px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-2);
  font-family: inherit;
}
.range-btn:hover { color: var(--text); }
.range-btn.active {
  background: var(--surface);
  color: var(--primary, #25D366);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.analytics-info {
  font-size: 0.78rem;
  color: var(--text-dim);
}

.analytics-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.analytics-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.875rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.analytics-stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.analytics-stat-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.analytics-stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 0.15rem;
  line-height: 1;
}

.analytics-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem 1.125rem;
  margin-bottom: 1rem;
}
.analytics-card h3 {
  margin: 0 0 0.875rem 0;
  font-size: 0.95rem;
}
.analytics-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
.analytics-row-2col > .analytics-card { margin-bottom: 0; }
@media (max-width: 800px) {
  .analytics-row-2col { grid-template-columns: 1fr; }
}

.chart-wrap { position: relative; }

/* HEATMAP */
.heatmap-grid { overflow-x: auto; }
.heatmap-table {
  display: inline-block;
  min-width: 100%;
  font-size: 0.7rem;
}
.heatmap-row {
  display: grid;
  grid-template-columns: 60px repeat(24, 1fr);
  gap: 2px;
  margin-bottom: 2px;
}
.heatmap-cell {
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text-2);
}
.heatmap-day {
  font-weight: 600;
  font-size: 0.7rem;
  background: transparent;
  color: var(--text-dim);
  justify-content: flex-start;
  padding-left: 0.25rem;
}
.heatmap-hour-label {
  font-size: 0.62rem;
  color: var(--text-dim);
  background: transparent;
}
.heatmap-data {
  font-size: 0.65rem;
  font-weight: 600;
  color: #14532d;
  cursor: default;
}
[data-theme="dark"] .heatmap-data { color: #ecfdf5; }
.heatmap-legend {
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.72rem;
  color: var(--text-dim);
}
.legend-gradient {
  width: 120px;
  height: 8px;
  background: linear-gradient(90deg, var(--surface-2), rgba(34, 197, 94, 0.95));
  border-radius: 4px;
}

/* LEADERBOARD */
.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.leaderboard-table th {
  text-align: left;
  font-weight: 600;
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.5rem 0.5rem;
  border-bottom: 1px solid var(--border);
}
.leaderboard-table th.num,
.leaderboard-table td.num { text-align: right; }
.leaderboard-table td {
  padding: 0.625rem 0.5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.leaderboard-table tr:last-child td { border-bottom: none; }
.leaderboard-table small { color: var(--text-dim); font-size: 0.72rem; }
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.78rem;
  background: var(--surface-2);
  color: var(--text-2);
}
.rank-1 { background: #fef08a; color: #713f12; }
.rank-2 { background: #e2e8f0; color: #334155; }
.rank-3 { background: #fde68a; color: #78350f; }
[data-theme="dark"] .rank-1 { background: #ca8a04; color: #fef9c3; }
[data-theme="dark"] .rank-2 { background: #475569; color: #f8fafc; }
[data-theme="dark"] .rank-3 { background: #b45309; color: #fef3c7; }

/* Card Analytics gradient (login dashboard) */
.shortcut-card.grad-cyan .card-icon { background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%); }

/* Role-aware card descriptions (default: hide both, JS toggles based on role) */
.card-desc-admin, .card-desc-operator { margin: 0; }
body[data-role="admin"] .card-desc-operator,
body[data-role="master"] .card-desc-operator { display: none; }
body[data-role="operator"] .card-desc-admin { display: none; }

/* Banned admin-only elements default visible, JS hides for operator */

/* MASTER role styling */
.role-master {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #78350f;
  border: 1px solid rgba(251, 191, 36, 0.5);
  font-weight: 700;
}
[data-theme="dark"] .role-master {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.2) 0%, rgba(245, 158, 11, 0.15) 100%);
  color: #fcd34d;
  border-color: rgba(251, 191, 36, 0.4);
}
.avatar-master {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%) !important;
  color: white !important;
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.3);
}

/* Master profile badge */
.role-tag.role-master {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: white;
  font-weight: 700;
}

/* ============================================================
   PROXY BADGE & MODAL
   ============================================================ */
.proxy-badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.proxy-on {
  background: linear-gradient(135deg, rgba(37, 211, 102, 0.15), rgba(22, 163, 74, 0.1));
  color: #16a34a;
  border: 1px solid rgba(34, 197, 94, 0.3);
}
.proxy-off {
  background: var(--surface-2);
  color: var(--text-dim);
  border: 1px solid var(--border);
}
[data-theme="dark"] .proxy-on { background: rgba(34, 197, 94, 0.2); color: #4ade80; }

.proxy-test-loading {
  padding: 0.625rem 0.875rem;
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 0.85rem;
  color: var(--text-2);
}
.proxy-test-success {
  padding: 0.875rem 1rem;
  border-radius: 10px;
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #166534;
  font-size: 0.85rem;
  line-height: 1.6;
}
.proxy-test-fail {
  padding: 0.875rem 1rem;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #991b1b;
  font-size: 0.88rem;
}
[data-theme="dark"] .proxy-test-success { color: #86efac; }
[data-theme="dark"] .proxy-test-fail { color: #fca5a5; }

/* === APP FOOTER (v9.43) === */
.app-footer {
  /* Natural position di end of body (body flex-column). Pakai margin-top: auto
     biar push ke bawah saat content pendek. Tidak fixed — biar gak nutupin
     content di viewport kecil. */
  margin-top: auto;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  z-index: 10;
}
[data-theme="dark"] .app-footer {
  background: rgba(15, 22, 38, 0.95);
  border-top-color: rgba(255, 255, 255, 0.08);
}
.app-footer-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  text-align: center;
}
.app-footer-warning {
  display: inline-block;
  padding: 0.4rem 0.875rem;
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.08), rgba(245, 158, 11, 0.08));
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 8px;
  color: #b91c1c;
  font-size: 0.78rem;
  line-height: 1.4;
}
.app-footer-credit {
  font-size: 0.78rem;
  color: #6b7280;
  font-style: italic;
}
.app-footer-credit strong {
  color: #25d366;
  font-style: normal;
  font-weight: 700;
}

@media (max-width: 639px) {
  .app-footer { padding: 0.5rem; }
  .app-footer-warning { font-size: 0.68rem; padding: 0.3rem 0.625rem; }
  .app-footer-credit { font-size: 0.7rem; }
}
