:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #273449;
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --accent: #38bdf8;
  --danger: #f87171;
  --success: #4ade80;
  --warning: #fbbf24;
  --border: #334155;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

#app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { font-weight: 700; font-size: 1.1rem; }

#app-nav { display: flex; flex-wrap: wrap; gap: 0.25rem; }

.nav-link {
  color: var(--text-dim);
  text-decoration: none;
  padding: 0.4rem 0.7rem;
  border-radius: 6px;
  font-size: 0.85rem;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link-logout { color: var(--danger); }

#app-main { padding: 1.5rem; max-width: 1100px; margin: 0 auto; }

.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
}

.login-card {
  background: var(--surface);
  padding: 2rem;
  border-radius: 12px;
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  border: 1px solid var(--border);
}

.login-card h1 { margin: 0; font-size: 1.3rem; }
.subtitle { color: var(--text-dim); margin: 0 0 0.5rem; }

label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; color: var(--text-dim); }
input, select, button {
  font: inherit;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
}
button { background: var(--accent); color: #0f172a; font-weight: 600; border: none; cursor: pointer; }
button:disabled { opacity: 0.6; cursor: default; }

.stacked-form { display: flex; flex-direction: column; gap: 0.9rem; max-width: 480px; }
.inline-form { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.inline-form input, .inline-form select { flex: 1; min-width: 140px; }

.error-text { color: var(--danger); font-size: 0.85rem; min-height: 1em; }

.data-table { width: 100%; border-collapse: collapse; margin-top: 0.75rem; }
.data-table th, .data-table td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.data-table th { color: var(--text-dim); font-weight: 600; }
.clickable-row { cursor: pointer; }
.clickable-row:hover { background: var(--surface); }
.row-overdue { background: rgba(248, 113, 113, 0.12); }

.badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--accent);
  vertical-align: middle;
}

.loading { color: var(--text-dim); padding: 2rem 0; }

.qr-modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.qr-modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 1.5rem; display: flex; flex-direction: column; align-items: center; gap: 0.75rem;
  max-width: 90vw;
}
.qr-modal video, .qr-modal canvas { border-radius: 8px; max-width: 280px; width: 100%; }
.qr-token { font-family: monospace; font-size: 0.75rem; color: var(--text-dim); word-break: break-all; text-align: center; }

.btn-secondary { background: var(--surface-2); color: var(--text); }
.btn-link { background: none; border: none; color: var(--accent); text-decoration: underline; cursor: pointer; padding: 0.2rem; }

.import-box { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1rem; margin: 1rem 0; }

.assisted-scan-row { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.scan-label { color: var(--success); font-size: 0.85rem; }
.hint-text { color: var(--text-dim); font-size: 0.85rem; }

.badge-card {
  border: 1px dashed var(--border); border-radius: 10px; padding: 0.75rem;
  display: flex; align-items: center; gap: 0.75rem; width: 260px; margin-bottom: 0.5rem;
}
.badge-card canvas { flex-shrink: 0; }
.badge-card .badge-info { font-size: 0.85rem; }
.badge-card .badge-info .name { font-weight: 700; }

@media print {
  #app-header, .import-box, #add-employee-form, #print-badges-btn { display: none !important; }
}
