:root {
  --ink: #0f0f0f;
  --ink-soft: #3a3a3a;
  --ink-muted: #888;
  --paper: #f7f5f0;
  --paper-warm: #eeeae2;
  --gold: #b8975a;
  --gold-light: #d4b47a;
  --sky: #2c5f8a;
  --sky-light: #4a85b8;
  --danger: #8b2e2e;
  --success: #2e6e4a;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.12);
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  padding-bottom: calc(24px + var(--safe-bottom));
}

/* NAV */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(12px + var(--safe-top)) 20px 12px;
  background: var(--ink);
  backdrop-filter: blur(12px);
}

.nav-brand {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--gold);
  text-decoration: none;
  letter-spacing: 0.08em;
}

.nav-links { display: flex; gap: 20px; align-items: center; }

.nav-link {
  font-size: 0.8rem;
  font-weight: 500;
  color: #aaa;
  text-decoration: none;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: color 0.2s;
}

.nav-link:hover, .nav-link.active { color: var(--gold); }

/* MAIN */
.main { max-width: 680px; margin: 0 auto; padding: 24px 16px; }

/* TYPOGRAPHY */
h1 {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 300;
  line-height: 1.2;
  color: var(--ink);
}

h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--ink);
}

h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
}

.eyebrow {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 8px;
}

/* CARDS */
.card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  transition: box-shadow 0.2s, transform 0.15s;
}

.card:hover { box-shadow: var(--shadow-lg); }

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-route {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 300;
  color: var(--ink);
  line-height: 1;
}

.card-route .arrow {
  color: var(--gold);
  font-size: 1.2rem;
  margin: 0 6px;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.03em;
}

.badge-seat { background: #e8f0f8; color: var(--sky); }
.badge-request { background: #f0ebe0; color: #7a5c2e; }
.badge-flex { background: #e8f5ee; color: var(--success); }
.badge-score { background: var(--ink); color: var(--gold); font-weight: 600; }
.badge-aircraft { background: var(--paper-warm); color: var(--ink-soft); }

.card-name {
  font-size: 0.82rem;
  color: var(--ink-muted);
  margin-top: 8px;
}

.card-notes {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-top: 8px;
  font-style: italic;
  border-left: 2px solid var(--gold-light);
  padding-left: 10px;
}

/* MATCH CARD */
.match-card {
  border-left: 3px solid var(--gold);
}

.match-reason {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--paper);
  border-radius: var(--radius-sm);
}

.match-parties {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.match-party {
  background: var(--paper);
  padding: 10px;
  border-radius: var(--radius-sm);
}

.match-party-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold);
  font-weight: 500;
  margin-bottom: 4px;
}

.match-party-route {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 400;
}

.match-vs {
  color: var(--gold);
  font-size: 1.2rem;
  font-weight: 300;
  text-align: center;
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--ink);
  color: var(--gold);
}

.btn-primary:hover { background: #1a1a2e; transform: translateY(-1px); }

.btn-gold {
  background: var(--gold);
  color: white;
}

.btn-gold:hover { background: var(--gold-light); }

.btn-outline {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--ink);
}

.btn-outline:hover { background: var(--ink); color: white; }

.btn-sky {
  background: var(--sky);
  color: white;
}

.btn-sky:hover { background: var(--sky-light); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1.5px solid var(--danger);
}

.btn-danger:hover { background: var(--danger); color: white; }

.btn-sm {
  padding: 7px 14px;
  font-size: 0.78rem;
}

.btn-full { width: 100%; }

/* FORMS */
.form-group { margin-bottom: 20px; }

.form-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 8px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--paper-warm);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink);
  background: white;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(184, 151, 90, 0.12);
}

.form-textarea { min-height: 80px; resize: vertical; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.form-hint {
  font-size: 0.75rem;
  color: var(--ink-muted);
  margin-top: 5px;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.form-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--gold);
  cursor: pointer;
}

.form-check-label {
  font-size: 0.88rem;
  color: var(--ink-soft);
}

/* DIVIDER */
.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--paper-warm), transparent);
  margin: 24px 0;
}

/* SECTION HEADER */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

/* PAGE HEADER */
.page-header { margin-bottom: 28px; }
.page-header p {
  color: var(--ink-muted);
  font-size: 0.9rem;
  margin-top: 6px;
}

/* EMPTY STATE */
.empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--ink-muted);
}

.empty-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.4;
}

.empty p { font-size: 0.9rem; margin-bottom: 16px; }

/* ALERT */
.alert {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin-bottom: 20px;
}

.alert-success { background: #e8f5ee; color: var(--success); border-left: 3px solid var(--success); }
.alert-error { background: #fceaea; color: var(--danger); border-left: 3px solid var(--danger); }
.alert-info { background: #e8f0f8; color: var(--sky); border-left: 3px solid var(--sky); }

/* FAB */
.fab-container {
  position: fixed;
  bottom: calc(24px + var(--safe-bottom));
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
  z-index: 50;
}

.fab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 20px;
  border-radius: 30px;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-decoration: none;
  box-shadow: var(--shadow-lg);
  transition: transform 0.2s, box-shadow 0.2s;
}

.fab:hover { transform: translateY(-2px); box-shadow: 0 12px 48px rgba(0,0,0,0.18); }

.fab-primary { background: var(--ink); color: var(--gold); }
.fab-secondary { background: var(--gold); color: white; }

/* TABS */
.tabs {
  display: flex;
  background: var(--paper-warm);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin-bottom: 20px;
}

.tab {
  flex: 1;
  padding: 9px;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.tab.active {
  background: white;
  color: var(--ink);
  box-shadow: 0 1px 6px rgba(0,0,0,0.08);
}

/* SCORE RING */
.score-ring {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  flex-shrink: 0;
}

.score-high { background: var(--ink); color: var(--gold); }
.score-mid { background: var(--paper-warm); color: var(--ink); }

/* LOGIN PAGE */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: var(--ink);
}

.login-logo {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 300;
  color: var(--gold);
  letter-spacing: 0.12em;
  margin-bottom: 8px;
}

.login-tagline {
  font-size: 0.78rem;
  color: #666;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 48px;
}

.login-card {
  background: #1a1a1a;
  border-radius: var(--radius);
  padding: 36px 28px;
  width: 100%;
  max-width: 380px;
  border: 1px solid #2a2a2a;
}

.login-card h2 {
  font-family: var(--font-display);
  color: white;
  font-size: 1.4rem;
  font-weight: 300;
  margin-bottom: 8px;
}

.login-card p {
  color: #666;
  font-size: 0.85rem;
  margin-bottom: 28px;
  line-height: 1.5;
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 14px;
  background: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  color: #333;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-google:hover { background: #f5f5f5; transform: translateY(-1px); }

.login-disclaimer {
  color: #444;
  font-size: 0.72rem;
  text-align: center;
  margin-top: 24px;
  line-height: 1.5;
}

/* CAL LINK */
.cal-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--sky);
  text-decoration: none;
  padding: 6px 12px;
  border: 1px solid var(--sky);
  border-radius: 20px;
  transition: all 0.2s;
}

.cal-link:hover { background: var(--sky); color: white; }

/* ACTIONS ROW */
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

/* DETAIL PAGE */
.detail-route {
  font-family: var(--font-display);
  font-size: 2.8rem;
  font-weight: 300;
  line-height: 1;
  margin-bottom: 4px;
}

.detail-route .arrow { color: var(--gold); margin: 0 8px; }

/* ADMIN TABLE */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th { text-align: left; padding: 10px 12px; color: var(--gold); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; border-bottom: 1px solid var(--paper-warm); font-weight: 500; }
td { padding: 10px 12px; border-bottom: 1px solid var(--paper); color: var(--ink-soft); vertical-align: middle; }
tr:last-child td { border-bottom: none; }

/* STATS ROW */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 24px; }
.stat { background: white; border-radius: var(--radius-sm); padding: 16px; text-align: center; box-shadow: var(--shadow); }
.stat-value { font-family: var(--font-display); font-size: 2rem; font-weight: 300; color: var(--gold); line-height: 1; }
.stat-label { font-size: 0.7rem; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 4px; }

/* RESPONSIVE */
@media (max-width: 380px) {
  .form-row { grid-template-columns: 1fr; }
  .match-parties { grid-template-columns: 1fr; }
  .match-vs { display: none; }
  .stats { grid-template-columns: 1fr 1fr; }
}
