:root {
  --navy: #0b3a5c;
  --navy-deep: #06263d;
  --teal: #2bb0a6;
  --teal-dark: #1f8a82;
  --sand: #eef4f8;
  --line: #c9d7e3;
  --text: #163247;
  --muted: #5d7386;
  --card: #ffffff;
  --danger: #b42318;
  --ok: #067647;
  --shadow: 0 10px 30px rgba(6, 38, 61, 0.08);
  --radius: 14px;
  --control-h: 32px;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(43, 176, 166, 0.18), transparent 60%),
    radial-gradient(900px 400px at 100% 0%, rgba(11, 58, 92, 0.16), transparent 55%),
    linear-gradient(180deg, #f5fafc 0%, var(--sand) 100%);
}

.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 8px 20px 28px;
}

.hero {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
  min-height: 28px;
}

.brand-home {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  text-decoration: none;
  color: inherit;
  line-height: 0;
}

.brand-home:hover .brand-name {
  color: var(--teal-dark);
}

.brand-home .logo {
  width: 28px;
  height: 28px;
  display: block;
  border-radius: 6px;
  box-shadow: none;
}

.brand-name {
  display: inline-flex;
  align-items: center;
  height: 28px;
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 28px;
  letter-spacing: 0.02em;
  color: var(--navy);
  white-space: nowrap;
}

.hero-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.apk-download {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border: 1px solid #d5e0ea;
  border-radius: 8px;
  background: #fff;
  text-decoration: none;
  color: inherit;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.apk-download:hover,
.apk-download:focus-visible {
  border-color: #9bb6cc;
  box-shadow: 0 2px 8px rgba(11, 58, 92, 0.12);
}

.apk-download-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--navy);
  white-space: nowrap;
  line-height: 28px;
}

.apk-qr-popup {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  padding: 10px;
  border: 1px solid #d5e0ea;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(11, 58, 92, 0.16);
  text-align: center;
}

.apk-download:hover .apk-qr-popup,
.apk-download:focus-within .apk-qr-popup {
  display: block;
}

.apk-qr {
  width: 120px;
  height: 120px;
  display: block;
  border-radius: 6px;
  background: #fff;
}

.apk-qr-popup small {
  display: block;
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
}

.hero-link {
  color: var(--accent, #0b3a5c);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
}

.hero-link:hover {
  text-decoration: underline;
}

.hero-text {
  flex: 1;
  min-width: 0;
}

.hero-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
}

.hero-title-row h1,
.page-heading {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy);
}

.lang-switch {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  min-width: 0;
  height: 28px;
}

.hero-right .lang-switch {
  margin-left: 0;
}

.lang-switch span {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 28px;
  white-space: nowrap;
}

.lang-switch select {
  height: 28px;
  min-width: 110px;
  padding: 0 8px;
  font-size: 0.82rem;
  line-height: 26px;
  border-radius: 8px;
  box-sizing: border-box;
}

.logo {
  border-radius: 6px;
}

.hero-text h1 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0.02em;
  color: var(--navy);
}

.hero-text p {
  margin: 4px 0 0;
  color: var(--muted);
}

/* ── Query mode cards ── */
.query-mode-section {
  margin-bottom: 8px;
  padding: 6px 10px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92) 0%, rgba(238, 244, 248, 0.95) 100%);
  border: 1px solid rgba(201, 215, 227, 0.85);
  border-radius: calc(var(--radius) + 2px);
  box-shadow: var(--shadow);
}

.query-mode-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  min-width: 0;
}

.query-mode-header {
  margin-bottom: 0;
}

.query-mode-heading {
  margin: 0;
  flex: 0 0 auto;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: 0.01em;
  white-space: nowrap;
  line-height: var(--control-h);
}

.query-mode-lead {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.35;
}

.query-mode-grid {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.query-mode-card {
  position: relative;
  display: inline-flex;
  flex: 1 1 0;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 8px;
  width: auto;
  max-width: none;
  min-width: 0;
  height: var(--control-h);
  min-height: var(--control-h);
  box-sizing: border-box;
  text-decoration: none;
  color: var(--text);
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(6, 38, 61, 0.04);
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease;
  overflow: hidden;
}

.query-mode-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--mode-accent, var(--teal));
  opacity: 0.45;
  transition: opacity 0.16s ease, width 0.16s ease;
}

.query-mode-card:hover {
  transform: translateY(-1px);
  border-color: var(--mode-accent, var(--teal));
  box-shadow: 0 6px 16px rgba(6, 38, 61, 0.1);
}

.query-mode-card:hover::before {
  opacity: 0.85;
  width: 4px;
}

.query-mode-card.is-active {
  border-color: var(--mode-accent, var(--teal));
  background: var(--mode-bg-active, rgba(43, 176, 166, 0.22));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.55),
    0 0 0 2px var(--mode-accent, var(--teal)),
    0 4px 14px rgba(6, 38, 61, 0.12);
  transform: none;
}

.query-mode-card.is-active::before {
  opacity: 1;
  width: 4px;
}

.query-mode-card.mode-vessel {
  --mode-accent: #0b3a5c;
  --mode-bg-active: rgba(11, 58, 92, 0.18);
  --mode-icon-bg: rgba(11, 58, 92, 0.1);
  --mode-icon-bg-active: rgba(11, 58, 92, 0.28);
  --mode-icon-color: #0b3a5c;
}

.query-mode-card.mode-container {
  --mode-accent: #c45c00;
  --mode-bg-active: rgba(196, 92, 0, 0.16);
  --mode-icon-bg: rgba(196, 92, 0, 0.12);
  --mode-icon-bg-active: rgba(196, 92, 0, 0.28);
  --mode-icon-color: #a34a00;
}

.query-mode-card.mode-bl {
  --mode-accent: #1565c0;
  --mode-bg-active: rgba(21, 101, 192, 0.16);
  --mode-icon-bg: rgba(21, 101, 192, 0.12);
  --mode-icon-bg-active: rgba(21, 101, 192, 0.28);
  --mode-icon-color: #0d47a1;
}

.query-mode-card.mode-booking {
  --mode-accent: #6a1b9a;
  --mode-bg-active: rgba(106, 27, 154, 0.16);
  --mode-icon-bg: rgba(106, 27, 154, 0.12);
  --mode-icon-bg-active: rgba(106, 27, 154, 0.28);
  --mode-icon-color: #4a148c;
}

.query-mode-card.mode-routes {
  --mode-accent: #00695c;
  --mode-bg-active: rgba(0, 105, 92, 0.16);
  --mode-icon-bg: rgba(0, 105, 92, 0.12);
  --mode-icon-bg-active: rgba(0, 105, 92, 0.28);
  --mode-icon-color: #004d40;
}

.routes-summary {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0, 105, 92, 0.06);
  border: 1px solid rgba(0, 105, 92, 0.18);
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.routes-summary code {
  font-family: var(--mono);
  font-size: 0.85em;
  color: var(--text);
}

.query-mode-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--mode-icon-bg, rgba(43, 176, 166, 0.12));
  color: var(--mode-icon-color, var(--navy));
  flex-shrink: 0;
}

.query-mode-card.is-active .query-mode-icon {
  background: var(--mode-icon-bg-active, var(--mode-icon-bg));
}

.query-mode-icon svg {
  width: 14px;
  height: 14px;
}

.query-mode-text {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 0 1 auto;
  min-width: 0;
}

.query-mode-title {
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--navy);
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.query-mode-card.is-active .query-mode-title {
  color: var(--mode-accent, var(--navy));
}

.query-mode-desc {
  font-size: 0.72rem;
  line-height: 1.25;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.query-mode-badge {
  display: none;
  flex-shrink: 0;
  padding: 2px 7px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #fff;
  background: var(--mode-accent, var(--teal));
  border-radius: 999px;
  white-space: nowrap;
}

.query-mode-card.is-active .query-mode-badge {
  display: inline-flex;
}

.page-nav {
  display: none;
}

.panel {
  background: var(--card);
  border: 1px solid rgba(201, 215, 227, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px 10px;
  margin-bottom: 8px;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

.wrap { flex-wrap: wrap; }

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 160px;
}

.field.grow { flex: 1; min-width: 200px; }
.field.narrow { width: 120px; min-width: 100px; }
.field.block { display: flex; margin-bottom: 8px; }

.carrier-filters {
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
}

.carrier-filters .field {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  flex: 1 1 0;
  min-width: 0;
}

.carrier-filters .field.narrow {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
}

.carrier-filters .field > span {
  flex: 0 0 auto;
  white-space: nowrap;
  line-height: var(--control-h);
  margin: 0;
}

.carrier-filters .field > input,
.carrier-filters .field > select {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  height: var(--control-h);
  min-height: var(--control-h);
  padding: 0 8px;
  font-size: 0.86rem;
  line-height: calc(var(--control-h) - 2px);
  border-radius: 8px;
  box-sizing: border-box;
}

.carrier-filters .field.narrow > input {
  width: 64px;
  flex: 0 0 64px;
}

.field span,
.check span {
  font-size: 0.82rem;
  color: var(--muted);
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.field-label-row > span[data-i18n] {
  flex: 1;
  min-width: 0;
  line-height: 1.35;
}

.btn-label-action {
  flex: 0 0 auto;
  margin: 0;
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  line-height: 1.35;
  height: auto;
  cursor: pointer;
  white-space: nowrap;
}

.btn-label-action:hover {
  border-color: var(--teal);
  color: var(--teal-dark);
}

input, select, textarea {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  font: inherit;
  color: var(--text);
  background: #fff;
}

textarea {
  font-family: var(--mono);
  font-size: 0.92rem;
  line-height: 1.45;
  resize: vertical;
  min-height: 120px;
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(43, 176, 166, 0.35);
  border-color: var(--teal);
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  user-select: none;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--navy);
  border-radius: 8px;
  height: var(--control-h);
  min-height: var(--control-h);
  padding: 0 14px;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1;
  box-sizing: border-box;
  cursor: pointer;
}

.btn:hover:not(:disabled) { border-color: var(--teal); color: var(--teal-dark); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn.primary {
  background: linear-gradient(135deg, var(--navy) 0%, #145078 100%);
  border-color: transparent;
  color: #fff;
}

.btn.primary:hover:not(:disabled) {
  filter: brightness(1.06);
  color: #fff;
}

.btn.ghost {
  background: transparent;
}

.hidden {
  display: none !important;
}

.status {
  color: var(--muted);
  font-size: 0.9rem;
}

.status.ok { color: var(--ok); }
.status.err { color: var(--danger); }
.status.busy { color: var(--navy); }

.hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.table-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
  min-width: 0;
}

.table-toolbar h2 {
  margin: 0;
  flex: 0 0 auto;
  font-size: 1.05rem;
  color: var(--navy);
  white-space: nowrap;
}

.table-toolbar .toolbar-hint {
  flex: 1 1 auto;
  margin: 0;
  min-width: 0;
  font-size: 0.8rem;
  line-height: 1.3;
}

.table-toolbar .muted {
  flex: 0 0 auto;
  margin-left: auto;
  white-space: nowrap;
}

.muted { color: var(--muted); font-size: 0.9rem; }

.table-wrap {
  overflow: auto;
  max-height: min(58vh, 640px);
  border: 1px solid var(--line);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: #fff;
}

th, td {
  border-bottom: 1px solid #e6eef4;
  padding: 8px 10px;
  text-align: left;
  white-space: nowrap;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}

th {
  position: sticky;
  top: 0;
  background: var(--navy);
  color: #fff;
  font-weight: 600;
  z-index: 1;
}

tbody tr:hover { background: #f3faf9; }

td.selected {
  outline: 2px solid var(--teal);
  outline-offset: -2px;
  background: rgba(43, 176, 166, 0.14);
  user-select: text;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

tr.empty td {
  text-align: center;
  color: var(--muted);
  padding: 16px 12px;
  white-space: normal;
}

.site-footer {
  margin-top: 28px;
  padding: 14px 4px 8px;
  border-top: 1px solid #e2ebf2;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.footer-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 16px;
}

.footer-icp {
  color: #667788;
  text-decoration: none;
  white-space: nowrap;
}

.footer-icp:hover {
  color: var(--navy);
  text-decoration: underline;
}

.footer-item {
  color: var(--muted);
  white-space: nowrap;
}

.footer-link {
  color: #667788;
  text-decoration: none;
  white-space: nowrap;
}

.footer-link:hover {
  color: var(--navy);
  text-decoration: underline;
}

/* Cookie consent bar (bottom fixed) */
.cookie-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  background: #fff;
  border-top: 1px solid #dde3ea;
  box-shadow: 0 -2px 12px rgba(15, 35, 55, 0.08);
  transform: translateY(100%);
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.cookie-banner.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.cookie-banner-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 24px;
}

.cookie-banner-text {
  margin: 0;
  flex: 1 1 280px;
  color: #222;
  font-size: 0.9rem;
  line-height: 1.55;
}

.cookie-banner-details {
  color: #1a5fb4;
  text-decoration: underline;
  margin-left: 4px;
  white-space: nowrap;
}

.cookie-banner-details:hover {
  color: #0b3a5c;
}

.cookie-banner-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 0 0 auto;
}

.cookie-banner-agree {
  background: none;
  border: none;
  padding: 0;
  color: #111;
  font: inherit;
  font-size: 0.95rem;
  text-decoration: underline;
  cursor: pointer;
}

.cookie-banner-agree:hover {
  color: #0b3a5c;
}

.cookie-banner-close {
  background: none;
  border: none;
  padding: 0 2px;
  color: #444;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.cookie-banner-close:hover {
  color: #000;
}

@media (max-width: 720px) {
  .cookie-banner-inner {
    padding: 12px 14px 14px;
  }
  .cookie-banner-text {
    font-size: 0.85rem;
  }
}

.legal-panel {
  max-width: 720px;
  margin: 0 auto;
}

.legal-body {
  color: var(--text, #1a2b3c);
  font-size: 0.95rem;
  line-height: 1.7;
}

.legal-body h2 {
  margin: 1.25em 0 0.4em;
  font-size: 1.05rem;
  color: var(--navy, #0b3a5c);
}

.legal-body p {
  margin: 0 0 0.85em;
}

.legal-list,
.contact-list {
  margin: 0 0 1em;
  padding-left: 1.25em;
}

.legal-list li {
  margin: 0.35em 0;
}

.contact-list {
  list-style: none;
  padding-left: 0;
}

.contact-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  padding: 10px 0;
  border-bottom: 1px solid #e2ebf2;
}

.contact-label {
  min-width: 5.5em;
  color: var(--muted);
  font-weight: 600;
}

.contact-value {
  color: var(--navy, #0b3a5c);
  text-decoration: none;
  word-break: break-all;
}

a.contact-value:hover {
  text-decoration: underline;
}

.legal-note,
.legal-updated {
  color: var(--muted);
  font-size: 0.88rem;
}

@media (max-width: 1100px) {
  .query-mode-row,
  .carrier-filters {
    flex-wrap: wrap;
  }

  .query-mode-grid {
    flex-wrap: nowrap;
    width: 100%;
  }
}

@media (max-width: 720px) {
  .hero-text h1,
  .page-heading { font-size: 0.95rem; }
  .brand-name { font-size: 1.05rem; }
  .page { padding: 8px 12px 20px; }
  .panel { padding: 10px 12px; }
  .query-mode-section { padding: 8px 10px; }
  .query-mode-row {
    align-items: flex-start;
  }
  .query-mode-grid {
    width: 100%;
  }
  .query-mode-desc {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .carrier-filters .field {
    flex: 1 1 calc(50% - 10px);
  }
}
