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

:root {
  --bg: #121212;
  --surface: #1e1e2e;
  --surface2: #2a2a3e;
  --primary: #00d4ff;
  --success: #00e676;
  --error: #ff5252;
  --warn: #ffc107;
  --text: #e0e0e0;
  --text-dim: #888;
  --radius: 12px;
}

html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  padding-bottom: env(safe-area-inset-bottom, 16px);
}

/* Header */
.header {
  background: var(--surface);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--surface2);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header h1 { font-size: 1.2rem; color: var(--primary); letter-spacing: 2px; flex: 1; text-align: center; }
.header-right { display: flex; gap: 4px; }
.header-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.4rem;
  padding: 8px;
  cursor: pointer;
}

/* Screens */
.screen { display: none; padding: 16px; }
.screen.active { display: block; }

/* Buttons */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: #000; }
.btn-success { background: var(--success); color: #000; }
.btn-danger { background: var(--error); color: #fff; }
.btn-outline {
  background: transparent;
  border: 2px solid var(--surface2);
  color: var(--text);
}
.btn-sm { padding: 10px 16px; font-size: 0.95rem; }
.btn + .btn { margin-top: 12px; }

/* Form */
.form-group { margin-bottom: 20px; }
.form-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.form-group input {
  width: 100%;
  padding: 14px 16px;
  background: var(--surface);
  border: 2px solid var(--surface2);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1.1rem;
  outline: none;
  transition: border-color 0.2s;
}
.form-group input:focus { border-color: var(--primary); }
.form-group input::placeholder { color: var(--text-dim); }

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--surface2);
}
.card-title { font-size: 1rem; font-weight: 600; margin-bottom: 4px; }
.card-sub { font-size: 0.85rem; color: var(--text-dim); }

/* Auftrag list item */
.auftrag-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background 0.15s;
}
.auftrag-item:active { background: var(--surface2); }
.auftrag-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}
.badge-open { background: var(--primary); color: #000; }
.badge-closed { background: var(--text-dim); color: #000; }

/* Progress */
.progress-ring {
  text-align: center;
  margin: 16px 0;
}
.progress-count {
  font-size: 3rem;
  font-weight: 700;
  color: var(--primary);
}
.progress-label {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-top: 4px;
}
.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: var(--surface2);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 12px;
}
.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.4s ease;
}

/* Last scan box */
.last-scan-box {
  position: fixed;
  bottom: 20px;
  left: 16px;
  background: var(--surface);
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  padding: 10px 18px;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
  z-index: 90;
  letter-spacing: 1px;
}

/* Scanner */
#scanner-container {
  width: 100%;
  max-width: 500px;
  margin: 0 auto 16px;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  aspect-ratio: 16/9;
  background: #000;
}
#scanner-container video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius);
}

/* Feedback overlay */
.feedback-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: feedbackIn 0.2s ease;
  pointer-events: none;
}
@keyframes feedbackIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}
.feedback-overlay.ok { background: rgba(0, 230, 118, 0.85); }
.feedback-overlay.error { background: rgba(255, 82, 82, 0.85); }
.feedback-overlay.warn { background: rgba(255, 193, 7, 0.85); }
.feedback-overlay.complete {
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.95), rgba(0, 230, 118, 0.95));
  animation: feedbackIn 0.3s ease, completePulse 0.6s ease 0.3s 3;
}
@keyframes completePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}
.feedback-icon { font-size: 5rem; }
.feedback-text {
  font-size: 1.3rem;
  font-weight: 700;
  margin-top: 12px;
  text-align: center;
  padding: 0 24px;
  color: #fff;
}
.feedback-name {
  font-size: 1rem;
  margin-top: 8px;
  opacity: 0.9;
  color: #fff;
}

/* Passenger list */
.pax-list { list-style: none; }
.pax-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface);
  border-radius: var(--radius);
  margin-bottom: 8px;
  border: 1px solid var(--surface2);
}
.pax-order {
  font-size: 0.75rem;
  color: var(--text-dim);
  min-width: 24px;
  text-align: center;
  font-weight: 700;
  background: var(--surface2);
  border-radius: 6px;
  padding: 2px 6px;
  flex-shrink: 0;
}
.pax-name { font-weight: 600; font-size: 0.95rem; flex: 1; }
.pax-seq {
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 700;
  min-width: 50px;
  text-align: right;
  flex-shrink: 0;
}

/* Family groups */
.family-group {
  margin-bottom: 12px;
}
.family-header {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--warn);
  letter-spacing: 0.5px;
  padding: 6px 12px;
  margin-bottom: 4px;
}
.pax-in-group {
  margin-bottom: 4px;
  border-left: 3px solid var(--warn);
}

/* Frankfurt Airport link */
.fra-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--text-dim);
  text-decoration: none;
  border: 1px solid var(--surface2);
  padding: 4px 12px;
  border-radius: 20px;
  transition: color 0.15s, border-color 0.15s;
}
.fra-link:active {
  color: var(--primary);
  border-color: var(--primary);
}

/* Sort buttons */
.sort-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.sort-btn {
  flex: 1;
  padding: 10px;
  background: var(--surface);
  border: 2px solid var(--surface2);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}
.sort-btn.active { border-color: var(--primary); color: var(--primary); }

/* Flight input rows */
.flight-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  margin-bottom: 12px;
}
.flight-row .form-group { margin-bottom: 0; flex: 1; }
.flight-row .form-group:first-child { flex: 1.3; }
.flight-row .btn-remove-flight {
  background: var(--error);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  width: 44px;
  height: 44px;
  font-size: 1.2rem;
  cursor: pointer;
  flex-shrink: 0;
  margin-bottom: 0;
}

/* Flight filter tabs */
.flight-filter {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.flight-filter:empty { display: none; }
.flight-filter-btn {
  padding: 6px 14px;
  background: var(--surface);
  border: 2px solid var(--surface2);
  border-radius: 20px;
  color: var(--text-dim);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.flight-filter-btn.active { border-color: var(--primary); color: var(--primary); }

/* Flight badge in pax list */
.pax-flight {
  font-size: 0.7rem;
  color: #000;
  background: var(--primary);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 700;
  flex-shrink: 0;
}

/* Seat display */
.pax-seat {
  font-size: 0.8rem;
  color: var(--text-dim);
  min-width: 32px;
  text-align: center;
  flex-shrink: 0;
}

/* Detail flight list */
.detail-flights { margin-bottom: 16px; }
.detail-flight-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border-radius: var(--radius);
  margin-bottom: 6px;
  border: 1px solid var(--surface2);
}
.detail-flight-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--primary);
  flex: 1;
}
.detail-flight-count {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}
.detail-flight-fra {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-decoration: none;
  border: 1px solid var(--surface2);
  padding: 2px 8px;
  border-radius: 12px;
}
.detail-flight-fra:active {
  color: var(--primary);
  border-color: var(--primary);
}

/* Delete mode */
.delete-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--surface2);
  padding: 12px 16px;
  z-index: 150;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.delete-bar .btn + .btn { margin-top: 0; }
.delete-select-all {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  padding: 8px 0;
  cursor: pointer;
}
.delete-select-all input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--primary);
}
.auftrag-item-delete {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  border: 1px solid var(--surface2);
  cursor: pointer;
  transition: border-color 0.15s;
}
.auftrag-item-delete.selected { border-color: var(--error); }
.auftrag-item-delete input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--error);
  flex-shrink: 0;
}

/* Fluginfo */
#fluginfo-scanner-container {
  width: 100%;
  max-width: 500px;
  margin: 0 auto 16px;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  aspect-ratio: 16/9;
  background: #000;
}
#fluginfo-scanner-container video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius);
}
#fluginfo-scanner-container:empty {
  display: none;
}
.fluginfo-result {
  background: var(--surface);
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  text-align: center;
}
.fluginfo-flight {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}
.fluginfo-dest {
  font-size: 1.1rem;
  color: var(--text);
  margin-bottom: 12px;
}
.fluginfo-details {
  display: flex;
  justify-content: center;
  gap: 24px;
}
.fluginfo-detail-item {
  text-align: center;
}
.fluginfo-detail-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.fluginfo-detail-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}
.fluginfo-status {
  margin-top: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--success);
}
.fluginfo-loading {
  text-align: center;
  padding: 24px;
  color: var(--text-dim);
  font-size: 0.95rem;
}
.fluginfo-error {
  text-align: center;
  padding: 16px;
  color: var(--error);
  font-size: 0.9rem;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
}
.empty-state .icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { font-size: 0.95rem; }

/* Danger zone */
.danger-zone {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--surface2);
}
.danger-zone h3 {
  font-size: 0.85rem;
  color: var(--error);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

/* Dialog */
.dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 16px;
}
.dialog {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 340px;
}
.dialog h3 { margin-bottom: 12px; font-size: 1.1rem; }
.dialog p { color: var(--text-dim); font-size: 0.9rem; margin-bottom: 20px; }
.dialog-actions { display: flex; gap: 10px; }
.dialog-actions .btn { flex: 1; }
