:root {
  --navy-900: #0a1830;
  --navy-800: #0f2444;
  --navy-700: #16305c;
  --navy-600: #1f3f78;
  --amber-400: #d9a441;
  --amber-300: #e8bd6b;
  --paper: #f6f4ee;
  --paper-dim: #eae6da;
  --ink: #1b2430;
  --ink-dim: #5b6472;
  --line: #dcd6c4;
  --ok: #2f7a4f;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(10, 24, 48, 0.08);
  --shadow-lg: 0 12px 32px rgba(10, 24, 48, 0.18);
  font-size: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ---------- Login page ---------- */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 20% 20%, var(--navy-700), transparent 55%),
    radial-gradient(circle at 80% 80%, var(--navy-600), transparent 55%),
    linear-gradient(160deg, var(--navy-900), var(--navy-800));
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--paper);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 40px 32px 32px;
  text-align: center;
}

.login-mark {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--amber-300), var(--amber-400));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--navy-900);
  font-size: 20px;
  letter-spacing: 0.5px;
}

.login-card h1 {
  font-size: 20px;
  margin: 0 0 4px;
  letter-spacing: 0.2px;
}

.login-card p.sub {
  margin: 0 0 24px;
  color: var(--ink-dim);
  font-size: 13.5px;
}

.login-card label {
  display: block;
  text-align: left;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-dim);
  margin: 14px 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.login-card input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 15px;
  color: var(--ink);
}

.login-card input:focus {
  outline: none;
  border-color: var(--navy-600);
  box-shadow: 0 0 0 3px rgba(31, 63, 120, 0.15);
}

.login-btn {
  width: 100%;
  margin-top: 22px;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: var(--navy-800);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.login-btn:hover { background: var(--navy-700); }

.login-error {
  margin-top: 14px;
  font-size: 13px;
  color: #b3392b;
  min-height: 16px;
}

/* ---------- App shell ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--navy-900);
  color: #fff;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  font-size: 15px;
  white-space: nowrap;
}

.brand .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--amber-400);
}

.airport-pick {
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.airport-pick select {
  background: var(--navy-800);
  color: #fff;
  border: 1px solid var(--navy-600);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13.5px;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.btn {
  border: 1px solid rgba(255,255,255,0.25);
  background: transparent;
  color: #fff;
  padding: 8px 14px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color .15s ease;
}
.btn:hover { background: rgba(255,255,255,0.08); }

.btn-amber {
  background: var(--amber-400);
  border-color: var(--amber-400);
  color: var(--navy-900);
}
.btn-amber:hover { background: var(--amber-300); }

.btn-ghost {
  border-color: transparent;
  color: rgba(255,255,255,0.75);
}

.layout {
  display: flex;
  align-items: flex-start;
  max-width: 1180px;
  margin: 0 auto;
}

.side-nav {
  position: sticky;
  top: 62px;
  width: 220px;
  flex-shrink: 0;
  padding: 28px 12px 40px 24px;
  max-height: calc(100vh - 62px);
  overflow-y: auto;
}

.side-nav a {
  display: block;
  text-decoration: none;
  font-size: 13.5px;
  color: var(--ink-dim);
  padding: 7px 10px;
  border-radius: 6px;
  margin-bottom: 2px;
  border-left: 2px solid transparent;
}

.side-nav a:hover { color: var(--ink); background: var(--paper-dim); }
.side-nav a.active {
  color: var(--navy-800);
  font-weight: 700;
  border-left-color: var(--amber-400);
  background: var(--paper-dim);
}

.content {
  flex: 1;
  min-width: 0;
  padding: 28px 24px 80px;
}

.hero {
  background: linear-gradient(135deg, var(--navy-800), var(--navy-700));
  color: #fff;
  border-radius: var(--radius);
  padding: 26px 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.hero .codes {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 6px;
}

.hero .iata {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--amber-300);
}

.hero .icao {
  font-size: 14px;
  color: rgba(255,255,255,0.65);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 5px;
  padding: 2px 8px;
}

.hero h1 {
  margin: 4px 0 6px;
  font-size: 22px;
}

.hero .loc {
  color: rgba(255,255,255,0.75);
  font-size: 13.5px;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.15);
}

.hero-meta .m {
  font-size: 12.5px;
}

.hero-meta .m .k {
  display: block;
  color: rgba(255,255,255,0.55);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 10.5px;
  margin-bottom: 2px;
}

section.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  scroll-margin-top: 74px;
}

section.card .card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

section.card .card-head .ico {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--paper-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: var(--navy-700);
}

section.card .card-head h2 {
  font-size: 15.5px;
  margin: 0;
  letter-spacing: 0.2px;
}

.card-body { padding: 18px 20px 20px; }

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px 20px;
}

.field label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ink-dim);
  margin-bottom: 3px;
}

.field .val {
  font-size: 14.5px;
  line-height: 1.4;
}

.field .val[contenteditable="true"] {
  background: #fffbe9;
  outline: 1px dashed var(--amber-400);
  border-radius: 4px;
  padding: 3px 5px;
  margin: -3px -5px;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

table.data-table thead th {
  text-align: left;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--ink-dim);
  border-bottom: 1px solid var(--line);
  padding: 6px 10px;
  white-space: nowrap;
}

table.data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--paper-dim);
  vertical-align: top;
}

table.data-table td[contenteditable="true"] {
  background: #fffbe9;
  outline: 1px dashed var(--amber-400);
  border-radius: 4px;
}

.notes-box {
  min-height: 90px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 14px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-dim);
  white-space: pre-wrap;
}

.notes-box[contenteditable="true"] {
  background: #fffbe9;
  outline: 1px dashed var(--amber-400);
  color: var(--ink);
}

.notes-box:empty::before {
  content: attr(data-placeholder);
  color: #a8a297;
}

.placeholder-flag {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: #9b6a12;
  background: #fdf0d3;
  border: 1px solid #eccf8f;
  border-radius: 5px;
  padding: 2px 8px;
  margin-bottom: 16px;
}

.edit-bar {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: none;
  gap: 10px;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background: var(--navy-900);
  color: #fff;
  box-shadow: 0 -6px 20px rgba(0,0,0,0.2);
}

.edit-bar.show { display: flex; }

.edit-bar span { font-size: 12.5px; color: rgba(255,255,255,0.7); margin-right: 6px; }

.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy-900);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 50;
}
.toast.show { opacity: 1; }

.export-modal {
  position: fixed;
  inset: 0;
  background: rgba(10,24,48,0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 60;
  padding: 20px;
}
.export-modal.show { display: flex; }

.export-modal .box {
  background: #fff;
  border-radius: 12px;
  max-width: 560px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.export-modal .box h3 {
  margin: 0;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}

.export-modal textarea {
  flex: 1;
  min-height: 260px;
  margin: 16px 20px;
  padding: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  resize: vertical;
}

.export-modal .row {
  display: flex;
  gap: 10px;
  padding: 0 20px 18px;
  justify-content: flex-end;
}

.export-modal .row button {
  padding: 9px 16px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.export-modal .row button.primary {
  background: var(--navy-800);
  color: #fff;
  border-color: var(--navy-800);
}

@media (max-width: 860px) {
  .side-nav { display: none; }
  .content { padding: 20px 16px 90px; }
  .app-header { flex-wrap: wrap; }
}
