/* ============================================================
   The Bali Bay — design tokens
   Sunrise (light) / Sunset (dark) theme system. Sunrise is the default
   palette on bare :root; Sunset applies either from the OS
   prefers-color-scheme (unless the user explicitly picked Sunrise) or
   from an explicit [data-theme="dark"] override — see Theme (theme.js)
   for how that attribute gets set. Semantic roles: bg = page background,
   surface = card backgrounds, border-strong = borders/muted decorative
   elements, accent = primary interactive color (buttons/links/routes),
   text-on-accent = text color for content sitting on an accent-colored
   background (e.g. button labels). danger is a deliberate off-palette
   rust/copper (not accent-colored) reserved for destructive/error states,
   since color-coding "something is wrong" needs a hue distinct from the
   brand accent to stay legible as a signal.
   ============================================================ */
:root {
  /* Sunrise (light) — default */
  --bg: #F6E9D8;
  --surface: #FFF6EC;
  --border-strong: #C9A27C;
  --accent: #E8734A;
  --accent-deep: #C85A32;
  --text-on-accent: #FFFBF6;

  --danger: #B4442A;
  --danger-deep: #8C3520;
  --danger-text: #A34A32;

  --text-heading: #3A2418;
  --text-body: #5B4636;
  --text-secondary: #8A6F58; /* meets WCAG AA on bg/surface */

  --border: color-mix(in srgb, var(--accent) 28%, transparent);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 10px 30px rgba(58, 36, 24, 0.12);

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --radius: 10px;
  --radius-sm: 6px;

  --dur-fast: 150ms;
  --dur-base: 320ms;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1F1522;
    --surface: #34212F;
    --border-strong: #6B4A5E;
    --accent: #F2905B;
    --accent-deep: #D9683E;
    --text-on-accent: #241726;

    --danger: #B4553B;
    --danger-deep: #954432;
    --danger-text: #E29B87;

    --text-heading: #FBEEE6;
    --text-body: #E4CFC7;
    --text-secondary: #B99287;

    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px rgba(0, 0, 0, 0.5);
  }
}

:root[data-theme="dark"] {
  --bg: #1F1522;
  --surface: #34212F;
  --border-strong: #6B4A5E;
  --accent: #F2905B;
  --accent-deep: #D9683E;
  --text-on-accent: #241726;

  --danger: #B4553B;
  --danger-deep: #954432;
  --danger-text: #E29B87;

  --text-heading: #FBEEE6;
  --text-body: #E4CFC7;
  --text-secondary: #B99287;

  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-body);
  margin: 0;
  padding: 0 1.5rem 4rem;
}

h1, h2, h3 { font-family: var(--font-display); color: var(--text-heading); }

a { color: var(--accent); }
a:hover { color: var(--text-heading); }

/* ============================================================
   Reveal-on-load — headings fade+lift in once, used sparingly
   (persistent headings via IntersectionObserver, dynamic modal/overlay
   headings triggered directly at creation time). Never reused per scroll.
   ============================================================ */
.reveal-on-load {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal-on-load.revealed { opacity: 1; transform: translateY(0); }

/* ============================================================
   Background water motion — a barely-perceptible drifting line pattern
   behind all content. Fixed, non-interactive, GPU-only (transform).
   ============================================================ */
.water-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.05;
  overflow: hidden;
}
.water-bg svg {
  width: 220%;
  height: 100%;
  animation: water-drift 80s linear infinite;
}
.water-bg-lines { stroke: var(--border-strong); }
@keyframes water-drift {
  from { transform: translateX(0); }
  to { transform: translateX(-52.5%); }
}

/* ============================================================
   Header — "command center" bar
   ============================================================ */
.site-header {
  background: var(--bg);
  color: var(--text-heading);
  margin: 0 -1.5rem 2rem;
  padding: 1.75rem 1.5rem;
  border-bottom: 3px solid var(--accent);
}

.site-header-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
}

.wordmark {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: fit-content; /* sizes to the widest child (the brand link) so the wave/ship SVG below, at
    width:100%, exactly matches the heading's rendered width instead of a fixed guessed px value */
}

.wordmark .kicker {
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.32em;
  color: var(--text-heading);
  opacity: 0.6;
}

.wordmark h1 {
  margin: 0;
  font-size: 2.1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
  color: var(--text-heading);
}

.wordmark svg {
  flex: 0 0 auto;
  margin-top: 4px;
  width: 100%;
  height: auto;
}

/* Whole logo lockup (kicker + wordmark + beta badge) is a link back home - to the dashboard when
   logged in, the landing page when logged out (see brand-nav.js, which needs the login check). */
.brand-link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: fit-content;
  color: inherit;
  text-decoration: none;
}
.brand-row { display: flex; align-items: baseline; gap: 0.55rem; }

.beta-badge {
  font-family: var(--font-body);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 0.12rem 0.5rem;
  line-height: 1.5;
  white-space: nowrap;
}

/* ============================================================
   Header brand mark — ship rests at a fixed point on the wave (no travel
   animation; the landing page's hero now carries the ship motion).
   ============================================================ */
.brand-wave {
  fill: none;
  stroke: var(--border-strong);
  stroke-width: 1.3;
  opacity: 0.75;
}
.brand-ship path:first-child { fill: var(--bg); stroke: var(--accent); stroke-width: 1.6; stroke-linejoin: round; }
.brand-ship path:nth-child(2) { fill: none; stroke: var(--accent); stroke-width: 1.5; }
.brand-ship-sail-a { fill: var(--accent); stroke: none; opacity: 0.92; }
.brand-ship-sail-b { fill: var(--accent); stroke: none; opacity: 0.5; }

.brand-ship-travel {
  offset-path: path("M0 22 q 12.5 -6 25 0 t 25 0 t 25 0 t 25 0 t 25 0 t 25 0 t 25 0 t 25 0");
  offset-rotate: 0deg;
  offset-distance: 50%;
}

.site-header p {
  margin: 0.3rem 0 0;
  color: var(--text-heading);
  opacity: 0.75;
  font-size: 0.9rem;
}

/* --- Account bar: connection badge + settings/logout, shown once logged in --- */
.account-bar { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.9rem; flex-wrap: wrap; }
.account-bar[hidden] { display: none; }
.account-bar .badge.connected { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent); }
.account-bar .badge.not-connected { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger-text); }

/* --- Auth / connect gates: centered, narrower than the full dashboard width --- */
.auth-section .upload-panel, .connect-gate .upload-panel { max-width: 420px; margin: 0 auto; }
.auth-section p.muted, .connect-gate p { font-size: 0.88rem; }

main { max-width: 900px; margin: 0 auto; }

section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

h2 {
  margin: 0 0 1rem;
  font-size: 1.2rem;
  font-weight: 600;
}
h2 .subhead {
  display: block;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.15rem;
}

/* ============================================================
   Forms
   ============================================================ */
form { display: flex; flex-direction: column; gap: 1rem; }
label { display: flex; flex-direction: column; gap: 0.4rem; font-size: 0.9rem; color: var(--text-secondary); }
input, textarea, select {
  font-family: inherit; font-size: 0.95rem; padding: 0.55rem 0.65rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text-body);
}
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible,
[role="button"]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

button {
  font-family: var(--font-body);
  background: var(--accent);
  color: var(--text-on-accent);
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  width: fit-content;
  transition: background var(--dur-fast), transform 0.12s ease-out, box-shadow var(--dur-fast);
}
button:hover:not(:disabled) { filter: brightness(1.08); box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent); }
button:active:not(:disabled) { transform: translateY(1px) !important; }
button:disabled { opacity: 0.55; cursor: not-allowed; }

button.secondary {
  background: transparent; color: var(--text-heading);
  border: 1px solid var(--border-strong);
}
button.secondary:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 12%, transparent); box-shadow: none; }

button.danger { background: var(--danger); color: #fff; }
button.danger:hover:not(:disabled) { background: var(--danger-deep); box-shadow: 0 4px 14px color-mix(in srgb, var(--danger) 35%, transparent); }

/* ============================================================
   Draft cards — "voyage manifest" tickets
   ============================================================ */
.draft-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 1rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, opacity 0.4s ease;
}
.draft-card::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%);
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}
.draft-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}
.draft-card:hover::before { opacity: 1; }

.draft-card.entering { opacity: 0; transform: translateY(6px); }

.draft-card .fields { display: flex; flex-direction: column; gap: 0.5rem; }
.draft-card input, .draft-card textarea, .draft-card select { width: 100%; }

/* --- Manifest sections: the edit fields grouped like a real cargo manifest
   (what it is / what it's worth / how it ships / how it's classified),
   separated by the same dashed rule the dropzone already uses. --- */
.manifest-section {
  display: flex; flex-direction: column; gap: 0.6rem;
  padding-top: 0.9rem; border-top: 1px dashed var(--border);
}
.manifest-section:first-child { padding-top: 0; border-top: none; }
.manifest-section-label {
  margin: 0; font-family: var(--font-body); font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent);
}
.field-title { font-family: var(--font-display); font-size: 1.05rem; font-weight: 600; color: var(--text-heading); }
.field-sublabel { margin: 0; font-size: 0.78rem; color: var(--text-secondary); }

.field-row { display: flex; gap: 0.5rem; }
.field-row > label { flex: 1; min-width: 0; }
.field-row > .field-qty { flex: 0 0 4.5rem; }

.manifest-filters { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.manifest-filters #manifest-search { flex: 1; min-width: 0; }
.manifest-filters select { flex: 0 0 auto; width: auto; }
.checkbox-field { flex-direction: row; align-items: center; gap: 0.4rem; }
.checkbox-field input[type="checkbox"] { width: auto; }

.card-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

/* --- Photo gallery & dropzones --- */
.photo-gallery { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.placeholder {
  width: 90px; height: 90px; background: var(--surface); border: 1px dashed var(--border);
  border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); font-size: 0.75rem; text-align: center;
}

.thumb { position: relative; width: 90px; height: 90px; flex: 0 0 auto; }
.thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius-sm); display: block; }
.thumb button {
  position: absolute; top: -6px; right: -6px;
  width: 22px; height: 22px; padding: 0; min-width: 0;
  border-radius: 50%; background: var(--bg); color: var(--text-heading); border: 1px solid var(--border);
  font-size: 0.85rem; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.thumb button::after {
  /* Expands the tap target to ~44px without changing the visible 22px circle. */
  content: "";
  position: absolute;
  inset: -11px;
}

/* --- Published listing embed: collapses a delivered part down to a thumbnail, title,
   price and a link out to the live eBay listing instead of the full editable draft form. --- */
.embed-body {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  text-decoration: none;
  color: inherit;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  transition: background var(--dur-fast);
}
.embed-body:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.embed-thumb {
  width: 72px; height: 72px; flex: 0 0 auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  overflow: hidden; display: flex; align-items: center; justify-content: center;
}
.embed-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.embed-info { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.embed-title {
  margin: 0; font-family: var(--font-display); font-size: 1rem; font-weight: 600;
  color: var(--text-heading); overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.embed-price { margin: 0; font-size: 0.85rem; color: var(--text-secondary); }
.embed-cta { font-size: 0.78rem; font-weight: 600; color: var(--accent); }

.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color var(--dur-fast), background var(--dur-fast);
}
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.dropzone p { margin: 0; font-size: 0.85rem; }

.dropzone-small {
  width: 90px; height: 90px; flex: 0 0 auto;
  padding: 0; display: flex; align-items: center; justify-content: center;
}
.dropzone-small p { font-size: 0.7rem; }

.photo-preview { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* --- Status badges: voyage stage labels --- */
.badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.02em;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--text-secondary);
  width: fit-content;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.stage-inport { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--text-secondary); }
.badge.stage-ready { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent); }
.badge.stage-delayed { background: color-mix(in srgb, var(--danger) 20%, transparent); color: var(--danger-text); }
.badge.stage-delivered { background: color-mix(in srgb, var(--accent) 28%, transparent); color: var(--text-heading); }

.actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; align-items: center; flex-wrap: wrap; }
#upload-status { margin-top: 0.75rem; font-size: 0.9rem; color: var(--text-secondary); }
.error { color: var(--danger-text); }
.muted { color: var(--text-secondary); }

/* --- Specifics ledger: key/value rows, entered on the manifest like cargo line items --- */
.specifics-ledger { display: flex; flex-direction: column; gap: 0.4rem; }
.specifics-row { display: flex; gap: 0.5rem; align-items: center; }
.specifics-row .specifics-key { flex: 0 0 38%; }
.specifics-row .specifics-value { flex: 1; }
.specifics-row-remove {
  position: relative;
  background: transparent; color: var(--text-secondary);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  width: 34px; height: 34px; min-width: 34px; padding: 0;
  display: flex; align-items: center; justify-content: center; font-size: 0.95rem;
}
.specifics-row-remove::after {
  /* Expands the tap target to ~44px without changing the visible 34px button. */
  content: "";
  position: absolute;
  inset: -5px;
}
.specifics-row-remove:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger-text); border-color: var(--danger); }
.specifics-add {
  align-self: flex-start;
  background: transparent; color: var(--accent);
  border: 1px dashed var(--border-strong); font-size: 0.82rem; font-weight: 600;
  padding: 0.4rem 0.7rem;
}
.specifics-add:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 8%, transparent); box-shadow: none; border-color: var(--accent); }
.specifics-empty { font-size: 0.82rem; color: var(--text-secondary); font-style: italic; }

/* --- eBay category lookup/search --- */
.category-field { display: flex; flex-direction: column; gap: 0.4rem; }
.category-current { font-size: 0.85rem; }
.category-current.category-missing { color: var(--danger-text); }
.category-search { display: flex; gap: 0.5rem; }
.category-search-input { flex: 1; }
.category-results { display: flex; flex-direction: column; gap: 0.25rem; }
.category-result {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.1rem;
  background: transparent; color: var(--text-body); border: 1px solid var(--border);
  padding: 0.4rem 0.6rem; border-radius: var(--radius-sm); width: 100%; text-align: left;
  transition: border-color var(--dur-fast), background var(--dur-fast);
}
.category-result:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.category-result .muted { font-size: 0.75rem; }

/* ============================================================
   Harbor board — manifest tally, one line per voyage stage
   ============================================================ */
.harbor-board {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: -0.25rem 0 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.harbor-board-item {
  flex: 1 1 130px;
  padding: 0.7rem 0.9rem;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 0.15rem;
}
.harbor-board-item:last-child { border-right: none; }
.harbor-board-count {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1;
  color: var(--text-heading);
}
.harbor-board-item.has-stage .harbor-board-count { color: var(--accent); }
.harbor-board-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

/* ============================================================
   Delete draft — trash icon + confirmation popover
   ============================================================ */
.delete-trigger {
  background: transparent; color: var(--text-secondary);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  width: 44px; height: 44px; min-width: 44px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
}
.delete-trigger:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger-text); border-color: var(--danger); }

.delete-popover {
  position: absolute; top: 3.2rem; right: 1rem; z-index: 5;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 0.9rem; width: min(280px, calc(100% - 2rem));
  display: none; flex-direction: column; gap: 0.6rem;
}
.delete-popover.open { display: flex; }
.delete-popover p { margin: 0; font-size: 0.85rem; color: var(--text-body); }
.delete-popover .popover-actions { display: flex; gap: 0.5rem; justify-content: flex-end; }

.draft-card.removing { animation: card-collapse var(--dur-base) ease forwards; }
@keyframes card-collapse {
  to { opacity: 0; transform: scale(0.97); max-height: 0; margin: 0; padding: 0; border-width: 0; }
}

/* ============================================================
   Voyage map — shared by generation + shipping loading states
   ============================================================ */
.voyage-map { display: block; width: 100%; height: auto; }
.voyage-map .voyage-water { fill: var(--bg); }
.voyage-map .voyage-chart-line { stroke: var(--border-strong); opacity: 0.5; }

.voyage-map .voyage-route {
  fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round;
}
.voyage-map .voyage-route.drawing { transition: stroke-dashoffset 0.9s cubic-bezier(0.4, 0, 0.2, 1); }
.voyage-map .voyage-route.charted {
  stroke-dasharray: 6 8;
  animation: voyage-dash 1.6s linear infinite;
}
.voyage-map .voyage-waypoint { fill: var(--border-strong); }
.voyage-map .voyage-port circle { fill: var(--accent); }
.voyage-map .voyage-port text, .voyage-map .voyage-dest text {
  font-family: var(--font-body); font-size: 11px; font-weight: 600; fill: var(--text-heading);
}
.voyage-map .voyage-dest circle {
  fill: var(--accent);
  animation: pulse-dot 1.8s ease-in-out infinite;
}
.voyage-map .voyage-ship { fill: var(--accent); stroke: var(--bg); stroke-width: 0.6; }
.voyage-map .voyage-ship-sail { fill: var(--text-heading); }
.voyage-map .voyage-ship-wake { fill: none; stroke: var(--accent); stroke-width: 1.2; opacity: 0.35; }

@keyframes voyage-dash {
  to { stroke-dashoffset: -28; }
}

@supports (offset-path: path("M0 0")) {
  .voyage-map .voyage-ship-group {
    offset-rotate: 0deg;
    animation: voyage-sail 3.2s ease-in-out infinite alternate;
  }
  .voyage-map .voyage-ship-ghost-1 { offset-rotate: 0deg; animation: voyage-sail 3.2s ease-in-out infinite alternate; animation-delay: -0.22s; opacity: 0.28; }
  .voyage-map .voyage-ship-ghost-2 { offset-rotate: 0deg; animation: voyage-sail 3.2s ease-in-out infinite alternate; animation-delay: -0.4s; opacity: 0.14; }
  @keyframes voyage-sail {
    from { offset-distance: 8%; }
    to { offset-distance: 92%; }
  }
}
@supports not (offset-path: path("M0 0")) {
  .voyage-map .voyage-ship-group { animation: voyage-bob 1.8s ease-in-out infinite; }
  .voyage-map .voyage-ship-ghost-1, .voyage-map .voyage-ship-ghost-2 { display: none; }
  @keyframes voyage-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
  }
}

.voyage-stage-list { list-style: none; margin: 0.9rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.voyage-stage-list li {
  font-size: 0.85rem; color: var(--text-secondary);
  display: flex; align-items: center; gap: 0.5rem;
  transition: color 0.35s ease, transform 0.35s ease;
}
.voyage-stage-list li::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--border); flex: 0 0 auto;
  transition: background 0.35s ease;
}
.voyage-stage-list li.active { color: var(--text-heading); font-weight: 600; transform: translateX(2px); }
.voyage-stage-list li.active::before { background: var(--accent); animation: pulse-dot 1.4s ease-in-out infinite; }
.voyage-stage-list li.done { color: var(--accent); }
.voyage-stage-list li.done::before { background: var(--accent); }

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 50%, transparent); }
  50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 0%, transparent); }
}

/* ============================================================
   Generation overlay (in-panel, over #upload-section content)
   ============================================================ */
.upload-panel { position: relative; }
.voyage-overlay {
  position: absolute; inset: 0; z-index: 4;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex; flex-direction: column;
  animation: fade-in var(--dur-base) ease;
}
.voyage-overlay h3 { margin: 0 0 0.75rem; font-size: 1.05rem; }
.voyage-overlay .voyage-overlay-actions { margin-top: auto; display: flex; gap: 0.5rem; padding-top: 0.75rem; }
.voyage-overlay.state-error { color: var(--text-body); }
.voyage-overlay .voyage-error-msg {
  background: color-mix(in srgb, var(--danger) 14%, transparent); border: 1px solid var(--danger);
  color: var(--danger-text); border-radius: var(--radius-sm); padding: 0.6rem 0.75rem; font-size: 0.88rem;
}

@keyframes fade-in {
  from { opacity: 0; } to { opacity: 1; }
}

/* ============================================================
   Shipping modal (eBay publish)
   ============================================================ */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 20;
  background: rgba(0, 0, 0, 0.5);
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
  animation: fade-in var(--dur-base) ease;
}
.modal-panel {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  width: min(480px, 100%);
  max-height: 90vh; overflow-y: auto;
  padding: 1.5rem;
}
.modal-panel h3 { margin: 0 0 0.5rem; }
.modal-panel .modal-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1.25rem; }
.modal-panel .modal-success-icon, .modal-panel .modal-error-icon {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 0.75rem; color: #fff; font-size: 1.3rem; font-weight: 700;
}
.modal-panel .modal-success-icon { background: var(--accent); color: var(--text-on-accent); }
.modal-panel .modal-error-icon { background: var(--danger-deep); }

/* ============================================================
   Appearance — Sunrise/Sunset/System picker (Settings modal)
   ============================================================ */
.theme-picker { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.theme-option {
  flex-direction: row; align-items: center; gap: 0.4rem;
  font-size: 0.85rem; color: var(--text-body);
  border: 1px solid var(--border-strong); border-radius: 999px;
  padding: 0.35rem 0.8rem 0.35rem 0.6rem; cursor: pointer;
  transition: border-color var(--dur-fast), background var(--dur-fast);
}
.theme-option:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--text-heading); }
.theme-option input[type="radio"] { width: auto; margin: 0; }

/* --- What's New: "News" list page, patch-notes style --- */
.updates-list-page { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.5rem; }
.update-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.update-card:hover { border-color: var(--border-strong); box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 18%, transparent); }
.update-card-link { display: block; padding: 1rem 1.1rem; color: inherit; text-decoration: none; }
.update-card-date {
  display: block;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 0.35rem;
}
.update-card h3 { margin: 0 0 0.35rem; font-size: 1.05rem; }
.update-card p { margin: 0; color: var(--text-body); }
.update-card .danger.small { position: absolute; top: 1rem; right: 1.1rem; }

/* --- What's New: single-entry detail page --- */
.update-back-link { display: inline-block; margin-bottom: 1rem; color: var(--text-heading); font-size: 0.88rem; }
#update-detail h2 { margin: 0.4rem 0 0.75rem; }
.update-detail-body { color: var(--text-body); white-space: pre-wrap; line-height: 1.6; }

.danger.small { padding: 0.2rem 0.5rem; font-size: 0.75rem; }
button.small { padding: 0.2rem 0.5rem; font-size: 0.75rem; }

.onboarding-checklist #onboarding-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.onboarding-checklist li {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.6rem 0.75rem; border: 1px solid var(--border); border-radius: 8px;
}
.onboarding-checklist li.done { opacity: 0.55; }
.onboarding-checklist li > span:nth-child(2) { flex: 1; }
.onboarding-checklist li.done > span:nth-child(2) { text-decoration: line-through; }
.onboarding-check {
  flex: 0 0 1.4rem; height: 1.4rem; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 50%; font-size: 0.85rem; color: var(--accent);
}
.onboarding-checklist li.done .onboarding-check { background: var(--accent); color: var(--text-on-accent); border-color: var(--accent); }

/* ============================================================
   Footer — links row, plus a standing feedback box on every page
   (near the legal links rather than behind an extra button/click)
   ============================================================ */
.site-footer {
  max-width: 900px;
  margin: 1.5rem auto 0;
  padding: 1.25rem 0 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}
.site-footer-links { display: flex; align-items: center; justify-content: center; gap: 1.25rem; }
.site-footer a {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.site-footer a:hover { color: var(--text-heading); }

.feedback-widget { width: 100%; max-width: 420px; }
.feedback-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  text-align: left;
}
.feedback-box h4 {
  margin: 0 0 0.35rem;
  font-family: var(--font-body);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-heading);
}
.feedback-box p.muted { margin: 0 0 0.6rem; font-size: 0.8rem; }
.feedback-box form { gap: 0.6rem; }
.feedback-box textarea { width: 100%; }
.feedback-box-actions { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.feedback-box-actions button { flex-shrink: 0; }
.feedback-box .feedback-sent { color: var(--accent); font-size: 0.8rem; }

/* ============================================================
   Legal pages (Terms / Privacy) — plain long-form text inside the
   existing card/section look, so they read like part of the app
   rather than a bolted-on generic page.
   ============================================================ */
.legal-page section { max-width: 720px; margin-left: auto; margin-right: auto; }
.legal-page h2 { font-size: 1.4rem; }
.legal-page h3 {
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text-heading);
  margin: 1.4rem 0 0.5rem;
}
.legal-page p, .legal-page li { line-height: 1.6; }
.legal-page p { margin: 0 0 0.9rem; }
.legal-page ul, .legal-page ol { margin: 0 0 0.9rem; padding-left: 1.4rem; }
.legal-page li { margin-bottom: 0.4rem; }
.legal-page .effective-date { color: var(--text-secondary); font-size: 0.85rem; margin: -0.5rem 0 1.5rem; }
.legal-page strong { color: var(--text-heading); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 640px) {
  body { padding: 0 1rem 3rem; }
  .site-header { margin: 0 -1rem 1.5rem; }
  .wordmark h1 { font-size: 1.25rem; }
  section { padding: 1.1rem; }
  .delete-popover { right: 0; left: 0; margin: 0 auto; }
  .voyage-stage-list { flex-direction: row; flex-wrap: wrap; gap: 0.6rem 1rem; }
  .draft-card:hover { transform: none; }
  .harbor-board-item { flex: 1 1 45%; border-bottom: 1px solid var(--border); }
  .specifics-row { flex-wrap: wrap; }
  .specifics-row .specifics-key, .specifics-row .specifics-value { flex: 1 1 100%; }
  .field-row { flex-wrap: wrap; }
  .field-row > label, .field-row > .field-qty { flex: 1 1 100%; }
  .manifest-filters { flex-wrap: wrap; }
  .manifest-filters #manifest-search { flex: 1 1 100%; }
  .manifest-filters select { flex: 1 1 auto; }
}

/* ============================================================
   Reduced motion — disable/simplify all motion, keep information
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .voyage-map .voyage-route,
  .voyage-map .voyage-route.drawing,
  .voyage-map .voyage-ship-group,
  .voyage-map .voyage-ship-ghost-1,
  .voyage-map .voyage-ship-ghost-2,
  .voyage-map .voyage-dest circle,
  .voyage-stage-list li.active::before,
  .draft-card.removing,
  .draft-card,
  .draft-card::before,
  .voyage-overlay,
  .modal-backdrop,
  .water-bg svg,
  .reveal-on-load {
    animation: none !important;
    transition: none !important;
  }
  .draft-card.removing { display: none; }
  .draft-card:hover { transform: none; }
  .draft-card.entering { opacity: 1; transform: none; }
  .reveal-on-load { opacity: 1; transform: none; }
  .water-bg { display: none; }
  * { transition-duration: 0.01ms !important; }
}
