:root {
  --bg-color: #0b0813;
  --card-bg: rgba(22, 18, 38, 0.65);
  --card-glow: rgba(139, 92, 246, 0.03);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(139, 92, 246, 0.35);

  --primary-gradient: linear-gradient(135deg, #a78bfa, #7c3aed, #4c1d95);
  --success-gradient: linear-gradient(135deg, #34d399, #10b981, #065f46);
  --warning-gradient: linear-gradient(135deg, #fbbf24, #f59e0b, #78350f);
  --danger-gradient: linear-gradient(135deg, #fb7185, #f43f5e, #9f1239);

  --color-primary: #a78bfa;
  --color-success: #10b981;
  --color-warning: #fbbf24;
  --color-danger: #f43f5e;
  --color-info: #3b82f6;

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dark: #0f172a;

  --font-display: 'Outfit', 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-body: 'Plus Jakarta Sans', system-ui, sans-serif;

  --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --glass-blur: blur(16px);
  --border-radius-lg: 16px;
  --border-radius-md: 10px;
}

body.light-theme {
  --bg-color: #f4f5f8;
  --card-bg: rgba(255, 255, 255, 0.75);
  --card-glow: rgba(124, 58, 237, 0.015);
  --border-color: rgba(15, 23, 42, 0.08);
  --border-hover: rgba(124, 58, 237, 0.35);

  --primary-gradient: linear-gradient(135deg, #7c3aed, #6d28d9, #4c1d95);
  --success-gradient: linear-gradient(135deg, #10b981, #059669, #064e3b);
  --warning-gradient: linear-gradient(135deg, #f59e0b, #d97706, #78350f);
  --danger-gradient: linear-gradient(135deg, #f43f5e, #e11d48, #9f1239);

  --color-primary: #6d28d9;
  --color-success: #059669;
  --color-warning: #d97706;
  --color-danger: #e11d48;
  --color-info: #2563eb;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dark: #f8fafc;

  --shadow-premium: 0 8px 32px 0 rgba(31, 38, 135, 0.05);
}

body.light-theme .orb {
  opacity: 0.06;
}

body.light-theme input,
body.light-theme select,
body.light-theme textarea {
  background: rgba(15, 23, 42, 0.02) !important;
  color: #0f172a !important;
}

body.light-theme input:focus,
body.light-theme select:focus,
body.light-theme textarea:focus {
  background: rgba(15, 23, 42, 0.04) !important;
}

body.light-theme .app-header {
  background: rgba(244, 245, 248, 0.8) !important;
}

body.light-theme #activeUserLabel {
  color: #0f172a !important;
}

body.light-theme h2,
body.light-theme h3,
body.light-theme h4,
body.light-theme h5 {
  color: #0f172a !important;
}

body.light-theme select option {
  background-color: #ffffff !important;
  color: #111111 !important;
}

body.light-theme .card h3 {
  color: #0f172a !important;
}

body.light-theme .badge-warning {
  color: #78350f !important;
  background: rgba(245, 158, 11, 0.15) !important;
}

body.light-theme .badge-info {
  color: #1e3a8a !important;
  background: rgba(59, 130, 246, 0.15) !important;
}

body.light-theme #themeToggleBtn {
  background: rgba(15, 23, 42, 0.05) !important;
  color: #0f172a !important;
}

body.light-theme .btn-reset {
  background: rgba(15, 23, 42, 0.04) !important;
  color: #0f172a !important;
  border-color: rgba(15, 23, 42, 0.1) !important;
}

body.light-theme .btn-reset:hover {
  background: rgba(15, 23, 42, 0.08) !important;
  border-color: rgba(15, 23, 42, 0.2) !important;
}

body.light-theme ::placeholder {
  color: #64748b !important;
  opacity: 0.75 !important;
}

body.light-theme .table tbody tr:hover td {
  background: rgba(15, 23, 42, 0.02) !important;
  color: #0f172a !important;
}

body.light-theme .login-overlay {
  background: rgba(244, 245, 248, 0.65) !important; /* Semi-transparan agar floating orbs di background terlihat */
}

body.light-theme .login-card {
  background: rgba(255, 255, 255, 0.75) !important; /* Glassmorphic card terang */
  backdrop-filter: blur(30px) !important;
  -webkit-backdrop-filter: blur(30px) !important;
  border: none !important; /* Menghilangkan border agar card menyatu lembut */
  box-shadow:
    0 20px 40px -10px rgba(15, 23, 42, 0.05),
    0 10px 20px -12px rgba(124, 58, 237, 0.08),
    0 0 40px rgba(0, 0, 0, 0.02) !important; /* Soft ambient shadows */
}

body.light-theme .login-card .card-glow {
  background: var(--primary-gradient) !important;
  opacity: 0.85 !important;
}

body.light-theme .login-header h2 {
  color: #0f172a !important;
}

body.light-theme .brand-name .highlight,
body.light-theme .login-header h2 .highlight {
  background: linear-gradient(to right, #7c3aed, #4facfe) !important; /* Gradien ungu-biru kontras tinggi untuk light mode */
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
}

body.light-theme .login-form .form-group label {
  color: var(--text-muted) !important;
}

body.light-theme .login-form .form-group input {
  background: rgba(15, 23, 42, 0.03) !important;
  border: 1px solid rgba(15, 23, 42, 0.08) !important;
  color: #0f172a !important;
}

body.light-theme .login-form .form-group input:focus {
  background: #ffffff !important;
  border-color: #7c3aed !important;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.1) !important;
}

body.light-theme #bypassLoginToTrack {
  color: var(--color-primary) !important;
}

body.light-theme #bypassLoginToTrack:hover {
  color: #4c1d95 !important;
}

body.light-theme .login-footer-info {
  border-top-color: rgba(15, 23, 42, 0.08) !important;
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-body);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Background floating glowing orbs */
.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(140px);
  opacity: 0.15;
  z-index: -1;
  pointer-events: none;
  animation: float 25s infinite alternate;
}

.orb-1 {
  width: 500px;
  height: 500px;
  background-color: #6d28d9;
  top: -10%;
  left: -10%;
}

.orb-2 {
  width: 450px;
  height: 450px;
  background-color: #0d9488;
  bottom: -5%;
  right: -5%;
  animation-delay: -5s;
}

.orb-3 {
  width: 350px;
  height: 350px;
  background-color: #be185d;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -10s;
}

@keyframes float {
  0% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(30px, -40px) scale(1.1);
  }
  100% {
    transform: translate(-20px, 20px) scale(0.95);
  }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(11, 8, 19, 0.8);
}
::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.3);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 92, 246, 0.6);
}

/* App Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 2rem;
  background: rgba(15, 12, 30, 0.6);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: var(--primary-gradient);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: #fff;
  box-shadow: 0 0 15px rgba(124, 58, 237, 0.4);
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.5px;
}

.brand-name .highlight,
.login-header h2 .highlight {
  background: linear-gradient(to right, #c084fc, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.role-selector-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.5rem 1rem;
  border-radius: 30px;
  border: 1px solid var(--border-color);
}

.role-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.role-select {
  background: transparent;
  color: #fff;
  border: none;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  padding-right: 0.5rem;
}

.role-select option {
  background-color: #ffffff !important;
  color: #111111 !important;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.live-clock {
  font-family: monospace;
  font-size: 0.95rem;
  font-weight: bold;
  background: rgba(139, 92, 246, 0.15);
  color: var(--color-primary);
  border: 1px solid rgba(139, 92, 246, 0.2);
  padding: 0.4rem 0.8rem;
  border-radius: var(--border-radius-md);
}

/* Base App Layout */
.app-container {
  max-width: 1300px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Premium Card Design */
.card {
  background: var(--card-bg);
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--border-color);
  padding: 1.75rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-premium);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 10px 40px 0 rgba(124, 58, 237, 0.08), var(--shadow-premium);
}

.card-glow {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--primary-gradient);
}

.card h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.card h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

/* Buttons */
.btn {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.65rem 1.25rem;
  border-radius: var(--border-radius-md);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.btn-primary {
  background: var(--primary-gradient);
  color: #fff;
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.5);
}

.btn-success {
  background: var(--success-gradient);
  color: #fff;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}
.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

.btn-warning {
  background: var(--warning-gradient);
  color: #fff;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}
.btn-warning:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);
}

.btn-reset {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}
.btn-reset:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--text-muted);
}

.btn-large {
  padding: 0.9rem 1.5rem;
  font-size: 1rem;
}

.full-width {
  width: 100%;
}

/* Grids and Columns */
.grid-2-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .grid-2-col {
    grid-template-columns: 1fr;
  }
  .app-header {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }
}

/* Public Tracking Portal */
.search-bar-wrapper {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

.input-icon-wrapper {
  position: relative;
  flex: 1;
}

.search-icon {
  position: absolute;
  left: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-primary);
  font-size: 1.1rem;
}

.input-icon-wrapper input {
  width: 100%;
  padding: 0.9rem 1rem 0.9rem 3rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition: all 0.3s ease;
}

.input-icon-wrapper input:focus {
  border-color: var(--color-primary);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.15);
}

/* Search Results Area */
.search-results {
  margin-top: 1.5rem;
  border-top: 1px dashed var(--border-color);
  padding-top: 1.5rem;
  animation: fadeIn 0.4s ease forwards;
}

.result-card {
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
  padding: 1.25rem;
}

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

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

.result-header h4 {
  font-size: 1.2rem;
  font-family: var(--font-display);
}

.result-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.detail-lbl {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.detail-val {
  font-size: 0.95rem;
  font-weight: 600;
}

/* Tracking Timeline */
.timeline {
  display: flex;
  justify-content: space-between;
  position: relative;
  margin: 2rem 0;
  padding: 0 1rem;
}

.timeline-line {
  position: absolute;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  top: 15px;
  left: 2rem;
  right: 2rem;
  z-index: 1;
}

.timeline-progress {
  position: absolute;
  height: 4px;
  background: var(--primary-gradient);
  top: 15px;
  left: 2rem;
  z-index: 2;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.timeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 3;
  width: 90px;
}

.step-node {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #1e1b38;
  border: 3px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: all 0.3s ease;
}

.step-lbl {
  margin-top: 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-align: center;
  color: var(--text-muted);
  transition: color 0.3s ease;
}

.timeline-step.active .step-node {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  box-shadow: 0 0 15px var(--color-primary);
}

.timeline-step.active .step-lbl {
  color: var(--text-main);
}

.timeline-step.completed .step-node {
  background: var(--color-success);
  border-color: var(--color-success);
  color: #fff;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

.timeline-step.completed .step-lbl {
  color: var(--color-success);
}

/* For small screens, make timeline responsive */
@media (max-width: 768px) {
  .timeline {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
    padding-left: 2rem;
  }
  .timeline-line {
    width: 4px;
    height: 90%;
    top: 5px;
    left: 2.15rem;
  }
  .timeline-progress {
    width: 4px;
    top: 5px;
    left: 2.15rem;
    transition: height 0.6s ease;
  }
  .timeline-step {
    flex-direction: row;
    width: auto;
    gap: 1rem;
  }
  .step-lbl {
    margin-top: 0;
    text-align: left;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-group.full-width {
    grid-column: span 1;
  }
  .app-container {
    padding: 1rem 0.75rem;
    gap: 1rem;
  }
  .card {
    padding: 1.25rem 1rem;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
}

/* Owner Panel: Statistics Dashboard */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}

.stats-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.5rem;
}

.stats-icon {
  width: 50px;
  height: 50px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stats-data {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.stats-val {
  font-size: 1.5rem;
  font-weight: 800;
  font-family: var(--font-display);
}

.stats-title {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Alert Leakage section */
.alert-section {
  border-left: 5px solid var(--color-danger);
  background: rgba(244, 63, 94, 0.05);
}
.alert-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}
.alert-header i {
  font-size: 2rem;
  color: var(--color-danger);
  animation: pulse 1.5s infinite;
}
.alert-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.7; }
  100% { transform: scale(1); opacity: 1; }
}

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

.leak-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(244, 63, 94, 0.2);
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius-md);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.leak-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  font-size: 0.65rem;
  font-weight: bold;
  border-radius: 4px;
  text-transform: uppercase;
}

.badge-danger {
  background: rgba(244, 63, 94, 0.15);
  color: var(--color-danger);
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--color-warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--color-success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-info {
  background: rgba(59, 130, 246, 0.15);
  color: var(--color-info);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.leak-time {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-danger);
}

/* Tables */
.table-container {
  width: 100%;
  overflow-x: auto;
  margin-top: 0.5rem;
}

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

.table th {
  border-bottom: 2px solid var(--border-color);
  padding: 0.75rem 0.5rem;
  color: var(--text-muted);
  font-weight: 600;
}

.table td {
  padding: 0.85rem 0.5rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-main);
}

/* Financial summary area */
.financial-summary {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.fin-item {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
  align-items: center;
}

.highlight-fin {
  background: rgba(139, 92, 246, 0.08);
  border-color: rgba(139, 92, 246, 0.3);
}

.fin-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.fin-val {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

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

.form-group.full-width {
  grid-column: span 2;
}

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

.form-group input {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 0.65rem 0.85rem;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.85rem;
  outline: none;
  transition: all 0.3s ease;
}

.form-group select {
  background: #161226; /* Solid dark background to force browser to render dark option list */
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 0.65rem 0.85rem;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.85rem;
  outline: none;
  transition: all 0.3s ease;
}

.form-group input:focus, .form-group select:focus {
  border-color: var(--color-primary);
  background: rgba(255, 255, 255, 0.06);
}

.form-group select option, select option {
  background-color: #ffffff !important;
  color: #111111 !important;
}


/* Tabs */
.tab-buttons {
  display: flex;
  background: rgba(255, 255, 255, 0.03);
  padding: 0.25rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  margin-bottom: 1.25rem;
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.5rem;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: var(--primary-gradient);
  color: #fff;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}

.tab-content {
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Checklists & Lists */
.doc-checklist-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.15);
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  border-radius: 6px;
  transition: background 0.2s;
  cursor: pointer;
}

.checkbox-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.checkbox-item input {
  accent-color: var(--color-primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.checkbox-label {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 0.8rem;
  align-items: center;
}

.checkbox-subtext {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Pickup List */
.pickup-list-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 350px;
  overflow-y: auto;
}

.pickup-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pickup-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.pickup-title {
  font-size: 0.85rem;
  font-weight: 700;
}

.pickup-subtitle {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.pickup-balance {
  font-size: 0.85rem;
  font-weight: bold;
}

/* Batches incoming list */
.batches-list-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.batch-item {
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--border-radius-md);
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.batch-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.batch-title {
  font-size: 0.95rem;
  font-weight: 800;
  font-family: var(--font-display);
}

.batch-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  gap: 1rem;
}

/* Real-Time Logs Section */
.logs-section {
  margin-top: 1rem;
}

.logs-container {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  height: 250px;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.log-row {
  font-family: monospace;
  font-size: 0.75rem;
  line-height: 1.4;
  padding: 0.4rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.01);
  border-left: 3px solid var(--border-color);
  display: flex;
  gap: 0.5rem;
}

.log-row.REGISTER_DOCUMENT { border-left-color: var(--color-info); }
.log-row.CREATE_BATCH { border-left-color: var(--color-primary); }
.log-row.RECEIVE_BATCH { border-left-color: var(--color-success); }
.log-row.FRAUD_ALERT { border-left-color: var(--color-danger); background: rgba(244, 63, 94, 0.05); }

.log-time {
  color: var(--text-muted);
  flex-shrink: 0;
}

.log-body {
  color: var(--text-main);
  flex-grow: 1;
}

.log-op {
  color: var(--color-primary);
  flex-shrink: 0;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  padding-top: 80px;
}

.modal-content {
  margin: auto;
  max-width: 700px;
  width: 90%;
  animation: slideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
  margin-bottom: 1.25rem;
}

.close-btn {
  color: var(--text-muted);
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.2s;
}

.close-btn:hover {
  color: var(--text-main);
}

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

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Detail Modal Styles */
.history-flow {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.25rem;
  position: relative;
  padding-left: 1.5rem;
}

.history-flow::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 5px;
  bottom: 5px;
  width: 2px;
  background: var(--border-color);
}

.history-node {
  position: relative;
}

.history-node::before {
  content: '';
  position: absolute;
  left: -24px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #1e1b38;
  border: 2px solid var(--color-primary);
}

.history-node.completed::before {
  border-color: var(--color-success);
  background: var(--color-success);
}

.history-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.history-msg {
  font-size: 0.85rem;
  font-weight: 500;
  margin-top: 0.15rem;
}

/* Helpers */
.hidden { display: none !important; }
.text-primary { color: var(--color-primary) !important; }
.text-success { color: var(--color-success) !important; }
.text-warning { color: var(--color-warning) !important; }
.text-danger { color: var(--color-danger) !important; }
.text-emerald { color: #10b981 !important; }

/* Alert layout for verify screen */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius-md);
  border: 1px solid transparent;
}
.alert-warning {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.2);
  color: var(--color-warning);
}
.alert-danger {
  background: rgba(244, 63, 94, 0.1);
  border-color: rgba(244, 63, 94, 0.2);
  color: var(--color-danger);
}

/* QR Code Mockup in receipt */
.qr-mockup {
  width: 80px;
  height: 80px;
  background: #fff;
  padding: 5px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.qr-mockup img {
  width: 100%;
  height: 100%;
}

.receipt-card {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  background: rgba(255,255,255,0.02);
  padding: 1rem;
  border-radius: var(--border-radius-md);
  border: 1px dashed var(--border-color);
  margin-bottom: 1.25rem;
}

/* Footer layout */
.app-footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  margin-top: 3rem;
  background: rgba(15, 12, 30, 0.4);
}

/* Login Page Overlay */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(11, 8, 19, 0.88);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.login-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.login-card {
  width: 100%;
  max-width: 440px;
  padding: 2.5rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 40px rgba(139, 92, 246, 0.1);
  background: rgba(22, 18, 38, 0.85);
  border-radius: var(--border-radius-lg);
  animation: slideUpLogin 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.login-header {
  text-align: center;
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.login-header .logo-icon {
  margin-bottom: 0.5rem;
}

.login-header h2 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 0;
}

.login-form .form-group label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.login-form .form-group label i {
  color: var(--color-primary);
  margin-right: 0.25rem;
}

.login-form .form-group input {
  width: 100%;
  padding: 0.8rem 1rem;
  font-size: 0.95rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  color: var(--text-main);
  transition: all 0.3s;
}

.login-form .form-group input:focus {
  border-color: var(--color-primary);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.25);
}

/* Print CSS */
@media print {
  body {
    background: #fff !important;
    color: #000 !important;
  }

  /* Hide interactive elements during print */
  .app-header,
  .app-footer,
  .btn,
  .btn-reset,
  .btn-success,
  .btn-primary,
  .btn-warning,
  .role-selector-container,
  .header-actions,
  .owner-controls-bar,
  .tracking-portal,
  .alert-section,
  .logs-section,
  #whatsappSettingsForm,
  #whatsappSettingsForm input,
  #whatsappSettingsForm button,
  .card-glow,
  .orb {
    display: none !important;
  }

  /* Force display of Owner view contents in a single printable page */
  #ownerView {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .app-container {
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
    background: transparent !important;
  }

  .card {
    background: transparent !important;
    border: 1px solid #ddd !important;
    box-shadow: none !important;
    color: #000 !important;
    padding: 1.25rem !important;
    margin-bottom: 1.5rem !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  .card h2, .card h3 {
    color: #000 !important;
    border-bottom: 1px solid #ddd !important;
    padding-bottom: 0.5rem !important;
    font-size: 1.2rem !important;
  }

  .section-desc {
    color: #555 !important;
  }

  .stats-card {
    border: 1px solid #ddd !important;
    background: transparent !important;
    color: #000 !important;
  }

  .stats-val {
    color: #000 !important;
    font-size: 1.25rem !important;
  }

  .stats-title {
    color: #555 !important;
  }

  .table {
    color: #000 !important;
  }

  .table th {
    color: #000 !important;
    border-bottom: 2px solid #000 !important;
  }

  .table td {
    color: #000 !important;
    border-bottom: 1px solid #ddd !important;
  }

  .fin-item {
    background: transparent !important;
    border: 1px solid #ddd !important;
    color: #000 !important;
  }

  .highlight-fin {
    border: 1px solid #000 !important;
  }

  .fin-label, .fin-val {
    color: #000 !important;
  }

  .text-primary, .text-success, .text-warning, .text-danger, .text-emerald {
    color: #000 !important;
  }
}


.modal.show {
  display: block;
}

/* Flashing Red Banner */
.fraud-banner {
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.9), rgba(185, 28, 28, 0.9));
  border: 1px solid rgba(248, 113, 113, 0.4);
  border-radius: 12px;
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.3);
  animation: pulse-danger-border 2s infinite ease-in-out;
}

.fraud-banner-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
}

.flashing-icon {
  font-size: 1.25rem;
  color: #fff;
  animation: flash-icon 1s infinite alternate;
}

@keyframes pulse-danger-border {
  0% {
    box-shadow: 0 0 5px rgba(239, 68, 68, 0.4);
    border-color: rgba(248, 113, 113, 0.3);
  }
  50% {
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.7);
    border-color: rgba(248, 113, 113, 0.8);
  }
  100% {
    box-shadow: 0 0 5px rgba(239, 68, 68, 0.4);
    border-color: rgba(248, 113, 113, 0.3);
  }
}

@keyframes flash-icon {
  0% {
    opacity: 0.3;
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1.1);
  }
}

/* ==================== ALERT PULSE & TOAST BANNER (BARU) ==================== */
.tab-btn.alert-pulse {
  position: relative;
  animation: tab-pulse-orange 1.5s infinite ease-in-out;
  border: 1px solid #f59e0b !important;
  color: var(--text-main) !important;
}

@keyframes tab-pulse-orange {
  0% {
    box-shadow: 0 0 5px rgba(245, 158, 11, 0.4);
    background-color: rgba(245, 158, 11, 0.05);
  }
  50% {
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.8);
    background-color: rgba(245, 158, 11, 0.25);
  }
  100% {
    box-shadow: 0 0 5px rgba(245, 158, 11, 0.4);
    background-color: rgba(245, 158, 11, 0.05);
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(120%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(120%);
    opacity: 0;
  }
}

/* Switch Toggle Styles untuk Telegram Backup */
.switch-toggle {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}
.switch-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider-round {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  transition: .4s;
  border-radius: 34px;
}
.slider-round:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #a7f3d0;
  transition: .4s;
  border-radius: 50%;
}
.switch-toggle input:checked + .slider-round {
  background-color: #0088cc;
  border-color: #0088cc;
}
.switch-toggle input:checked + .slider-round:before {
  transform: translateX(24px);
  background-color: #fff;
}

/* Password Toggle Visibility Utility */
.password-toggle-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.password-toggle-wrapper input {
  padding-right: 2.75rem !important;
  width: 100%;
}
.btn-toggle-password {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
  z-index: 5;
  outline: none;
}
.btn-toggle-password:hover {
  color: var(--text-main);
}

/* QRIS Specific Styles */
#brandAppQrisPreview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.qris-pay-container {
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 1.5rem;
  text-align: center;
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  animation: fadeIn 0.4s ease;
}

.qris-barcode-wrapper {
  background: #fff;
  padding: 1rem;
  border-radius: var(--border-radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-premium);
  width: 220px;
  height: 220px;
}

.qris-barcode-wrapper img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.qris-meta-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

#qrisTransactionsCard table tbody tr td {
  vertical-align: middle;
}

