:root {
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-soft: #f7f9fd;
  --line: #d9e2ef;
  --text: #142033;
  --muted: #607089;
  --primary: #2257c7;
  --primary-strong: #173f97;
  --danger: #be2f3b;
  --success: #17834d;
  --warning: #b87400;
  --shadow: 0 18px 40px rgba(18, 38, 63, 0.10);
  --radius: 18px;
  --radius-sm: 12px;
  --max: 1320px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: Inter, Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

body {
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand h1 {
  font-size: 1.3rem;
  line-height: 1.1;
  margin: 0;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.brand-badge {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: white;
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: 0.04em;
  box-shadow: var(--shadow);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 26px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
	display: flex;
	flex-direction: column;
	height: 100%;
	min-height: 0;
}

.panel + .panel {
  margin-top: 20px;
}

.panel-head {
  margin-bottom: 18px;
	flex-shrink: 0;
}

.panel-head h2 {
  margin: 0;
  font-size: 1.15rem;
}

.panel-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

.panel-body {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	padding-right: 6px;
}

.auth-panel {
  max-width: 560px;
  margin: 40px auto;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.tab-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 600;
}

.tab-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.grid {
  display: grid;
  gap: 20px;
  margin-bottom: 20px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.form-grid label span,
.subhead h3 {
  font-size: 0.92rem;
  font-weight: 700;
}

.form-grid .full {
  grid-column: 1 / -1;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 90px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(34, 87, 199, 0.12);
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 700;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-strong);
}

.btn-light {
  background: var(--surface-soft);
  color: var(--text);
  border: 1px solid var(--line);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.status-pill,
.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.92rem;
  font-weight: 700;
}

.status-pill.online {
  background: rgba(23, 131, 77, 0.12);
  color: var(--success);
}

.status-pill.offline {
  background: rgba(190, 47, 59, 0.12);
  color: var(--danger);
}

.user-badge {
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.card-list {
  display: grid;
  gap: 12px;
}

.card {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  border-radius: 14px;
  padding: 14px;
}

.card h3,
.card h4 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.card p {
  margin: 5px 0;
  color: var(--muted);
  line-height: 1.45;
}

.info-box,
.code-box,
.scan-result {
  margin-top: 14px;
  border-radius: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.code-box {
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 120px;
}

.subhead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.passenger-row {
  display: grid;
  grid-template-columns: 180px 1fr 1fr auto;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
  margin-bottom: 10px;
}

.ticket-preview-list {
  display: grid;
  gap: 16px;
}

.ticket-sheet {
  background: white;
  border: 1px dashed #b7c4d7;
  border-radius: 18px;
  overflow: hidden;
}

.ticket-main,
.ticket-stub {
  padding: 18px;
}

.ticket-main {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 16px;
}

.ticket-stub {
  background: #f8fbff;
}

.tear-line {
  border-top: 2px dashed #93a4bd;
}

.ticket-title {
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 10px;
}

.ticket-meta {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.ticket-meta strong {
  color: var(--text);
}

.ticket-qr img {
  width: 100%;
  max-width: 180px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  padding: 8px;
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.toast-wrap {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 10px;
  z-index: 30;
}

.toast {
  min-width: 260px;
  max-width: 360px;
  border-radius: 14px;
  padding: 14px 16px;
  background: #12263f;
  color: white;
  box-shadow: var(--shadow);
}

.toast.success {
  background: var(--success);
}

.toast.error {
  background: var(--danger);
}

.small {
  font-size: 0.9rem;
  color: var(--muted);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.stat-card {
  background: #f4f7fb;
  border: 1px solid #d8e1ec;
  border-radius: 16px;
  padding: 18px;
}

.stat-label {
  font-size: 13px;
  color: #5a6a7d;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 34px;
  font-weight: 700;
  color: #0f2e4f;
  line-height: 1;
}

.table-wrap {
  overflow-x: auto;
}

.pending-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.pending-table th,
.pending-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #dfe6ee;
  text-align: left;
  vertical-align: middle;
}

.pending-table th {
  background: #eef3f8;
  color: #163250;
  font-weight: 700;
  position: sticky;
  top: 0;
}

.pending-row.overdue {
  background: rgba(190, 47, 59, 0.10);
}

.pending-row.soon {
  background: rgba(214, 162, 38, 0.12);
}

.status-chip {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: #e7edf5;
  color: #163250;
}

.status-sold {
  background: #e9eef6;
  color: #35506f;
}

.status-assigned,
.status-reassigned {
  background: #e5f0ff;
  color: #1f4f8a;
}

.status-boarded {
  background: #fff2d9;
  color: #8a5a00;
}

.status-departed {
  background: #ede7ff;
  color: #5b3fa3;
}

.status-completed {
  background: #e4f5ea;
  color: #22663b;
}

.flight-run-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 16px;
}

.flight-run-card {
  background: #ffffff;
  border: 1px solid #dbe4ee;
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 6px 18px rgba(15, 46, 79, 0.06);
}

.flight-run-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.flight-run-head h3 {
  margin: 0 0 4px 0;
}

.flight-run-head p {
  margin: 0;
  color: #5d6d80;
  font-size: 14px;
}

.flight-run-meta {
  display: grid;
  gap: 6px;
  font-size: 14px;
  margin-bottom: 12px;
}

.load-bar {
  width: 100%;
  height: 10px;
  background: #e9eff5;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 14px;
}

.load-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #2f6fb3, #56a3ff);
  border-radius: 999px;
}

.flight-passenger-list {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  max-height: 280px;
  overflow-y: auto;
}

.flight-passenger {
  border: 1px solid #e1e8f0;
  border-radius: 12px;
  padding: 10px 12px;
  background: #f8fbfe;
}

.flight-passenger.is-boarded {
  background: #fff4dc;
  border-color: #f0d18a;
}

.flight-passenger-main {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.flight-passenger-id {
  font-family: monospace;
  font-size: 12px;
  color: #63758a;
}

.flight-passenger-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  font-size: 12px;
  color: #607286;
}

.flight-passenger-empty {
  color: #6b7b8d;
  font-size: 14px;
  padding: 8px 0;
}

.boarding-zone-box {
  background: rgba(255, 214, 102, 0.18);
  border: 1px solid rgba(214, 162, 38, 0.45);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 14px;
}

.boarding-zone-box h4,
.boarded-zone-box h4 {
  margin: 0 0 10px 0;
}

.boarded-zone-box {
  background: #f8fbfe;
  border: 1px solid #dbe4ee;
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 14px;
}

.boarding-zone-item {
  background: rgba(255, 244, 204, 0.85);
  border-color: rgba(214, 162, 38, 0.4);
}

.status-chip.status-boarding {
  background: rgba(255, 193, 7, 0.18);
  color: #9a6700;
  border: 1px solid rgba(255, 193, 7, 0.35);
}

.status-chip.status-departed {
  background: rgba(0, 102, 204, 0.14);
  color: #0b63c9;
  border: 1px solid rgba(0, 102, 204, 0.3);
}

.status-chip.status-arrived {
  background: rgba(30, 160, 80, 0.16);
  color: #1d7f46;
  border: 1px solid rgba(30, 160, 80, 0.3);
}

.scroll-panel {
	max-height: 320px;          /* Höhe der Kachel */
	overflow-y: auto;
	padding-right: 6px;         /* Platz für Scrollbar */
}

/* optional: hübschere Scrollbar (Chrome/Edge) */
.scroll-panel::-webkit-scrollbar {
	width: 8px;
}

.scroll-panel::-webkit-scrollbar-thumb {
	background: rgba(0,0,0,0.2);
	border-radius: 6px;
}

.scroll-panel::-webkit-scrollbar-thumb:hover {
	background: rgba(0,0,0,0.35);
}

.scroll-panel .card {
	padding: 10px;
	margin-bottom: 8px;
}


#dashboardTab .grid {
  align-items: stretch;
}

#dashboardTab .panel {
  height: 420px;         
  overflow: hidden;
}

#dashboardTab .panel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;
}

/* Scrollbar hübscher */
#dashboardTab .panel-body::-webkit-scrollbar {
  width: 8px;
}

#dashboardTab .panel-body::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.2);
  border-radius: 6px;
}

#dashboardTab .panel-body::-webkit-scrollbar-thumb:hover {
  background: rgba(0,0,0,0.35);
}

.scanner-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.scanner-modal.hidden {
  display: none !important;
}

.scanner-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 16, 28, 0.72);
  backdrop-filter: blur(4px);
}

.scanner-modal-content {
  position: relative;
  z-index: 1;
  width: 90vw;              
  max-width: 720px;
  max-height: 92vh;
  overflow: auto;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(0,0,0,0.28);
  padding: 16px;
}

.scanner-modal-content .scan-result {
  margin-top: 0;
  border: 0;
  background: transparent;
  padding: 0;
}

.scanner-close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  z-index: 20;
}

.scanner-close-btn:hover {
  background: rgba(0,0,0,0.8);
}

/* Handy */
@media (max-width: 768px) {
  .scanner-modal-content {
    width: 90vw;           /* 🔥 statt 100vw */
    max-width: 90vw;
    max-height: 92vh;
    height: auto;
    border-radius: 16px;
    padding: 12px;
  }
}

@media (max-width: 980px) {
  .grid.two,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .ticket-main {
    grid-template-columns: 1fr;
  }

  .passenger-row {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 8px 14px;
    gap: 8px;
  }

  /* Auf Handy: BoardingPilot-Header ausblenden, nur Status-Aktionen anzeigen */
  .brand {
    display: none;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
    gap: 6px;
  }

  /* Status-Pills und User-Badge schlanker auf Handy */
  .topbar-actions .status-pill,
  .topbar-actions .user-badge {
    padding: 5px 10px;
    font-size: 0.78rem;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 50%;
  }

  .topbar-actions .btn {
    padding: 6px 12px;
    font-size: 0.85rem;
  }

  .main {
    padding: 16px;
  }
}

@media print {
  .topbar,
  .tabs,
  .btn,
  .toast-wrap {
    display: none !important;
  }

  body {
    background: white;
  }

  .ticket-sheet {
    border: 0;
    box-shadow: none;
    page-break-inside: avoid;
  }
}

/* ============================
   FLUGHELFER MOBILE OPTIMIZATION
============================ */

.helfer-actionbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.helfer-scan-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 16px;
  font-size: 1.05rem;
}

.helfer-scan-icon {
  font-size: 1.2em;
  line-height: 1;
}

.helfer-machine-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  user-select: none;
  min-width: 90px;
  transition: background 0.15s;
}

.helfer-machine-chip:hover,
.helfer-machine-chip:active {
  background: var(--surface-soft);
}

.helfer-machine-label {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  line-height: 1;
  margin-bottom: 3px;
}

.helfer-machine-chip strong {
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.1;
  font-family: monospace;
}

.helfer-settings-btn {
  width: 48px;
  height: 48px;
  padding: 0;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.helfer-settings-panel {
  margin-bottom: 16px;
  animation: slideDown 0.2s ease-out;
}

.helfer-settings-panel.hidden {
  display: none !important;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Auf Handy: Action-Bar bleibt kompakt, Boarding-Karten direkt sichtbar */
@media (max-width: 768px) {
  .helfer-scan-btn {
    flex: 1 1 100%;
    order: 1;
  }

  .helfer-machine-chip {
    flex: 1;
    order: 2;
  }

  .helfer-settings-btn {
    order: 3;
  }
}
