:root {
  --bg: #f3efe5;
  --paper: #fffdf8;
  --ink: #182126;
  --muted: #64707a;
  --accent: #0f7a5b;
  --accent-2: #d17f21;
  --line: #d8d0c4;
  --shadow: 0 14px 40px rgba(24, 33, 38, 0.08);
  --radius: 20px;
  --page-bg: linear-gradient(180deg, #e3e5e8, #d4d8dd 48%, #c9cdd2);
  --hero-bg: linear-gradient(135deg, rgba(255,255,255,.55), rgba(199,205,212,.6));
  --hero-border: rgba(94, 104, 113, 0.22);
  --subtle-button-bg: #ffffff;
  --input-bg: #ffffff;
  --tab-bg: rgba(255,255,255,0.72);
  --row-bg: #faf7f0;
  --table-head-bg: #f3eee3;
  --label-bg: rgba(24, 33, 38, 0.82);
}

html[data-theme="dark"] {
  --bg: #13181b;
  --paper: #1b2227;
  --ink: #eef3f6;
  --muted: #a7b4bc;
  --accent: #2cb087;
  --accent-2: #e09539;
  --line: #344149;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.35);
  --page-bg: linear-gradient(180deg, #1a1d21, #14181c 52%, #0f1215);
  --hero-bg: linear-gradient(135deg, rgba(42,48,54,.92), rgba(28,33,38,.96));
  --hero-border: rgba(113, 123, 133, 0.22);
  --subtle-button-bg: #20292e;
  --input-bg: #141a1e;
  --tab-bg: rgba(32,41,46,0.92);
  --row-bg: #20282d;
  --table-head-bg: #222b30;
  --label-bg: rgba(238, 243, 246, 0.14);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--ink);
  background: var(--page-bg);
}

a { color: inherit; }
.site-header {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  align-items: center;
  padding: 1.25rem 2rem;
}
.brand {
  text-decoration: none;
  font-size: 1.5rem;
  font-weight: 700;
}
.tagline { color: var(--muted); margin: 0.35rem 0 0; }
.site-header nav {
  display: flex;
  gap: 1rem;
  align-items: center;
}
.site-header nav a {
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
}
.page-shell { padding: 0 2rem 3rem; }
.hero {
  background: var(--hero-bg);
  border: 1px solid var(--hero-border);
  padding: 2rem;
  border-radius: var(--radius);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}
.hero.compact { padding: 1.5rem 2rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .16em; font-size: .75rem; color: var(--accent); margin: 0 0 .5rem; }
h1, h2, h3, p { margin-top: 0; }
.card-grid, .two-up, .three-up {
  display: grid;
  gap: 1rem;
}
.card-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.two-up { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.three-up { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.card, .auth-card, .admin-panel, .map-card, .sidebar, .aircraft-admin-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.button {
  border: none;
  background: var(--accent);
  color: white;
  border-radius: 999px;
  padding: .8rem 1.15rem;
  font-weight: 700;
  text-decoration: none;
  display: inline-block;
  cursor: pointer;
}
.button.subtle { background: var(--subtle-button-bg); color: var(--ink); border: 1px solid var(--line); }
.stack-form { display: grid; gap: .85rem; }
.stack-form label { display: grid; gap: .35rem; font-weight: 600; }
.stack-form input, .stack-form select {
  padding: .75rem .85rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--input-bg);
  color: var(--ink);
}
.stack-form input::placeholder { color: var(--muted); opacity: .9; }
.auth-card { max-width: 460px; margin: 3rem auto; }
.error { color: #a12626; }
.dev-note code { font-size: .95rem; }
.table-list { display: grid; gap: .65rem; }
.tab-strip {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  margin: 0 0 1rem;
}
.admin-top-nav {
  margin-bottom: 1.25rem;
}
.tab-link {
  text-decoration: none;
  padding: .75rem 1rem;
  border-radius: 999px;
  background: var(--tab-bg);
  border: 1px solid var(--line);
  font-weight: 700;
}
.tab-link.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.table-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: .9rem 1rem;
  border-radius: 14px;
  background: var(--row-bg);
}
.link-row { text-decoration: none; }
.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, .8fr);
  gap: 1rem;
}
.map-controls, .sidebar-header {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  align-items: center;
  margin-bottom: .85rem;
}
.sidebar-header h2 {
  margin-bottom: 0;
}
.map-panel { min-height: 520px; border-radius: 16px; overflow: hidden; }
.panel-fullscreen-active {
  position: fixed;
  inset: 1rem;
  z-index: 1100;
  margin: 0;
  width: auto;
  height: auto;
  overflow: auto;
}
.panel-fullscreen-active .map-panel {
  min-height: calc(100vh - 11rem);
}
.panel-fullscreen-active .aircraft-board-wrap {
  max-height: calc(100vh - 10rem);
}
.aircraft-board-wrap {
  overflow: auto;
}
.aircraft-board {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
.aircraft-board th,
.aircraft-board td {
  border: 1px solid var(--line);
  padding: .45rem .55rem;
  text-align: left;
  white-space: nowrap;
}
.aircraft-board th {
  background: var(--table-head-bg);
  position: sticky;
  top: 0;
  z-index: 1;
}
.aircraft-board tbody tr:nth-child(even) {
  background: var(--row-bg);
}
.aircraft-config-table td {
  vertical-align: middle;
}
.aircraft-config-table .table-input {
  width: 100%;
  min-width: 0;
  padding: .6rem .75rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--input-bg);
  color: var(--ink);
  font: inherit;
}
.aircraft-config-table .table-input::placeholder {
  color: var(--muted);
}
.aircraft-config-table form {
  margin: 0;
}
.aircraft-config-table .button {
  width: 100%;
  text-align: center;
}
.aircraft-div-icon {
  background: transparent;
  border: 0;
}
.airport-div-icon {
  background: transparent;
  border: 0;
}
.aircraft-marker {
  width: 28px;
  height: 28px;
  transform-origin: center center;
  filter: drop-shadow(0 3px 6px rgba(24, 33, 38, 0.28));
}
.airport-marker {
  width: 30px;
  height: 30px;
  filter: drop-shadow(0 4px 8px rgba(138, 24, 24, 0.32));
}
.aircraft-marker svg {
  width: 100%;
  height: 100%;
  display: block;
}
.airport-marker svg {
  width: 100%;
  height: 100%;
  display: block;
}
.airport-marker path {
  fill: #c93b32;
  stroke: rgba(255, 245, 245, 0.98);
  stroke-width: 1.6;
}
.aircraft-marker-tracked path {
  fill: var(--accent);
  stroke: rgba(255, 255, 255, 0.92);
  stroke-width: 1.6;
}
.aircraft-marker-tracked-active path {
  fill: var(--accent-2);
  stroke: rgba(255, 255, 255, 0.95);
  stroke-width: 1.6;
}
.aircraft-marker-traffic path {
  fill: #4d6072;
  stroke: rgba(255, 255, 255, 0.92);
  stroke-width: 1.4;
}
.aircraft-label {
  background: var(--label-bg);
  border: 0;
  border-radius: 999px;
  color: #fff;
  font-family: "Courier New", monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
  padding: .25rem .45rem;
  box-shadow: 0 8px 18px rgba(24, 33, 38, 0.18);
}
.aircraft-label::before {
  display: none;
}
.tracked-label {
  background: rgba(15, 122, 91, 0.9);
}
.traffic-label {
  background: rgba(77, 96, 114, 0.9);
}
.airport-label {
  background: rgba(201, 59, 50, 0.92);
}
.theme-toggle {
  min-width: 7.5rem;
  padding: .48rem .9rem;
  line-height: 1.2;
  align-self: center;
}
.sidebar, .aircraft-row { display: grid; gap: .35rem; }
.aircraft-admin-card { margin-bottom: 1rem; }
.user-admin-card {
  display: grid;
  gap: .75rem;
  padding: .9rem 0;
  border-bottom: 1px solid var(--line);
}
.user-admin-card:last-child {
  border-bottom: none;
}
.aircraft-admin-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.queue-list { display: grid; gap: .65rem; margin-top: 1rem; }
.inline-form { align-content: start; }
@media (max-width: 900px) {
  .site-header, .hero, .map-layout { grid-template-columns: 1fr; display: grid; }
  .page-shell { padding: 0 1rem 2rem; }
  .site-header { padding: 1rem; }
}

.button.danger { border-color: #b04242; color: #7d2323; }
.row-actions, .stack-actions {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-wrap: wrap;
}
.stack-actions { flex-direction: column; align-items: end; }
