:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --card: #ffffff;
  --line: #dce4ef;
  --text: #18324b;
  --muted: #5f738b;
  --primary: #0f6cbd;
  --primary-dark: #0b5597;
  --accent: #ffb703;
  --danger: #d64545;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.auth-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, rgba(15, 108, 189, 0.95), rgba(24, 50, 75, 0.95));
  display: grid;
  place-items: center;
  z-index: 20;
  padding: 20px;
}
.auth-card {
  width: min(460px, 100%);
  background: var(--card);
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.2);
}
.auth-card h2 { margin: 0 0 8px; }
.auth-card p { color: var(--muted); }
.login-form { display: grid; gap: 12px; margin-top: 16px; }
.auth-message { margin-top: 10px; color: var(--danger); font-weight: 600; }
.auth-overlay.hidden { display: none; }

.app-shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}
.app-shell.disabled { filter: grayscale(0.15); pointer-events: none; opacity: 0.65; }

.hero {
  background: linear-gradient(135deg, #0f6cbd, #2c7fb8);
  color: white;
  border-radius: 20px;
  padding: 24px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  box-shadow: 0 16px 40px rgba(15, 108, 189, 0.2);
}

.hero h1 { margin: 0 0 8px; font-size: 2rem; }
.hero p { margin: 0; line-height: 1.5; max-width: 680px; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.24em; font-size: 0.8rem; margin-bottom: 6px; opacity: 0.9; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.session-badge { background: rgba(255,255,255,0.2); padding: 8px 12px; border-radius: 999px; font-size: 0.9rem; }
.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #23324b; }
.btn-secondary { background: #e8f1fb; color: var(--primary-dark); }
#excelInput { display: none; }

.stats-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.stat-card, .panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 12px 24px rgba(24, 50, 75, 0.05);
}
.stat-card span { display: block; font-size: 1.6rem; font-weight: 700; color: var(--primary-dark); }
.stat-card small { color: var(--muted); }

.content-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1.2fr 0.9fr;
  gap: 18px;
}
.panel-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.panel-header h2 { margin: 0; font-size: 1.1rem; }
.panel-header p { margin: 0; color: var(--muted); font-size: 0.94rem; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: #fbfcfe;
}
textarea { resize: vertical; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 500px; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--muted); font-weight: 600; font-size: 0.84rem; text-transform: uppercase; letter-spacing: 0.06em; }
tr:hover { background: #f8fbff; cursor: pointer; }

.scanner-card { border: 1px dashed var(--line); border-radius: 14px; padding: 12px; margin-bottom: 14px; background: #fcfeff; }
.scanner-controls, .scanner-inputs, .form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
#video { width: 100%; border-radius: 12px; background: #000; max-height: 260px; object-fit: cover; display: none; }
.selected-equipment { padding: 10px; border-radius: 10px; background: #f3f8ff; color: var(--primary-dark); font-weight: 600; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field-group, .audit-form label { display: block; margin-bottom: 10px; }
.audit-form label { font-weight: 600; font-size: 0.95rem; }
.audit-form select, .audit-form input, .audit-form textarea { margin-top: 6px; }
.history-panel { margin-top: 18px; }
.history-list { display: grid; gap: 10px; }
.history-item { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #fcfeff; }
.history-item strong { display: block; margin-bottom: 4px; }
.history-item small { color: var(--muted); }
.history-item.warning { border-color: var(--danger); background: #fff7f7; }

@media (max-width: 950px) {
  .content-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
  .hero { flex-direction: column; }
}
