/* ==========================================================================
   style.css — Sistem UI Responsif & Modern Pemeliharaan APAR / FSS
   Dirancang untuk Mobile (HP) & Desktop
   ========================================================================== */

:root {
  /* Nuansa MyBirawa: Merah, Putih, & Orange (Mode Terang) */
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-inner: #f1f5f9;
  --bg-input: #ffffff;
  --border: #e2e8f0;
  --border-subtle: #f1f5f9;
  --border-focus: #dc2626;
  
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;
  
  --primary: #dc2626;
  --primary-hover: #b91c1c;
  --secondary: #ea580c;
  --secondary-hover: #c2410c;
  --accent: #f97316;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --warning: #f59e0b;
  
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --radius-full: 9999px;
  
  --shadow-card: 0 4px 20px -2px rgba(220, 38, 38, 0.08), 0 2px 8px -1px rgba(0, 0, 0, 0.05);
  --shadow-btn: 0 4px 14px rgba(220, 38, 38, 0.28);
}

/* Mode Gelap (Dark Mode) - Nuansa MyBirawa Dark */
[data-theme="dark"] {
  --bg-body: #0a0e17;
  --bg-card: #121929;
  --bg-card-inner: #0b1120;
  --bg-input: #0a0e17;
  --border: #233048;
  --border-subtle: #1a2438;
  --border-focus: #ef4444;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --primary: #ef4444;
  --primary-hover: #dc2626;
  --secondary: #ea580c;
  --secondary-hover: #c2410c;
  --accent: #f97316;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --warning: #f59e0b;
  
  --shadow-card: 0 10px 30px -5px rgba(0, 0, 0, 0.6), 0 4px 6px -2px rgba(0, 0, 0, 0.5);
  --shadow-btn: 0 4px 14px rgba(239, 68, 68, 0.35);
}

.btn-theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card-inner);
  color: var(--text-main);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.btn-theme-toggle:hover {
  background: var(--bg-input);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.header-actions .btn-theme-toggle {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.header-actions .btn-theme-toggle:hover {
  background: #ffffff;
  color: #dc2626;
  border-color: #ffffff;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  min-height: 100vh;
  background-color: var(--bg-body);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px;
  padding-bottom: 40px;
}

@media (min-width: 640px) {
  body {
    padding: 20px;
    padding-bottom: 48px;
  }
}

@media (min-width: 1024px) {
  body {
    padding: 32px 24px;
  }
}

/* ===========================================================
   App Layout Containers
   =========================================================== */
.app-container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ===========================================================
   Cards & Surfaces
   =========================================================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
  width: 100%;
}

@media (min-width: 640px) {
  .card {
    padding: 24px;
  }
}

/* ===========================================================
   Typography
   =========================================================== */
h1 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

h3 {
  font-size: 0.92rem;
  font-weight: 700;
  color: #cbd5e1;
  margin: 18px 0 8px 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.hint {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* ===========================================================
   Standard Form Inputs & Controls
   =========================================================== */
.form-group {
  margin-bottom: 14px;
}

label {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-main);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18);
}

input::placeholder, textarea::placeholder {
  color: var(--text-dim);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

/* ===========================================================
   Specific Button Classes (No Broken Global Button Selectors)
   =========================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  width: 100%;
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(135deg, #dc2626, #ea580c);
  color: #ffffff;
  box-shadow: var(--shadow-btn);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #b91c1c, #c2410c);
  transform: translateY(-1px);
}

.btn-secondary {
  background: linear-gradient(135deg, #ea580c, #f97316);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.25);
}

.btn-secondary:hover {
  background: linear-gradient(135deg, #c2410c, #ea580c);
  transform: translateY(-1px);
}

.btn-ghost {
  background: var(--bg-card-inner);
  color: var(--text-main);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
}

.btn-danger:hover {
  background: var(--danger-hover);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
}

.btn-sm {
  width: auto;
  padding: 8px 14px;
  font-size: 0.85rem;
}

/* ===========================================================
   AUTH SCREEN (Login & Register Modal View)
   =========================================================== */
.auth-wrapper {
  width: 100%;
  max-width: 440px;
  margin: 30px auto;
  animation: fadeIn 0.3s ease-out;
}

.auth-header {
  text-align: center;
  margin-bottom: 22px;
}

.auth-logo-badge {
  width: 76px;
  height: 76px;
  background: transparent;
  border-radius: 20px;
  margin: 0 auto 14px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 28px rgba(220, 38, 38, 0.35);
  padding: 0;
  transition: all 0.3s ease;
}

[data-theme="dark"] .auth-logo-badge {
  background: transparent;
  box-shadow: 0 10px 28px rgba(239, 68, 68, 0.45);
}

.auth-logo-svg, .header-logo-svg {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.25));
}

.auth-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.auth-header h1 {
  font-size: 1.45rem;
  margin-bottom: 4px;
}

.auth-header p {
  color: var(--text-muted);
  font-size: 0.86rem;
}

/* Segmented Control for Auth Tabs */
.auth-segmented-control {
  display: flex;
  background: var(--bg-card-inner);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
  margin-bottom: 18px;
}

.auth-tab-item {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 9px 12px;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.auth-tab-item:hover {
  color: var(--text-main);
}

.auth-tab-item.active {
  background: var(--bg-card);
  color: var(--accent);
  font-weight: 700;
  border: 1px solid var(--border);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Password field with embedded toggle */
.password-box {
  position: relative;
  width: 100%;
}

.password-box input {
  padding-right: 44px;
}

.password-eye-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent !important;
  border: none !important;
  color: var(--text-muted);
  font-size: 1.15rem;
  cursor: pointer;
  padding: 6px;
  width: auto;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

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

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 18px 0;
  color: var(--text-dim);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border);
}

.auth-divider span {
  padding: 0 12px;
}

/* Google Sign-in Button */
.btn-google {
  background: #ffffff !important;
  color: #1f2937 !important;
  border: 1px solid #e5e7eb !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 10px !important;
  font-weight: 600 !important;
  font-size: 0.92rem !important;
  padding: 11px 18px !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  transition: all 0.2s ease !important;
  width: 100%;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  cursor: pointer;
}

.btn-google:hover {
  background: #f8fafc !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
  transform: translateY(-1px);
}

.btn-google:active {
  transform: translateY(0);
}

.google-icon {
  flex-shrink: 0;
}

/* Modal overlay & Google Quick Sign-in Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 440px;
  padding: 22px;
  max-height: 90vh;
  overflow-y: auto;
}

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

.btn-close-modal {
  background: transparent !important;
  border: none !important;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  width: auto !important;
  height: auto !important;
}

.btn-close-modal:hover {
  color: var(--text-main);
  background: var(--bg-input) !important;
}

.modal-card-lg {
  max-width: 580px !important;
}

.gdrive-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.gdrive-status-badge.connected {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.gdrive-status-badge.disconnected {
  background: rgba(100, 116, 139, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(100, 116, 139, 0.3);
}

.petugas-selector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.petugas-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.petugas-chip:hover {
  border-color: var(--primary);
  background: rgba(16, 185, 129, 0.08);
  transform: translateY(-1px);
}

.petugas-chip.active {
  border-color: var(--primary);
  background: rgba(16, 185, 129, 0.16);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
}

.petugas-chip-avatar {
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.petugas-chip-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gdrive-auto-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
  color: #34d399;
  font-size: 0.82rem;
  line-height: 1.4;
  margin-bottom: 14px;
}

.btn-gdrive-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--bg-input);
  border: 1px solid #10b981;
  color: #10b981;
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-gdrive-pill:hover {
  background: rgba(16, 185, 129, 0.12);
  transform: translateY(-1px);
}

.script-code-container {
  position: relative;
  margin: 12px 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #0f172a;
}

.script-code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: #1e293b;
  border-bottom: 1px solid #334155;
  font-size: 0.78rem;
  color: #94a3b8;
  font-weight: 600;
}

.btn-copy-code {
  background: #3b82f6 !important;
  color: white !important;
  border: none !important;
  padding: 4px 10px !important;
  border-radius: 6px !important;
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  cursor: pointer;
  width: auto !important;
  height: auto !important;
  transition: all 0.2s ease !important;
}

.btn-copy-code:hover {
  background: #2563eb !important;
}

.script-code-box {
  max-height: 220px;
  overflow-y: auto;
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.75rem;
  line-height: 1.5;
  color: #e2e8f0;
  white-space: pre;
  tab-size: 2;
  margin: 0;
}

.gdrive-features-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.gdrive-feat-item {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.8rem;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.google-account-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.google-account-pill:hover {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.08);
  transform: translateY(-1px);
}

.google-avatar-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #3b82f6, #60a5fa);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.google-account-info {
  flex: 1;
  text-align: left;
}

.google-account-name {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-main);
}

.google-account-email {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.google-select-arrow {
  font-size: 0.8rem;
  font-weight: 600;
  color: #3b82f6;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(59, 130, 246, 0.1);
}

.firebase-help-details {
  margin-top: 18px;
  padding: 10px 12px;
  background: var(--bg-body);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.firebase-help-details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-dim);
}

.firebase-help-body {
  margin-top: 8px;
  line-height: 1.5;
}

/* ===========================================================
   MAIN DASHBOARD HEADER
   =========================================================== */
.app-header {
  background: linear-gradient(135deg, #b91c1c 0%, #dc2626 55%, #ea580c 100%);
  border: none;
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: 0 10px 25px -5px rgba(220, 38, 38, 0.3);
  display: flex;
  flex-direction: column;
  gap: 14px;
  color: #ffffff;
}

@media (min-width: 768px) {
  .app-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
  }
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-icon {
  width: 50px;
  height: 50px;
  background: transparent;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}

.header-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.header-title-group h1 {
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 2px;
}

@media (min-width: 640px) {
  .header-title-group h1 {
    font-size: 1.4rem;
  }
}

.header-title-group p {
  font-size: 0.8rem;
  color: #fecaca;
}

.header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  color: #ffffff;
}

.user-avatar {
  width: 26px;
  height: 26px;
  background: #ffffff;
  color: #dc2626;
  font-weight: 800;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

.user-name-text {
  font-size: 0.82rem;
  font-weight: 700;
  color: #ffffff;
  max-width: 130px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-logout {
  background: rgba(0, 0, 0, 0.25);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  padding: 3px 10px;
  font-size: 0.72rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
  transition: all 0.2s;
}

.btn-logout:hover {
  background: #ffffff;
  color: #dc2626;
  border-color: #ffffff;
}

/* Database Status Pill */
.db-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
}

.db-status-pill.db-online {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.4);
}

.db-status-pill.db-offline {
  background: rgba(0, 0, 0, 0.25);
  color: #fee2e2;
  border-color: rgba(255, 255, 255, 0.2);
}

.db-status-pill.db-connecting {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.4);
}

.db-status-pill.db-warning {
  background: rgba(251, 146, 60, 0.3);
  color: #ffffff;
  border-color: rgba(251, 146, 60, 0.6);
}

.btn-sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  padding: 5px 12px;
  font-size: 0.76rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-sync-pill:hover {
  background: #ffffff;
  color: #dc2626;
  border-color: #ffffff;
  transform: translateY(-1px);
}

.btn-sync-pill:active {
  transform: translateY(0);
}

.btn-sync-pill.spinning span.sync-icon {
  display: inline-block;
  animation: spin 1s linear infinite;
}

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

/* ===========================================================
   Quick Stats Bento Grid
   =========================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (min-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
  }
}

.stat-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-card);
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.stat-box.primary .stat-value { color: #dc2626; }
.stat-box.success .stat-value { color: #16a34a; }
.stat-box.warning .stat-value { color: #ea580c; }

/* ===========================================================
   Navigation Tabbar
   =========================================================== */
.nav-tabbar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: var(--bg-card);
  padding: 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}

.nav-tab-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 12px 16px;
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.nav-tab-btn:hover {
  color: var(--text-main);
  background: #f1f5f9;
}

.nav-tab-btn.active {
  background: linear-gradient(135deg, #dc2626, #ea580c);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.3);
}

/* ===========================================================
   Tab Content Layouts
   =========================================================== */
.tabpanel {
  display: none;
  width: 100%;
}

.tabpanel.active {
  display: block;
}

.scan-grid-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 960px) {
  .scan-grid-layout {
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
  }
}

.riwayat-grid-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (min-width: 960px) {
  .riwayat-grid-layout {
    display: grid;
    grid-template-columns: 1.25fr 0.75fr;
    gap: 20px;
    align-items: start;
  }
}

/* ===========================================================
   QR Scanner Viewfinder
   =========================================================== */
#reader {
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #000;
  border: 2px solid var(--border);
  margin-top: 14px;
  margin-bottom: 14px;
}

#reader video {
  width: 100% !important;
  border-radius: var(--radius-md);
}

/* ===========================================================
   Inspection Result Card
   =========================================================== */
.result-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.result-kode-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(220, 38, 38, 0.12);
  color: #dc2626;
  border: 1px solid rgba(220, 38, 38, 0.28);
  font-weight: 800;
  font-size: 0.9rem;
  padding: 4px 12px;
  border-radius: var(--radius-full);
}

.result-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 4px 12px;
  border-radius: var(--radius-full);
}

.result-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 12px;
}

dl.result-list {
  background: var(--bg-card-inner);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 4px 14px;
  margin-bottom: 16px;
}

dl.result-list .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

dl.result-list .row:last-child {
  border-bottom: none;
}

dl.result-list dt {
  color: var(--text-muted);
  font-size: 0.84rem;
}

dl.result-list dd {
  margin: 0;
  text-align: right;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-main);
}

/* ===========================================================
   Checklist Condition Items (Wajib Diisi Validation)
   =========================================================== */
.kondisi-header-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  margin-bottom: 8px;
}

.kondisi-counter-pill {
  font-size: 0.76rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: #1e293b;
  color: #38bdf8;
  border: 1px solid var(--border);
}

.kondisi-counter-pill.complete {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.4);
}

.kondisi-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-card-inner);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  transition: all 0.25s ease;
}

@media (min-width: 500px) {
  .kondisi-item {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }
}

.kondisi-item.invalid {
  border-color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.08) !important;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.25);
  animation: shake 0.3s ease-in-out;
}

.kondisi-item.valid {
  border-color: rgba(16, 185, 129, 0.35);
}

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

.kondisi-item .label-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.kondisi-item .label {
  font-size: 0.88rem;
  font-weight: 600;
  color: #e2e8f0;
}

.wajib-tag {
  font-size: 0.7rem;
  font-weight: 700;
  color: #f87171;
  background: rgba(239, 68, 68, 0.12);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.terisi-tag {
  font-size: 0.7rem;
  font-weight: 700;
  color: #34d399;
  background: rgba(16, 185, 129, 0.12);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.toggle2 {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  width: 100%;
}

@media (min-width: 500px) {
  .toggle2 {
    width: auto;
  }
}

.toggle2 button {
  flex: 1;
  width: 100%;
  margin: 0;
  padding: 8px 12px;
  font-size: 0.82rem;
  background: #0f172a;
  color: var(--text-muted);
  border: 1px solid var(--border);
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

@media (min-width: 500px) {
  .toggle2 button {
    flex: initial;
    width: auto;
    min-width: 100px;
  }
}

.toggle2 button:hover {
  border-color: #475569;
  color: var(--text-main);
}

.toggle2 button.on-good {
  background: #14532d !important;
  color: #4ade80 !important;
  border-color: #22c55e !important;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.3);
}

.toggle2 button.on-bad {
  background: #7f1d1d !important;
  color: #fca5a5 !important;
  border-color: #ef4444 !important;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}

/* ===========================================================
   Photo Upload Box
   =========================================================== */
.foto-upload-box {
  background: var(--bg-card-inner);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-top: 12px;
  margin-bottom: 16px;
}

.foto-preview {
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-top: 10px;
  display: none;
  border: 1px solid var(--border);
}

.foto-preview.show {
  display: block;
}

.foto-btn-row {
  display: flex;
  gap: 8px;
}

/* ===========================================================
   Progress Bar & Indicators
   =========================================================== */
.progress-wrap {
  margin-top: 10px;
}

.progress-bar-track {
  background: var(--bg-card-inner);
  border-radius: var(--radius-full);
  height: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.progress-bar-fill {
  background: linear-gradient(90deg, #dc2626, #ea580c);
  height: 100%;
  width: 0%;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 6px;
}

.progress-done-all {
  color: #34d399;
  font-weight: 800;
  font-size: 1rem;
  text-align: center;
  margin-top: 10px;
  padding: 8px;
  background: rgba(16, 185, 129, 0.1);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.gedung-progress-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  max-height: 260px;
  overflow-y: auto;
}

.gedung-item {
  background: var(--bg-card-inner);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}

.gedung-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 5px;
}

/* ===========================================================
   History / Log Items
   =========================================================== */
.log-item {
  background: var(--bg-card-inner);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 12px;
  transition: border-color 0.2s;
}

.log-item:hover {
  border-color: #475569;
}

.log-item .log-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.log-item .log-kode {
  font-weight: 800;
  color: #dc2626;
  font-size: 0.92rem;
}

.log-item .log-check {
  color: #34d399;
  font-weight: 700;
  font-size: 0.82rem;
  background: rgba(16, 185, 129, 0.15);
  padding: 2px 8px;
  border-radius: 4px;
}

.log-item .log-ruangan {
  font-size: 0.95rem;
  margin-top: 6px;
  font-weight: 700;
  color: var(--text-main);
}

.log-item .log-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 5px;
  line-height: 1.4;
}

.log-item .log-pemeriksa {
  display: inline-block;
  font-size: 0.75rem;
  background: var(--bg-card);
  color: #cbd5e1;
  padding: 2px 8px;
  border-radius: 4px;
  margin-top: 6px;
  border: 1px solid var(--border);
}

.log-item .log-ket {
  font-size: 0.84rem;
  color: #cbd5e1;
  margin-top: 8px;
  background: rgba(0, 0, 0, 0.3);
  padding: 8px 10px;
  border-radius: 6px;
  border-left: 3px solid var(--secondary);
}

.log-item img.log-foto {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-top: 10px;
  border: 1px solid var(--border);
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 36px 16px;
  background: var(--bg-card-inner);
  border-radius: var(--radius-md);
  border: 1px dashed var(--border);
}

/* ===========================================================
   Search & Filter Row
   =========================================================== */
.filter-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

@media (min-width: 640px) {
  .filter-row {
    grid-template-columns: 1.5fr 1fr;
  }
}

/* ===========================================================
   Status / Alert Notification Toast
   =========================================================== */
.status {
  width: 100%;
  font-size: 0.88rem;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  display: none;
  font-weight: 600;
  box-shadow: var(--shadow-card);
  animation: fadeIn 0.25s ease-out;
}

.status.ok {
  background: #14532d;
  color: #86efac;
  border: 1px solid #22c55e;
  display: block;
}

.status.err {
  background: #7f1d1d;
  color: #fca5a5;
  border: 1px solid #ef4444;
  display: block;
}

.status.info {
  background: #1e3a8a;
  color: #93c5fd;
  border: 1px solid #3b82f6;
  display: block;
}

/* ===========================================================
   Utilities & Animations
   =========================================================== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.hidden {
  display: none !important;
}

a.nav-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}

a.nav-link:hover {
  text-decoration: underline;
}

/* ===========================================================
   Admin Dashboard & User Management Styles
   =========================================================== */
.admin-grid-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 900px) {
  .admin-grid-layout {
    grid-template-columns: 1.1fr 1.4fr;
  }
}

.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.role-badge.admin {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.role-badge.petugas {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.user-item-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  transition: all 0.2s ease;
}

.user-item-card:hover {
  border-color: rgba(16, 185, 129, 0.4);
  transform: translateY(-1px);
}

.user-item-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.user-item-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: #fff;
  flex-shrink: 0;
}

.user-item-avatar.admin {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

.user-item-avatar.petugas {
  background: linear-gradient(135deg, #10b981, #059669);
}

.user-item-text {
  min-width: 0;
}

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

.user-item-sub {
  font-size: 0.76rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.btn-delete-user {
  background: transparent;
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-delete-user:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
}

.btn-delete-user:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.petugas-chip-role {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 4px;
  margin-top: 2px;
  display: inline-block;
}

.petugas-chip-role.admin {
  background: rgba(245, 158, 11, 0.25);
  color: #fbbf24;
}

.petugas-chip-role.petugas {
  background: rgba(16, 185, 129, 0.25);
  color: #34d399;
}

/* Print Styles */
@media print {
  body * {
    visibility: hidden;
  }
  #printArea, #printArea * {
    visibility: visible;
  }
  #printArea {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
  }
}

/* ===========================================================
   Real-Time Notification System & Bell Button
   =========================================================== */
.btn-notif-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  padding: 5px 12px;
  font-size: 0.76rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-notif-bell:hover {
  background: #ffffff;
  color: #dc2626;
  border-color: #ffffff;
  transform: translateY(-1px);
}

.btn-notif-bell .bell-icon {
  font-size: 0.95rem;
}

.notif-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #ef4444;
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  animation: pulseBadge 2s infinite;
}

@keyframes pulseBadge {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); box-shadow: 0 0 10px rgba(239, 68, 68, 0.8); }
  100% { transform: scale(1); }
}

/* Notification Feed Items */
.notif-feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 4px;
  margin: 12px 0;
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-card-inner);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  position: relative;
}

.notif-item:hover {
  background: var(--bg-card);
  border-color: var(--border-focus);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.notif-item.unread {
  border-left: 4px solid var(--primary);
  background: rgba(220, 38, 38, 0.04);
}

[data-theme="dark"] .notif-item.unread {
  background: rgba(239, 68, 68, 0.08);
}

.notif-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.notif-icon-box.new_task {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
}

.notif-icon-box.deleted_task {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.notif-icon-box.system {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
}

.notif-content {
  flex: 1;
  min-width: 0;
}

.notif-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

.notif-msg {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 6px;
  word-break: break-word;
}

.notif-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.72rem;
  color: var(--text-dim);
}

.notif-btn-view {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

/* Toast Floating Notification */
.notif-toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
  pointer-events: none;
}

.notif-toast {
  pointer-events: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transition: opacity 0.3s ease;
}

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

/* Shake Animation for Mandatory Validation */
.invalid-shake {
  animation: shakeBox 0.5s ease-in-out;
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3) !important;
}

@keyframes shakeBox {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

/* Watermark indicator badge */
.watermark-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 700;
  margin-top: 4px;
}

