/* Shanti's passages: base and Passages styles from the DB project's app/static/style.css, plus the public header. */
:root {
  --bg: #f5f5f0;
  --panel: #ffffff;
  --border: #d8d8d0;
  --text: #1c1c1a;
  --muted: #6b6b64;
  --accent: #0f6e5c;
  --accent-hover: #0b5548;
  --danger: #a4373a;
  --warn: #a87c00;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --panel: #1d2025;
    --border: #33373f;
    --text: #e8e8e4;
    --muted: #9a9a92;
    --accent: #3fb996;
    --accent-hover: #63cbad;
    --danger: #e08084;
    --warn: #e0b84a;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
nav button, .btn {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.4rem 0.7rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
}
nav button.active, .btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn.primary:hover { background: var(--accent-hover); }
main { padding: 1rem; max-width: 1000px; margin: 0 auto; }
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}
table { border-collapse: collapse; width: 100%; font-size: 0.85rem; }
th, td {
  border-bottom: 1px solid var(--border);
  padding: 0.4rem 0.5rem;
  text-align: left;
  white-space: nowrap;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}
th { color: var(--muted); font-weight: 600; }
/* .browse-table lives inside .table-scroll, which is a real bounded-height
   scroll box (not just overflow-x) so it -- not the page -- is the sticky
   positioning container. That keeps the header pinned to the table's own
   top edge regardless of nav-bar height, instead of a hardcoded px offset
   measured against the page, which used to land the header mid-table. */
.browse-table th { position: sticky; top: 0; background: var(--panel); z-index: 1; }
tbody tr:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); cursor: pointer; }
.table-scroll { overflow: auto; max-height: 65vh; }
label { display: block; margin: 0.6rem 0 0.2rem; font-size: 0.85rem; color: var(--muted); }
input, select, textarea {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
}
textarea { min-height: 4rem; }
.row-actions { margin-top: 1rem; display: flex; gap: 0.5rem; }
.muted { color: var(--muted); font-size: 0.85rem; }
.stat-bar { display: flex; flex-wrap: wrap; gap: 1.5rem; }
.stat-bar .stat { min-width: 140px; }
.stat .stat-label { font-size: 0.78rem; color: var(--muted); }
.stat .stat-value { font-size: 1.3rem; font-weight: 600; }
.warn-banner {
  border: 1px solid var(--danger); border-radius: 6px;
  padding: 0.6rem 0.75rem; margin-bottom: 1rem;
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  font-size: 0.86rem; display: flex; flex-direction: column;
  gap: 0.5rem; align-items: flex-start;
}
.dash-title { margin: 0 0 0.75rem; font-size: 1.2rem; }
/* Passages page (docs/passage-map-design.md) */
.passage-filters { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0.75rem 0; }
.passage-filters select { width: auto; }
.passage-check { display: flex; align-items: center; gap: 0.25rem; font-size: 0.9rem; }
.passage-check input { width: auto; }
.passage-totals { align-items: flex-end; }
.passage-note { flex-basis: 100%; }
.passage-breakdown { margin-top: 0.75rem; }
.passage-breakdown summary { cursor: pointer; color: var(--accent); font-size: 0.9rem; }
.passage-breakdown-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 1rem; margin-top: 0.6rem; }
.passage-mini th, .passage-mini td { padding: 0.15rem 0.5rem; font-size: 0.85rem; }
.passage-body { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 1rem; align-items: start; }
.passage-list, .passage-detail { margin: 0; }
.passage-detail { position: sticky; top: 0.5rem; }
.passage-table th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.passage-table td.num { text-align: right; white-space: nowrap; }
.passage-table tr { cursor: pointer; }
.passage-table tr.selected td { background: color-mix(in srgb, var(--accent) 15%, transparent); }
.passage-table tr.not-counted td { color: var(--muted); font-style: italic; }
.passage-detail-title { margin: 0 0 0.6rem; font-size: 1rem; }
.passage-dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 0.8rem; margin: 0 0 0.8rem; font-size: 0.9rem; }
.passage-dl dt { color: var(--muted); }
.passage-dl dd { margin: 0; }
.passage-wind { border-top: 1px solid var(--border, #ddd); padding-top: 0.6rem; margin-bottom: 0.8rem; }
.passage-wind h4 { margin: 0 0 0.5rem; font-size: 0.95rem; }
.passage-wind .muted { font-size: 0.85rem; }
@media (max-width: 800px) {
  .passage-body { grid-template-columns: minmax(0, 1fr); }
  .passage-detail { position: static; order: -1; }
}
/* The Passages page needs room for the leg list beside the detail panel (and the map, stage 4). */
main:has(> .passages) { max-width: 1400px; }
.passage-table th, .passage-table td { padding: 0.35rem 0.4rem; max-width: 190px; text-overflow: ellipsis; }
.passage-map { height: 58vh; min-height: 320px; border-radius: 6px; }
.passage-map.leaflet-container { background: #d6e6ef; }  /* sea colour under the offline coastline */
.passage-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; margin-top: 0.6rem; font-size: 0.8rem; color: var(--muted); }
.passage-legend > span { display: inline-flex; align-items: center; gap: 0.35rem; }
.passage-legend i { display: inline-block; width: 22px; height: 4px; border-radius: 2px; }
.passage-legend i.dashed { background: repeating-linear-gradient(90deg, var(--text) 0 6px, transparent 6px 10px); }
.passage-legend i.dot { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid #222; background: #fff; }
.passage-popup { font-size: 0.85rem; line-height: 1.4; }
@media (max-width: 800px) { .passage-map { height: 45vh; } }
.passage-map-note { margin-top: 0.4rem; }
.passage-map-note:empty { display: none; }
.passage-legend .passage-legend-sep { padding-left: 1rem; border-left: 1px solid var(--border); }

/* Public header and footer */
.site-header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4rem 1.2rem; }
.site-header h1 { font-size: 1.3rem; margin: 0; }
.site-header .home-port { color: var(--muted); font-size: 0.9rem; }
.site-header .where-now { margin-left: auto; font-size: 0.95rem; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
.site-footer { margin: 0.5rem 0 2rem; text-align: center; }
.passage-map.leaflet-container { background: #c8dbe6; }
