* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #eef0f3;
  --panel: #ffffff;
  --card: #f4f4f6;
  --line: #e4e6ea;
  --text: #17181a;
  --dim: #6b7280;
  --green: #1a9e57;
  --amber: #e8a013;
  --red: #dd3b3b;
  --blue: #0b5aa5;
}
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---------- header ---------- */
header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  z-index: 1200;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  display: flex; align-items: center; justify-content: center;
}
.logo { font-weight: 800; font-size: 19px; letter-spacing: 0.5px; }
.sub { color: var(--dim); font-size: 12px; margin-left: 2px; }
.views {
  display: flex;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.views button {
  border: none;
  background: none;
  color: var(--dim);
  font-size: 13px;
  font-weight: 700;
  padding: 6px 16px;
  border-radius: 999px;
  cursor: pointer;
}
.views button.active { background: var(--green); color: #fff; }
.stats-link {
  color: var(--dim);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
}
.stats-link:hover { color: var(--text); background: var(--card); }
.meta { margin-left: auto; display: flex; gap: 16px; font-size: 12.5px; align-items: center; }
#counts { font-weight: 700; }
.dim { color: var(--dim); }

/* ---------- layout ---------- */
main { flex: 1; display: flex; min-height: 0; }
#panel {
  width: 392px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  z-index: 1100;
  box-shadow: 2px 0 10px rgba(20, 30, 40, 0.06);
}
#map { flex: 1; background: #dfe6ec; }
.panel-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.panel-head h2 { font-size: 14px; font-weight: 800; color: var(--green); }
.panel-actions { display: flex; gap: 6px; }
.pill-btn {
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.pill-btn.active { background: var(--green); border-color: var(--green); color: #fff; }
.views.range { padding: 2px; }
.views.range button { padding: 4px 10px; font-size: 12px; }
#flights { overflow-y: auto; flex: 1; padding: 12px; display: flex; flex-direction: column; gap: 12px; }

/* ---------- cards ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 1px 3px rgba(20, 30, 40, 0.05);
}
.c-top { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.airline-chip {
  width: 26px; height: 26px;
  border-radius: 6px;
  background: var(--blue);
  color: #fff;
  font-weight: 800;
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}
.c-num { font-weight: 800; font-size: 18px; }
.c-date { margin-left: auto; color: var(--dim); font-size: 12.5px; font-weight: 600; }

/* route block: big codes + line */
.route { display: flex; align-items: flex-start; gap: 10px; }
.route .ap { flex: 0 0 auto; }
.route .ap.right { text-align: right; }
.route .code { font-size: 28px; font-weight: 800; line-height: 1; }
.route .city { font-size: 12px; color: var(--dim); margin-top: 3px; max-width: 120px; }
.routeline { flex: 1; display: flex; align-items: center; margin-top: 12px; position: relative; }
.routeline .track { height: 3px; width: 100%; border-radius: 2px; background: var(--line); }
.routeline.cancelled .track { background: repeating-linear-gradient(90deg, var(--red) 0 6px, transparent 6px 12px); height: 2px; }
.routeline .badge {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 999px;
}

/* two-up mini stat cards, like Abflug/Ankunft */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.stat { background: var(--card); border-radius: 10px; padding: 10px 12px; }
.stat .label { font-size: 12px; font-weight: 700; margin-bottom: 2px; display: flex; align-items: center; gap: 6px; }
.stat .big { font-size: 24px; font-weight: 800; letter-spacing: 0.3px; font-variant-numeric: tabular-nums; }
.stat .small { font-size: 12px; color: var(--dim); margin-top: 2px; }
.stat .big.ok { color: var(--green); }
.stat .big.warn { color: var(--amber); }
.stat .big.crit { color: var(--red); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.ok { background: var(--green); }
.dot.warn { background: var(--amber); }
.dot.crit { background: var(--red); }

/* tag chips */
.tags { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.tag {
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--card);
  color: var(--dim);
  border: 1px solid var(--line);
}
.tag.reg { background: #1f2937; color: #fff; border-color: #1f2937; }
.tag.model { color: var(--blue); }
.tag.cancel { background: var(--red); color: #fff; border-color: var(--red); }
.tag.overdue { background: var(--amber); color: #fff; border-color: var(--amber); }

.released-card { opacity: 0.6; }
.has-tip { position: relative; cursor: help; }
.has-tip:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 7px);
  left: 0;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(20, 30, 40, 0.15);
  z-index: 20;
}
.empty { color: var(--dim); text-align: center; padding: 44px 20px; font-size: 14px; }

/* ---------- map markers ---------- */
.ap-marker {
  border-radius: 50%;
  color: #fff;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2.5px solid #fff;
  box-shadow: 0 1px 6px rgba(20, 30, 40, 0.35);
  background: var(--red);
}
.ap-marker.sev-ok { background: var(--green); }
.ap-marker.sev-warn { background: var(--amber); }
.ap-marker.sev-crit { background: var(--red); }
.ap-dot {
  border-radius: 50%;
  background: #aab3bf;
  border: 1.5px solid #fff;
}
.leaflet-container { font: inherit; }
.plane { filter: drop-shadow(0 1px 2px rgba(20, 30, 40, 0.4)); }
.plane-tip {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 12px;
  box-shadow: 0 2px 8px rgba(20, 30, 40, 0.15);
}

@media (max-width: 800px) {
  main { flex-direction: column-reverse; }
  #panel { width: 100%; height: 52%; border-right: none; border-top: 1px solid var(--line); }
  .sub { display: none; }
  .meta { display: none; }
}
