/* Import google fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  /* Dark Theme Variables (Default) */
  --bg-primary: #0b0f19;
  --bg-secondary: #131b2e;
  --bg-card: rgba(26, 35, 57, 0.65);
  --border-color: rgba(255, 255, 255, 0.08);
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  --primary: #6366f1;
  --primary-glow: rgba(99, 102, 241, 0.3);
  --primary-hover: #4f46e5;
  --accent: #06b6d4;
  --accent-glow: rgba(6, 182, 212, 0.3);
  
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.2);
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.2);
  --warning: #f59e0b;
  --warning-glow: rgba(245, 158, 11, 0.2);
  
  --sidebar-width: 260px;
  --header-height: 70px;
  --transition-speed: 0.3s;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 8px 16px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 12px 30px rgba(0, 0, 0, 0.3);
  
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-blur: blur(12px);
  color-scheme: dark;
}

[data-theme="light"] {
  /* Light Theme Variables */
  color-scheme: light;
  --bg-primary: #f3f4f6;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.8);
  --border-color: rgba(0, 0, 0, 0.08);
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;
  
  --primary: #4f46e5;
  --primary-glow: rgba(79, 70, 229, 0.15);
  --primary-hover: #3730a3;
  --accent: #0891b2;
  --accent-glow: rgba(8, 145, 178, 0.15);
  
  --success: #059669;
  --success-glow: rgba(5, 150, 105, 0.15);
  --danger: #dc2626;
  --danger-glow: rgba(220, 38, 38, 0.15);
  --warning: #d97706;
  --warning-glow: rgba(217, 119, 6, 0.15);
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.12);
  
  --glass-bg: rgba(0, 0, 0, 0.02);
  --glass-blur: blur(12px);
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
  transition: background-color var(--transition-speed), color var(--transition-speed);
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* AUTHENTICATION PAGE */
.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.15) 0%, rgba(0, 0, 0, 0) 40%),
              radial-gradient(circle at 90% 80%, rgba(6, 182, 212, 0.15) 0%, rgba(0, 0, 0, 0) 40%);
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 40px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
  animation: cardFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.auth-card::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 24px 24px 0 0;
}

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

.auth-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 16px;
  color: white;
  font-family: 'Outfit', sans-serif;
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 16px;
  box-shadow: 0 8px 16px rgba(99, 102, 241, 0.3);
}

.auth-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}

.auth-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
}

.form-group {
  margin-bottom: 20px;
  position: relative;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

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

.form-input {
  width: 100%;
  padding: 12px 16px;
  background-color: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
}

.form-input:focus {
  border-color: var(--primary);
  background-color: rgba(0, 0, 0, 0.3);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

[data-theme="light"] .form-input {
  background-color: rgba(0, 0, 0, 0.03);
}
[data-theme="light"] .form-input:focus {
  background-color: #ffffff;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #ffffff;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px var(--primary-glow);
}

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

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

.btn-danger:hover {
  background-color: #dc2626;
}

.btn-secondary {
  background-color: var(--border-color);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .btn-secondary:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

/* MAIN DASHBOARD LAYOUT */
.dashboard-layout {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: transform var(--transition-speed) ease;
}

.sidebar-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 10px;
  color: white;
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 800;
}

.sidebar-brand {
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(90deg, var(--text-primary), var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-menu {
  list-style: none;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.menu-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-radius: 10px;
  transition: all 0.2s ease;
}

.menu-item a:hover {
  color: var(--text-primary);
  background-color: var(--glass-bg);
}

.menu-item.active a {
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  box-shadow: 0 4px 12px var(--primary-glow);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
}

.user-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 12px;
  background-color: rgba(0, 0, 0, 0.15);
  border-radius: 10px;
  margin-bottom: 12px;
}

.username {
  font-weight: 600;
  font-size: 14px;
}

.user-role-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-customers { background-color: var(--primary-glow); color: #818cf8; border: 1px solid rgba(129, 140, 248, 0.3); }
.badge-machines { background-color: var(--accent-glow); color: #22d3ee; border: 1px solid rgba(34, 211, 238, 0.3); }
.badge-audit { background-color: var(--success-glow); color: #34d399; border: 1px solid rgba(52, 211, 153, 0.3); }
.badge-settings { background-color: var(--warning-glow); color: #fbbf24; border: 1px solid rgba(251, 191, 36, 0.3); }

/* MAIN CONTENT */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition-speed) ease;
}

/* HEADER */
.main-header {
  height: var(--header-height);
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 90;
}

.page-title-area {
  display: flex;
  align-items: center;
  gap: 16px;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 20px;
  cursor: pointer;
}

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

/* THEME SWITCHER */
.theme-switch {
  background: var(--border-color);
  border: 1px solid var(--border-color);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.theme-switch:hover {
  background-color: var(--glass-bg);
}

.theme-switch svg {
  width: 20px;
  height: 20px;
}

.theme-switch .sun-icon { display: none; }
.theme-switch .moon-icon { display: block; }
[data-theme="light"] .theme-switch .sun-icon { display: block; }
[data-theme="light"] .theme-switch .moon-icon { display: none; }

/* CONTENT CONTAINER */
.content-body {
  padding: 32px;
  flex: 1;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

.section-panel {
  display: none;
  animation: bodyFadeIn 0.4s ease forwards;
}

.section-panel.active {
  display: block;
}

/* STATS GRID */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(99, 102, 241, 0.2);
}

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #fff;
}

.icon-blue { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.icon-teal { background: linear-gradient(135deg, #0d9488, #0f766e); }
.icon-purple { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }

.stat-details {
  display: flex;
  flex-direction: column;
}

.stat-title {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  margin-top: 4px;
}

/* RECENT ACTIVITY / OTHER GRAPHS GRID */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.panel-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.panel-title {
  font-size: 18px;
  font-weight: 600;
}

/* DATA CONTROLS (SEARCH, FILTERS, ADD) */
.controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.search-filter-group {
  display: flex;
  gap: 12px;
  flex: 1;
  max-width: 900px;
  flex-wrap: wrap;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-input {
  width: 100%;
  padding: 10px 16px 10px 40px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-icon-svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
  pointer-events: none;
}

.filter-select {
  padding: 10px 16px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 150px;
  max-width: 250px;
}

.filter-select:focus {
  border-color: var(--primary);
}

.btn-add {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #fff;
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-add:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--primary-glow);
}

/* DATA TABLE */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

.data-table th {
  background-color: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: 600;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.data-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

.data-table tbody tr {
  transition: background-color 0.15s ease;
}

.data-table tbody tr:hover {
  background-color: var(--glass-bg);
}

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

#audits-table th, #audits-table td {
  padding: 10px 10px;
  font-size: 13px;
}

#audits-table th {
  font-size: 11px;
}

/* ACTIONS */
.action-buttons {
  display: flex;
  gap: 8px;
}

.btn-action {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-action:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

.btn-action.edit-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
  background-color: var(--primary-glow);
}

.btn-action.delete-btn:hover {
  color: var(--danger);
  border-color: var(--danger);
  background-color: var(--danger-glow);
}

/* PAGINATION */
.pagination-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--text-secondary);
  font-size: 13px;
}

.pagination-controls {
  display: flex;
  gap: 6px;
  align-items: center;
}

.btn-page {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 13px;
}

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

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

.btn-page.active {
  background-color: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* MODAL */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-container {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
}

.modal-overlay.active .modal-container {
  transform: scale(1);
}

.modal-container form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

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

.modal-title {
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  transition: color 0.2s ease;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* FORM GRID */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

/* NOTIFICATIONS (TOASTS) */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 2000;
}

.toast {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  border-radius: 12px;
  padding: 16px;
  min-width: 300px;
  max-width: 400px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transform: translateX(120%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.toast.show {
  transform: translateX(0);
}

.toast::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
}

.toast-success::before { background-color: var(--success); }
.toast-error::before { background-color: var(--danger); }
.toast-warning::before { background-color: var(--warning); }

.toast-icon {
  font-size: 18px;
  margin-top: 2px;
}

.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon { color: var(--danger); }
.toast-warning .toast-icon { color: var(--warning); }

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}

.toast-message {
  font-size: 13px;
  color: var(--text-secondary);
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
}

.toast-close:hover {
  color: var(--text-primary);
}

/* EMPTY STATE */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-text {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 8px;
}

.empty-subtext {
  font-size: 13px;
  color: var(--text-muted);
}

/* TOP CUSTOMERS TABLE LIST IN DASHBOARD */
.customer-stat-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.customer-stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background-color: var(--glass-bg);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.cust-name {
  font-weight: 500;
}

.cust-count {
  background-color: var(--primary-glow);
  color: var(--primary);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 12px;
}
[data-theme="light"] .cust-count {
  background-color: rgba(79, 70, 229, 0.1);
}

/* ANIMATIONS */
@keyframes cardFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* FORM CHECKBOXES */
.checkbox-group {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
  margin-bottom: 20px;
}

.form-checkbox {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background-color: rgba(0, 0, 0, 0.2);
  cursor: pointer;
  accent-color: var(--primary);
  transition: all 0.2s ease;
}

.form-checkbox:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.checkbox-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
}

/* RESPONSIVENESS */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  
  .sidebar.active {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
  }
  
  .menu-toggle {
    display: block;
  }
  
  .controls-bar {
    flex-direction: column;
    align-items: stretch;
  }
  
  .search-filter-group {
    flex-direction: column;
    align-items: stretch;
  }
  
  .btn-add {
    justify-content: center;
  }
}

/* ========================================
   HELP / USER MANUAL TAB STYLES
   ======================================== */

.help-manual-wrapper {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  max-width: 1400px;
  margin: 0 auto;
}

/* --- Table of Contents --- */
.help-toc {
  position: sticky;
  top: 20px;
  min-width: 220px;
  max-width: 240px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  font-size: 13px;
  flex-shrink: 0;
}

.help-toc-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.help-toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.help-toc ul ul {
  padding-left: 14px;
  margin-top: 4px;
}

.help-toc li {
  margin-bottom: 4px;
}

.toc-link {
  display: block;
  padding: 5px 8px;
  border-radius: 6px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  transition: all 0.2s;
}

.toc-link:hover,
.toc-link.active {
  color: var(--accent);
  background-color: rgba(6, 182, 212, 0.08);
}

/* --- Main Content --- */
.help-content {
  flex: 1;
  min-width: 0;
}

.help-section {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 32px;
  margin-bottom: 28px;
  scroll-margin-top: 20px;
}

.help-section-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.help-section-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.help-section-icon {
  font-size: 28px;
  line-height: 1;
}

.help-intro-text {
  font-size: 15px;
  line-height: 1.8;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.help-subheading {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 24px 0 12px;
  padding-left: 12px;
  border-left: 3px solid var(--accent);
}

/* --- Steps --- */
.help-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0;
}

.help-step {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 16px;
  background: rgba(6, 182, 212, 0.04);
  border: 1px solid rgba(6, 182, 212, 0.12);
  border-radius: 10px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.step-num {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

/* --- Screenshots --- */
.help-screenshot-container {
  margin: 20px 0;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-secondary);
}

.help-screenshot {
  width: 100%;
  display: block;
  cursor: zoom-in;
  transition: opacity 0.2s;
}

.help-screenshot:hover {
  opacity: 0.9;
}

.help-screenshot-caption {
  padding: 10px 16px;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  text-align: center;
  font-style: italic;
}

/* --- Callouts --- */
.help-callout {
  padding: 14px 18px;
  border-radius: 10px;
  font-size: 14px;
  margin: 16px 0;
  line-height: 1.6;
  border-left: 4px solid;
}

.help-callout-info {
  background: rgba(6, 182, 212, 0.08);
  border-color: var(--accent);
  color: var(--text-secondary);
}

.help-callout-warn {
  background: rgba(245, 158, 11, 0.08);
  border-color: #f59e0b;
  color: var(--text-secondary);
}

.help-callout-danger {
  background: rgba(239, 68, 68, 0.08);
  border-color: var(--danger);
  color: var(--text-secondary);
}

/* --- Feature Cards Grid --- */
.help-feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin: 16px 0;
}

.help-feature-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  transition: border-color 0.2s;
}

.help-feature-card:hover {
  border-color: var(--accent);
}

.help-feature-icon {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
}

/* --- Tables --- */
.help-table-wrapper {
  overflow-x: auto;
  margin: 16px 0;
  border-radius: 10px;
  border: 1px solid var(--border-color);
}

.help-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.help-table th {
  background: rgba(6, 182, 212, 0.1);
  color: var(--accent);
  font-weight: 600;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.help-table td {
  padding: 11px 16px;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: top;
}

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

.help-table tr:hover td {
  background: rgba(255,255,255,0.02);
}

.help-table code {
  background: rgba(6, 182, 212, 0.12);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-family: monospace;
}

/* --- Footer --- */
.help-footer {
  text-align: center;
  padding: 28px;
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  margin-top: 8px;
}

/* --- Responsive --- */
@media (max-width: 900px) {
  .help-manual-wrapper {
    flex-direction: column;
  }
  .help-toc {
    position: static;
    min-width: unset;
    max-width: 100%;
    width: 100%;
  }
  .help-feature-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 600px) {
  .help-section {
    padding: 20px;
  }
  .help-feature-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Form Wizard & Readonly Fields --- */
.form-wizard-steps {
  display: flex;
  justify-content: space-between;
  margin-bottom: 24px;
  position: relative;
}

.form-wizard-steps::before {
  content: '';
  position: absolute;
  top: 15px;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.06);
  z-index: 1;
}

.wizard-step-line {
  position: absolute;
  top: 15px;
  left: 0;
  height: 2px;
  background: var(--primary-color, #6366f1);
  z-index: 1;
  width: 0%;
  transition: width 0.3s ease;
}

.wizard-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 2;
  gap: 8px;
  cursor: pointer;
  flex: 1;
}

.wizard-step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-secondary, #0f172a);
  border: 2px solid var(--border-color);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.wizard-step-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-align: center;
  transition: color 0.2s ease;
}

.wizard-step.active .wizard-step-number {
  background: var(--primary-color, #6366f1);
  border-color: var(--primary-color, #6366f1);
  color: white;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.4);
}

.wizard-step.active .wizard-step-label {
  color: var(--text-primary);
  font-weight: 600;
}

.wizard-step.completed .wizard-step-number {
  background: var(--accent, #14b8a6);
  border-color: var(--accent, #14b8a6);
  color: white;
}

.wizard-step.completed .wizard-step-label {
  color: var(--accent, #14b8a6);
}

.form-wizard-section {
  display: none;
}

.form-wizard-section.active {
  display: block;
  animation: bodyFadeIn 0.4s ease forwards;
}

.form-readonly-value {
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-weight: 500;
  min-height: 42px;
  display: flex;
  align-items: center;
}

@media print {
  body {
    background: white !important;
    color: black !important;
  }
  
  /* Hide every top level element except the print template */
  body > *:not(#print-template) {
    display: none !important;
  }
  
  #print-template {
    display: block !important;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 20px;
    background: white !important;
    color: black !important;
    font-family: sans-serif;
  }

  .print-table th {
    background-color: #f2f2f2 !important;
    color: black !important;
    border: 1px solid #333 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .print-table td {
    border: 1px solid #333 !important;
    color: black !important;
  }
}

/* Signature Pad */
.signature-pad-container {
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 8px;
  background: var(--card-bg, #fafafa);
  margin-top: 5px;
}

.signature-canvas {
  border: 1px dashed #ccc;
  background: #ffffff;
  width: 100%;
  height: 150px;
  display: block;
  touch-action: none;
  cursor: crosshair;
  border-radius: 4px;
}

.signature-pad-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

.signature-pad-hint {
  font-size: 11px;
  color: var(--text-muted, #777);
}

#onsite-modal .modal-container {
  max-width: 900px;
  width: 95%;
}

