/* LSO Laser Show Compliance Tool - Main Styles */

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

:root {
  --bg: #0a0e12;
  --bg-secondary: #12181f;
  --card: #1a2129;
  --card-hover: #1f2833;
  --border: #252d38;
  --text: #e0e6ed;
  --text-muted: #6b7a8a;
  --text-dim: #4a5568;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-dim: rgba(59, 130, 246, 0.15);
  --success: #22c55e;
  --success-dim: rgba(34, 197, 94, 0.15);
  --danger: #ef4444;
  --danger-dim: rgba(239, 68, 68, 0.15);
  --warning: #f97316;
  --warning-dim: rgba(249, 115, 22, 0.15);
  --purple: #8b5cf6;

  /* Laser-themed accent */
  --laser-green: #39ff14;
  --laser-red: #ff073a;
  --laser-blue: #00d4ff;

  --sidebar-width: 260px;
  --header-height: 76px;
  --radius: 8px;
  --radius-sm: 4px;
  --transition: 150ms ease;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-brand {
  padding: 20px 16px 12px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand h1 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-brand h1 .laser-icon {
  color: var(--laser-green);
  font-size: 20px;
}

.sidebar-brand .company-name {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.sidebar-nav {
  padding: 8px 0;
  flex: 1;
}

.nav-section {
  padding: 8px 12px 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 13px;
  border-left: 3px solid transparent;
}

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

.nav-item.active {
  background: var(--primary-dim);
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 600;
}

.nav-item .nav-icon {
  width: 18px;
  text-align: center;
  font-size: 15px;
  flex-shrink: 0;
}

.nav-item .nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

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

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.sidebar-user:hover {
  background: var(--card);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-dim);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

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

.user-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.main-header {
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

#laser-header-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

#fluid-overlay-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.main-header > :not(canvas) {
  position: relative;
  z-index: 2;
}

.main-header h2 {
  font-size: 18px;
  font-weight: 600;
}

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

.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn:hover {
  background: var(--card-hover);
  border-color: var(--text-dim);
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

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

.btn-success {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 15px;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
}

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

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
  margin-bottom: 16px;
}

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

.form-input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="url"],
input[type="tel"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color var(--transition);
}

.form-input:focus,
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-dim);
}

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

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

.form-hint {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}

.form-error {
  font-size: 11px;
  color: var(--danger);
  margin-top: 4px;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

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

.card-title {
  font-size: 15px;
  font-weight: 600;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

/* ============================================================
   STATUS BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-success { background: var(--success-dim); color: var(--success); }
.badge-danger { background: var(--danger-dim); color: var(--danger); }
.badge-warning { background: var(--warning-dim); color: var(--warning); }
.badge-primary { background: var(--primary-dim); color: var(--primary); }
.badge-muted { background: var(--card); color: var(--text-muted); }

/* ============================================================
   TABLES
   ============================================================ */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

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

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

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

.empty-state h3 {
  font-size: 18px;
  color: var(--text);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
  margin-bottom: 20px;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
}

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

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
}

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

.modal-body {
  padding: 20px;
}

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

/* ============================================================
   ALERTS / TOASTS
   ============================================================ */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  min-width: 280px;
  max-width: 400px;
  animation: toast-in 300ms ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   STATS / DASHBOARD CARDS
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.stat-card .stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
}

.stat-card .stat-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ============================================================
   COMPLIANCE STATUS INDICATORS
   ============================================================ */
.compliance-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.compliance-dot.green { background: var(--success); }
.compliance-dot.yellow { background: var(--warning); }
.compliance-dot.red { background: var(--danger); }
.compliance-dot.gray { background: var(--text-dim); }

.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar .progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 300ms ease;
}

.progress-bar .progress-fill.green { background: var(--success); }
.progress-bar .progress-fill.yellow { background: var(--warning); }
.progress-bar .progress-fill.red { background: var(--danger); }
.progress-bar .progress-fill.blue { background: var(--primary); }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
}

.login-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 420px;
  padding: 32px;
}

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

.login-card .login-header h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.login-card .login-header p {
  color: var(--text-muted);
  font-size: 13px;
}

.login-tabs {
  display: flex;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.login-tab {
  flex: 1;
  text-align: center;
  padding: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
}

.login-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.login-tab:hover {
  color: var(--text);
}

.login-error {
  background: var(--danger-dim);
  color: var(--danger);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
}

.login-success {
  background: var(--success-dim);
  color: var(--success);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
}

/* ============================================================
   LOADING / SPINNER
   ============================================================ */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 600ms linear infinite;
}

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

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-muted);
  gap: 12px;
}

/* ============================================================
   TABS
   ============================================================ */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.tab {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
}

.tab:hover { color: var(--text); }
.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ============================================================
   MOBILE RESPONSIVE
   ============================================================ */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -260px;
    top: 0;
    bottom: 0;
    transition: left 300ms ease;
    z-index: 200;
  }

  .sidebar.open {
    left: 0;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 199;
  }

  .mobile-menu-btn {
    display: block;
  }

  .page-content {
    padding: 16px;
  }

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

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .modal {
    max-width: 100%;
    margin: 0;
    border-radius: var(--radius) var(--radius) 0 0;
    max-height: 85vh;
  }

  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
}

/* Calendar filter */
.cal-filtered-out { display: none !important; }

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

  .page-content {
    padding: 10px;
  }

  .card {
    padding: 12px;
  }

  .main-header h2 {
    font-size: 16px;
  }

  /* Bigger touch targets for buttons */
  .btn {
    min-height: 40px;
    padding: 8px 14px;
  }

  .btn-sm {
    min-height: 34px;
    padding: 6px 10px;
  }

  /* QC checklist - big checkboxes for on-site phone use */
  .cl-item {
    padding: 14px 12px;
    min-height: 48px;
  }

  .cl-item div[style*="width: 22px"] {
    width: 28px !important;
    height: 28px !important;
  }

  /* Nav items need bigger touch targets */
  .nav-item {
    padding: 12px 16px;
    min-height: 44px;
  }

  /* Tabs stack vertically on small screens */
  .calc-grid {
    grid-template-columns: 1fr;
  }

  .dash-grid {
    grid-template-columns: 1fr 1fr;
  }

  .dash-shows-grid {
    grid-template-columns: 1fr;
  }

  .doc-grid {
    grid-template-columns: 1fr;
  }

  /* Table scroll on mobile */
  .calc-table {
    display: block;
    overflow-x: auto;
  }

  /* Resources stack */
  .resources-grid {
    grid-template-columns: 1fr;
  }

  /* Form selects full width */
  select {
    min-width: unset !important;
    width: 100%;
  }
}

/* ============================================================
   UTILITY
   ============================================================ */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.gap-2 { gap: 8px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ============================================================
   FORMS MODULE
   ============================================================ */
.form-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.form-card {
  cursor: pointer;
  transition: all var(--transition);
}

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

.form-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.form-card-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.form-card-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 4px;
}

.form-card-sub {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  margin: 0 0 6px;
}

.form-card-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.4;
}

.form-top-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.form-top-info h3 {
  margin: 0;
  font-size: 18px;
}

.form-top-info p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.form-actions-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.form-section {
  margin-bottom: 16px;
}

.section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.section-toggle:hover .card-title {
  color: var(--primary);
}

.toggle-arrow {
  font-size: 11px;
  color: var(--text-muted);
  transition: transform var(--transition);
  display: inline-block;
}

.toggle-arrow.open {
  transform: rotate(90deg);
}

.section-body {
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-top: 12px;
}

.section-note {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
  font-style: italic;
}

/* Checkbox field layout */
.fg-check {
  margin-bottom: 6px;
}

.form-group .check-label {
  display: flex !important;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  line-height: 1.4;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  margin-bottom: 0;
}

.form-group .check-label:hover {
  background: var(--card-hover);
}

.form-group .check-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 1px;
  accent-color: var(--primary);
}

/* Non-skippable items */
.nonskip-item {
  border-left: 3px solid var(--danger);
  padding-left: 12px;
}

.nonskip-check {
  background: var(--danger-dim);
}

.nonskip-check:hover {
  background: rgba(239, 68, 68, 0.2);
}

.nonskip-badge {
  font-size: 10px;
  font-weight: 700;
  color: var(--danger);
  background: var(--danger-dim);
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: 8px;
  flex-shrink: 0;
  white-space: nowrap;
}

/* Repeating entries */
.repeating-entry {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 12px;
  background: var(--bg);
}

.repeating-entry-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}

/* ── Modal ── */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

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

.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

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

.modal-body {
  padding: 20px;
}

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

/* Event detail rows */
.event-detail-row {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
  font-size: 14px;
}

.event-detail-label {
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  min-width: 60px;
  padding-top: 2px;
}

.event-type-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  color: white;
}

.event-notes-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.event-notes-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
}

.event-notes-input:focus {
  outline: none;
  border-color: var(--primary);
}

.event-notes-input::placeholder {
  color: var(--text-dim);
}

/* Print-ready hidden div */
#form-printable {
  display: none;
  position: absolute;
  left: -9999px;
  top: 0;
  width: 8.5in;
  background: white;
}

/* ── Hardware Module ── */

.hw-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}

.hw-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.hw-card:hover {
  background: var(--card-hover);
  border-color: var(--text-dim);
  transform: translateY(-1px);
}

.hw-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.hw-card-name {
  font-weight: 600;
  font-size: 15px;
}

.hw-status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.hw-card-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.hw-card-serial {
  font-size: 12px;
  color: var(--text-dim);
  font-family: monospace;
  margin-bottom: 8px;
}

.hw-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}

.hw-class-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  margin-right: 8px;
}

.hw-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 12px;
}

.hw-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.hw-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.hw-field-label {
  color: var(--text-muted);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.hw-safety-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.hw-safety-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  padding: 4px 8px;
  border-radius: 4px;
}

.hw-safety-item.pass {
  color: #22c55e;
}

.hw-safety-item.fail {
  color: #ef4444;
  opacity: 0.7;
}

.hw-diode-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  font-size: 13px;
}

.hw-diode-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.hw-diode-form-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.hw-log-entry {
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.hw-form-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.hw-form-tab {
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.hw-form-tab:hover {
  background: var(--card-hover);
}

.hw-form-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.hw-safety-checks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.hw-safety-checks .check-label {
  font-size: 13px;
}

@media (max-width: 768px) {
  .hw-grid {
    grid-template-columns: 1fr;
  }
  .hw-detail-grid {
    grid-template-columns: 1fr;
  }
  .hw-safety-grid {
    grid-template-columns: 1fr;
  }
  .hw-form-tabs {
    flex-wrap: nowrap;
  }
  .hw-diode-form-row > div {
    grid-template-columns: 1fr 1fr !important;
  }
}

/* ── Resources Page ── */

.resources-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 24px 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.resources-section-title:first-of-type {
  margin-top: 12px;
}

.resources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}

.resource-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  text-decoration: none;
  color: var(--text);
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
  cursor: pointer;
}

.resource-card:hover {
  background: var(--card-hover);
  border-color: var(--text-dim);
  transform: translateY(-1px);
}

.resource-logo {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.resource-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
  color: var(--text);
}

.resource-desc {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
}

.resource-arrow {
  flex-shrink: 0;
  font-size: 18px;
  color: var(--text-dim);
  transition: color 0.15s, transform 0.15s;
}

.resource-card:hover .resource-arrow {
  color: var(--primary);
  transform: translateX(3px);
}

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

/* ─── Dashboard ──────────────────────────────────────────────────── */

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

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

.dash-issue {
  padding: 8px 12px;
  background: var(--bg);
  border-radius: 6px;
  font-size: 13px;
}

.dash-deadline {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.dash-deadline:last-child { border-bottom: none; }

.dash-urgency-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dash-shows-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.dash-show-card {
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.dash-show-card:hover {
  border-color: var(--primary);
}

.mt-3 { margin-top: 16px; }

/* ─── Safety Calculators ─────────────────────────────────────────── */

.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.calc-result {
  margin-top: 20px;
  padding: 16px;
  border-radius: 8px;
  border: 2px solid;
}

.calc-safe {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.08);
}

.calc-danger {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
}

.calc-info {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.06);
}

.calc-result-header {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
}

.calc-safe .calc-result-header { color: #22c55e; }
.calc-danger .calc-result-header { color: #ef4444; }
.calc-info .calc-result-header { color: #3b82f6; }

.calc-steps {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}

.calc-step {
  display: flex;
  gap: 8px;
}

.calc-step-label {
  color: var(--text-muted);
  min-width: 180px;
}

.calc-formula {
  margin-top: 12px;
  padding: 8px 12px;
  background: var(--bg);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.calc-formula code {
  font-family: 'SF Mono', 'Fira Code', monospace;
}

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

.calc-table th {
  text-align: left;
  padding: 8px;
  border-bottom: 2px solid var(--border);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
}

.calc-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}

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

/* ─── Documents ──────────────────────────────────────────────────── */

.doc-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.doc-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color 0.15s;
}

.doc-card:hover {
  border-color: var(--primary);
}

.doc-card-icon {
  font-size: 28px;
  flex-shrink: 0;
  width: 36px;
  text-align: center;
}

.doc-card-info {
  flex: 1;
  min-width: 0;
}

.doc-card-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-card-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  flex-wrap: wrap;
}

.doc-cat-badge {
  background: var(--bg);
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
  white-space: nowrap;
}

.doc-exp-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  margin-top: 4px;
}

.doc-card-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.doc-dropzone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  color: var(--text-muted);
}

.doc-dropzone:hover,
.doc-dropzone-active {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.05);
}

/* ─── Checklist ──────────────────────────────────────────────────── */

.cl-item {
  padding: 10px 12px;
  border-radius: 6px;
  transition: background 0.15s;
}

.cl-item:hover {
  background: var(--bg);
}

.cl-item-checked {
  opacity: 0.7;
}

.cl-item-nonskip {
  border-left: 3px solid #ef4444;
  padding-left: 9px;
  background: rgba(239, 68, 68, 0.04);
}

.cl-item input[type="checkbox"] {
  accent-color: var(--primary);
}

/* ============================================================
   LAYOUT DESIGNER
   ============================================================ */
#layout-map {
  transition: transform 150ms ease;
  overflow: visible;
}

#layout-map img {
  min-height: 300px;
  object-fit: contain;
}

/* Zone drag handles hover effect */
#layout-map div[style*="cursor: crosshair"] > div {
  transition: transform 100ms ease, opacity 100ms ease;
}
#layout-map div[style*="cursor: crosshair"]:hover > div {
  transform: scale(1.4);
  opacity: 1 !important;
}

/* Responsive marker sizing */
@media (max-width: 640px) {
  #layout-map div[style*="cursor: grab"] > div:first-child {
    width: 30px !important;
    height: 30px !important;
    font-size: 15px !important;
  }
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
  body {
    background: white !important;
    color: #111 !important;
    font-size: 12px;
  }
  .sidebar, .sidebar-backdrop, .main-header, .mobile-menu-btn,
  .toast-container, .btn, button, [x-show="page !== "],
  .nav-item, .nav-section, .sidebar-footer, .sidebar-brand {
    display: none !important;
  }
  .main-content {
    margin-left: 0 !important;
    padding: 0 !important;
  }
  .page-content {
    padding: 0 !important;
  }
  .card {
    background: white !important;
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    page-break-inside: avoid;
    color: #111 !important;
  }
  .app-layout {
    display: block !important;
  }
  /* Show print-only elements */
  .print-only { display: block !important; }
  .no-print { display: none !important; }
  /* Checklist print styling */
  .cl-item {
    border: 1px solid #ddd !important;
    padding: 6px 8px !important;
    margin-bottom: 3px;
    page-break-inside: avoid;
    background: white !important;
    color: #111 !important;
  }
  .cl-item-checked {
    background: #f0f0f0 !important;
  }
  .cl-item-nonskip {
    border-left: 3px solid #ef4444 !important;
  }
  input[type="checkbox"] {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    width: 16px !important;
    height: 16px !important;
  }
  .text-muted {
    color: #555 !important;
  }
  .calc-result, .loading-overlay, .spinner {
    color: #111 !important;
  }
  a { color: #111 !important; text-decoration: underline; }
}
