/* ============================================================================
 * 183 PWA — position.css
 * Split from the original single-file PWA. See styles/README.md for the
 * full layout map.
 * ========================================================================== */



/* ============================================================================
   Position log — capture form, calendar dot, status indicators
   ========================================================================== */

/* DMS row — three small numeric inputs side-by-side then hemi toggle */
.dms-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.dms-group {
  display: flex;
  align-items: center;
  flex: 1;
  background: var(--bg-base);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0 8px;
  min-width: 0;
}
.dms-input {
  width: 100%;
  background: transparent;
  border: none;
  padding: 10px 0;
  color: var(--text);
  font-family: var(--mono);
  font-size: 1rem;
  text-align: center;
  outline: none;
  -moz-appearance: textfield;
}
.dms-input::-webkit-outer-spin-button,
.dms-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.dms-unit {
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.78rem;
  margin-left: 2px;
  flex-shrink: 0;
}

/* Hemisphere toggle — N/S or E/W */
.hemi-toggle {
  display: flex;
  background: var(--bg-base);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
  flex-shrink: 0;
}
.hemi-btn {
  background: transparent;
  border: none;
  padding: 10px 14px;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 120ms;
}
.hemi-btn:hover { color: var(--text-soft); }
.hemi-btn.active {
  background: var(--accent-faint);
  color: var(--accent);
}

/* Source select — match other form inputs */
.source-select {
  width: 100%;
  background: var(--bg-base);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 11px 12px;
  color: var(--text);
  font-size: 0.92rem;
  outline: none;
}

/* GPS fill button — small affordance icon + label */
.gps-btn {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.84rem;
}
.gps-btn svg { width: 16px; height: 16px; }

/* Calendar position dot — tiny indicator in the top-left of each day cell */
.day-cell {
  position: relative;
}
.day-pos-dot {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--pass);
  box-shadow: 0 0 4px rgba(80, 220, 140, 0.5);
}
.day-pos-dot.missing {
  background: transparent;
  border: 1.5px solid var(--fail);
  box-shadow: none;
}

/* Position summary in trip detail rows */
.evidence-day-row {
  position: relative;
}
.evidence-day-row.has-position {
  border-color: rgba(80, 220, 140, 0.35);
}
.evidence-day-row.has-position .evidence-day-date {
  color: var(--text);
}
.evidence-day-pos {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  padding-left: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  flex: 1;
  min-width: 0;
  text-align: right;
}

/* Position-log tile on the home screen — small affordance reminding the
   user to capture today's position, or pointing to gaps that need filling */
.position-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
  background: var(--bg-base);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.position-tile.tone-prompt {
  border-color: rgba(0, 224, 255, 0.35);
  background: var(--accent-faint);
}
.position-tile.tone-warn {
  border-color: rgba(255, 184, 77, 0.35);
  background: var(--signal-faint);
}
.position-tile.tone-ok {
  opacity: 0.85;
}
.position-tile-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--accent);
}
.position-tile.tone-warn .position-tile-icon { color: var(--signal); }
.position-tile.tone-ok .position-tile-icon { color: var(--text-muted); }
.position-tile-icon svg { width: 22px; height: 22px; }
.position-tile-body {
  flex: 1;
  min-width: 0;
}
.position-tile-label {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 2px;
}
.position-tile-stat {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}
.position-tile-cta {
  background: var(--accent);
  color: var(--bg-deep);
  border: none;
  padding: 8px 14px;
  border-radius: var(--r-sm);
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
  flex-shrink: 0;
}
.position-tile.tone-warn .position-tile-cta {
  background: var(--signal);
}
.position-tile-cta:hover { filter: brightness(1.1); }

/* Evidence toggle in the trip edit form — checkbox + label/sub layout */
.evidence-toggle {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  background: var(--bg-base);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  cursor: pointer;
  margin-bottom: 4px;
}
.evidence-toggle:hover {
  border-color: var(--line-strong);
}
.evidence-toggle input[type="checkbox"] {
  margin-top: 2px;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--accent);
}
.evidence-toggle-body {
  flex: 1;
  min-width: 0;
}
.evidence-toggle-title {
  font-weight: 500;
  color: var(--text);
  font-size: 0.92rem;
  margin-bottom: 4px;
}
.evidence-toggle-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Evidence list summary — small header above the per-day rows showing
   logged count without offering a group action */
.evidence-list-summary {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  padding: 0 2px 8px;
}
.evidence-list-summary-hint { color: var(--text-muted); font-style: italic; }
.evidence-list-summary-ok { color: var(--pass); }

/* Coordinate format toggle (DMS / Decimal) */
.field-label-inline {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.format-toggle {
  display: flex;
  background: var(--bg-base);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.format-toggle-btn {
  background: transparent;
  border: none;
  padding: 8px 14px;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: all 120ms;
}
.format-toggle-btn:hover { color: var(--text-soft); }
.format-toggle-btn.active {
  background: var(--accent-faint);
  color: var(--accent);
}

/* Decimal-degree input row */
.decimal-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.decimal-input {
  width: 100%;
  background: transparent;
  border: none;
  padding: 10px 0;
  color: var(--text);
  font-family: var(--mono);
  font-size: 1rem;
  text-align: left;
  outline: none;
  -moz-appearance: textfield;
}
.decimal-input::-webkit-outer-spin-button,
.decimal-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.dms-group.decimal-only { flex: 1; padding: 0 12px; }

/* Tax-year row in settings — checkbox + label + status */
.tax-year-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.tax-year-row:last-child { border-bottom: none; }
.tax-year-row input[type="checkbox"] {
  width: 18px; height: 18px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.tax-year-body { flex: 1; min-width: 0; }
.tax-year-label {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.tax-year-current-pill {
  background: var(--accent-faint);
  color: var(--accent);
  font-size: 0.62rem;
  font-family: var(--display);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
}
.tax-year-status {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
  letter-spacing: 0.02em;
}

/* Unfiled-years notice on home — surfaces multiple unfiled years honestly */
.unfiled-years-notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 11px 14px;
  margin-top: 8px;
  margin-bottom: 16px;
  background: var(--bg-base);
  border: 1px solid var(--line);
  border-left: 3px solid var(--signal);
  border-radius: var(--r-md);
}
.unfiled-years-icon {
  flex-shrink: 0;
  width: 18px; height: 18px;
  color: var(--signal);
  margin-top: 1px;
}
.unfiled-years-icon svg { width: 18px; height: 18px; }
.unfiled-years-body { flex: 1; min-width: 0; }
.unfiled-years-label {
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 3px;
  line-height: 1.4;
}
.unfiled-years-help {
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.45;
}
.unfiled-years-cta {
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--text-soft);
  padding: 6px 12px;
  border-radius: var(--r-sm);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
  flex-shrink: 0;
  align-self: center;
}
.unfiled-years-cta:hover {
  color: var(--text);
  border-color: var(--accent);
}




/* ============================================================================
   Sextant — full-screen cylinder-band coordinate input
   ========================================================================== */

/* Trigger button on the form — calm, doesn't dominate the row */
.coord-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 16px 0 8px;
}
.sextant-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-soft);
  padding: 5px 10px;
  border-radius: var(--r-sm);
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 140ms ease;
}
.sextant-trigger:hover {
  color: var(--signal);
  border-color: rgba(212, 168, 90, 0.4);
}
.sextant-trigger-icon {
  display: inline-flex;
  align-items: center;
  color: var(--signal);
}
.sextant-trigger-icon svg { width: 14px; height: 14px; }

/* Full-screen overlay — fills the viewport, no scroll */
.sextant-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  opacity: 0;
  transition: opacity 220ms ease;
  display: flex;
  flex-direction: column;
  /* Light mode background (default) */
  background: linear-gradient(180deg, var(--bg-deep) 0%, var(--bg-soft) 100%);
  padding-top: env(safe-area-inset-top, 0);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.sextant-overlay.show { opacity: 1; }

/* Dark mode: richer maritime gradient, deeper black */
@media (prefers-color-scheme: dark) {
  .sextant-overlay {
    background: radial-gradient(ellipse at top, #0a1219 0%, #050a0d 60%, #000 100%);
  }
}
:root[data-theme="dark"] .sextant-overlay {
  background: radial-gradient(ellipse at top, #0a1219 0%, #050a0d 60%, #000 100%);
}
:root[data-theme="light"] .sextant-overlay {
  background: linear-gradient(180deg, #f5f1e8 0%, #ebe4d2 100%);
}

.sextant-sheet {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
  padding: 8px 16px 16px;
  /* No vertical scroll inside the sheet — everything must fit */
  overflow: hidden;
}

/* Header */
.sextant-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0 14px;
  flex-shrink: 0;
}
.sextant-back {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 50%;
  width: 36px; height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-soft);
  cursor: pointer;
}
.sextant-back svg { width: 18px; height: 18px; }
.sextant-back:hover { color: var(--accent); border-color: var(--accent); }
.sextant-title {
  font-family: var(--display);
  font-size: 1rem;
  font-weight: 500;
  color: var(--signal);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* The cylinder rows column — fills available space, distributes evenly */
.sextant-cyls {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  padding: 4px 0;
  min-height: 0;
}



/* Each cylinder row: readout label/value on left, the rolling band on right.
   Compact — designed to sit in the thumb zone of the screen, not span
   from edge to edge. */
.cyl-row {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 4px 0;
}
.cyl-row.dragging .cyl-band-wrap {
  border-color: var(--signal);
  box-shadow: 0 0 0 1px rgba(212, 168, 90, 0.35),
              inset 0 0 16px rgba(0, 0, 0, 0.5);
}

/* Left readout — value plus label; sits beside the band */
.cyl-readout {
  flex: 0 0 84px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding-left: 8px;
}
.cyl-readout-label {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 500;
}
.cyl-readout-num {
  font-family: "Times New Roman", Georgia, serif;
  font-size: 2.4rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.05;
  cursor: pointer;
  letter-spacing: -0.02em;
}
.cyl-readout-num:hover { color: var(--signal); }
.cyl-readout-input {
  font-family: "Times New Roman", Georgia, serif;
  font-size: 2.4rem;
  font-weight: 600;
  color: var(--accent);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--accent);
  outline: none;
  width: 2.2em;
  padding: 0;
  -moz-appearance: textfield;
}
.cyl-readout-input::-webkit-outer-spin-button,
.cyl-readout-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* The rolling band — compact, dark, with thin metallic edges */
.cyl-band-wrap {
  flex: 0 0 160px;
  position: relative;
  background:
    linear-gradient(180deg,
      rgba(0, 0, 0, 0.35) 0%,
      rgba(0, 0, 0, 0.05) 50%,
      rgba(0, 0, 0, 0.35) 100%),
    #0a0e12;
  border: 1px solid rgba(0, 0, 0, 0.6);
  border-radius: 6px;
  overflow: hidden;
  cursor: ns-resize;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    inset 0 -1px 0 rgba(0, 0, 0, 0.4);
}
:root[data-theme="light"] .cyl-band-wrap {
  background:
    linear-gradient(180deg,
      rgba(0, 0, 0, 0.18) 0%,
      rgba(0, 0, 0, 0.04) 50%,
      rgba(0, 0, 0, 0.18) 100%),
    #1a1f24;
}

.cyl-band {
  position: relative;
  width: 100%;
  height: 100%;
}

/* Strip — translates as a unit */
.cyl-strip {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  will-change: transform;
}

/* Numbers: every visible row identical — white, crisp, same size.
   No transitions. The brass indicator lines are what tell you which
   value is selected, not the number's appearance. */
.cyl-row-num {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Times New Roman", Georgia, serif;
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: #ffffff;
  pointer-events: none;
}
.cyl-row-num.out { color: rgba(255, 255, 255, 0.15); }

/* Centre indicator — two thin brass lines bracketing the selected row.
   ROW_HEIGHT = 24, so indicators sit at 50% ± 12px to clip the centre row. */
.cyl-indicator-top, .cyl-indicator-bottom {
  position: absolute;
  left: 6%;
  right: 6%;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(212, 168, 90, 0.85) 20%,
    rgba(212, 168, 90, 0.85) 80%,
    transparent 100%);
  pointer-events: none;
  box-shadow: 0 0 4px rgba(212, 168, 90, 0.3);
  z-index: 3;
}
.cyl-indicator-top    { top: calc(50% - 12px); }
.cyl-indicator-bottom { top: calc(50% + 12px); }

/* Hemisphere toggle — compact, centred */
.sextant-hemi-wrap {
  margin-top: 16px;
  text-align: center;
  flex-shrink: 0;
}
.sextant-hemi-label {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.sextant-hemi {
  display: inline-flex;
  background: var(--bg-base);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}
.sextant-hemi-btn {
  background: transparent;
  border: none;
  padding: 10px 28px;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 140ms;
}
.sextant-hemi-btn:hover { color: var(--text-soft); }
.sextant-hemi-btn.active {
  background: var(--accent-faint);
  color: var(--accent);
}

/* Footer actions */
.sextant-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding: 0 4px;
  flex-shrink: 0;
}
.sextant-cancel { flex: 1; }
.sextant-save { flex: 1.6; }

/* Tighter for shorter phones */
@media (max-height: 720px) {
  .cyl-row { gap: 14px; }
  .cyl-readout-num { font-size: 2.1rem; }
  .cyl-readout { flex-basis: 76px; }
  .cyl-band-wrap { flex-basis: 150px; }
}
@media (max-height: 640px) {
  .sextant-cyls { gap: 8px; }
  .cyl-row { gap: 12px; padding: 2px 0; }
  .cyl-readout-num { font-size: 1.85rem; }
  .sextant-hemi-btn { padding: 8px 24px; font-size: 0.95rem; }
}

/* dms-input select-all visibility */
.dms-input::selection { background: var(--accent-faint); color: var(--text); }
.decimal-input::selection { background: var(--accent-faint); color: var(--text); }

