@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,600;9..144,700&family=Source+Sans+3:wght@400;600;700&display=swap");

:root {
  --sea-deep: #0a3d4a;
  --sea-mid: #146377;
  --foam: #e8f4f2;
  --sand: #d9c4a1;
  --ink: #14222a;
  --panel: rgba(248, 250, 249, 0.94);
  --line: rgba(20, 34, 42, 0.12);
  --accent: #c45c26;
  --err: #c62828;
  --shadow: 0 8px 24px rgba(10, 61, 74, 0.16);
  --font-display: "Fraunces", "Palatino Linotype", Palatino, serif;
  --font-body: "Source Sans 3", "Segoe UI", sans-serif;
  --pad: 0.55rem;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  background: #0a3d4a;
  overflow-x: hidden;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 420px at 12% -8%, rgba(232, 244, 242, 0.32), transparent 55%),
    radial-gradient(700px 380px at 92% 8%, rgba(217, 196, 161, 0.22), transparent 50%),
    linear-gradient(165deg, #0a3d4a 0%, #146377 45%, #0f4a56 100%);
}

.top {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.85rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.75rem 0.35rem;
  animation: rise 0.55s ease-out both;
}

.brand-block h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 4.2vw, 1.75rem);
  font-weight: 700;
  color: var(--foam);
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.45rem;
  align-items: center;
}

.mode-toggle {
  display: inline-flex;
  border: 1px solid rgba(232, 244, 242, 0.35);
  border-radius: 6px;
  overflow: hidden;
  background: rgba(10, 61, 74, 0.35);
}

.mode-toggle button,
.ghost {
  font: inherit;
  cursor: pointer;
  border: 0;
  background: transparent;
  color: var(--foam);
  padding: 0.32rem 0.65rem;
  font-size: 0.88rem;
}

.mode-toggle button.active {
  background: var(--foam);
  color: var(--sea-deep);
  font-weight: 700;
}

.ghost {
  border: 1px solid rgba(232, 244, 242, 0.35);
  border-radius: 6px;
}

.ghost:hover {
  background: rgba(232, 244, 242, 0.12);
}

.status {
  margin: 0;
  font-size: 0.78rem;
  color: rgba(232, 244, 242, 0.85);
  max-width: min(28rem, 42vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status.error {
  color: #ffc9c9;
}

.stale-slot {
  margin: 0 0.75rem;
  min-height: 2.1rem;
}

.stale-banner {
  margin: 0;
  padding: 0.35rem 0.65rem;
  background: #fff3cd;
  color: #5c4800;
  border: 1px solid #e6d89c;
  font-weight: 600;
  font-size: 0.82rem;
  min-height: 1.4rem;
  line-height: 1.35;
}

.stale-banner.is-empty {
  visibility: hidden;
  border-color: transparent;
  background: transparent;
}

.hidden {
  display: none !important;
}

.index-count {
  margin: 0.1rem 0 0;
  color: var(--sand);
  font-size: 0.8rem;
  font-weight: 600;
}

.filters {
  margin: 0.4rem 0.75rem 0;
  padding: 0.45rem 0.65rem;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  align-items: center;
  margin: 0.2rem 0;
}

.filter-row label {
  font-size: 0.82rem;
}

.provider-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.provider-label select {
  font: inherit;
  max-width: min(100%, 14rem);
  padding: 0.25rem 0.35rem;
  border: 1px solid var(--line);
  background: #fff;
}

.search-wrap {
  display: inline-flex;
  align-items: stretch;
  gap: 0;
  min-width: min(100%, 14rem);
  flex: 1 1 10rem;
}

.search-wrap input[type="search"] {
  flex: 1;
  min-width: 0;
  padding: 0.3rem 0.45rem;
  border: 1px solid var(--line);
  border-right: 0;
  font: inherit;
  border-radius: 4px 0 0 4px;
}

.q-clear {
  display: none;
  border: 1px solid var(--err);
  background: var(--err);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0 0.28rem;
  min-width: 1.15rem;
  height: 1.35rem;
  border-radius: 0 4px 4px 0;
  line-height: 1;
  align-items: center;
  justify-content: center;
}

.q-clear.visible,
.q-clear.always {
  display: inline-flex;
}

.app-nav .nav-about {
  margin-top: auto;
  align-self: stretch;
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  border: 1px solid rgba(232, 244, 242, 0.35);
  background: transparent;
  color: var(--foam);
  border-radius: 8px;
  padding: 0.35rem 0.55rem;
}

.app-nav .nav-about:hover {
  background: rgba(232, 244, 242, 0.12);
}

@media (max-width: 720px) {
  .app-nav .nav-about {
    margin-top: 0;
    margin-left: auto;
  }
}

.app-shell {
  display: flex;
  align-items: stretch;
  min-height: 100dvh;
}

.app-nav {
  flex: 0 0 7.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.75rem 0.45rem;
  background: rgba(8, 40, 48, 0.94);
  position: sticky;
  top: 0;
  height: 100dvh;
  z-index: 40;
}

.app-nav a {
  color: var(--foam);
  text-decoration: none;
  font-weight: 700;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
}

.app-nav a[aria-current="page"] {
  background: rgba(232, 244, 242, 0.18);
}

.app-stage {
  flex: 1 1 auto;
  min-width: 0;
}

@media (max-width: 720px) {
  .app-shell {
    flex-direction: column;
  }
  .app-nav {
    flex-direction: row;
    flex: none;
    height: auto;
    width: 100%;
    position: sticky;
  }
}

@media print {
  .app-nav {
    display: none !important;
  }
}

.ghost-dark {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.82rem;
}

.star-cell {
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  border: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  padding: 0.1rem 0.25rem;
}

.star-cell:hover {
  filter: brightness(0.9);
}

.operators-panel {
  display: none;
}

.cell-link {
  color: var(--sea-mid);
  text-decoration: underline;
  font-weight: 600;
}

.muted-cell {
  color: #9aa7ad;
  font-style: italic;
  font-size: 0.75rem;
}

td[data-col="note"],
td[data-col="links"] {
  max-width: 9rem;
  white-space: normal;
  font-size: 0.75rem;
}

.side-title {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: 0.95rem;
}

.ops-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  overflow: auto;
  max-height: 100%;
}

.ops-note {
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
}

.op-card {
  padding: 0.35rem 0;
  border-top: 1px solid var(--line);
}

.op-card:first-child {
  border-top: 0;
  padding-top: 0;
}

.op-card h3 {
  margin: 0;
  font-size: 0.82rem;
  font-family: var(--font-body);
}

.op-card p {
  margin: 0.12rem 0;
  font-size: 0.72rem;
}

.op-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.55rem;
  align-items: center;
}

.op-links a,
.detail-links a,
.foot a {
  color: var(--sea-mid);
}

.schedule-dialog {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem;
  max-width: min(98vw, 1100px);
  width: 100%;
  max-height: min(92dvh, 920px);
  background: #fff;
  box-sizing: border-box;
}

/* Never set display on closed <dialog> — it overrides UA display:none and leaks onto the page. */
.schedule-dialog[open] {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.schedule-dialog::backdrop {
  background: rgba(10, 61, 74, 0.55);
}

.schedule-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.35rem;
  flex-shrink: 0;
}

.schedule-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.1rem;
}

#schedule-note {
  margin: 0 0 0.25rem;
  font-size: 0.78rem;
  flex-shrink: 0;
  max-height: 3.2em;
  overflow: auto;
}

.schedule-stats {
  margin: 0 0 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #44555c;
  flex-shrink: 0;
}

.sched-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.55rem;
  align-items: center;
  margin: 0 0 0.45rem;
  flex-shrink: 0;
}

.sched-month-label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
}

.sched-month-label input {
  font: inherit;
  padding: 0.2rem 0.3rem;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}

.seg-btn {
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  border: 0;
  background: #f4f7f6;
  padding: 0.28rem 0.55rem;
}

.seg-btn + .seg-btn {
  border-left: 1px solid var(--line);
}

.seg-btn.active {
  background: var(--sea-mid);
  color: #fff;
  font-weight: 700;
}

.sched-pub-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin: 0 0 0.5rem;
  flex-shrink: 0;
}

.sched-pub-actions a.ghost-dark {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.schedule-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0 0 0.45rem;
  flex-shrink: 0;
}

.sched-tab {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--line);
  background: #f4f7f6;
  padding: 0.3rem 0.65rem;
  border-radius: 4px;
}

.sched-tab.active {
  background: var(--sea-mid);
  color: #fff;
  border-color: var(--sea-mid);
  font-weight: 700;
}

.schedule-scroll {
  overflow: auto;
  flex: 1;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

.sched-pane {
  min-height: 0;
}

.table-x {
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

.sched-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.76rem;
  min-width: 640px;
}

.sched-calls {
  min-width: 920px;
}

.sched-table th,
.sched-table td {
  border: 1px solid var(--line);
  padding: 0.28rem 0.38rem;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.sched-table th {
  position: sticky;
  top: 0;
  background: #f3f7f6;
  z-index: 1;
}

.sched-table tr.row-proj {
  color: #5a6a72;
  font-style: italic;
}

.sched-table tr.row-star td:nth-child(3) {
  font-weight: 700;
}

.pill {
  display: inline-block;
  font-size: 0.65rem;
  font-style: normal;
  font-weight: 700;
  padding: 0.05rem 0.3rem;
  border-radius: 3px;
  background: #e8eef0;
  color: #44555c;
}

.call-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.45rem;
}

.call-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.5rem 0.55rem;
  background: #fafcfb;
}

.call-card.is-proj {
  opacity: 0.85;
  border-style: dashed;
}

.call-card header {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin-bottom: 0.25rem;
}

.call-card header strong {
  font-size: 0.88rem;
}

.call-card header span {
  font-size: 0.72rem;
  color: #617680;
}

.call-meta {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  color: #44555c;
}

.call-times {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem 0.4rem;
  margin: 0;
}

.call-times dt {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #617680;
}

.call-times dd {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
}

.table-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  padding: 0.45rem 0.55rem;
  border-bottom: 1px solid var(--line);
}

.table-count {
  margin-right: auto;
  font-weight: 700;
  font-size: 0.82rem;
}

th {
  position: sticky;
  top: 0;
  background: #f3f7f6;
  user-select: none;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

th .th-label {
  cursor: pointer;
}

th .th-filter {
  margin-left: 0.15rem;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0 0.15rem;
}

th.filtered .th-filter {
  color: var(--accent);
  font-weight: 700;
}

th.asc .th-label::after {
  content: " ▲";
}
th.desc .th-label::after {
  content: " ▼";
}

.filter-popup {
  position: absolute;
  z-index: 5000;
  width: min(260px, 92vw);
  max-height: 360px;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 0.45rem;
}

.filter-popup-head {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.3rem;
}

.filter-popup-head input {
  font: inherit;
  padding: 0.25rem 0.35rem;
  border: 1px solid var(--line);
}

.filter-popup-actions,
.filter-popup-foot {
  display: flex;
  gap: 0.3rem;
  margin: 0.2rem 0;
}

.filter-popup button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--line);
  background: #f7f7f7;
  padding: 0.2rem 0.4rem;
}

.filter-popup button.primary {
  background: var(--sea-mid);
  color: #fff;
  border-color: var(--sea-mid);
}

.filter-popup-list {
  overflow: auto;
  flex: 1;
  max-height: 200px;
  border: 1px solid var(--line);
  padding: 0.3rem;
}

.filter-popup-list label {
  display: block;
  font-size: 0.8rem;
  padding: 0.1rem 0;
}

.layout {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-areas:
    "map"
    "detail"
    "ops"
    "table";
  gap: 0.45rem;
  padding: 0.4rem 0.75rem 0.85rem;
  max-width: 100%;
  min-width: 0;
}

.map-panel {
  grid-area: map;
  min-height: 140px;
  height: 22vh;
  max-height: 200px;
  min-width: 0;
  animation: fade-in 0.5s ease both;
}

.side-detail {
  grid-area: detail;
  overflow: auto;
  max-height: 28vh;
  padding: 0.55rem 0.65rem;
  min-width: 0;
  animation: fade-in 0.5s ease 0.05s both;
}

.side-ops {
  grid-area: ops;
  overflow: auto;
  max-height: 26vh;
  padding: 0.55rem 0.65rem;
  min-width: 0;
  animation: fade-in 0.5s ease 0.08s both;
}

.table-panel {
  grid-area: table;
  min-height: 32vh;
  min-width: 0;
  overflow: hidden;
  animation: fade-in 0.5s ease 0.1s both;
}

.layout-live .table-scroll {
  max-height: min(52vh, 520px);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}

#map {
  height: 100%;
  min-height: 120px;
}

.detail h2 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: 1rem;
}

.detail-empty {
  margin: 0;
  color: #51636c;
  font-size: 0.85rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem 0.45rem;
  margin: 0;
}

.detail-grid dt {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #617680;
}

.detail-grid dd {
  margin: 0.05rem 0 0;
  font-weight: 600;
  font-size: 0.8rem;
}

.detail-links {
  margin-top: 0.45rem;
  font-size: 0.8rem;
}

.detail-hint {
  margin: 0.45rem 0 0;
  font-size: 0.72rem;
  color: #617680;
}

.muted {
  color: #617680;
}

.table-scroll {
  overflow: auto;
  max-height: 42vh;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

th,
td {
  text-align: left;
  padding: 0.35rem 0.45rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

tbody tr {
  cursor: pointer;
  transition: background 0.12s ease;
}

tbody tr:hover {
  background: rgba(20, 99, 119, 0.08);
}

tbody tr.selected {
  background: rgba(196, 92, 38, 0.14);
}

tbody tr.row-cruise {
  background: rgba(217, 196, 161, 0.35);
}

tbody tr.row-cruise.selected {
  background: rgba(196, 92, 38, 0.22);
}

.foot {
  padding: 0 0.75rem 1rem;
  color: rgba(232, 244, 242, 0.75);
  font-size: 0.72rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.marker-tri,
.marker-pin {
  background: transparent;
  border: 0;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (min-width: 720px) {
  .top {
    padding: 0.75rem 1rem 0.45rem;
  }
  .filters {
    margin-left: 1rem;
    margin-right: 1rem;
  }
  .layout {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

@media (min-width: 960px) {
  .layout {
    grid-template-columns: minmax(160px, 200px) minmax(0, 1fr) minmax(200px, 260px);
    grid-template-rows: minmax(180px, 28vh) auto;
    grid-template-areas:
      "ops map detail"
      "table table table";
    gap: 0.55rem;
  }
  .map-panel {
    height: 28vh;
    max-height: 260px;
    min-height: 180px;
  }
  .side-ops,
  .side-detail {
    max-height: 28vh;
  }
  .layout-live .table-scroll {
    max-height: min(48vh, 560px);
  }
  #map {
    min-height: 160px;
  }
}
