/* settings — see public/css/app.css for tokens. Use tokens only; every rule must work in both themes.

   Also the blocks Settings shares with the first run (components/invite.js,
   privacy.js, datasource.js, phone.js): every stylesheet loads on every
   screen, so their finishing touches live here, beside the page that owns
   them. Targets 44px (48px for primary actions), nothing under 11px, no
   sentence under 13px, fills never used as text. */

/* ------------------------------------------------------------------ pages */
.settings { padding-bottom: var(--sp-6); }
.settings-stack { gap: var(--sp-3); }
.settings-stack > .card,
.settings-stack > .banner { margin-bottom: 0; }
.settings-stack > .overline { margin: var(--sp-3) 2px 0; }
.settings-stack > .disclosure { margin-top: var(--sp-1); }

/* One or two sentences, straight under the h1: what this page is for. */
.settings-intro {
  margin: calc(var(--sp-2) * -1) 2px 0; max-width: 36em;
  font-size: var(--fs-body); line-height: 1.5; color: var(--ink-2);
}
.settings-note { font-size: var(--fs-note); line-height: 1.5; color: var(--ink-3); }
.settings-card-note { margin: 0 2px; }
.settings-list {
  margin: 0; padding-left: 20px;
  font-size: var(--fs-body); line-height: 1.55; color: var(--ink-2);
}
.settings-list li + li { margin-top: 6px; }
.settings-list li::marker { color: var(--ink-3); }

/* ----------------------------------------------------------------- index */
.settings-group { margin-bottom: 0; }
.settings-index > .card { margin-bottom: var(--sp-3); }
.settings-index > .section-title { margin-top: var(--sp-6); }

/* The Guide gets the accent wash: it is the one row a newcomer should find. */
.card.settings-guide {
  background: var(--seaglass-wash);
  border-color: color-mix(in srgb, var(--seaglass) 30%, transparent);
  box-shadow: none;
}
.settings-guide .item-lead { background: var(--surface); }
.settings-guide .item-sub { color: var(--ink-2); }

.settings-appearance .field,
.settings-appearance .field:last-child { margin-bottom: 0; }
.settings-seg button { font-size: var(--fs-body); }

/* A summary line with the shared tag under it, inside a row's subtitle. */
.settings-sub-stack { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }

/* Delete sits alone and says what it is in its own colour — never as a fill. */
.settings-danger .item-title { color: var(--bad-text); }
.settings-danger .item-lead {
  background: color-mix(in srgb, var(--bad) 12%, var(--surface));
  color: var(--bad-text);
}
.settings-index > .settings-danger { margin-top: var(--sp-5); }

.settings-version .item { flex-wrap: wrap; }
.settings-version .btn { flex: none; }

.settings-foot {
  margin: var(--sp-6) var(--sp-2) 0; text-align: center;
  font-size: var(--fs-note); line-height: 1.6; color: var(--ink-3);
}

/* item() makes buttons; a row that leaves the app is a real link instead. */
a.item { text-decoration: none; color: var(--ink); cursor: pointer; }
a.item:active { background: var(--surface-2); }
a.item:focus-visible { outline: 2px solid var(--accent-text); outline-offset: -2px; border-radius: var(--r); }

/* ---------------------------------------------------------------- profile */
.emoji-chips { gap: 6px; }
.chip.emoji-chip {
  min-width: var(--tap-min); justify-content: center; padding: 6px;
  font-size: 1.25rem; line-height: 1;
}
.tz-suggest { margin-top: var(--sp-1); padding-left: 0; color: var(--accent-text); }
.tz-suggest[hidden] { display: none; }

/* ------------------------------------------------------------------ WHOOP */
.whoop-head { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-2); flex-wrap: wrap; }
.whoop-icon {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--seaglass) 14%, var(--surface));
  color: var(--accent-text);
}
.whoop-title { flex: 1 1 auto; font-size: var(--fs-h3); font-weight: 650; line-height: 1.3; }
.whoop-line { font-size: var(--fs-body); line-height: 1.5; color: var(--ink-2); margin-bottom: var(--sp-3); }
.whoop-card .banner { margin-bottom: var(--sp-3); }
.whoop-card .banner p { margin-top: 2px; }

.whoop-facts {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2);
  margin: 0 0 var(--sp-3);
}
.whoop-facts > div {
  padding: var(--sp-2) 10px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--line-soft);
}
.whoop-facts dt { font-size: var(--fs-caption); color: var(--ink-3); line-height: 1.3; }
.whoop-facts dd { margin: 2px 0 0; font-size: var(--fs-note); font-weight: 600; color: var(--ink); line-height: 1.35; font-variant-numeric: tabular-nums; }
.whoop-card > .settings-note { margin: calc(var(--sp-1) * -1) 0 var(--sp-3); }

.whoop-actions .btn { flex: 1 1 auto; }
.whoop-actions .btn.primary { min-height: var(--tap); }
.whoop-switch { margin-top: var(--sp-2); }
.whoop-disconnect { display: flex; margin: var(--sp-2) auto 0; }
.btn.quiet.danger-quiet { color: var(--bad-text); }

.settings-disclose { padding: 0 2px; }
.settings-disclose .disclosure-body > .card { margin-bottom: 0; }

@media (max-width: 360px) {
  .whoop-facts { grid-template-columns: 1fr; }
  .whoop-facts > div { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-2); }
  .whoop-facts dd { margin: 0; }
}

/* ------------------------------------------------------------- automation */
.settings-days { gap: var(--sp-2); }
.settings-days input { flex: 0 1 120px; }
.settings-unit { font-size: var(--fs-body); color: var(--ink-2); }

/* -------------------------------------------------------------- reminders */
.settings-phone .phone-status:last-child,
.settings-phone .btn-row:last-child { margin-bottom: 0; }
.settings-dependents { display: flex; flex-direction: column; gap: var(--sp-3); }
.settings-dependents > .card { margin-bottom: 0; }
.settings-dependents > .overline { margin: var(--sp-3) 2px 0; }
/* Off: still readable, visibly not in force. */
.settings-dependents.is-off { opacity: .55; }

.settings-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.settings-fieldset > legend {
  padding: 0; margin-bottom: 5px;
  font-size: var(--fs-note); font-weight: 640; color: var(--ink-2); letter-spacing: .01em;
}
.settings-fieldset > .hint { font-size: var(--fs-note); line-height: 1.5; color: var(--ink-3); margin-top: 5px; }
.settings-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); }
.settings-pair > .field { margin-bottom: 0; }

.settings-pause-state { font-size: var(--fs-body); color: var(--ink); margin-bottom: var(--sp-2); }
.settings-pause + .hint { display: block; margin-top: var(--sp-2); font-size: var(--fs-note); color: var(--ink-3); line-height: 1.5; }

/* ------------------------------------------------------------- crew & rules */
.settings-shared-line { display: flex; margin: 0 2px; }
.crew-facts .item { min-height: 52px; }
.crew-facts .item-sub { color: var(--ink-2); font-size: var(--fs-body); }
.settings-edit-crew { min-height: var(--tap); }
.settings-aboard { margin: 0 2px; font-size: var(--fs-body); color: var(--ink-2); line-height: 1.5; }
div.settings-aboard { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); }

.settings-triple { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2); }
.settings-triple > .field { margin-bottom: 0; }
.xp-budget { margin-top: var(--sp-1); }
.xp-total {
  display: block; margin-top: var(--sp-2);
  font-family: var(--font-display); font-size: var(--fs-md); font-weight: 650;
  color: var(--xp-text); font-variant-numeric: tabular-nums;
}
.sheet-body > .settings-shared-line { margin-bottom: var(--sp-3); }
.settings-sheet-foot { display: flex; flex-direction: column; gap: var(--sp-2); }
.settings-consequence { font-size: var(--fs-note); line-height: 1.45; color: var(--ink-2); text-align: center; }
.settings-sheet-foot .btn.primary { min-height: var(--tap); }

/* ---------------------------------------------------------- export, delete */
.settings-sheet-lead { font-size: var(--fs-body); line-height: 1.55; color: var(--ink-2); margin-bottom: var(--sp-3); }
.export-status { font-size: var(--fs-body); color: var(--ink); margin-bottom: var(--sp-2); }
.export-summary { margin-bottom: var(--sp-2); }
.delete-list { margin-bottom: var(--sp-4); }
.delete-export { margin-bottom: var(--sp-4); }
.delete-email { font-weight: 650; color: var(--ink); overflow-wrap: anywhere; }

/* ========================================================= shared blocks */

/* privacy.js */
.privacy-block { display: flex; flex-direction: column; }
.privacy-block > .card { margin-bottom: 0; }
.privacy-block > .overline { margin-top: var(--sp-5); }
.privacy-intro { margin: 0 2px var(--sp-2); font-size: var(--fs-body); line-height: 1.5; color: var(--ink-2); }
.privacy-intro-2 { margin-bottom: var(--sp-4); }
.privacy-preview-text { font-size: var(--fs-md); line-height: 1.5; color: var(--ink); }
.privacy-preview-more { margin-top: var(--sp-2); font-size: var(--fs-note); line-height: 1.5; color: var(--ink-2); }
.privacy-unused { margin-top: var(--sp-4); }
.privacy-unused > summary { color: var(--ink-2); }
.privacy-unused-note { margin: 0 2px; font-size: var(--fs-note); line-height: 1.5; color: var(--ink-3); }
.privacy-unused .overline { margin-top: var(--sp-4); }
.privacy-unused .card { margin-bottom: 0; }

/* invite.js */
.invite-state { display: flex; align-items: flex-start; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.invite-state-icon {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--seaglass) 14%, var(--surface));
  color: var(--accent-text);
}
.invite-state b { display: block; font-size: var(--fs-md); line-height: 1.35; color: var(--ink); }
.invite-state p { margin-top: 2px; font-size: var(--fs-note); line-height: 1.5; color: var(--ink-2); }
.invite-lead { font-size: var(--fs-body); color: var(--ink-2); }
.invite-note { font-size: var(--fs-note); color: var(--ink-3); }
.invite-url { font-size: 16px; text-overflow: ellipsis; }
.invite-done .btn.quiet { color: var(--accent-text); }

/* datasource.js */
.datasource-intro { font-size: var(--fs-body); color: var(--ink-2); }
.datasource-note { font-size: var(--fs-note); color: var(--ink-3); }
.datasource-choices { margin-bottom: 0; }
.datasource-choices .item { min-height: 72px; align-items: flex-start; padding-top: 14px; padding-bottom: 14px; }
.datasource-choices .item-chev { align-self: center; }
/* Not switched on for this server: readable, plainly not a button. */
.datasource-choices > div.item .item-title { color: var(--ink-2); }
.datasource-unconfigured p { margin-top: 2px; }
.datasource-unconfigured .glyph { color: var(--accent-text); }
.datasource-actions { margin-bottom: var(--sp-2); }
.datasource-actions .btn { flex: 1 1 auto; }
.datasource-actions .btn.primary { min-height: var(--tap); }
.datasource-manual { padding-left: 0; color: var(--accent-text); }

/* phone.js */
.phone-actions { align-items: center; }

/* ---------------------------------------------------- voyage dates (crew) */
/* Departure and Home as one short passage: a wavy line of sea, the wake the
   ship has left in sea-glass, and the ship itself where the crew is. The wave
   is a mask over a token colour, so it follows the theme; nothing animates,
   and the caption under it says the same thing in words. */
.voyage-dates { margin: 0; --wave: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 8'%3E%3Cpath d='M0 4 Q4 0.6 8 4 T16 4' fill='none' stroke='%23000' stroke-width='1.7'/%3E%3C/svg%3E"); }
.vd-ends { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--sp-3); }
.vd-end { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.vd-home { align-items: flex-end; text-align: right; }
.vd-key {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--fs-overline); font-weight: 650; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-3);
}
.vd-glyph { display: inline-flex; color: var(--ink-3); }
.vd-end.is-reached .vd-glyph { color: var(--accent-text); }
.vd-date {
  font-family: var(--font-display); font-size: var(--fs-md); font-weight: 650; line-height: 1.3;
  color: var(--ink); overflow-wrap: anywhere;
}
.voyage-dates[data-home="unset"] .vd-home .vd-date { color: var(--ink-3); font-weight: 560; }

.vd-passage { position: relative; height: 40px; margin: var(--sp-2) 0 var(--sp-1); }
.vd-sea, .vd-wake {
  position: absolute; top: calc(50% - 4px); height: 8px; left: 6px;
  -webkit-mask: var(--wave) 0 50% / 16px 8px repeat-x;
  mask: var(--wave) 0 50% / 16px 8px repeat-x;
}
.vd-sea { right: 6px; background: var(--line-strong); opacity: .55; }
.vd-wake { width: calc(var(--at, 0) * (100% - 12px)); background: var(--seaglass); }
.vd-pin {
  position: absolute; top: calc(50% - 6px); width: 12px; height: 12px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--line-strong);
}
.vd-pin-start { left: 0; }
.vd-pin-end { right: 0; }
.voyage-dates:is([data-phase="departure-day"], [data-phase="at-sea"], [data-phase="bon-voyage"], [data-phase="home-port"]) .vd-pin-start,
.voyage-dates[data-phase="home-port"] .vd-pin-end { background: var(--seaglass); border-color: var(--seaglass); }
/* No Home date: the sea fades out instead of stopping — an open end, not a
   provisional one, so it is never dashed. */
.voyage-dates[data-home="unset"] .vd-pin-end { display: none; }
.voyage-dates[data-home="unset"] .vd-passage::after {
  content: ''; position: absolute; top: 0; bottom: 0; right: 0; width: 45%;
  background: linear-gradient(90deg, transparent, var(--surface));
  pointer-events: none;
}
.vd-ship {
  position: absolute; top: 50%; z-index: 1;
  left: calc(6px + var(--at, 0) * (100% - 12px));
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  transform: translate(-50%, -50%);
  background: var(--surface); color: var(--accent-text);
  border: 1.5px solid color-mix(in srgb, var(--seaglass) 70%, var(--line));
  box-shadow: var(--shadow-1);
}
/* Tied up at either end, the ship sits over the pin rather than past it. */
.voyage-dates:not([data-phase="at-sea"]):not([data-phase="bon-voyage"]) .vd-ship { left: calc(17px + var(--at, 0) * (100% - 34px)); }
.vd-caption { font-size: var(--fs-body); line-height: 1.5; color: var(--ink-2); }
.vd-action { margin-top: var(--sp-3); }

/* The Home date in the crew sheet: the picker and a way to empty it. */
.settings-home { gap: var(--sp-2); }
.settings-home input { flex: 1 1 auto; min-width: 0; }
.settings-home-clear { flex: none; color: var(--accent-text); }
.settings-home-clear[hidden] { display: none; }
.settings-home-note { font-size: var(--fs-note); line-height: 1.5; color: var(--ink-2); margin-top: 5px; }
.settings-home-note:empty { display: none; }

.settings-pause-sea { display: block; margin-top: var(--sp-3); font-size: var(--fs-note); line-height: 1.5; color: var(--ink-2); }

/* privacy.js — one line per thing the other person sees. */
.privacy-preview-list {
  margin: var(--sp-2) 0 0; padding-left: 20px;
  font-size: var(--fs-body); line-height: 1.5; color: var(--ink);
}
.privacy-preview-list li + li { margin-top: 4px; }
.privacy-preview-list li::marker { color: var(--accent-text); }

/* ----------------------------------------- the five honest states (guide.js) */
/* Shared with the Guide ("Where your data comes from"). Each mark stands on a
   baseline, the way it sits in a chart, and is drawn beside its word — the
   mark is never the only way to tell the states apart. Neutral colours only:
   no state is a warning, and dashed means provisional and nothing else. */
.state-legend.stack { gap: var(--sp-3); }
.state-legend-list { list-style: none; margin: 0; }
.state-legend-row {
  display: grid; grid-template-columns: 44px minmax(0, 1fr); align-items: center; gap: var(--sp-3);
  padding: 10px 0;
}
.state-legend-row + .state-legend-row { border-top: 1px solid var(--line-soft); }
.state-legend-row:first-child { padding-top: 0; }
.state-legend-row:last-child { padding-bottom: 0; }
.state-legend-mark {
  position: relative; height: 30px;
  display: flex; align-items: flex-end; justify-content: center;
  border-bottom: 1px solid var(--line);
}
.state-legend-cell { display: block; width: 22px; height: 24px; border-radius: 6px 6px 2px 2px; }
.state-legend-row[data-state="measured"] .state-legend-cell { background: var(--seaglass); }
.state-legend-row[data-state="pending"] .state-legend-cell { border: 1.5px dashed var(--pending); }
.state-legend-row[data-state="in_progress"] .state-legend-cell {
  border: 1.5px dashed var(--seaglass);
  background: linear-gradient(to top, color-mix(in srgb, var(--seaglass) 38%, transparent) 42%, transparent 42%);
}
.state-legend-row[data-state="calibrating"] .state-legend-cell { background: color-mix(in srgb, var(--line-strong) 38%, var(--surface)); }
.state-legend-row[data-state="unscorable"] .state-legend-cell {
  display: grid; place-items: end center; height: 24px; border-radius: 2px;
  border-bottom: 5px solid var(--line-strong);
  font-size: var(--fs-md); font-weight: 700; line-height: 1; color: var(--ink-3); padding-bottom: 3px;
}
.state-legend-row[data-state="unavailable"] .state-legend-cell { width: 12px; height: 3px; border-radius: 2px; background: var(--line-strong); }
.state-legend-text { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
.state-legend-text > .term,
.state-legend-word { font-size: var(--fs-body); font-weight: 650; color: var(--ink); }
.state-legend-what { font-size: var(--fs-note); line-height: 1.45; color: var(--ink-2); }
.state-legend-note { margin: 0 2px; line-height: 1.5; }
