:root {
  color-scheme: light;
  font-family: Arial, Helvetica, sans-serif;
  --navy: #00352f;
  --green: #00f04a;
  --green-dark: #00cb40;
  --purple: #8500a8;
  --pink: #f24bc1;
  --red: #e53935;
  --red-dark: #8500a8;
  --blue: #1976d2;
  --line: #dce5e2;
  --muted: #60706b;
  --panel: #ffffff;
  --soft: #f4f7f6;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: var(--soft);
  color: var(--navy);
}

button,
input,
select {
  font: inherit;
}

[hidden] {
  display: none !important;
}

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--navy);
  box-shadow: 0 2px 12px rgba(0, 53, 47, 0.06);
}

.brand {
  display: flex;
  align-items: center;
  gap: 15px;
  font-size: 1rem;
  font-weight: 700;
}

.brand-logo {
  position: relative;
  width: 54px;
  height: 54px;
  display: grid;
  flex: 0 0 54px;
  place-items: center;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 1px rgba(0, 53, 47, 0.08);
}

.brand-logo-pill {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 46px;
  display: inline-flex;
  min-height: 18px;
  align-items: center;
  justify-content: center;
  padding: 3px 4px;
  border-radius: 999px;
  background: var(--navy);
  color: var(--green);
  font-size: 0.45rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  text-align: center;
  transform: translate(-50%, -50%);
  white-space: nowrap;
}

.brand-title {
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(1.45rem, 2vw, 2rem);
  font-weight: 900;
  letter-spacing: 0.015em;
  line-height: 1;
  text-transform: uppercase;
}

.hotel-count {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  padding: 8px 18px;
  border-radius: 999px;
  background: var(--navy);
  color: var(--green);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.refresh-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 15px;
  border: 1px solid var(--navy);
  border-radius: 999px;
  background: #fff;
  color: var(--navy);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.refresh-button:hover,
.refresh-button:focus-visible {
  background: var(--green);
  outline: none;
}

.refresh-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.refresh-icon {
  display: inline-block;
  font-size: 1.25rem;
  line-height: 1;
}

.refresh-button.is-loading .refresh-icon {
  animation: refresh-spin 0.8s linear infinite;
}

.refresh-status {
  min-width: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.refresh-status.is-error {
  color: #b42318;
}

@keyframes refresh-spin {
  to { transform: rotate(360deg); }
}

.workspace {
  height: calc(100vh - 72px);
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(330px, 1fr);
}

.map-panel {
  position: relative;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: #dfe8df;
}

.map-canvas {
  position: absolute;
  inset: 0;
}

.map-placeholder {
  height: 100%;
  display: grid;
  place-content: center;
  gap: 8px;
  padding: 32px;
  text-align: center;
  background:
    linear-gradient(rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0.75)),
    repeating-linear-gradient(45deg, #d5e2d6 0, #d5e2d6 18px, #e4ece4 18px, #e4ece4 36px);
}

.map-placeholder strong {
  font-size: 1.1rem;
}

.map-placeholder span {
  color: var(--muted);
}

.map-status {
  position: absolute;
  left: 14px;
  bottom: 24px;
  z-index: 3;
  max-width: min(440px, calc(100% - 28px));
  padding: 9px 12px;
  border-radius: 6px;
  background: rgba(0, 53, 47, 0.94);
  color: white;
  font-size: 0.82rem;
  line-height: 1.35;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: 160ms ease;
}

.map-status.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.sidebar {
  position: relative;
  height: 100%;
  min-height: 0;
  background: var(--panel);
  overflow-y: auto;
}

.search-panel {
  padding: 24px;
}

#school-form {
  margin: 0;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: 1.55rem;
  line-height: 1.15;
  color: var(--navy);
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  letter-spacing: 0.015em;
  text-transform: uppercase;
}

h2 {
  margin-bottom: 4px;
  font-size: 1rem;
  color: var(--navy);
}

label {
  display: block;
  margin: 18px 0 7px;
  font-size: 0.9rem;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 48px;
  border: 1px solid #bac5cd;
  border-radius: 12px;
  background: #fff;
  color: var(--navy);
}

input {
  padding: 0 13px;
}

input:focus {
  outline: 3px solid rgba(0, 240, 74, 0.22);
  border-color: var(--green-dark);
}

.school-search {
  position: relative;
}

.school-suggestions {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  z-index: 1100;
  max-height: min(380px, 48vh);
  overflow-y: auto;
  border: 1px solid #bac5cd;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(25, 39, 50, 0.18);
}

.school-suggestion {
  width: 100%;
  display: block;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--navy);
  text-align: left;
  cursor: pointer;
}

.school-suggestion:last-child {
  border-bottom: 0;
}

.school-suggestion:hover,
.school-suggestion:focus-visible {
  background: #ecfff2;
  outline: none;
}

.school-suggestion-name,
.school-suggestion-address {
  display: block;
}

.school-suggestion-name {
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.3;
}

.school-suggestion-address {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.3;
}

.primary-button {
  width: 100%;
  min-height: 48px;
  margin-top: 12px;
  border: 0;
  border-radius: 999px;
  background: var(--green);
  color: var(--navy);
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 120ms ease, transform 120ms ease;
}

.primary-button:hover:not(:disabled) {
  background: var(--green-dark);
}

.primary-button:active:not(:disabled) {
  transform: translateY(1px);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.search-mode-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  margin-top: 12px;
  padding: 3px;
  border: 1px solid #b9d5c2;
  border-radius: 14px;
  background: #eff7f1;
}

.search-mode-tab {
  min-width: 0;
  min-height: 40px;
  padding: 7px 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #405a52;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.15;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.search-mode-tab:hover:not(.is-active) {
  background: rgba(0, 240, 74, 0.12);
  color: var(--navy);
}

.search-mode-tab:focus-visible {
  outline: 3px solid rgba(133, 0, 168, 0.18);
  outline-offset: 1px;
}

.search-mode-tab.is-active {
  background: var(--green);
  color: var(--navy);
  box-shadow: 0 1px 4px rgba(0, 53, 47, 0.18);
}

.custom-hotel-panel,
.date-search-panel {
  margin-top: 10px;
  padding: 0;
  border: 0;
  background: transparent;
}

.custom-hotel-panel label,
.date-search-panel label {
  margin: 0 0 7px;
}

.date-range-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.date-range-fields label {
  color: var(--navy);
  font-size: 0.82rem;
}

.date-range-fields input {
  margin-top: 6px;
  padding: 0 9px;
  font-size: 0.84rem;
}

.result-card.is-date-available {
  border-left-color: var(--green-dark);
}

.result-card.is-date-available .result-schedule {
  color: #08722d;
  font-weight: 700;
}

.custom-hotel-search {
  position: relative;
}

.custom-hotel-suggestions {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  z-index: 1120;
  max-height: min(360px, 45vh);
  overflow-y: auto;
  border: 1px solid #a9bab4;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(0, 53, 47, 0.2);
}

.custom-hotel-suggestion {
  width: 100%;
  display: block;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--navy);
  text-align: left;
  cursor: pointer;
}

.custom-hotel-suggestion:last-child {
  border-bottom: 0;
}

.custom-hotel-suggestion:hover,
.custom-hotel-suggestion:focus-visible {
  background: #ecfff2;
  outline: none;
}

.custom-hotel-suggestion-name,
.custom-hotel-suggestion-address {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-hotel-suggestion-name {
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.3;
}

.custom-hotel-suggestion-address {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.35;
}

.custom-hotel-panel input:disabled {
  background: #edf2f0;
  color: var(--muted);
  cursor: not-allowed;
}

.eyebrow {
  margin-bottom: 5px;
  color: var(--purple);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.message {
  min-height: 20px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.message:empty {
  display: none;
}

.message.is-error {
  color: #a61b1b;
}

.school-contact-card {
  margin-top: 14px;
  padding: 15px;
  border: 1px solid #b8d9c1;
  border-radius: 12px;
  background: #f3fff7;
}

.school-contact-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.school-contact-heading h2 {
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.3;
}

.school-contact-heading .eyebrow {
  margin-bottom: 4px;
}

.school-contact-badge {
  flex: 0 0 auto;
  padding: 4px 7px;
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.school-contact-list {
  display: grid;
  gap: 6px;
}

.school-contact-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 9px 10px;
  border: 1px solid #d7e8dc;
  border-radius: 8px;
  background: #fff;
}

.school-contact-label {
  color: var(--muted);
  font-size: 0.69rem;
  font-weight: 800;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.school-contact-value {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--navy);
  font-size: 0.8rem;
  line-height: 1.35;
}

.school-contact-row.is-loading .school-contact-value {
  color: var(--muted);
  font-weight: 600;
}

.school-contact-link {
  color: var(--purple);
  font-weight: 800;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.school-contact-hint {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 600;
}

.school-contact-source {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.67rem;
  line-height: 1.4;
}

.school-crm-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #cbe3d2;
}

.school-crm-title {
  margin: 0 0 8px;
  color: var(--navy);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.school-crm-list {
  display: grid;
  gap: 8px;
}

.school-crm-contact {
  padding: 10px;
  border: 1px solid #9fd2ad;
  border-left: 4px solid var(--green);
  border-radius: 9px;
  background: #fff;
}

.school-crm-contact-heading {
  display: grid;
  gap: 2px;
}

.school-crm-name {
  color: var(--navy);
  font-size: 0.82rem;
  line-height: 1.3;
}

.school-crm-role {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
}

.school-crm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 8px;
}

.school-crm-action {
  color: var(--purple);
  font-size: 0.73rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.school-crm-empty {
  color: var(--muted);
  font-size: 0.7rem;
}

.school-contact-verify {
  display: inline-block;
  margin-top: 8px;
  color: var(--navy);
  font-size: 0.73rem;
  font-weight: 800;
}

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

.results-heading {
  margin-bottom: 10px;
}

#school-name {
  display: block;
  min-height: 18px;
  color: var(--muted);
  font-size: 0.82rem;
}

.results-list {
  display: grid;
  gap: 8px;
}

.empty-state {
  padding: 18px;
  border: 1px dashed #bdc8d0;
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.result-card {
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: 10px;
  background: #fff;
}

.result-card.is-custom-hotel {
  border-left-color: var(--green-dark);
  box-shadow: 0 0 0 2px rgba(0, 240, 74, 0.12);
}

.result-main {
  width: 100%;
  display: grid;
  grid-template-columns: 30px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 0;
  background: #fff;
  color: var(--navy);
  text-align: left;
  cursor: pointer;
}

.result-card:hover {
  border-color: #aebbc5;
}

.result-main:hover,
.result-main:focus-visible {
  background: #f3fff7;
  outline: none;
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid #edf1f4;
}

.route-link,
.result-detail-button {
  display: flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  padding: 7px 9px;
  border: 0;
  background: #fff;
  color: var(--purple);
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.result-detail-button {
  border-right: 1px solid #edf1f4;
  color: var(--navy);
}

.route-link:hover,
.route-link:focus-visible,
.result-detail-button:hover,
.result-detail-button:focus-visible {
  background: #f3f7fa;
  text-decoration: underline;
  outline: none;
}

.result-order {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--purple);
}

.result-name {
  display: block;
  margin-bottom: 3px;
  font-size: 0.92rem;
  font-weight: 700;
}

.result-place,
.result-capacity,
.result-schedule {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
}

.result-capacity {
  margin-top: 3px;
  color: #405463;
  font-weight: 700;
}

.result-schedule {
  margin-top: 4px;
  color: #5a6873;
}

.result-distance {
  text-align: right;
  white-space: nowrap;
}

.result-distance strong,
.result-distance span {
  display: block;
}

.result-distance strong {
  font-size: 0.9rem;
}

.result-distance span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.75rem;
}

.hotel-marker-shell,
.school-marker-shell {
  position: absolute;
  cursor: pointer;
  user-select: none;
}

.hotel-dot {
  width: 11px;
  height: 11px;
  display: block;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  transition: transform 110ms ease;
}

.hotel-marker-shell.is-swimming .hotel-dot {
  background: var(--blue);
}

.hotel-label {
  position: absolute;
  left: 50%;
  bottom: 14px;
  z-index: 4;
  width: max-content;
  max-width: 190px;
  padding: 3px 5px;
  transform: translateX(-50%) translateY(3px);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.94);
  color: #111;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.2;
  opacity: 0;
  pointer-events: none;
  transition: 110ms ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.hotel-marker-shell:hover .hotel-dot,
.hotel-marker-shell:focus .hotel-dot,
.hotel-marker-shell.is-active .hotel-dot {
  transform: scale(1.55);
}

.hotel-marker-shell.is-active .hotel-dot {
  box-shadow: 0 0 0 4px rgba(0, 53, 47, 0.26), 0 2px 8px rgba(0, 0, 0, 0.45);
}

.hotel-marker-shell:hover .hotel-label,
.hotel-marker-shell:focus .hotel-label,
.hotel-marker-shell.is-active .hotel-label,
.hotel-marker-shell.is-label-visible .hotel-label,
.hotel-marker-shell.is-nearest .hotel-label {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.hotel-marker-shell.is-nearest .hotel-dot {
  width: 15px;
  height: 15px;
  border-width: 3px;
}

.hotel-marker-shell.is-route-hover .hotel-dot {
  transform: scale(1.45);
}

.hotel-route-hit {
  cursor: pointer;
}

.hotel-route-line {
  transition: stroke 120ms ease, stroke-width 120ms ease, stroke-opacity 120ms ease;
}

.route-hotel-tooltip {
  padding: 6px 9px;
  border: 1px solid rgba(0, 53, 47, 0.18);
  border-radius: 6px;
  background: #fff;
  color: #111;
  font-size: 0.78rem;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(0, 53, 47, 0.18);
}

.route-hotel-tooltip::before {
  border-top-color: #fff;
}

.route-tooltip-content strong,
.route-tooltip-content span {
  display: block;
}

.route-tooltip-content span {
  margin-top: 2px;
  color: #52616c;
  font-size: 0.72rem;
  font-weight: 600;
}

.school-dot {
  width: 22px;
  height: 22px;
  display: block;
  border: 4px solid white;
  border-radius: 50%;
  background: var(--purple);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}

.custom-hotel-marker-shell {
  position: absolute;
  cursor: pointer;
  user-select: none;
}

.custom-hotel-dot {
  width: 18px;
  height: 18px;
  display: block;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--green-dark);
  box-shadow: 0 0 0 3px rgba(0, 53, 47, 0.3), 0 2px 8px rgba(0, 0, 0, 0.42);
  transition: transform 120ms ease;
}

.custom-hotel-marker-shell:hover .custom-hotel-dot,
.custom-hotel-marker-shell:focus .custom-hotel-dot,
.custom-hotel-marker-shell.is-route-hover .custom-hotel-dot {
  transform: scale(1.3);
}

.custom-hotel-label {
  position: absolute;
  left: 50%;
  bottom: 24px;
  width: max-content;
  max-width: 220px;
  padding: 4px 7px;
  transform: translateX(-50%);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.96);
  color: #111;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
}

.service-note {
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.4;
}

.leaflet-container {
  font-family: Arial, Helvetica, sans-serif;
}

.hotel-detail {
  position: absolute;
  inset: 0;
  z-index: 1200;
  display: flex;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
}

.hotel-detail[hidden] {
  display: none;
}

.detail-topbar {
  position: relative;
  z-index: 6;
  flex: 0 0 auto;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 4px 14px rgba(0, 53, 47, 0.1);
  backdrop-filter: blur(8px);
}

.detail-back {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  padding: 9px 14px;
  border: 1px solid rgba(0, 53, 47, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.97);
  color: var(--navy);
  font-size: 0.84rem;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(0, 53, 47, 0.12);
  cursor: pointer;
}

.detail-back:hover,
.detail-back:focus-visible {
  border-color: var(--purple);
  color: var(--purple);
  outline: 3px solid rgba(133, 0, 168, 0.14);
}

.detail-header {
  padding: 20px 22px 14px;
}

.detail-scroll {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.detail-header h2 {
  margin: 0;
  font-size: 1.55rem;
  line-height: 1.15;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  letter-spacing: 0.015em;
}

.detail-location {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

.detail-tabs {
  position: sticky;
  top: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.detail-tabs button {
  min-height: 43px;
  padding: 8px 5px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.detail-tabs button:hover,
.detail-tabs button:focus-visible {
  color: var(--navy);
  outline: none;
}

.detail-tabs button.is-selected {
  border-bottom-color: var(--purple);
  color: var(--navy);
}

.detail-content {
  padding: 18px 22px 30px;
}

.detail-route-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  padding: 13px 14px;
  border: 1px solid #93b4ef;
  border-left: 4px solid #2563eb;
  border-radius: 7px;
  background: #f3f7ff;
}

.detail-route-text,
.detail-route-values {
  min-width: 0;
}

.detail-route-label,
.detail-route-school,
.detail-route-values strong,
.detail-route-values span {
  display: block;
}

.detail-route-label {
  margin-bottom: 3px;
  color: #52616c;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.detail-route-school {
  overflow: hidden;
  font-size: 0.79rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-route-values {
  flex: 0 0 auto;
  color: #153d8a;
  text-align: right;
  white-space: nowrap;
}

.detail-route-values strong {
  font-size: 0.96rem;
}

.detail-route-values span {
  margin-top: 3px;
  font-size: 0.76rem;
  font-weight: 700;
}

.detail-route-loading {
  font-size: 0.8rem !important;
}

.detail-fact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.fact-card {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fafbfc;
}

.fact-label,
.fact-value {
  display: block;
}

.fact-label {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.fact-value {
  overflow-wrap: anywhere;
  font-size: 0.83rem;
  line-height: 1.35;
}

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

.detail-section h3 {
  margin: 0 0 11px;
  font-size: 1rem;
}

.detail-copy,
.detail-help {
  color: #4d5e6b;
  font-size: 0.82rem;
  line-height: 1.5;
}

.detail-help {
  margin: 11px 0 0;
  color: var(--muted);
}

.registry-details {
  overflow: hidden;
}

.registry-details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  cursor: pointer;
  list-style: none;
  color: var(--ink);
}

.registry-details > summary::-webkit-details-marker {
  display: none;
}

.registry-details > summary::after {
  content: "+";
  flex: 0 0 auto;
  color: var(--purple);
  font-size: 1.25rem;
  font-weight: 800;
}

.registry-details[open] > summary::after {
  content: "−";
}

.registry-summary-title {
  font-size: 0.92rem;
  font-weight: 800;
}

.registry-summary-count {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.registry-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.registry-row {
  display: grid;
  grid-template-columns: minmax(110px, 0.8fr) minmax(0, 1.2fr);
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafbfc;
}

.registry-label,
.registry-value {
  overflow-wrap: anywhere;
}

.registry-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.registry-source {
  display: block;
  margin-top: 3px;
  color: #87939d;
  font-size: 0.64rem;
  font-weight: 600;
}

.registry-value {
  font-size: 0.8rem;
  line-height: 1.4;
}

.schedule-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.schedule-metric {
  min-width: 0;
  padding: 10px 7px;
  border-radius: 6px;
  background: #f3f6f8;
  text-align: center;
}

.schedule-metric strong,
.schedule-metric span {
  display: block;
}

.schedule-metric strong {
  font-size: 1.05rem;
}

.schedule-metric span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.67rem;
  line-height: 1.25;
}

.secondary-button,
.show-more-button {
  width: 100%;
  min-height: 42px;
  margin-top: 12px;
  padding: 9px 12px;
  border: 1px solid #9eabb5;
  border-radius: 6px;
  background: #fff;
  color: var(--navy);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.secondary-button:hover,
.secondary-button:focus-visible,
.show-more-button:hover,
.show-more-button:focus-visible {
  border-color: var(--navy);
  background: #ecfff2;
  outline: none;
}

.data-source-note {
  display: grid;
  gap: 4px;
  padding: 11px 12px;
  border-left: 4px solid #82929e;
  border-radius: 4px;
  background: #f3f6f8;
}

.data-source-note strong {
  font-size: 0.8rem;
}

.data-source-note span {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.detail-toolbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin: 14px 0 10px;
}

.term-filter-label {
  margin: 0;
  font-size: 0.78rem;
}

.term-filter {
  width: 100%;
  min-height: 40px;
  padding: 0 34px 0 10px;
  border: 1px solid #bac5cd;
  border-radius: 6px;
  background: #fff;
  color: var(--navy);
}

.term-filter:focus {
  outline: 3px solid rgba(0, 240, 74, 0.22);
  border-color: var(--green-dark);
}

.term-list {
  display: grid;
  gap: 8px;
}

.term-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.term-card.term-availability-green {
  border-color: #78a96c;
  border-left: 5px solid #4b9844;
  background: #e2f0d9;
}

.term-card.term-availability-yellow {
  border-color: #d7b84f;
  border-left: 5px solid #c69a00;
  background: #fff2cc;
}

.term-card.term-availability-red {
  border-color: #d27a7a;
  border-left: 5px solid #c43d3d;
  background: #f4cccc;
}

.term-card.term-availability-green .term-summary:hover,
.term-card.term-availability-green .term-summary:focus-visible {
  background: #d7ead0;
}

.term-card.term-availability-yellow .term-summary:hover,
.term-card.term-availability-yellow .term-summary:focus-visible {
  background: #faeab9;
}

.term-card.term-availability-red .term-summary:hover,
.term-card.term-availability-red .term-summary:focus-visible {
  background: #efbebe;
}

.term-summary {
  padding: 12px 13px;
  cursor: pointer;
  list-style-position: outside;
}

.term-summary:hover,
.term-summary:focus-visible {
  background: #f8fafb;
  outline: none;
}

.term-heading,
.term-summary-meta,
.term-summary-meta span {
  display: block;
}

.term-heading {
  padding-left: 3px;
}

.term-date {
  font-size: 0.86rem;
}

.term-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.term-summary-meta {
  margin-top: 7px;
  padding-left: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.4;
}

.term-summary-meta span + span {
  margin-top: 2px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 1.15;
}

.status-confirmed {
  background: #dff3e4;
  color: #1d6d34;
}

.status-reserved {
  background: #e0effc;
  color: #125b91;
}

.status-pending {
  background: #fff0d8;
  color: #8a5505;
}

.status-recorded,
.status-empty {
  background: #e9edf0;
  color: #53636f;
}

.status-cancelled {
  background: #f9dede;
  color: #9c1f1f;
}

.status-occupied {
  background: #ece6fa;
  color: #5c3c8a;
}

.term-body {
  padding: 0 12px 12px;
  border-top: 1px solid #edf1f4;
}

.term-note {
  margin: 10px 0 0;
  padding: 8px 9px;
  border-radius: 4px;
  background: #fff7e8;
  color: #785316;
  font-size: 0.72rem;
  line-height: 1.4;
}

.term-empty-copy {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

.assignment-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.assignment-card {
  padding: 10px;
  border: 1px solid #e1e7eb;
  border-radius: 6px;
  background: #fafbfc;
}

.assignment-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.assignment-header h4 {
  margin: 1px 0 0;
  font-size: 0.82rem;
  line-height: 1.3;
}

.assignment-facts {
  display: grid;
  gap: 7px;
  margin: 9px 0 0;
}

.assignment-fact {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 7px;
  font-size: 0.72rem;
  line-height: 1.4;
}

.assignment-fact dt {
  color: var(--muted);
  font-weight: 700;
}

.assignment-fact dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.status-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 11px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 0.65rem;
}

.legend-dot {
  width: 9px;
  height: 9px;
  display: inline-block;
  border-radius: 50%;
}

.contact-list {
  display: grid;
  gap: 9px;
}

.contact-row {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafbfc;
}

.contact-label {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.contact-value {
  overflow-wrap: anywhere;
  font-size: 0.86rem;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.contact-action {
  width: fit-content;
  color: var(--purple);
  font-size: 0.76rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.contact-action:hover,
.contact-action:focus-visible {
  text-decoration: none;
  outline: 2px solid rgba(133, 0, 168, 0.22);
  outline-offset: 2px;
}

@media (max-width: 900px) {
  .topbar {
    height: auto;
    min-height: 64px;
    padding: 8px 16px;
  }

  .hotel-count {
    display: none;
  }

  .topbar-actions {
    margin-left: auto;
  }

  .refresh-status {
    display: none;
  }

  .refresh-button {
    min-height: 38px;
    padding: 8px 12px;
  }

  .workspace {
    display: flex;
    height: auto;
    min-height: auto;
    flex-direction: column;
  }

  .map-panel {
    height: auto;
    min-height: 58vh;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar {
    position: static;
    height: auto;
    min-height: auto;
    overflow: visible;
  }

  .search-panel {
    padding: 20px 16px 28px;
  }

  .hotel-detail {
    position: fixed;
    top: 64px;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 2000;
  }

  body.detail-open {
    overflow: hidden;
  }

  .detail-content,
  .detail-header {
    padding-right: 16px;
    padding-left: 16px;
  }

  .detail-tabs {
    padding-right: 16px;
    padding-left: 16px;
  }
}

@media (max-width: 420px) {
  .search-mode-switch {
    gap: 2px;
    padding: 2px;
  }

  .search-mode-tab {
    min-height: 42px;
    padding: 6px 4px;
    font-size: 0.69rem;
  }

  .detail-fact-grid {
    grid-template-columns: 1fr;
  }

  .assignment-fact {
    grid-template-columns: 1fr;
    gap: 1px;
  }

  .result-main {
    grid-template-columns: 26px minmax(0, 1fr);
  }

  .result-distance {
    grid-column: 2;
    text-align: left;
  }
}
