:root {
  --ink: #122033;
  --muted: #66768a;
  --navy: #0b172a;
  --navy-soft: #152640;
  --brand: #2f7cf6;
  --brand-dark: #1f65d6;
  --surface: #ffffff;
  --canvas: #f4f7fb;
  --line: #e3e9f1;
  --success: #12805c;
  --warning: #a86408;
  --danger: #bd3d4a;
  --shadow: 0 8px 24px rgba(18, 32, 51, 0.07);
}

body {
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 90% 0%, rgba(47, 124, 246, 0.08), transparent 27rem),
    var(--canvas);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

.app-shell { max-width: 1480px; }
.page-content { padding-top: 2rem; padding-bottom: 4rem; }

.app-navbar {
  min-height: 72px;
  color: #fff;
  background: rgba(11, 23, 42, 0.97);
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(14px);
}

.app-navbar .navbar-brand { color: #fff; font-weight: 750; letter-spacing: -0.03em; }
.app-navbar .navbar-toggler { border-color: rgba(255, 255, 255, 0.2); }
.app-navbar .navbar-toggler-icon { filter: invert(1); }

.brand-mark {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, #4c96ff, #2268d8);
  border-radius: 10px;
  box-shadow: 0 8px 18px rgba(47, 124, 246, 0.3);
}

.app-nav { gap: 0.15rem; }
.app-navbar .nav-link {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: #aebbd0;
  padding: 0.55rem 0.7rem !important;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 550;
}
.app-navbar .nav-link:hover, .app-navbar .nav-link.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.09);
}

.btn-brand {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}
.btn-brand:hover { color: #fff; background: var(--brand-dark); border-color: var(--brand-dark); }

.user-chip { display: flex; align-items: center; gap: 0.6rem; color: #fff; font-size: 0.82rem; }
.user-chip small { display: block; color: #8fa0b8; line-height: 1.1; }
.user-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #dce9ff;
  background: var(--navy-soft);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  font-weight: 700;
}
.logout-link { font-size: 1.05rem !important; }
.notification-bell {
  position: relative;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: #aebbd0;
  border-radius: 50%;
  text-decoration: none;
}
.notification-bell:hover { color: #fff; background: rgba(255, 255, 255, 0.09); }
.notification-badge {
  position: absolute;
  top: -2px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  color: #fff;
  background: var(--danger);
  border: 2px solid var(--navy);
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 750;
  line-height: 14px;
  text-align: center;
}

.notification-item { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.15rem; }
.notification-unread { background: #f5f9ff; }
.notification-unread strong::after {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 0.45rem;
  background: var(--brand);
  border-radius: 50%;
  content: "";
}
.notification-icon {
  display: grid;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--brand);
  background: #edf4ff;
  border-radius: 11px;
}
.notification-action { color: var(--warning); background: #fff3dd; }
.notification-assignment { color: var(--success); background: #e4f6ef; }

h1, h2, h3, h4, h5, h6 { color: var(--ink); letter-spacing: -0.025em; }
.page-title { margin: 0; font-size: clamp(1.55rem, 3vw, 2.15rem); font-weight: 750; }
.page-kicker {
  margin-bottom: 0.3rem;
  color: var(--brand);
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.page-subtitle { max-width: 680px; margin: 0.35rem 0 0; color: var(--muted); }

.card {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.card-header {
  padding: 1rem 1.15rem;
  color: var(--ink);
  background: #fff;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
}
.card-body { padding: 1.2rem; }

.metric-card { height: 100%; position: relative; }
.metric-card .card-body { padding: 0.8rem 0.95rem; }
.metric-card::after {
  position: absolute;
  top: 0;
  right: 0;
  width: 72px;
  height: 72px;
  background: radial-gradient(circle at top right, rgba(47, 124, 246, 0.13), transparent 70%);
  content: "";
}
.metric-icon {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: var(--brand);
  background: #edf4ff;
  border-radius: 10px;
  font-size: 0.88rem;
}
.metric-label { color: var(--muted); font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.055em; }
.metric-value { margin-top: 0.3rem; font-size: 1.35rem; font-weight: 750; line-height: 1; letter-spacing: -0.04em; }

.table { --bs-table-bg: transparent; color: var(--ink); }
.table > :not(caption) > * > * { padding: 0.85rem 1rem; border-color: var(--line); vertical-align: middle; }
.table thead th {
  color: var(--muted);
  background: #f8fafc;
  border-bottom-width: 1px;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.055em;
  text-transform: uppercase;
  white-space: nowrap;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafcff; }
.route-code { font-weight: 750; letter-spacing: 0.02em; }
.route-arrow { margin: 0 0.35rem; color: #9aa8ba; }
.secondary-text { color: var(--muted); font-size: 0.84rem; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.58rem;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 700;
  text-transform: capitalize;
}
.status-pill::before { width: 6px; height: 6px; border-radius: 50%; background: currentColor; content: ""; }
.status-requested { color: var(--warning); background: #fff3dd; }
.status-approved, .status-scheduled { color: #2766bd; background: #e9f2ff; }
.status-completed { color: var(--success); background: #e4f6ef; }
.status-cancelled { color: var(--danger); background: #fdebee; }
.status-neutral { color: #59697d; background: #edf1f5; }

.form-label { margin-bottom: 0.4rem; color: #47576b; font-size: 0.84rem; font-weight: 650; }
.form-control, .form-select {
  min-height: 43px;
  border-color: #d5deea;
  border-radius: 9px;
}
.form-control:focus, .form-select:focus {
  border-color: #85b2f8;
  box-shadow: 0 0 0 0.22rem rgba(47, 124, 246, 0.12);
}
.ts-dropdown {
  z-index: 1090;
  border-color: var(--line);
  border-radius: 10px;
  box-shadow: 0 14px 34px rgba(18, 32, 51, 0.18);
}
.ts-dropdown .option { padding: 0.7rem 0.8rem; }
.ts-dropdown .active { background: #f1f6ff; color: var(--ink); }
.ts-wrapper.multi .ts-control { min-height: 43px; padding: 0.45rem 0.65rem; border-radius: 9px; }
.qualification-grid { display: flex; flex-wrap: wrap; gap: 0.55rem; }
.qualification-option {
  display: flex;
  min-width: 170px;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  padding: 0.6rem 0.7rem;
  cursor: pointer;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 9px;
}
.qualification-option:hover { background: #f1f6ff; border-color: #b9d2f9; }
.qualification-option:has(input:checked) { background: #edf4ff; border-color: #85b2f8; }
.qualification-option strong { display: block; font-size: 0.8rem; }
.qualification-option small { display: block; color: var(--muted); font-size: 0.7rem; }
.qualification-grid-compact { min-width: 360px; }
.qualification-grid-compact .qualification-option { min-width: 110px; padding: 0.45rem 0.55rem; }
.btn { border-radius: 9px; font-weight: 650; }
.btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }

.empty-state { padding: 3rem 1rem; color: var(--muted); text-align: center; }
.empty-state i { display: block; margin-bottom: 0.75rem; color: #9fb5d0; font-size: 2rem; }
.app-alert { border: 0; border-radius: 11px; box-shadow: var(--shadow); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.section-title { margin: 0; font-size: 1rem; font-weight: 750; }

.calendar-subscription-card { background: linear-gradient(135deg, #fff, #f6faff); }
.subscription-icon {
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--brand);
  background: #eaf3ff;
  border-radius: 12px;
  font-size: 1.05rem;
}
.calendar-subscription-card .input-group .form-control {
  color: #526278;
  background: #fff;
  font-size: 0.76rem;
}
.subscription-help summary { color: var(--brand); cursor: pointer; font-size: 0.8rem; font-weight: 650; }
.subscription-help summary:hover { color: var(--brand-dark); }

.owner-chip {
  display: inline-flex;
  margin: 0.15rem 0.2rem 0.15rem 0;
  padding: 0.28rem 0.55rem;
  color: #40536b;
  background: #eef3f8;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 650;
}
.action-needed {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0.12rem 0.25rem 0.12rem 0;
  padding: 0.25rem 0.5rem;
  color: #9a5d08;
  background: #fff3dd;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}
.owner-selection-list { display: grid; gap: 0.6rem; }
.owner-selection-item {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}
.owner-selection-item:hover { background: #f7faff; border-color: #b9c9dd; }
.owner-selection-item small { display: block; color: var(--muted); font-size: 0.76rem; font-weight: 400; }
.owner-selection-item .form-check-input { flex: 0 0 auto; width: 1.2rem; height: 1.2rem; margin: 0; }

.calendar-card { overflow: visible; }
.calendar-card .card-body { padding: 1.25rem; }
.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  padding: 0.8rem 1.25rem;
  color: var(--muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  border-radius: 14px 14px 0 0;
  font-size: 0.75rem;
  font-weight: 650;
}
.calendar-legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
.calendar-dot { width: 8px; height: 8px; border-radius: 50%; }
.dot-requested { background: #c47a10; }
.dot-scheduled { background: var(--brand); }
.dot-completed { background: var(--success); }
.dot-cancelled { background: var(--danger); }
.dot-unavailable { background: #6c5ce7; }

#calendar { min-height: 620px; }
.fc { color: var(--ink); font-size: 0.88rem; }
.fc .fc-toolbar { margin-bottom: 1.25rem; }
.fc .fc-toolbar-title { font-size: 1.25rem; font-weight: 750; letter-spacing: -0.03em; }
.fc .fc-button {
  padding: 0.48rem 0.72rem;
  border-radius: 9px !important;
  box-shadow: none !important;
  font-size: 0.78rem;
  font-weight: 650;
  text-transform: capitalize;
}
.fc .fc-button-primary {
  color: #4b5d73;
  background: #fff;
  border-color: #d7e0eb;
}
.fc .fc-button-primary:hover, .fc .fc-button-primary:focus {
  color: var(--ink);
  background: #f3f6fa;
  border-color: #c7d2df;
}
.fc .fc-button-primary:not(:disabled).fc-button-active {
  color: #fff;
  background: var(--navy);
  border-color: var(--navy);
}
.fc .fc-today-button:disabled { color: #9aa8ba; background: #f3f6fa; border-color: #e2e8f0; opacity: 1; }
.fc-theme-standard td, .fc-theme-standard th, .fc-theme-standard .fc-scrollgrid { border-color: var(--line); }
.fc .fc-scrollgrid { overflow: hidden; border-radius: 11px; }
.fc .fc-col-header-cell {
  padding: 0.65rem 0;
  color: #6d7c8f;
  background: #f8fafc;
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.fc .fc-col-header-cell-cushion, .fc .fc-daygrid-day-number {
  color: inherit;
  text-decoration: none;
}
.fc .fc-daygrid-day-frame { min-height: 112px; }
.fc .fc-daygrid-day-top { padding: 0.35rem 0.45rem 0; }
.fc .fc-daygrid-day-number {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  font-size: 0.78rem;
  font-weight: 650;
}
.fc .fc-day-today { background: #f2f7ff !important; }
.fc .fc-day-today .fc-daygrid-day-number { color: #fff; background: var(--brand); }
.fc .fc-day-other { background: #fbfcfe; }
.fc .fc-day-other .fc-daygrid-day-number { color: #abb6c4; }
.fc .fc-daygrid-event {
  margin: 2px 5px;
  padding: 0.3rem 0.4rem;
  border: 0;
  border-left: 3px solid;
  border-radius: 6px;
  box-shadow: none;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.fc .fc-daygrid-event:hover { transform: translateY(-1px); box-shadow: 0 3px 10px rgba(18, 32, 51, 0.12); }
.fc .fc-event .fc-event-main { color: inherit; }
.calendar-event-content { display: flex; min-width: 0; align-items: baseline; gap: 0.35rem; }
.calendar-event-time { flex: 0 0 auto; font-size: 0.68rem; font-weight: 750; opacity: 0.78; }
.calendar-event-title { overflow: hidden; font-size: 0.72rem; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.fc-event.trip-requested { color: #88520a; background: #fff5df; border-left-color: #c47a10; }
.fc-event.trip-approved, .fc-event.trip-scheduled { color: #215da9; background: #eaf3ff; border-left-color: var(--brand); }
.fc-event.trip-completed { color: #0d694a; background: #e5f6ef; border-left-color: var(--success); }
.fc-event.trip-cancelled { color: #9f2f3c; background: #fdebed; border-left-color: var(--danger); }
.fc-event.aircraft-unavailable { color: #5142b5; background: #eeeafe; border-left-color: #6c5ce7; }
.fc .fc-more-link { color: var(--brand); font-size: 0.72rem; font-weight: 700; }
.fc .fc-list { overflow: hidden; border-color: var(--line); border-radius: 11px; }
.fc .fc-list-day-cushion { padding: 0.7rem 1rem; background: #f6f9fc; }
.fc .fc-list-day-text, .fc .fc-list-day-side-text { color: var(--ink); text-decoration: none; font-size: 0.78rem; font-weight: 700; }
.fc .fc-list-event:hover td { background: #f7faff; }
.fc .fc-list-event-dot { border-color: var(--brand); }
.fc .fc-list-event-time { color: var(--muted); font-size: 0.78rem; }
.fc .fc-list-event-title { padding: 0.85rem 1rem; }

@media (max-width: 1199.98px) {
  .app-navbar .navbar-collapse { padding: 1rem 0 0.4rem; }
  .app-nav { margin-bottom: 0.75rem; }
  .user-chip { margin: 0.5rem 0; }
}

@media (max-width: 767.98px) {
  .page-content { padding-top: 1.25rem; }
  .table > :not(caption) > * > * { padding: 0.72rem 0.8rem; }
  .calendar-card .card-body { padding: 0.75rem; }
  .calendar-legend { gap: 0.55rem 1rem; padding: 0.7rem 0.85rem; }
  #calendar { min-height: 500px; }
  .fc .fc-toolbar { align-items: stretch; gap: 0.75rem; flex-direction: column; }
  .fc .fc-toolbar-chunk { display: flex; justify-content: space-between; }
  .fc .fc-toolbar-chunk:nth-child(2) { order: -1; }
  .fc .fc-toolbar-title { font-size: 1.1rem; }
}
