:root {
  /* Clean Enterprise Light Mode Theme (Default) */
  --bg-primary: #f8fafc;
  --bg-sidebar: #ffffff;
  --bg-secondary: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-subtle: #f8fafc;
  --bg-card-hover: #f1f5f9;
  --border-color: #e2e8f0;
  --border-subtle: #f1f5f9;
  --border-focus: #2563eb;
  
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;
  
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-border: #bfdbfe;
  --primary-glow: rgba(37, 99, 235, 0.12);
  
  --accent-cyan: #0284c7;
  --accent-emerald: #059669;
  --accent-amber: #d97706;
  --accent-rose: #e11d48;
  
  --input-bg: #ffffff;
  --input-border: #cbd5e1;
  --input-focus: #2563eb;

  --table-th-bg: #f8fafc;
  --table-tr-hover: #f1f5f9;
  --table-td-border: #f1f5f9;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.06), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --transition: all 0.18s ease-in-out;
}

[data-theme="dark"] {
  /* Rich Midnight Dark Mode */
  --bg-primary: #0b1120;
  --bg-sidebar: #0f172a;
  --bg-secondary: #111827;
  --bg-card: #131c31;
  --bg-card-subtle: #0f172a;
  --bg-card-hover: #1e293b;
  --border-color: #243048;
  --border-subtle: #1e293b;
  --border-focus: #38bdf8;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-light: rgba(59, 130, 246, 0.15);
  --primary-border: rgba(59, 130, 246, 0.35);
  --primary-glow: rgba(59, 130, 246, 0.25);
  
  --accent-cyan: #38bdf8;
  --accent-emerald: #34d399;
  --accent-amber: #fbbf24;
  --accent-rose: #f43f5e;
  
  --input-bg: #0f172a;
  --input-border: #334155;
  --input-focus: #38bdf8;

  --table-th-bg: #0f172a;
  --table-tr-hover: #182234;
  --table-td-border: #182234;
  
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 10px 30px -5px rgba(0, 0, 0, 0.6);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ========================================================
   APP SIDEBAR LAYOUT
   ======================================================== */
.app-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.app-sidebar {
  width: 290px;
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 50;
  transition: var(--transition);
  padding: 1.25rem 1rem;
  box-shadow: var(--shadow-sm);
}

.app-main-content {
  flex: 1;
  min-width: 0;
  padding: 1.75rem 2rem;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

/* Sidebar Top Section */
.sidebar-top-section {
  display: flex;
  flex-direction: column;
}

/* Sidebar Brand Header */
.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 0.25rem 0.5rem 1.25rem 0.5rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1rem;
}

.sidebar-brand-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.sidebar-close-btn {
  display: none;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}

.sidebar-close-btn:hover {
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
  border-color: rgba(244, 63, 94, 0.3);
}

/* Mobile Navbar Styles (Hidden by default on Desktop) */
.mobile-navbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  height: 58px;
  padding: 0 1rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 990;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(12px);
}

.mobile-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  color: var(--primary);
  padding: 0.42rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.mobile-menu-btn:hover,
.mobile-menu-btn:active {
  background: var(--primary);
  color: #ffffff;
}

.mobile-navbar-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  text-align: center;
  min-width: 0;
  padding: 0 0.5rem;
}

.mobile-brand-title {
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
  white-space: nowrap;
}

.mobile-brand-sub {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 145px;
}

.mobile-navbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mobile-theme-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  font-size: 0.95rem;
  cursor: pointer;
  color: var(--text-main);
  transition: var(--transition);
}

.mobile-theme-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary-border);
}

.mobile-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  z-index: 1040;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.brand-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--primary), var(--accent-cyan));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px var(--primary-glow);
}

.sidebar-brand-text h1 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.sidebar-brand-text p {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.3;
}

/* Sidebar Active User Card */
.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
  margin-bottom: 1.25rem;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-nip {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
}

/* Sidebar Navigation Items */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  padding: 0.5rem 0.75rem 0.25rem 0.75rem;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: var(--transition);
  user-select: none;
}

.sidebar-nav-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
}

.sidebar-nav-item.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 8px var(--primary-glow);
  font-weight: 700;
}

.sidebar-nav-item.active .nav-icon {
  color: #ffffff;
}

.sidebar-nav-item.active .nav-badge {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.nav-icon {
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 20px;
}

.nav-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-badge {
  font-size: 0.65rem;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  background: var(--bg-card-hover);
  color: var(--text-dim);
  font-weight: 600;
}

/* Sidebar Footer & System Actions */
.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  margin-top: 1rem;
}

/* Server Clock Pill */
.server-clock-pill {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.75rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}

.server-clock-pill:hover {
  border-color: var(--border-focus);
}

.clock-pulsing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 6px var(--accent-emerald);
  animation: pulse 2s infinite;
}

.server-clock-text {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.server-clock-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.server-clock-date {
  font-size: 0.65rem;
  color: var(--text-dim);
}

/* Token Status Pill */
.token-status-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.74rem;
  color: var(--text-muted);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.status-dot.active {
  background: var(--accent-emerald);
  box-shadow: 0 0 5px var(--accent-emerald);
}

.status-dot.inactive {
  background: var(--text-dim);
}

/* Sidebar Action Buttons Grid */
.sidebar-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.sidebar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.45rem 0.65rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.sidebar-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
}

.sidebar-link-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 0.75rem;
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-md);
  color: var(--primary);
  font-size: 0.76rem;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
}

.sidebar-link-btn:hover {
  background: var(--primary);
  color: #ffffff;
}

/* Dedicated Logout Button */
.sidebar-logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.55rem 0.85rem;
  background: rgba(225, 29, 72, 0.08);
  border: 1px solid rgba(225, 29, 72, 0.25);
  border-radius: var(--radius-md);
  color: var(--accent-rose);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.sidebar-logout-btn:hover {
  background: var(--accent-rose);
  color: #ffffff;
  border-color: var(--accent-rose);
  box-shadow: 0 2px 8px rgba(225, 29, 72, 0.25);
}

@media (max-width: 900px) {
  .mobile-navbar {
    display: flex;
  }

  .sidebar-backdrop {
    display: block;
  }

  .sidebar-close-btn {
    display: flex;
  }

  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 295px;
    max-width: 86vw;
    height: 100vh;
    z-index: 1050;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
    border-right: 1px solid var(--border-color);
  }

  .app-sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 35px rgba(0, 0, 0, 0.45);
  }

  .sidebar-backdrop.open {
    opacity: 1;
    pointer-events: auto;
  }

  body.sidebar-drawer-open {
    overflow: hidden;
  }

  .app-layout {
    flex-direction: column;
  }

  .app-main-content {
    padding: 1rem 0.85rem;
    padding-top: calc(58px + 1rem); /* Space for fixed mobile topbar */
    width: 100%;
    max-width: 100%;
  }

  .two-column-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .card {
    padding: 1.15rem 1rem;
    border-radius: var(--radius-md);
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .card-header .header-tools {
    width: 100%;
    display: flex;
    justify-content: flex-end;
  }

  .profile-summary-card {
    padding: 0.85rem 1rem;
  }

  .profile-info-grid {
    gap: 0.75rem;
  }

  .profile-token-preview {
    width: 100%;
    justify-content: space-between;
  }

  .preset-buttons {
    max-height: 130px;
  }

  .form-row-2,
  .form-row-3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .app-main-content {
    padding: 0.75rem 0.5rem;
    padding-top: calc(58px + 0.75rem);
  }

  .card {
    padding: 1rem 0.75rem;
  }

  .card-title-group h2,
  .card-title-group h3 {
    font-size: 1rem;
  }

  .location-quick-tools,
  .time-quick-tools {
    gap: 0.35rem;
  }

  .btn-micro {
    padding: 0.25rem 0.5rem;
    font-size: 0.68rem;
  }
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.inactive {
  background-color: var(--text-dim);
}

.status-dot.active {
  background-color: var(--accent-emerald);
  box-shadow: 0 0 6px rgba(5, 150, 105, 0.4);
}

/* Stepper Navigation */
.stepper-nav {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.stepper-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.65rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  overflow-x: auto;
}

.step-indicator {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  user-select: none;
}

.step-indicator:hover {
  background: var(--bg-secondary);
}

.step-indicator.active {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.step-indicator.active .step-title {
  color: #1d4ed8;
}

.step-number {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #475569;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.step-indicator.active .step-number {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
}

.step-indicator.completed .step-number {
  background: var(--accent-emerald);
  color: #fff;
}

.step-info {
  display: flex;
  flex-direction: column;
}

.step-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
}

.step-desc {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
}

.step-arrow {
  color: #cbd5e1;
  font-size: 0.95rem;
}

/* Layout */
.main-layout {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Profile Summary Card */
.profile-summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.5rem;
  box-shadow: var(--shadow-sm);
  animation: slideDown 0.25s ease-out;
}

.profile-info-grid {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.profile-avatar {
  width: 44px;
  height: 44px;
  background: #eff6ff;
  border-radius: 50%;
  font-size: 1.15rem;
  font-weight: 700;
  color: #1d4ed8;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #bfdbfe;
}

.profile-details {
  flex: 1;
  min-width: 250px;
}

.profile-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.profile-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.profile-meta strong {
  color: #1d4ed8;
}

.profile-token-preview {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-secondary);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.label-mini {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.profile-token-preview code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: #1d4ed8;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Grid & Cards */
.two-column-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 980px) {
  .two-column-grid {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.card-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.card-title-group h2,
.card-title-group h3 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

/* Badges */
.badge {
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.method-post {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.method-get {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-tag {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
  border: 1px solid var(--border-color);
}

.status-tag.success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  border-color: rgba(16, 185, 129, 0.3);
}

.status-tag.error {
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
  border-color: rgba(244, 63, 94, 0.3);
}

.status-tag.loading {
  background: rgba(59, 130, 246, 0.15);
  color: var(--primary);
  border-color: rgba(59, 130, 246, 0.3);
}

.auto-badge {
  font-size: 0.65rem;
  background: rgba(6, 182, 212, 0.12);
  color: var(--accent-cyan);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(6, 182, 212, 0.25);
  font-weight: 500;
}

/* Forms */
form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.label-with-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.required {
  color: var(--accent-rose);
}

.input-hint {
  font-size: 0.72rem;
  color: var(--text-dim);
}

input[type="text"],
input[type="password"],
input[type="date"],
textarea,
select {
  background: var(--bg-card);
  border: 1px solid #cbd5e1;
  color: var(--text-main);
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-family: inherit;
  transition: var(--transition);
  outline: none;
  width: 100%;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  background: var(--bg-card);
}

textarea {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  resize: vertical;
}

.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrapper input {
  padding-right: 2.5rem;
}

.btn-toggle-pw {
  position: absolute;
  right: 0.65rem;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-dim);
  padding: 0.25rem;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 640px) {
  .form-row-2,
  .form-row-3 {
    grid-template-columns: 1fr;
  }
}

.form-actions {
  margin-top: 0.5rem;
}

/* Quick Tools */
.location-quick-tools,
.time-quick-tools {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: -0.25rem;
}

.btn-micro {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.73rem;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: var(--transition);
}

.btn-micro:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  text-decoration: none;
  user-select: none;
}

.btn-primary {
  background: #2563eb;
  border: 1px solid #1d4ed8;
  color: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  width: 100%;
}

.btn-primary:hover:not(:disabled) {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid #cbd5e1;
  color: var(--text-main);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.btn-secondary:hover {
  background: var(--bg-secondary);
  border-color: #94a3b8;
}

.btn-outline {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #60a5fa;
}

.btn-outline:hover {
  background: rgba(59, 130, 246, 0.18);
  border-color: #60a5fa;
}

.btn-subtle {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: var(--transition);
}

.btn-subtle:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.btn-icon:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}

.btn-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

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

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

/* Response Section */
.response-card {
  display: flex;
  flex-direction: column;
}

.response-time {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
}

.response-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
}

.autofill-notice {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
  animation: slideDown 0.25s ease-out;
}

.check-icon {
  width: 22px;
  height: 22px;
  background: var(--accent-emerald);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.autofill-notice strong {
  color: #15803d;
}

.autofill-notice p {
  color: #166534;
  margin-top: 0.1rem;
  font-size: 0.75rem;
}

.json-viewer {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--text-main);
  overflow-x: auto;
  max-height: 400px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-all;
  flex: 1;
  transition: var(--transition);
}

/* Location Cards Render */
.location-cards-container {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.location-cards-container h4 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.location-card-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.location-card-item:hover {
  border-color: var(--primary);
  background: var(--bg-card-hover);
}

.location-card-item.selected {
  border-color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.08);
}

.loc-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.loc-item-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
}

.loc-item-id {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--accent-cyan);
}

.loc-item-details {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.loc-badge-coord {
  background: rgba(255, 255, 255, 0.05);
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
  font-family: 'JetBrains Mono', monospace;
}

.loc-item-actions {
  margin-top: 0.25rem;
}

.btn-select-loc {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #93c5fd;
  font-size: 0.75rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
  font-weight: 600;
}

.btn-select-loc:hover {
  background: var(--primary);
  color: #fff;
}

/* Attendance Result Banner */
.attendance-result-banner {
  padding: 1rem;
  border-radius: var(--radius-md);
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  animation: slideDown 0.3s ease-out;
}

.attendance-result-banner.success {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.attendance-result-banner.error {
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.banner-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  flex-shrink: 0;
}

.attendance-result-banner.success .banner-icon {
  background: var(--accent-emerald);
}

.attendance-result-banner.error .banner-icon {
  background: var(--accent-rose);
}

.banner-content h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.banner-content p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* History Section */
.history-section {
  margin-top: 0.5rem;
}

.table-responsive {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.8rem;
}

.history-table th {
  background: var(--table-th-bg);
  padding: 0.75rem 1rem;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  border-bottom: 2px solid var(--border-color);
}

.history-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--table-td-border);
  color: var(--text-main);
  background: var(--bg-card);
}

.history-table tr:last-child td {
  border-bottom: none;
}

.history-table tr:hover td {
  background: var(--table-tr-hover);
}

.empty-row td {
  text-align: center;
  color: var(--text-dim);
  padding: 2rem !important;
}

/* Tabs */
.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.25s ease-in-out;
}

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

/* Toast */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 100;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  backdrop-filter: blur(10px);
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 380px;
}

.toast.success {
  border-left: 4px solid var(--accent-emerald);
}

.toast.error {
  border-left: 4px solid var(--accent-rose);
}

.toast.info {
  border-left: 4px solid var(--accent-cyan);
}

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

/* IMEI Generator Styling */
.preset-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1.15rem;
  background: rgba(255, 255, 255, 0.02);
  padding: 0.85rem;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-color);
}

.preset-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.preset-title-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.preset-actions-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.preset-dropdown-container select {
  padding: 0.5rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 500;
  border-color: var(--border-color);
  background-color: var(--bg-card);
  cursor: pointer;
  border-radius: var(--radius-md);
}

.preset-brand-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.15rem;
}

.btn-brand-tab {
  padding: 0.22rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.btn-brand-tab:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: var(--primary-border);
}

.btn-brand-tab.active {
  background: var(--primary-light);
  border-color: var(--primary-border);
  color: var(--primary);
  font-weight: 700;
}

.preset-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  max-height: 150px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.preset-buttons::-webkit-scrollbar {
  width: 5px;
}

.preset-buttons::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

.preset-chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.55rem;
  font-size: 0.72rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.preset-chip-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-border);
  transform: translateY(-1px);
}

.preset-chip-btn.active {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.45);
  font-weight: 600;
}

.imei-decoder-box input:focus {
  border-color: #c084fc;
  box-shadow: 0 0 0 3px rgba(192, 132, 252, 0.15);
}

/* Server Clock Styles */
.server-clock-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
}

.server-clock-pill:hover {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.45);
}

.clock-pulsing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
  animation: pulseDot 2s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
}

.server-clock-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.server-clock-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: 0.03em;
}

.server-clock-date {
  font-size: 0.65rem;
  color: var(--text-dim);
}

/* Big Clock Display in Tab 5 */
.server-big-clock-box {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.08), rgba(16, 185, 129, 0.05));
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.25rem;
  text-align: center;
  margin-bottom: 1rem;
  position: relative;
  overflow: hidden;
}

.server-big-clock-box::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(52, 211, 153, 0.5), transparent);
}

.big-clock-day {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.big-clock-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 3rem;
  font-weight: 800;
  color: var(--accent-emerald);
  margin: 0.25rem 0;
  letter-spacing: 0.05em;
}

.big-clock-date {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-main);
}

.big-clock-badge {
  display: inline-block;
  margin-top: 0.6rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--bg-card-subtle);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
}

.clock-sync-meta {
  display: flex;
  justify-content: space-between;
  background: var(--bg-card-subtle);
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  font-size: 0.78rem;
}

.clock-sync-meta strong {
  color: var(--accent-emerald);
  font-family: 'JetBrains Mono', monospace;
}

/* Riwayat Cards Styling */
.riwayat-cards-container h4 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
}

.riwayat-cards-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.riwayat-card-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.riwayat-card-item:hover {
  border-color: var(--border-focus);
}

.riwayat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.5rem;
}

.riwayat-date-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.riwayat-verified-tag {
  font-size: 0.68rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.riwayat-times-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 640px) {
  .riwayat-times-grid {
    grid-template-columns: 1fr;
  }
}

.riwayat-box {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  transition: var(--transition);
}

.riwayat-box.datang {
  border-left: 3px solid var(--primary);
  background: var(--primary-light);
}

.riwayat-box.pulang {
  border-left: 3px solid #8b5cf6;
  background: rgba(139, 92, 246, 0.08);
}

.riwayat-box-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.riwayat-box-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.riwayat-box-meta {
  font-size: 0.72rem;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.riwayat-box-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Kartu Aksi Download Riwayat Kehadiran (Mirip Aplikasi Mobile Pusat) */
.download-riwayat-card-action {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(16, 185, 129, 0.08));
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.download-riwayat-card-action::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #3b82f6, #10b981, #06b6d4);
  opacity: 0.8;
}

.download-riwayat-card-action:hover {
  transform: translateY(-2px);
  border-color: rgba(59, 130, 246, 0.65);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.18), rgba(16, 185, 129, 0.14));
  box-shadow: 0 8px 25px rgba(37, 99, 235, 0.22);
}

.download-riwayat-card-action:active {
  transform: translateY(0);
}

.dl-riwayat-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #2563eb, #10b981);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
  transition: transform 0.25s ease;
}

.download-riwayat-card-action:hover .dl-riwayat-icon {
  transform: scale(1.06);
}

.dl-riwayat-info {
  flex: 1;
  min-width: 0;
}

.dl-riwayat-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dl-riwayat-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.dl-riwayat-desc strong {
  color: #60a5fa;
}

.dl-riwayat-badge {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.35);
  transition: all 0.2s ease;
  user-select: none;
}

.download-riwayat-card-action:hover .dl-riwayat-badge:not(.loading):not(.downloaded) {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.5);
  transform: scale(1.02);
}

.dl-riwayat-badge.downloaded {
  background: linear-gradient(135deg, #059669, #10b981);
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.35);
}

.dl-riwayat-badge.loading {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-main);
  box-shadow: none;
}

/* ==========================================
   MODERN RIWAYAT LAYOUT & TABLE STYLES (THEME AWARE)
   ========================================== */
.riwayat-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.riwayat-kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.riwayat-kpi-card:hover {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.riwayat-kpi-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.riwayat-kpi-val {
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.2;
}

.riwayat-kpi-card.kpi-total {
  border-left: 4px solid var(--primary);
  background: var(--bg-card-subtle);
}
.riwayat-kpi-card.kpi-total .riwayat-kpi-val { color: var(--primary); }

.riwayat-kpi-card.kpi-ontime {
  border-left: 4px solid var(--accent-emerald);
  background: var(--bg-card-subtle);
}
.riwayat-kpi-card.kpi-ontime .riwayat-kpi-val { color: var(--accent-emerald); }

.riwayat-kpi-card.kpi-tl {
  border-left: 4px solid var(--accent-amber);
  background: var(--bg-card-subtle);
}
.riwayat-kpi-card.kpi-tl .riwayat-kpi-val { color: var(--accent-amber); }

.riwayat-kpi-card.kpi-psw {
  border-left: 4px solid var(--accent-cyan);
  background: var(--bg-card-subtle);
}
.riwayat-kpi-card.kpi-psw .riwayat-kpi-val { color: var(--accent-cyan); }

/* Full Width Display Card */
.riwayat-full-table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-top: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.riwayat-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-color);
}

.riwayat-month-pills-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  overflow-x: auto;
  padding-bottom: 0.35rem;
  max-width: 100%;
}

.month-pill-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.month-pill-btn:hover {
  border-color: var(--border-focus);
  color: var(--text-main);
  background: var(--bg-card-hover);
}

.month-pill-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 6px var(--primary-glow);
  font-weight: 700;
}

.riwayat-view-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-view-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.btn-view-toggle:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
}

.btn-view-toggle.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

/* Modern Attendance Table (Theme Aware) */
.riwayat-table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

.riwayat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  text-align: left;
}

.riwayat-table th {
  background: var(--table-th-bg);
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  padding: 0.85rem 1rem;
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}

.riwayat-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--table-td-border);
  color: var(--text-main);
  vertical-align: middle;
  background: var(--bg-card);
}

.riwayat-table tr:hover td {
  background: var(--table-tr-hover);
}

.time-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: 'JetBrains Mono', Consolas, monospace;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sm);
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.time-chip.in {
  color: var(--primary);
  background: var(--primary-light);
  border-color: var(--primary-border);
}

.time-chip.out {
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.12);
  border-color: rgba(6, 182, 212, 0.3);
}

.date-cell-group {
  display: flex;
  flex-direction: column;
}

.date-cell-main {
  font-weight: 700;
  color: var(--text-main);
}

.date-cell-sub {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.badge-tl {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-ontime {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-psw {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  background: rgba(124, 58, 237, 0.15);
  color: #a78bfa;
  border: 1px solid rgba(124, 58, 237, 0.3);
}

/* Pagination Controls */
.riwayat-pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.pagination-btn-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.pagination-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.pagination-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.pagination-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: var(--bg-card-subtle);
  border-color: var(--border-color);
  color: var(--text-dim);
}

/* Cards Grid View (Theme Aware) */
.riwayat-cards-grid-modern {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 0.85rem;
}

.riwayat-card-modern {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.95rem;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  box-shadow: var(--shadow-sm);
}

.riwayat-card-modern:hover {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.rc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.rc-date-box {
  display: flex;
  flex-direction: column;
}

.rc-day {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.rc-date {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.rc-badges {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.rc-body {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.rc-time-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
}

.rc-time-row.in {
  border-left: 3px solid var(--primary);
}

.rc-time-row.out {
  border-left: 3px solid var(--accent-cyan);
}

.rc-time-col {
  display: flex;
  flex-direction: column;
}

.rc-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
}

.rc-time {
  font-family: 'JetBrains Mono', Consolas, monospace;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
}

.rc-meta-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  max-width: 65%;
  text-align: right;
}

.rc-shift {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.rc-loc {
  font-size: 0.72rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

@media (max-width: 768px) {
  .riwayat-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .riwayat-cards-grid-modern {
    grid-template-columns: 1fr;
  }
}

/* ========================================================
   LEAFLET MAP & 50M GEOFENCE INTERACTIVE STYLING
   ======================================================== */
.map-interactive-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

#absenMapContainer {
  background: #f1f5f9;
  position: relative;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* Penyesuaian tema gelap untuk OpenStreetMap Leaflet Tiles */
.leaflet-container {
  font-family: 'Inter', -apple-system, sans-serif !important;
  background: #f1f5f9 !important;
}

.leaflet-tile {
  filter: none !important;
}

.leaflet-bar {
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
  border-radius: var(--radius-sm) !important;
  overflow: hidden;
}

.leaflet-bar a {
  background-color: #ffffff !important;
  color: #1e293b !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

.leaflet-bar a:hover {
  background-color: #f8fafc !important;
  color: #2563eb !important;
}

/* Custom Marker: Titik Pusat Kantor */
.leaflet-office-pin-wrapper {
  background: transparent;
  border: none;
}

.leaflet-office-pin {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  cursor: default;
}

.leaflet-office-pin .pin-badge {
  background: #ffffff;
  color: #0369a1;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  border: 1px solid #bae6fd;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  white-space: nowrap;
  letter-spacing: 0.02em;
  margin-bottom: 2px;
}

.leaflet-office-pin .pin-core {
  width: 14px;
  height: 14px;
  background: #0284c7;
  border: 2px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(2, 132, 199, 0.5);
}

/* Custom Marker: Titik Kehadiran Pengguna (Bisa Digeser) */
.leaflet-user-pin-wrapper {
  background: transparent;
  border: none;
}

.leaflet-user-pin {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: grab;
  position: relative;
  transition: transform 0.15s ease;
}

.leaflet-user-pin:active {
  cursor: grabbing;
  transform: scale(1.12);
}

.leaflet-user-pin .user-pin-glow {
  position: absolute;
  top: 10px;
  width: 32px;
  height: 32px;
  background: rgba(225, 29, 72, 0.2);
  border-radius: 50%;
  animation: pulsePinGlow 2s infinite ease-out;
  pointer-events: none;
}

@keyframes pulsePinGlow {
  0% { transform: scale(0.6); opacity: 0.9; }
  100% { transform: scale(1.8); opacity: 0; }
}

.leaflet-user-pin .user-pin-marker {
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.25));
  z-index: 2;
  display: flex;
  justify-content: center;
}

.leaflet-user-pin .user-pin-badge {
  background: #e11d48;
  color: #fff;
  font-size: 0.6rem;
  font-weight: 800;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  letter-spacing: 0.04em;
  margin-top: -3px;
  z-index: 3;
}

/* ========================================================
   MODUL PENGELOLAAN USER & MODAL KONFIRMASI HAPUS
   ======================================================== */
.user-mgmt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.user-mgmt-table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.badge-user-active {
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.badge-user-saved {
  background: var(--bg-card-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
}

.btn-user-switch {
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  color: var(--primary);
  padding: 0.35rem 0.75rem;
  font-size: 0.76rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.btn-user-switch:hover {
  background: var(--primary);
  color: #ffffff;
}

.btn-user-delete {
  background: rgba(225, 29, 72, 0.1);
  border: 1px solid rgba(225, 29, 72, 0.25);
  color: var(--accent-rose);
  padding: 0.35rem 0.75rem;
  font-size: 0.76rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.btn-user-delete:hover {
  background: var(--accent-rose);
  color: #ffffff;
}

/* Modal Konfirmasi Hapus */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 440px;
  padding: 1.5rem;
  animation: slideDown 0.2s ease-out;
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.modal-icon-danger {
  width: 40px;
  height: 40px;
  background: #fef2f2;
  color: #dc2626;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid #fecaca;
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-body {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 1.25rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}






