/* ============================================================
   Crew IQ Design System — Aeronex Airlines
   Navy(#0A1B3D) + Gold(#C9A961) on a light operations-dashboard layout
   ============================================================ */
:root {
  --navy-900: #0a1b3d;
  --navy-800: #0f234c;
  --navy-700: #15316b;
  --navy-500: #24478f;
  --gold-600: #ab8a44;
  --gold-500: #c9a961;
  --gold-100: #f6efe0;
  --bg: #f4f6fa;
  --card: #ffffff;
  --border: #e5e8ef;
  --text: #16213e;
  --text-muted: #6b7280;
  --text-faint: #9aa2b1;
  --danger: #dc2626;
  --danger-bg: #fdecec;
  --success: #16a34a;
  --success-bg: #eafaf0;
  --warning: #d97706;
  --warning-bg: #fff6e6;
  --info-bg: #eaf1ff;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow: 0 4px 16px rgba(16, 24, 40, 0.08);
  --sidebar-w: 248px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ---------- Layout shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
}
.sidebar-brand .logo-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--navy-900), var(--navy-500));
  display: flex; align-items: center; justify-content: center;
  color: var(--gold-500); font-weight: 800; font-size: 15px;
}
.sidebar-brand .brand-text { line-height: 1.25; }
.sidebar-brand .brand-name { font-weight: 700; font-size: 15px; color: var(--navy-900); }
.sidebar-brand .brand-sub { font-size: 11px; color: var(--text-muted); }

.sidebar-cta {
  margin: 4px 16px 14px;
  padding: 10px 14px;
  background: var(--navy-900);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13px;
  display: flex; align-items: center; gap: 8px;
}
.sidebar-cta:hover { background: var(--navy-700); }

.sidebar-nav { flex: 1; padding: 4px 10px; overflow-y: auto; }
.sidebar-group-label {
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-faint); padding: 14px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; margin: 1px 0; border-radius: var(--radius-sm);
  color: var(--text-muted); font-weight: 500; font-size: 13.5px;
  border-left: 3px solid transparent;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nav-item .ico { width: 16px; text-align: center; flex-shrink: 0; }
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active {
  background: var(--gold-100);
  color: var(--navy-900);
  font-weight: 700;
  border-left-color: var(--gold-500);
}
.nav-item.soon { opacity: .55; }
.nav-item .badge-soon {
  margin-left: auto; font-size: 9.5px; font-weight: 700; color: var(--text-faint);
  border: 1px solid var(--border); border-radius: 999px; padding: 1px 6px;
}

.sidebar-footer { padding: 10px; border-top: 1px solid var(--border); }
.sidebar-footer .nav-item { color: var(--text-muted); }

/* ---------- Main column ---------- */
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 64px; flex-shrink: 0;
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px; background: var(--card); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.topbar-search {
  flex: 1; max-width: 420px; display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 999px;
  padding: 8px 14px; color: var(--text-faint); font-size: 13px;
}
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 999px; border: none; background: transparent;
  display: flex; align-items: center; justify-content: center; color: var(--text-muted); position: relative;
}
.icon-btn:hover { background: var(--bg); }
.icon-btn .dot {
  position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger); border: 2px solid var(--card);
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--navy-800); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12.5px;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.page { padding: 28px 32px 60px; max-width: 1240px; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.page-title { font-size: 22px; font-weight: 800; color: var(--navy-900); margin: 0 0 4px; }
.page-subtitle { color: var(--text-muted); font-size: 13.5px; margin: 0; }

/* ---------- Cards / grid ---------- */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 18px 20px;
}
.card-title { font-weight: 700; font-size: 14.5px; color: var(--navy-900); margin: 0 0 12px; display: flex; align-items: center; justify-content: space-between; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: 2fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 980px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-weight: 600; font-size: 13.5px; transition: background .12s ease;
}
.btn-primary { background: var(--navy-900); color: #fff; }
.btn-primary:hover { background: var(--navy-700); }
.btn-gold { background: var(--gold-500); color: var(--navy-900); }
.btn-gold:hover { background: var(--gold-600); color: #fff; }
.btn-outline { background: #fff; color: var(--text); border-color: var(--border); }
.btn-outline:hover { background: var(--bg); }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.badge-info { background: var(--info-bg); color: var(--navy-700); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-gold { background: var(--gold-100); color: var(--gold-600); }
.badge-muted { background: var(--bg); color: var(--text-muted); }

/* ---------- Table ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; color: var(--text-faint); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; padding: 8px 10px; border-bottom: 1px solid var(--border); }
td { padding: 12px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-muted); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: #fff; color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--navy-500); box-shadow: 0 0 0 3px rgba(21,49,107,.12); }
.field-hint { font-size: 11.5px; color: var(--text-faint); margin-top: 4px; }
.field-error { font-size: 12px; color: var(--danger); margin-top: 4px; }

/* ---------- Auth screens (splash / login / setup) ---------- */
.auth-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 20% 20%, #142c5e 0%, var(--navy-900) 55%, #06122b 100%);
  padding: 24px;
}
.auth-card {
  width: 100%; max-width: 420px; background: rgba(255,255,255,.98); border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(0,0,0,.35); padding: 40px 36px; text-align: center;
}
.auth-logo {
  width: 56px; height: 56px; margin: 0 auto 18px; border-radius: 14px;
  background: linear-gradient(135deg, var(--navy-900), var(--navy-500));
  display: flex; align-items: center; justify-content: center; color: var(--gold-500);
  font-weight: 800; font-size: 22px;
}
.auth-title { font-size: 20px; font-weight: 800; color: var(--navy-900); margin: 0 0 4px; }
.auth-sub { color: var(--text-muted); font-size: 13px; margin: 0 0 26px; }
.auth-tagline { color: var(--gold-600); font-weight: 700; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 6px; }
.discord-btn {
  width: 100%; background: #5865F2; color: #fff; border: none; border-radius: var(--radius-sm);
  padding: 13px; font-weight: 700; font-size: 14px; display: flex; align-items: center; justify-content: center; gap: 10px;
}
.discord-btn:hover { background: #4752c4; }
.auth-divider { display: flex; align-items: center; gap: 10px; color: var(--text-faint); font-size: 11.5px; margin: 20px 0; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth-footer-link { font-size: 12.5px; color: var(--text-muted); margin-top: 18px; }
.auth-footer-link a { color: var(--navy-500); font-weight: 700; }
.auth-alert { text-align: left; font-size: 12.5px; padding: 10px 12px; border-radius: var(--radius-sm); margin-bottom: 16px; }
.auth-alert.error { background: var(--danger-bg); color: var(--danger); }
.auth-alert.success { background: var(--success-bg); color: var(--success); }
.auth-alert.info { background: var(--info-bg); color: var(--navy-700); }

/* ---------- Progress / misc ---------- */
.progress { height: 8px; border-radius: 999px; background: var(--bg); overflow: hidden; }
.progress > div { height: 100%; background: var(--navy-700); border-radius: 999px; }
.spinner { width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.spinner-dark { border-color: rgba(10,27,61,.18); border-top-color: var(--navy-900); }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-faint); }
.stub-panel { text-align: center; padding: 70px 20px; color: var(--text-faint); }
.stub-panel .stub-ico { font-size: 30px; margin-bottom: 10px; }
.stub-panel h3 { color: var(--text-muted); margin: 0 0 6px; }
.toast {
  position: fixed; bottom: 24px; right: 24px; background: var(--navy-900); color: #fff;
  padding: 12px 18px; border-radius: var(--radius-sm); box-shadow: var(--shadow); font-size: 13px; z-index: 999;
}
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }
.modal-overlay {
  position: fixed; inset: 0; background: rgba(10,15,30,.5); display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal { background: #fff; border-radius: var(--radius); padding: 24px; width: 100%; max-width: 440px; box-shadow: var(--shadow); }
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.mono { font-family: "SFMono-Regular", Consolas, monospace; letter-spacing: .04em; }
