:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-soft: #eef2f5;
  --ink: #20262d;
  --muted: #626d79;
  --line: #e1e5ea;
  --brand: #1673c9;
  --brand-strong: #095da7;
  --accent: #486b95;
  --danger: #b42318;
  --shadow: 0 2px 8px rgba(23, 32, 42, 0.04);
}

.wl-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-bottom: 20px; }
.wl-filters label { flex: 1 1 160px; }
.table-scroll { overflow-x: auto; }
.wl-table { width: 100%; border-collapse: collapse; background: white; }
.wl-table { min-width: 980px; }
.wl-table td:last-child { min-width: 180px; }
.wl-table td:last-child > a, .wl-table td:last-child > button { display: block; white-space: nowrap; margin-block: 4px; }
.wl-table th, .wl-table td { text-align: left; padding: 12px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.wl-table th { white-space: nowrap; font-size: 13px; color: var(--muted); }
.wl-pagination { display: flex; justify-content: center; align-items: center; gap: 16px; margin-top: 20px; }
.widget-section { margin-bottom: 30px; }
.widget-section iframe { width: 100%; border: 1px solid var(--line); background: white; }
#oqrsFrame { height: 320px; }
#visitorFrame { height: 1000px; }
button:disabled { opacity: .5; cursor: not-allowed; }
.header-actions a { color: var(--brand-strong); }

* {
  box-sizing: border-box;
}

.mail-fields { display: grid; gap: 12px; border: 0; padding: 0; margin: 0; min-width: 0; }
.mail-fields:disabled { opacity: .65; }

[hidden] {
  display: none !important;
}

.owner-settings { border-bottom: 1px solid var(--line); margin-bottom: 20px; padding-bottom: 16px; }
.owner-settings summary { cursor: pointer; font-weight: 700; padding: 8px 0; }
.owner-settings .form { max-width: 640px; margin-top: 12px; }
.owner-settings .form-actions { flex-wrap: wrap; }
.owner-settings p { margin: 0; }
.address-preview { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.6; margin-bottom: 0; }
.return-address-section { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
label:has(#incomingCardReceived) { display: flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; }
#incomingCardReceived { width: 20px; height: 20px; margin: 0; accent-color: var(--brand); flex-shrink: 0; }
.request-layout { max-width: 820px; }
.incoming-details { border: 0; border-left: 3px solid var(--line); padding: 4px 0 4px 12px; margin: 0; min-width: 0; }
.date-field { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 600; }
.date-parts { display: grid; grid-template-columns: minmax(58px, 1.5fr) auto minmax(36px, 1fr) auto minmax(36px, 1fr) auto auto; align-items: center; gap: 4px; }
.date-parts input { min-width: 0; padding: 10px 4px; text-align: center; font-variant-numeric: tabular-nums; }
.date-parts .text-button { padding: 8px; font-size: 13px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; }
.checkbox-label input { width: 18px; height: 18px; }
.incoming-image-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.image-preview, .gallery-photo { display: block; padding: 0; border: 1px solid var(--line); background: #fff; cursor: zoom-in; width: 100%; }
.image-preview img, .gallery-photo img { display: block; width: 100%; height: 100%; object-fit: contain; }
.image-preview { aspect-ratio: 3 / 2; }
#incomingImageStatus { margin: 0; overflow-wrap: anywhere; font-size: 13px; }
.photo-dialog { width: min(1100px, 96vw); padding: 12px; border: 1px solid var(--line); border-radius: 6px; }
.photo-dialog::backdrop { background: rgba(0,0,0,.72); }
.photo-dialog > img { display: block; width: 100%; height: min(75vh, 800px); object-fit: contain; }
.photo-controls { display: flex; align-items: center; justify-content: end; gap: 10px; margin-bottom: 8px; }
.photo-controls button { width: 40px; height: 40px; border: 1px solid var(--line); background: white; font-size: 23px; cursor: pointer; }
.photo-controls span { flex: 1; text-align: center; overflow-wrap: anywhere; }
.received-map-section { position: relative; }
#qslMap { height: 56vh; min-height: 340px; max-height: 600px; background: #e1e9eb; z-index: 0; }
.map-actions { display: flex; justify-content: end; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface); }
.map-actions .icon-button { display: grid; place-items: center; }
.map-grid-toggle { margin-right: auto; align-self: center; cursor: pointer; }
.maidenhead-grid { position: absolute; pointer-events: none; }
.leaflet-marker-icon.station-marker { display: grid; place-items: center; background: #b42318; border: 2px solid white; border-radius: 6px; box-shadow: 0 1px 3px #3338; }
.station-marker img { display: block; width: 16px; height: 16px; filter: invert(1); }
.qsl-connection { display: none; }
.map-overview .qsl-connection { display: block; animation: qsl-route-flow 1.4s linear infinite; }
@keyframes qsl-route-flow { from { stroke-dashoffset: 20; } to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .map-overview .qsl-connection { animation: none; } }
.account-layout { max-width: 760px; }
.account-profile { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 16px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.account-profile dt { color: var(--muted); }
.account-profile dd { margin: 0; overflow-wrap: anywhere; }
.account-settings-section { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.account-settings-section h2 { margin-bottom: 16px; }
.account-settings-section p, #credentialAvailability { font-size: 14px; overflow-wrap: anywhere; }
.account-settings-section p { min-height: 22px; margin: 8px 0 0; }
.account-settings-section [data-error=true] { color: var(--danger); }
.notification-template-tools { flex-wrap: wrap; align-items: end; }
#notificationSettingsForm section { display: grid; gap: 12px; }
#notificationSection .mail-fields { margin-top: 10px; }
#notificationStatus { margin-top: 10px; overflow-wrap: anywhere; }
.received-list-heading { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.received-list-heading label { margin-left: auto; min-width: 170px; }
.received-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(200px, 1fr); gap: 24px; padding: 24px 0; border-top: 1px solid var(--line); }
.received-photos { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; min-width: 0; }
.gallery-photo { aspect-ratio: 3 / 2; max-height: 320px; }
.received-info { min-width: 0; overflow-wrap: anywhere; }
.received-info h3 { font-size: 22px; }
.received-info p { color: var(--muted); margin-bottom: 12px; }
.received-info .form-actions { flex-wrap: wrap; }
.no-card-image { display: grid; place-items: center; aspect-ratio: 3 / 2; background: var(--surface-soft); color: var(--muted); }
.qsl-marker-content { position: absolute; width: 30px; height: 30px; border-radius: 50%; border: 3px solid white; background: var(--brand); box-shadow: 0 1px 6px #555; }
.qsl-marker-content img, .qsl-marker-content span { display: none; }
.show-card-thumbnails .has-photo .qsl-marker-content { width: 100px; height: 76px; left: -35px; top: -46px; border-radius: 4px; background: white; }
.show-card-thumbnails .has-photo img { display: block; width: 94px; height: 54px; object-fit: contain; }
.show-card-thumbnails .has-photo span { display: block; font-size: 11px; line-height: 16px; text-align: center; color: var(--ink); overflow: hidden; white-space: nowrap; }
.qsl-map-popup { width: 230px; }
.qsl-map-popup p { margin: 6px 0; }
@media (max-width: 540px) {
  .received-row { grid-template-columns: 1fr; gap: 14px; }
  .received-photos { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .map-actions { flex-wrap: wrap; gap: 8px; }
  .map-actions button { font-size: 12px; padding: 7px; }
  .received-list-heading label { margin-left: 0; width: 100%; }
}
.request-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
#oqrsStatus { margin-top: 18px; overflow-wrap: anywhere; }
@media (max-width: 540px) { .request-grid { grid-template-columns: 1fr; } }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 28px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 24px;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
}

h3 {
  margin-bottom: 4px;
  font-size: 16px;
}

.header-actions,
.form-actions,
.panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.layout {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 24px clamp(14px, 3vw, 36px) 40px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px;
  gap: 12px;
  margin-bottom: 16px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(22, 115, 201, 0.14);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stats div,
.panel,
.visitor-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.stats div {
  padding: 16px;
}

.stats span {
  display: block;
  font-size: 26px;
  font-weight: 800;
}

.stats small {
  color: var(--muted);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 420px);
  gap: 16px;
  align-items: start;
}

.panel {
  min-width: 0;
  padding: 16px;
}

.panel-title {
  justify-content: space-between;
  margin-bottom: 14px;
}

.panel-title span {
  color: var(--muted);
  font-size: 13px;
}

.card-list {
  display: grid;
  gap: 10px;
}

.record-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
  text-align: left;
  cursor: pointer;
}

.record-card:hover,
.record-card.active {
  border-color: var(--brand);
}

.record-main {
  min-width: 0;
}

.record-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.record-title strong {
  font-size: 18px;
}

.record-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: var(--muted);
  font-size: 13px;
}

.record-address {
  margin: 8px 0 0;
  color: #36413a;
  font-size: 14px;
  line-height: 1.45;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  background: var(--surface-soft);
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 700;
}

.badge.received {
  background: #e8f6ee;
  color: #137044;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.detail-panel {
  position: sticky;
  top: 16px;
}

.form {
  display: grid;
  gap: 12px;
}

.primary-button,
.danger-button,
.text-button,
.icon-button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 14px;
  cursor: pointer;
  font-weight: 700;
}

.primary-button {
  background: var(--brand);
  color: #fff;
}

.primary-button:hover {
  background: var(--brand-strong);
}

.danger-button {
  border-color: #f1c8c5;
  background: #fff7f6;
  color: var(--danger);
}

.danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.text-button,
.icon-button {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.icon-button {
  width: 42px;
  padding: 0;
  font-size: 22px;
}

.wide {
  width: 100%;
}

.qr-box {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.qr-box img {
  width: 180px;
  height: 180px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.qr-box p,
.qr-box a {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  padding: 12px 14px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.visitor-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 18px;
}

.visitor-shell {
  width: min(560px, 100%);
}

.visitor-panel {
  padding: clamp(20px, 5vw, 34px);
}

.public-summary {
  display: grid;
  gap: 8px;
  margin: 18px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 14px;
}

.public-summary strong {
  font-size: 22px;
}

.visitor-result {
  margin: 14px 0 0;
  color: var(--brand-strong);
  font-weight: 700;
}

.skeleton {
  width: 70%;
  height: 18px;
  border-radius: 4px;
  background: #dfe7dd;
}

.skeleton.short {
  width: 45%;
}

@media (max-width: 860px) {
  .app-header,
  .header-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
  }
}

@media (max-width: 540px) {
  #oqrsFrame { height: 420px; }
  .stats {
    grid-template-columns: 1fr;
  }

  .record-card {
    grid-template-columns: 1fr;
  }
}
/* Translated labels may be wider than their Chinese equivalents. */
.language-picker { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.language-picker select { width: auto; min-width: 140px; }
.eqsl-notice { padding: 16px; border-left: 4px solid #b42318; background: #fff0ec; color: #842218; font-weight: 600; white-space: pre-wrap; overflow-wrap: anywhere; }
.receipt-yes,.receipt-no,.receipt-unknown { display: inline-block; width: 24px; text-align: center; font-size: 22px; font-weight: 700; }
.receipt-yes { color: #087640; } .receipt-no { color: #b42318; } .receipt-unknown { color: #626969; }
.receipt-mark { cursor: help; border-radius: 4px; }
.connection-test-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.connection-test-button img { flex: 0 0 18px; }
#integrationTestSaved { margin-bottom: 20px; }
.connection-test-results { margin-block: 24px; }
.connection-test-results h2 { font-size: 18px; }
.connection-test-results ul { list-style: none; padding: 0; margin: 0; }
.connection-test-results li { padding: 14px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.connection-test-results p { margin: 8px 0; }
.connection-check-heading { display: flex; align-items: baseline; gap: 12px; }
.connection-check-state { flex: 0 0 56px; font-size: 14px; font-weight: 700; }
.connection-check-state.pass { color: #087640; }
.connection-check-state.fail { color: #b42318; }
.connection-check-state.warn { color: #855b00; }
.connection-check-state.skip { color: #626969; }
.connection-test-results code { font-size: 12px; color: var(--muted); }
.receipt-tooltip { white-space: pre-line; }
html:not([data-integrations-ready]) a[href="wavelog.html"], html:not([data-integrations-ready]) a[href="request.html"], html:not([data-integrations-ready]) [data-requires], html[data-wavelog-available="false"] #qsoAssociation { display: none !important; }
.receipt-mark:focus-visible { outline: 2px solid var(--brand-strong); outline-offset: 3px; }
.receipt-tooltip { position: fixed; z-index: 1000; width: 300px; max-width: calc(100vw - 16px); padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: #25332d; box-shadow: 0 4px 16px #0002; font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; box-sizing: border-box; }
#platformAdmin > form, #platformInvites { margin-block: 24px; }
#platformUsers fieldset { margin-block: 16px; }
#platformUsers .form-actions { margin-block: 12px; }
.header-actions, .form-actions { flex-wrap: wrap; }
.site-navigation { display: flex; flex-wrap: wrap; gap: 0 20px; padding: 0 32px; background: var(--surface); border-bottom: 1px solid var(--line); }
.site-navigation a { display: flex; align-items: center; min-height: 44px; padding: 10px 0; color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent; font-size: 14px; }
.site-navigation a:hover { color: var(--brand-strong); }
.site-navigation a[aria-current="page"] { color: var(--brand-strong); border-bottom-color: var(--brand); font-weight: 700; }
.site-navigation a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.navigation-language { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.navigation-language span { font-size: 12px; color: var(--muted); }
.navigation-language select { width: auto; min-width: 126px; max-width: 100%; }
.app-header.public-header { padding: 12px 24px; justify-content: flex-end; }
.request-admin-login { display: inline-flex; align-items: center; min-height: 40px; }
.app-header:has(#requestAdminLogin) { flex-direction: row; align-items: center; flex-wrap: wrap; }
.app-header:has(#requestAdminLogin) .header-actions { margin-left: auto; align-self: flex-start; }
@media (max-width: 860px) {
  .site-navigation { padding-inline: 18px; gap: 0 16px; }
  .app-header .header-actions { flex-direction: row; align-items: center; }
}
button, label, h1, h2 { overflow-wrap: anywhere; }
