/* Schedule page — uses portal-shell.css tokens; no global body overrides */
body.portal-shell-page > .container {
  max-width: 1600px;
}

.schedule-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--wingman-border-strong);
  flex-wrap: wrap;
}
.schedule-header h1 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  color: var(--wingman-gold);
}
.loading { text-align: center; padding: 40px; color: var(--wingman-muted); }

.view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--wingman-border-strong);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 18px;
  background: var(--wingman-panel);
}
.view-toggle button {
  padding: 10px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  background: transparent;
  color: #aaa;
  cursor: pointer;
  min-width: 120px;
}
.view-toggle button + button {
  border-left: 1px solid #333;
}
.view-toggle button.active {
  background: var(--wingman-gold);
  color: var(--wingman-brown);
}
.view-toggle button:hover:not(.active) {
  background: #1f1f1f;
  color: #fff;
}

/* Month navigation */
.month-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.month-nav button {
  padding: 10px 18px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background-color: #333;
  color: #fff;
  border: 1px solid #444;
}
.month-nav button:hover {
  background-color: #444;
  border-color: #555;
}
.month-nav .btn-today {
  background-color: var(--wingman-gold);
  color: var(--wingman-brown);
  border-color: var(--wingman-gold);
}
.month-nav .btn-today:hover {
  background-color: #ffca28;
  border-color: #ffca28;
}
.month-title {
  font-size: 1.4rem;
  font-weight: 600;
  color: #fff;
  min-width: 180px;
  text-align: center;
}

/* Category bar (custom events) */
.category-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: center;
  padding: 12px 0;
  margin-bottom: 16px;
  border-bottom: 1px solid #333;
}
.category-bar label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  color: #ccc;
  padding: 6px 10px;
  border-radius: 6px;
  min-height: 44px;
}
.category-bar label:hover { color: #fff; }
.category-bar input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  flex-shrink: 0;
}

/* Compact header for the agenda view so the schedule sits higher and gets
   more room. The category filters are calendar-overlay controls, so they are
   hidden here. */
.schedule-view-agenda .category-bar { display: none; }
.schedule-view-agenda .schedule-header {
  margin-bottom: 10px;
  padding-bottom: 10px;
}
.schedule-view-agenda .schedule-header h1 {
  font-size: clamp(1.25rem, 3vw, 1.55rem);
}
.schedule-view-agenda .view-toggle { margin-bottom: 10px; }
.schedule-view-agenda .month-nav { margin-bottom: 10px; }
.schedule-view-agenda .agenda-list-pane,
.schedule-view-agenda .agenda-detail-pane {
  max-height: calc(100vh - 175px);
}

/* Legend button */
.legend-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 0.9rem;
  background: #333;
  color: #ccc;
  border: 1px solid #444;
  border-radius: 8px;
  cursor: pointer;
  margin-left: auto;
}
.legend-btn:hover { background: #444; color: #fff; border-color: #555; }

/* Calendar grid wrapper - responsive scroll */
.calendar-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 24px;
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: minmax(120px, 1fr);
  min-width: min(100%, 900px);
  margin: 0 auto;
  border: 1px solid #333;
  border-radius: 12px;
  overflow: hidden;
}
@media (min-width: 900px) {
  .calendar-grid {
    grid-auto-rows: minmax(140px, 1fr);
    max-width: 1400px;
  }
}
.calendar-day-header {
  padding: 10px 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #999;
  text-align: center;
  background: #1a1a1a;
  border-bottom: 1px solid #333;
  border-right: 1px solid #333;
}
.calendar-grid .calendar-day-header:nth-child(7n) { border-right: none; }
.cal-day {
  min-height: 100px;
  padding: 6px 8px;
  background: #0d0d0d;
  border-bottom: 1px solid #222;
  border-right: 1px solid #222;
  overflow: visible;
  display: flex;
  flex-direction: column;
}
@media (min-width: 900px) {
  .cal-day { min-height: 120px; padding: 8px 10px; }
}
.calendar-grid .cal-day:nth-child(7n) { border-right: none; }
.cal-day.other-month { background: #0a0a0a; }
.cal-day .day-num {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 6px;
  flex-shrink: 0;
  min-height: 26px;
  line-height: 26px;
  display: flex;
  align-items: center;
  box-sizing: border-box;
}
.cal-day.other-month .day-num { color: #555; }
.cal-day.today .day-num {
  background: #FF3B30;
  color: #fff;
  width: 26px;
  height: 26px;
  min-width: 26px;
  border-radius: 50%;
  padding: 0;
  justify-content: center;
}
.cal-day .events-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
  overflow: visible;
}
.event-bar {
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  padding: 0 6px;
  font-size: 0.7rem;
  font-weight: 500;
  color: #e5e5e5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  cursor: pointer;
  transition: filter 120ms ease, transform 120ms ease;
  --bar-connect: 12px;
}
.event-bar:hover {
  filter: brightness(1.12);
  z-index: 2;
}
.event-bar.event-bar-no-flight {
  cursor: default;
}
.event-bar.event-bar-no-flight:hover {
  filter: none;
}
.event-bar.bar-first {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  width: calc(100% + var(--bar-connect));
  margin-right: calc(-1 * var(--bar-connect));
}
.event-bar.bar-mid {
  border-radius: 0;
  width: calc(100% + 2 * var(--bar-connect));
  margin-left: calc(-1 * var(--bar-connect));
  margin-right: calc(-1 * var(--bar-connect));
}
.event-bar.bar-last {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  width: calc(100% + var(--bar-connect));
  margin-left: calc(-1 * var(--bar-connect));
}
.event-bar.bar-single { margin: 0 auto; max-width: 94%; }
.custom-event-chip {
  height: 20px;
  border-radius: 4px;
  padding: 0 6px;
  font-size: 0.65rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.custom-event-chip .chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.cal-day .more-events {
  font-size: 0.65rem;
  color: #888;
  padding: 2px 0;
  flex-shrink: 0;
}

.hidden {
  display: none !important;
}

.agenda-split {
  display: grid;
  grid-template-columns: minmax(340px, 40%) minmax(0, 1fr);
  border: 1px solid #222;
  border-radius: 14px;
  overflow: hidden;
  min-height: 640px;
  background: #0d0d0d;
  margin-bottom: 24px;
}
.agenda-list-pane {
  min-width: 0;
  max-height: calc(100vh - 240px);
  overflow-y: auto;
  overflow-x: hidden;
  background: #0d0d0d;
  border-right: 1px solid #222;
}
.agenda-detail-pane {
  min-width: 0;
  background: #0a0a0a;
  padding: 20px;
  overflow-y: auto;
}
.agenda-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
}
.agenda-empty {
  text-align: center;
  padding: 36px 20px;
  border: 1px solid #222;
  border-radius: 12px;
  background: #0d0d0d;
  color: #888;
}
.agenda-date-group {
  border: 1px solid #222;
  border-radius: 12px;
  overflow: hidden;
  background: #0d0d0d;
}
.agenda-date-header {
  padding: 10px 14px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #B86747;
  background: linear-gradient(180deg, #1A232B 0%, #111920 100%);
  border-bottom: 1px solid #222;
}
.agenda-date-header.today {
  color: #3b82f6;
}
.agenda-row {
  display: grid;
  grid-template-columns: 92px 1fr;
  align-items: stretch;
  min-height: 58px;
  border-bottom: 1px solid #0c0c0e;
  background: #13181C;
}
.agenda-row:last-child {
  border-bottom: none;
}
.agenda-row.selectable {
  cursor: pointer;
  transition: background-color 120ms ease, box-shadow 120ms ease;
}
.agenda-row.selectable:hover {
  background: #182127;
}
.agenda-row.active {
  background: #1b252d;
  box-shadow: inset 3px 0 0 var(--wingman-gold);
}
.agenda-time {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 8px;
  border-right: 1px solid #1f262b;
  color: #3b82f6;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.agenda-time.muted {
  color: #6b7280;
}
.agenda-content {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-width: 0;
}
.agenda-topline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.agenda-title {
  color: #e5e7eb;
  font-size: 1rem;
  font-weight: 700;
  min-width: 0;
}
.agenda-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.agenda-badge.deadhead {
  background: rgba(249, 115, 22, 0.15);
  color: #f97316;
}
.agenda-badge.connection {
  background: rgba(255, 181, 0, 0.16);
  color: var(--wingman-gold);
}
.agenda-badge.layover {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}
.agenda-badge.custom {
  color: #111827;
}
.agenda-subtitle {
  color: #9ca3af;
  font-size: 0.9rem;
  line-height: 1.35;
}
.agenda-dayoff {
  color: #9ca3af;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-size: 0.85rem;
  font-weight: 700;
}
.agenda-detail-empty {
  height: 100%;
  min-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #888;
  border: 1px dashed #2a2a2a;
  border-radius: 12px;
  padding: 28px;
  background: #0d0d0d;
}
.agenda-detail-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.agenda-detail-card {
  border: 1px solid #222;
  border-radius: 12px;
  background: #101418;
  padding: 18px;
}
.agenda-detail-kicker {
  color: var(--wingman-gold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.agenda-detail-title {
  color: #f3f4f6;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 6px;
}
.agenda-detail-subtitle {
  color: #9ca3af;
  font-size: 0.96rem;
  line-height: 1.4;
}
.agenda-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
}
.agenda-detail-item {
  min-width: 0;
}
.agenda-detail-label {
  color: #6b7280;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
  font-weight: 700;
}
.agenda-detail-value {
  color: #e5e7eb;
  font-size: 0.96rem;
  line-height: 1.4;
  word-break: break-word;
}

/* Legend modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-content {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 24px;
  max-width: 400px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-content h2 {
  color: var(--wingman-gold);
  margin-bottom: 20px;
  font-size: 1.25rem;
}
.modal-legend-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 20px;
  margin-bottom: 24px;
}
.modal-legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
}
.modal-legend-item .swatch {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  flex-shrink: 0;
}
.modal-legend-item span { font-size: 0.9rem; color: #e0e0e0; }
.modal-close {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  font-weight: 600;
  background: #333;
  color: #fff;
  border: 1px solid #444;
  border-radius: 8px;
  cursor: pointer;
}
.modal-close:hover { background: #444; }

@media (max-width: 600px) {
  .month-title { font-size: 1.1rem; min-width: 140px; }
  .calendar-grid { grid-auto-rows: minmax(100px, 1fr); }
  .cal-day { min-height: 90px; }
  .modal-legend-grid { grid-template-columns: 1fr; }
  .agenda-row { grid-template-columns: 80px 1fr; }
  .agenda-detail-pane { padding: 14px; }
  .agenda-detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 1100px) {
  .agenda-split {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .agenda-list-pane {
    max-height: none;
    border-right: none;
    border-bottom: 1px solid #222;
  }
}

/* Inline flight detail + edit (rendered into the agenda detail pane) */
.sd-section { margin-bottom: 16px; }
.sd-section-title { color: #64748b; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 8px; }
.sd-section-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.sd-section-title-row .sd-section-title { margin: 0; }
.sd-badge { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; margin-top: 10px; }
.sd-badge.operating { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.sd-badge.deadhead { background: rgba(249, 115, 22, 0.15); color: #fb923c; }
.sd-inline-edit { border: none; background: transparent; color: var(--wingman-gold); font-size: 0.72rem; font-weight: 700; cursor: pointer; padding: 0; text-transform: uppercase; letter-spacing: 0.04em; }
.sd-link { color: var(--wingman-gold); font-weight: 600; }
.sd-note { padding: 10px 12px; border-radius: 8px; background: rgba(255, 193, 7, 0.1); border: 1px solid rgba(255, 193, 7, 0.25); color: #fde68a; font-size: 0.82rem; line-height: 1.4; }
.sd-error { padding: 10px 12px; border-radius: 8px; background: rgba(239, 68, 68, 0.12); border: 1px solid rgba(239, 68, 68, 0.3); color: #fca5a5; font-size: 0.85rem; margin: 12px 0; }
.sd-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.sd-btn { flex: 1; min-width: 120px; padding: 11px 16px; border-radius: 10px; border: 1px solid var(--wingman-border-strong); background: var(--wingman-panel); color: #e2e8f0; font-size: 0.9rem; font-weight: 600; cursor: pointer; }
.sd-btn:hover { border-color: var(--wingman-gold); }
.sd-btn.primary { background: var(--wingman-gold); color: var(--wingman-brown); border-color: var(--wingman-gold); }
.sd-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.sd-alert { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--wingman-border-strong); background: rgba(255, 255, 255, 0.03); margin-top: 8px; display: flex; flex-direction: column; gap: 3px; }
.sd-alert-title { font-weight: 700; color: #f1f5f9; font-size: 0.92rem; }
.sd-alert-desc { color: #94a3b8; font-size: 0.84rem; line-height: 1.4; }

/* Inline flight edit form (rendered inside a detail card) */
.flight-edit-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--wingman-border); overflow-x: auto; margin-bottom: 4px; }
.flight-edit-tab { padding: 10px 12px; border: none; background: transparent; color: #94a3b8; font-size: 0.76rem; font-weight: 700; letter-spacing: 0.04em; cursor: pointer; white-space: nowrap; border-bottom: 2px solid transparent; }
.flight-edit-tab.active { color: var(--wingman-gold); border-bottom-color: var(--wingman-gold); }
.flight-edit-panel { display: none; padding-top: 14px; }
.flight-edit-panel.active { display: block; }
.flight-edit-field { margin-bottom: 14px; }
.flight-edit-field label { display: block; color: #94a3b8; font-size: 0.78rem; font-weight: 600; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.04em; }
.flight-edit-field input, .flight-edit-field select, .flight-edit-field textarea { width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--wingman-border-strong); background: rgba(0, 0, 0, 0.25); color: #f1f5f9; font-size: 0.95rem; }
.flight-edit-checkbox { display: flex; align-items: center; gap: 8px; margin-top: 8px; color: #cbd5e1; font-size: 0.88rem; }
.flight-edit-checkbox input { width: auto; }
.jumpseat-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; margin-bottom: 8px; align-items: end; }
@media (max-width: 768px) {
  .jumpseat-row { grid-template-columns: 1fr; }
}
