/* ── Variables ───────────────────────────────────────────── */
:root {
  --color-bg:          #f1f3f5;
  --color-surface:     #ffffff;
  --color-border:      #dde1e7;
  --color-nav-bg:      #1e293b;
  --color-nav-text:    #94a3b8;
  --color-nav-active:  #ffffff;
  --color-nav-hover:   #334155;
  --color-primary:     #2563eb;
  --color-primary-d:   #1d4ed8;
  --color-text:        #0f172a;
  --color-muted:       #64748b;
  --color-success:     #10b981;
  --color-danger:      #ef4444;
  --color-warning:     #f59e0b;
  --radius:            8px;
  --radius-sm:         5px;
  --sidebar-w:         220px;
  --shadow:            0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
       font-size: 14px; line-height: 1.6; color: var(--color-text); background: var(--color-bg); }
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ──────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--color-nav-bg);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.content { flex: 1; overflow-x: hidden; }
.content-inner { max-width: 1100px; padding: 2rem; }

/* ── Sidebar nav ─────────────────────────────────────────── */
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 1.25rem 1.125rem;
  font-size: 15px; font-weight: 600;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.logo-icon { font-size: 18px; }

.nav-list { list-style: none; padding: .5rem 0; flex: 1; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: .5rem 1.125rem;
  color: var(--color-nav-text);
  border-radius: 0;
  transition: background .15s, color .15s;
  font-size: 13.5px;
}
.nav-link:hover { background: var(--color-nav-hover); color: #fff; text-decoration: none; }
.nav-link.active { color: var(--color-nav-active); background: rgba(255,255,255,.08); }
.nav-icon { font-size: 15px; width: 20px; text-align: center; }

.sidebar-user {
  padding: 1rem 1.125rem;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.user-name  { font-size: 13px; font-weight: 500; color: #fff; }
.logout-link { font-size: 12px; color: var(--color-nav-text); display: block; }
.logout-link:hover { color: #fff; }

/* ── Page header ─────────────────────────────────────────── */
.page-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-title { font-size: 22px; font-weight: 600; }
.page-actions { display: flex; gap: 8px; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: .45rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  cursor: pointer; border: 1px solid transparent;
  transition: background .15s, border-color .15s, opacity .15s;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-d); }
.btn-outline { background: transparent; color: var(--color-primary); border-color: var(--color-primary); }
.btn-outline:hover { background: var(--color-primary); color: #fff; }
.btn-ghost  { background: transparent; color: var(--color-muted); border-color: var(--color-border); }
.btn-ghost:hover { background: var(--color-border); }
.btn-sm { padding: .3rem .7rem; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }

/* ── Cards ───────────────────────────────────────────────── */
.card { background: var(--color-surface); border: 1px solid var(--color-border);
        border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1rem; }
.card-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: .875rem 1.25rem;
  font-weight: 600; font-size: 14px;
  border-bottom: 1px solid var(--color-border);
}
.card-link  { font-size: 12px; font-weight: 400; color: var(--color-muted); }
.card-body  { padding: 1.25rem; }
.card-alert { border-color: var(--color-warning); }
.card-alert .card-header { background: #fffbeb; }

/* ── Stat grid ───────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 1.5rem;
}
.stat-card { background: var(--color-surface); border: 1px solid var(--color-border);
             border-radius: var(--radius); padding: 1rem 1.25rem; box-shadow: var(--shadow); }
.stat-label { font-size: 11px; color: var(--color-muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.stat-value { font-size: 26px; font-weight: 600; line-height: 1.2; }
.stat-sub   { font-size: 12px; color: var(--color-muted); margin-top: 3px; }

/* ── Tables ──────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  padding: .6rem 1rem;
  text-align: left; font-size: 11px; font-weight: 600;
  color: var(--color-muted); text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--color-border); background: #fafbfc;
  white-space: nowrap;
}
.table td { padding: .65rem 1rem; border-bottom: 1px solid #f1f3f5; vertical-align: middle; }
.table-hover tbody tr:hover td { background: #f8fafc; }
.table tbody tr:last-child td { border-bottom: none; }
.row-overnight td { background: #fffbeb; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions a { font-size: 15px; color: var(--color-muted); margin-left: 8px; }
.row-actions a:hover { color: var(--color-text); text-decoration: none; }
.row-actions a.text-danger:hover { color: var(--color-danger); }
.empty-cell { text-align: center; color: var(--color-muted); padding: 2rem; }
.sort-link { color: inherit; text-decoration: none; white-space: nowrap; }
.sort-link:hover { color: var(--color-primary); }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 2px 7px;
  border-radius: 20px; font-size: 11px; font-weight: 500;
  white-space: nowrap;
}
.badge-economy      { background: #f0f4ff; color: #3730a3; }
.badge-economy-plus { background: #eff6ff; color: #1d4ed8; }
.badge-business     { background: #faf5ff; color: #7c3aed; }
.badge-premium      { background: #fdf4ff; color: #9333ea; }
.badge-first        { background: #fef3c7; color: #92400e; }
.badge-secondary    { background: #f1f5f9; color: #475569; }
.badge-warning      { background: #fef9c3; color: #854d0e; }

/* ── Filter bar ──────────────────────────────────────────── */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-bottom: 1rem;
}
.filter-input  { padding: .45rem .75rem; border: 1px solid var(--color-border); border-radius: var(--radius-sm); font-size: 13px; min-width: 220px; }
.filter-select { padding: .45rem .75rem; border: 1px solid var(--color-border); border-radius: var(--radius-sm); font-size: 13px; background: white; }
.filter-input:focus, .filter-select:focus { outline: 2px solid var(--color-primary); outline-offset: -1px; border-color: var(--color-primary); }

/* ── Summary row ─────────────────────────────────────────── */
.summary-row {
  display: flex; gap: 8px; align-items: center;
  font-size: 13px; color: var(--color-muted);
  margin-bottom: .75rem;
}
.summary-row span:first-child { color: var(--color-text); font-weight: 500; }

/* ── Forms ───────────────────────────────────────────────── */
.form-card { max-width: 700px; }
.form-section-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--color-muted);
  margin: 1.5rem 0 .75rem; padding-bottom: .5rem;
  border-bottom: 1px solid var(--color-border);
}
.form-section-title:first-child { margin-top: 0; }
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: .25rem; }
.form-row .form-group { flex: 1; min-width: 180px; }
.form-group { margin-bottom: .875rem; }
.form-group label { display: block; font-size: 12px; font-weight: 500; color: var(--color-muted);
                    margin-bottom: 4px; text-transform: uppercase; letter-spacing: .03em; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: .5rem .75rem;
  border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  font-size: 14px; font-family: inherit; background: white;
  transition: border-color .15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: 2px solid var(--color-primary); outline-offset: -1px;
  border-color: var(--color-primary);
}
.form-actions { display: flex; gap: 8px; align-items: center; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--color-border); }
.required { color: var(--color-danger); }
.input-iata { text-transform: uppercase; font-weight: 600; font-size: 16px; letter-spacing: .05em; }

/* ── Alerts ──────────────────────────────────────────────── */
.alert { padding: .75rem 1rem; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 1rem; }
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger  { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fffbeb; color: #78350f; border: 1px solid #fde68a; }
.alert-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ── Layout helpers ──────────────────────────────────────── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.text-muted  { color: var(--color-muted); }
.text-sm     { font-size: 12px; }
.text-danger { color: var(--color-danger); }
.text-success{ color: var(--color-success); }
.nowrap      { white-space: nowrap; }
.iata        { font-weight: 700; font-size: 13px; letter-spacing: .03em; }
.route-arrow { color: var(--color-muted); margin: 0 3px; }
.empty-state { padding: 2rem; text-align: center; color: var(--color-muted); }

/* ── Auth page ───────────────────────────────────────────── */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-box { width: 340px; background: var(--color-surface); border: 1px solid var(--color-border);
            border-radius: var(--radius); padding: 2rem; box-shadow: var(--shadow); }
.auth-logo { font-size: 20px; font-weight: 700; margin-bottom: 1.5rem; text-align: center; }
.auth-sub  { font-size: 13px; color: var(--color-muted); text-align: center; margin-bottom: 1rem; }
.auth-footer { margin-top: 1rem; text-align: center; font-size: 13px; color: var(--color-muted); }

/* ── Landing page ────────────────────────────────────────── */
.landing-page { background: var(--color-bg); }
.landing-wrap {
  display: flex;
  min-height: 100vh;
}
.landing-hero {
  flex: 1;
  background: var(--color-nav-bg);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 2.5rem;
}
.landing-hero-inner { max-width: 480px; }
.landing-logo {
  display: flex; align-items: center; gap: 10px;
  font-size: 18px; font-weight: 700;
  color: #fff;
  margin-bottom: 2.5rem;
}
.landing-logo-icon { font-size: 22px; }
.landing-logo-text { letter-spacing: .01em; }
.landing-headline {
  font-size: 36px; font-weight: 700; line-height: 1.2;
  margin-bottom: 1rem;
  color: #fff;
}
.landing-sub {
  font-size: 15px; line-height: 1.65;
  color: #94a3b8;
  margin-bottom: 2.5rem;
}
.landing-features {
  list-style: none;
  display: flex; flex-direction: column; gap: 1.1rem;
}
.landing-features li {
  display: flex; gap: 1rem; align-items: flex-start;
}
.lf-icon {
  flex-shrink: 0;
  width: 32px; height: 32px;
  background: rgba(255,255,255,.08);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  margin-top: 1px;
}
.landing-features li div { display: flex; flex-direction: column; gap: 1px; }
.landing-features li strong { font-size: 14px; color: #e2e8f0; }
.landing-features li span  { font-size: 13px; color: #64748b; }

.landing-form-wrap {
  width: 420px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
}
.landing-form-box { width: 100%; max-width: 340px; }
.landing-form-title { font-size: 22px; font-weight: 700; margin-bottom: .25rem; }
.landing-form-sub   { font-size: 13px; color: var(--color-muted); margin-bottom: 1.5rem; }
.landing-form-footer {
  margin-top: 1.25rem;
  text-align: center;
  font-size: 13px;
  color: var(--color-muted);
}

/* ── Sidebar username link ───────────────────────────────── */
.user-name-link {
  display: block;
  color: #fff;
  font-size: 13px; font-weight: 500;
  text-decoration: none;
  transition: color .15s;
}
.user-name-link:hover { color: #93c5fd; text-decoration: none; }

/* ── Home city tags ──────────────────────────────────────── */
.home-city-tag {
  display: inline-flex; align-items: center; gap: 4px;
  background: #eff6ff; border: 1px solid #bfdbfe;
  border-radius: 20px;
  padding: 3px 10px 3px 12px;
  font-size: 13px; color: #1e40af;
}
.home-city-label { line-height: 1.4; }
.home-city-remove {
  background: none; border: none; cursor: pointer;
  color: #93c5fd; font-size: 16px; line-height: 1;
  padding: 0 2px;
  transition: color .15s;
}
.home-city-remove:hover { color: #1e40af; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .landing-wrap { flex-direction: column; }
  .landing-hero { padding: 2.5rem 1.5rem; }
  .landing-headline { font-size: 28px; }
  .landing-form-wrap { width: 100%; border-left: none; border-top: 1px solid var(--color-border); }
}
@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static;
             flex-direction: row; flex-wrap: wrap; }
  .nav-list { display: flex; flex-direction: row; padding: 0; }
  .sidebar-user { display: none; }
  .content-inner { padding: 1rem; }
  .two-col { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-bar { flex-direction: column; align-items: stretch; }
}
