
:root {
  --bg: #f3f4f6;
  --card: #ffffff;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --black: #000000;
  --green: #34a853;
  --blue: #2563eb;
  --red: #dc2626;
  --yellow: #fef3c7;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 24px 32px;
  background: var(--black);
  color: white;
}

.app-header h1 { margin: 0 0 6px; }
.muted { color: #d1d5db; margin: 0; }
.section-help { color: var(--muted); font-size: 13px; margin-top: -4px; margin-bottom: 12px; line-height: 1.35; }

.tabs {
  display: flex;
  gap: 8px;
  padding: 12px 32px;
  background: white;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.tab {
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: white;
  border-radius: 999px;
  cursor: pointer;
}

.tab.active {
  background: var(--black);
  color: white;
}

main {
  padding: 28px 32px 60px;
}

.page { display: none; }
.page.active { display: block; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.05);
  margin-bottom: 20px;
}

.card h2 { margin-top: 0; }
.card h3 { margin: 0 0 8px; }

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
}

.primary {
  background: var(--black);
  color: white;
  border-color: var(--black);
}

button {
  border: 1px solid var(--line);
  background: white;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
}

input, select, textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: white;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #374151;
  margin-bottom: 8px;
}

label.inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

label.inline input {
  width: auto;
}

.row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.log {
  white-space: pre-wrap;
  background: #111827;
  color: #d1fae5;
  padding: 14px;
  border-radius: 12px;
  min-height: 90px;
}

.grid-dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
}

.stat span {
  color: var(--muted);
  display: block;
  margin-bottom: 8px;
}

.stat strong {
  font-size: 32px;
}

.columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.filter-layout {
  display: grid;
  grid-template-columns: minmax(360px, 500px) 1fr;
  gap: 18px;
  align-items: start;
}

.filter-card {
  max-height: calc(100vh - 140px);
  overflow: auto;
  position: sticky;
  top: 78px;
}

.filter-section {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin-top: 18px;
}

.results-card {
  min-height: 400px;
}

.checklist {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.check-item {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 700;
  background: #f9fafb;
}

.check-item input {
  width: auto;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border-radius: 999px;
  padding: 7px 10px;
  background: #f3f4f6;
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 700;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

.pairing-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 14px;
  background: white;
}

.pairing-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}

.pairing-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0;
}

.small {
  font-size: 12px;
  color: var(--muted);
}

.route {
  font-family: Consolas, monospace;
  font-size: 12px;
  white-space: normal;
  color: #374151;
}

.calendar {
  display: block;
}

.calendar-header {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.dayname {
  font-weight: 800;
  text-align: center;
  background: var(--black);
  color: white;
  padding: 10px;
  border-radius: 12px;
}

.day {
  min-height: 140px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  cursor: pointer;
  overflow: hidden;
}

.day.blank {
  background: transparent;
  border: none;
  cursor: default;
}

.day.unavailable {
  background: #fee2e2;
  border-color: #fecaca;
}

.day-number {
  font-weight: 900;
  margin-bottom: 8px;
}

.event {
  background: #dcfce7;
  color: #166534;
  border-radius: 8px;
  padding: 4px 6px;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 700;
}

.note {
  background: var(--yellow);
  border-radius: 8px;
  padding: 4px 6px;
  font-size: 12px;
  margin-top: 4px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 99;
}

.modal.hidden { display: none; }

.modal-content {
  width: min(560px, 100%);
  background: white;
  border-radius: 18px;
  padding: 22px;
}

@media (max-width: 980px) {
  .filter-layout, .columns {
    grid-template-columns: 1fr;
  }
  .filter-card {
    position: static;
    max-height: none;
  }
  .calendar {
    grid-template-columns: repeat(7, minmax(80px, 1fr));
  }
}

@media (max-width: 680px) {
  main { padding: 16px; }
  .app-header { padding: 18px; flex-direction: column; align-items: start; }
  .tabs { padding: 10px 16px; overflow-x: auto; }
  .calendar { grid-template-columns: 1fr; }
  .dayname { display: none; }
}


/* v7 calendar span bars */
.calendar-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 8px;
  position: relative;
  min-height: 166px;
  margin-bottom: 8px;
}

.calendar-week .day {
  min-height: 166px;
}

.span-layer {
  position: absolute;
  left: 0;
  right: 0;
  top: 42px;
  height: 92px;
  pointer-events: none;
}

.span-event {
  position: absolute;
  height: 28px;
  border-radius: 999px;
  background: #b7d9d7;
  color: #0f172a;
  font-weight: 900;
  padding: 5px 12px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  pointer-events: auto;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.span-event.conflict {
  background: #fecaca;
  color: #7f1d1d;
}

.modal-content.wide {
  width: min(980px, 96vw);
  max-height: 88vh;
  overflow: auto;
}

.danger {
  background: #dc2626;
  border-color: #dc2626;
  color: white;
}

.bid-window-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 10px;
}

@media (max-width: 680px) {
  .calendar-week {
    display: block;
    min-height: auto;
  }
  .span-layer {
    position: static;
    height: auto;
  }
  .span-event {
    position: static;
    display: block;
    margin: 6px 0;
  }
}

@media (max-width: 680px) {
  .calendar-header { display: none; }
}

.match-mode-note {
  font-size: 12px;
  color: var(--muted);
}


/* v10 bid-summary pairing mini calendars */
.pairing-breakdown {
  border: 1px solid var(--line);
  border-radius: 16px;
  margin: 18px 0;
  overflow: hidden;
  background: white;
}

.pairing-breakdown-header {
  display: grid;
  grid-template-columns: 48px 1fr;
  align-items: center;
  background: var(--black);
  color: white;
  min-height: 42px;
}

.pairing-breakdown-header label {
  display: flex;
  justify-content: center;
  margin: 0;
}

.pairing-breakdown-header input {
  width: 22px;
  height: 22px;
}

.pairing-breakdown-title {
  font-weight: 900;
  text-align: center;
  font-size: 20px;
  letter-spacing: 0.02em;
}

.pairing-breakdown-body {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 18px;
  padding: 16px;
  align-items: start;
}

.mini-cal {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border: 3px solid var(--black);
  background: white;
}

.mini-cal-title {
  grid-column: 1 / -1;
  background: var(--black);
  color: white;
  font-weight: 900;
  text-align: center;
  font-size: 20px;
  padding: 8px;
}

.mini-cal-head {
  background: var(--black);
  color: white;
  font-weight: 900;
  text-align: center;
  padding: 4px 0 8px;
}

.mini-day {
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.mini-day.blank {
  background: white;
}

.mini-day.selected {
  background: #34a853;
  color: #000;
  font-weight: 900;
}

.mini-day.removed {
  background: #dc2626;
  color: white;
  font-weight: 900;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  color: var(--muted);
  font-size: 13px;
  flex-wrap: wrap;
}

.legend {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  display: inline-block;
}

.legend.green { background: #34a853; }
.legend.red { background: #dc2626; }

@media (max-width: 900px) {
  .pairing-breakdown-body {
    grid-template-columns: 1fr;
  }
  .mini-cal {
    max-width: 320px;
  }
}


/* v11 bid summary pairing detail formatting */
.formatted-breakdown .pairing-breakdown-body {
  grid-template-columns: 250px 1fr;
  gap: 22px;
}

.mini-cal-column {
  min-width: 230px;
}

.pairing-detail-wrap {
  overflow-x: auto;
}

.pairing-detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.pairing-detail-table thead th {
  background: #000;
  color: #fff;
  font-weight: 900;
  text-align: center;
  border-bottom: none;
  padding: 9px 8px;
}

.pairing-detail-table tbody td {
  padding: 8px;
  border-bottom: 1px solid #d1d5db;
  text-align: center;
}

.pairing-detail-table tbody td:nth-child(1),
.pairing-detail-table tbody td:nth-child(2) {
  text-align: left;
}

.pairing-detail-table .hotel-row td {
  text-align: left;
  font-weight: 700;
  background: #f9fafb;
  border-top: 1px solid #111827;
  border-bottom: 1px solid #111827;
}

.pairing-detail-table .totals-row td {
  border-top: 2px solid #000;
  border-bottom: none;
  text-align: left;
  font-size: 15px;
  background: #fff;
}

.pairing-submeta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0;
}

@media (max-width: 1000px) {
  .formatted-breakdown .pairing-breakdown-body {
    grid-template-columns: 1fr;
  }
}


/* v12 calendar color coding */
.calendar-color-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
}

.color-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}

.pairing-card details[open] {
  margin-top: 10px;
}

/* v14 revisions */
.card:has(#calendarGrid) { overflow-x: auto; }
.calendar { min-width: 980px; }
.calendar-color-legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.color-chip {
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 900;
  box-shadow: 0 4px 12px rgba(0,0,0,0.14);
  cursor: help;
}
.span-layer { top: 0; height: auto; }
.span-event { z-index: 3; }
.note { position: relative; z-index: 1; max-height: 38px; overflow: hidden; }
.pairing-card:has(.selectPairing:checked) {
  background: #e6fffb;
  border-color: #99f6e4;
}
.pairing-detail-grid {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 16px;
  align-items: start;
  margin: 10px 0;
}
.pairing-date-cal {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border: 2px solid var(--black);
  border-radius: 10px;
  overflow: hidden;
  max-width: 230px;
}
.pairing-date-cal .mini-cal-title { font-size: 14px; padding: 6px; }
.pairing-date-cal .mini-cal-head { font-size: 11px; padding: 3px 0; }
.pairing-date-cal .mini-day { min-height: 24px; font-size: 11px; }
.date-picker-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 6px 0 10px;
}
.date-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
  margin: 0;
  background: #f9fafb;
}
.date-pill input { width: auto; }
@media (max-width: 900px) {
  .pairing-detail-grid { grid-template-columns: 1fr; }
}


/* v15 filter must-match + calendar note refinements */
.must-wrap {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}
.must-wrap input { width: auto; margin: 0; }
.day-topline {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  position: relative;
  z-index: 4;
}
.day .note {
  margin-top: 0;
  max-width: calc(100% - 42px);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.day.unavailable .day-off-number {
  color: #8b8b8b;
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}
.day.unavailable {
  background: #f3f4f6;
}
.color-chip { cursor: pointer; }

.mini-day.day-off {
  background: #e5e7eb !important;
  color: #8b8b8b;
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

/* v18: pairing detail mini-calendar availability states
   - day off only: grey + strike-through
   - pairing date that conflicts with required day off: red + strike-through
   - pairing date that works: green */
.pairing-date-cal .mini-day.day-off:not(.selected) {
  background: #e5e7eb !important;
  color: #8b8b8b !important;
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}
.pairing-date-cal .mini-day.selected:not(.day-off) {
  background: #34a853 !important;
  color: #000 !important;
  text-decoration: none;
}
.pairing-date-cal .mini-day.selected.day-off {
  background: #fee2e2 !important;
  color: #dc2626 !important;
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  font-weight: 900;
}
