:root {
  --bg: #101418;
  --panel: #1A2027;
  --panel2: #232B34;
  --line: #2C3641;
  --text: #EDF1F4;
  --muted: #8C99A5;
  --red: #D6001C;
  --red-hover: #B00017;
  --amber: #FFB400;
  --green: #2FBF71;
  --blue: #3E9BD8;
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  padding-bottom: calc(74px + env(safe-area-inset-bottom));
}

h1, h2, h3, .logo { font-family: 'Oswald', 'Inter', sans-serif; letter-spacing: 0.02em; }
h1 { font-size: 24px; margin: 18px 0 10px; text-transform: uppercase; }
h2 { font-size: 17px; margin: 20px 0 8px; text-transform: uppercase; color: var(--muted); }
h2:first-child { margin-top: 0; }

/* Topbar */
.topbar { background: #0B0E11; position: sticky; top: 0; z-index: 500; }
.topbar-inner {
  max-width: 760px; margin: 0 auto; padding: 12px 16px;
  display: flex; align-items: baseline; gap: 10px;
}
.logo { font-weight: 700; font-size: 19px; color: #fff; }
.logo em { font-style: normal; color: var(--red); }
.logo-sub { font-size: 12px; color: var(--muted); }
.stripe { height: 4px; background: linear-gradient(90deg, var(--red) 0 60%, var(--amber) 60% 100%); }

.container { max-width: 760px; margin: 0 auto; padding: 16px; }

/* Cards */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-bottom: 12px;
}
.card.clickable { cursor: pointer; }
.card.clickable:active { background: var(--panel2); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--panel2); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 18px; font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: none; text-align: center;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-hover); }
.btn.big { width: 100%; padding: 16px; font-size: 17px; text-transform: uppercase; font-family: 'Oswald', sans-serif; letter-spacing: 0.04em; }
.btn.small { padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.btn.danger { color: #FF6B7A; border-color: #5A2028; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.btn-row .btn { flex: 1; }

.link-btn { background: none; border: none; color: var(--muted); font: inherit; cursor: pointer; text-decoration: underline; padding: 0; }

/* Forms */
label.field { display: block; margin-bottom: 12px; }
label.field span, .field-label { display: block; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 5px; }
input, select, textarea {
  width: 100%; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px; font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--red); outline-offset: -1px; border-color: var(--red); }
input[type="checkbox"] { width: auto; accent-color: var(--red); transform: scale(1.25); margin-right: 8px; }
textarea { min-height: 70px; resize: vertical; }
::placeholder { color: #5A6772; }
input[type="datetime-local"], input[type="date"] { color-scheme: dark; }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Segmented type picker */
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg button {
  flex: 1; min-width: 70px; padding: 10px 6px; border-radius: 10px;
  background: var(--bg); color: var(--muted); border: 1px solid var(--line);
  font: inherit; font-weight: 600; cursor: pointer;
}
.seg button.sel { background: var(--red); border-color: var(--red); color: #fff; }

/* Chips (batteries) */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips button {
  padding: 8px 14px; border-radius: 999px; background: var(--bg);
  color: var(--muted); border: 1px solid var(--line); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.chips button.sel { background: var(--amber); border-color: var(--amber); color: #14100A; }

/* Checklist */
.check-item {
  display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  margin-bottom: 8px; cursor: pointer;
}
.check-item.done { border-color: var(--green); }
.check-item .box {
  flex: 0 0 22px; height: 22px; border: 2px solid var(--muted); border-radius: 6px;
  display: flex; align-items: center; justify-content: center; font-size: 14px; color: #fff; margin-top: 1px;
}
.check-item.done .box { background: var(--green); border-color: var(--green); }

/* Tags */
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.tag.indsats { background: #3A1216; color: #FF7382; }
.tag.øvelse { background: #12293A; color: #6FBBEB; }
.tag.test { background: #2A2E33; color: #AAB6C0; }
.tag.andet { background: #2A2E33; color: #AAB6C0; }
.tag.aktiv { background: #12382A; color: #58DB9C; }
.tag.service { background: #3A2E10; color: var(--amber); }
.tag.udgået { background: #2A2E33; color: #8C99A5; }
.tag.admin { background: #3A1216; color: #FF7382; }
.tag.warn { background: #3A2E10; color: var(--amber); }

/* Lists */
.list-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: 8px; cursor: pointer;
}
.list-row:active { background: var(--panel2); }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .right { text-align: right; font-size: 13px; color: var(--muted); flex-shrink: 0; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 12px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 14px; }
.stat .num { font-family: 'Oswald', sans-serif; font-size: 26px; font-weight: 600; }
.stat .lbl { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }

/* Active flight */
.active-flight { border: 2px solid var(--red); background: linear-gradient(180deg, #1E1216, var(--panel)); }
.active-flight .timer { font-family: 'Oswald', sans-serif; font-size: 52px; font-weight: 600; text-align: center; margin: 6px 0; font-variant-numeric: tabular-nums; }
.pulse { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--red); margin-right: 7px; animation: pulse 1.4s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

/* Bottom nav */
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 500;
  background: #0B0E11; border-top: 1px solid var(--line);
  display: flex; padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav a {
  flex: 1; text-align: center; padding: 9px 2px 8px; color: var(--muted);
  text-decoration: none; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em;
}
.bottomnav a .ico { display: block; font-size: 21px; margin-bottom: 1px; }
.bottomnav a.sel { color: #fff; }
.bottomnav a.sel .ico { color: var(--red); }

/* Map */
#map { height: calc(100vh - 260px); min-height: 320px; border-radius: var(--radius); border: 1px solid var(--line); }
#detailmap { height: 200px; border-radius: 10px; border: 1px solid var(--line); margin-top: 10px; }
.leaflet-container { background: #1A2027; }

/* Meta table (flight detail) */
.meta { width: 100%; border-collapse: collapse; }
.meta td { padding: 7px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.meta td:first-child { color: var(--muted); font-size: 13px; width: 42%; padding-right: 10px; }
.meta tr:last-child td { border-bottom: none; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 86px; transform: translateX(-50%);
  background: #fff; color: #111; font-weight: 600; padding: 11px 18px;
  border-radius: 999px; z-index: 900; max-width: 90vw; text-align: center;
  box-shadow: 0 6px 24px rgba(0,0,0,0.5);
}
.toast.err { background: var(--red); color: #fff; }

/* Photos */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 10px; }
.photo-grid .ph { position: relative; }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); cursor: pointer; display: block; }
.photo-grid .del {
  position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%;
  background: rgba(0,0,0,0.65); color: #fff; border: none; cursor: pointer; font-size: 13px; line-height: 1;
}
.lightbox {
  position: fixed; inset: 0; z-index: 1000; background: rgba(5,7,9,0.93);
  display: flex; align-items: center; justify-content: center; cursor: zoom-out;
}
.lightbox img { max-width: 96vw; max-height: 92vh; border-radius: 8px; }

/* Marker add mode */
.marker-hint { background: #3A2E10; border: 1px solid var(--amber); color: var(--amber); padding: 9px 13px; border-radius: 10px; margin: 10px 0; font-size: 13.5px; }
.tag.fund { background: #3A2E10; color: var(--amber); }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mt0 { margin-top: 0; }
.center { text-align: center; }
.incident-banner { background: #3A1216; border: 1px solid var(--red); color: #FF9AA5; padding: 10px 14px; border-radius: 10px; margin: 10px 0; }

/* Login */
.auth-wrap { max-width: 420px; margin: 4vh auto 0; }
.auth-logo { text-align: center; margin-bottom: 18px; }
.auth-logo .big { font-family: 'Oswald', sans-serif; font-size: 34px; font-weight: 700; }
.auth-logo .big em { font-style: normal; color: var(--red); }

@media (min-width: 700px) {
  .container { padding: 24px; }
  #map { height: calc(100vh - 300px); }
}
