/* Masthead */

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 4px;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
}

.masthead-titles {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.masthead-word {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tx3);
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

.masthead-word:hover {
  color: var(--accent);
}

.masthead-trip {
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.masthead-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-toggle,
.logistics-toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.85rem;
}

.export-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.95rem;
  padding: 0;
}

.export-btn:hover {
  border-color: var(--accent);
}

.export-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.export-btn.spinning {
  animation: refresh-spin 0.8s linear infinite;
}

@keyframes refresh-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.export-menu-wrap {
  position: relative;
}

.export-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.export-menu button {
  padding: 10px 12px;
  border: none;
  background: none;
  color: var(--tx);
  font-size: 0.85rem;
  text-align: left;
}

.export-menu button:hover {
  background: var(--raise);
}

.export-menu button + button {
  border-top: 1px solid var(--border);
}

/* Logistics view — flat, whole-trip, read-only sweep */

.logistics-view,
.phrases-view {
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  padding: 0 16px 32px;
}

.logistics-heading,
.phrases-heading {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 20px 0 2px;
}

.logistics-sub,
.phrases-sub {
  color: var(--tx3);
  font-size: 0.85rem;
  margin: 0 0 20px;
}

.phrase-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--wash-divider);
}

.phrase-row:last-child {
  border-bottom: none;
}

.phrase-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.phrase-english {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--tx3);
}

.phrase-written {
  font-weight: 700;
  font-size: 1.05rem;
}

.phrase-phonetic {
  font-size: 0.85rem;
  font-style: italic;
  color: var(--tx2);
}

.phrase-speak {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--raise);
  font-size: 1.1rem;
}

.phrase-speak:hover {
  border-color: var(--accent);
}

.logistics-empty {
  color: var(--tx3);
  font-size: 0.9rem;
}

.logistics-day {
  margin-bottom: 18px;
}

.logistics-day-marker {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tx);
  border-bottom: 1px solid var(--wash-divider);
  padding-bottom: 6px;
  margin-bottom: 8px;
}

.logistics-entry {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--wash-divider);
}

.logistics-entry:last-child {
  border-bottom: none;
}

.logistics-time {
  flex: 0 0 52px;
  font-weight: 700;
  color: var(--tx);
}

.logistics-label {
  font-weight: 600;
}

.logistics-note {
  flex-basis: 100%;
  font-size: 0.85rem;
  color: var(--tx2);
  padding-left: 62px;
}

/* Day rail */

.day-chip {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--tx2);
  min-width: 64px;
}

.day-chip .dow {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.day-chip .dt {
  font-size: 0.95rem;
  font-weight: 600;
}

.day-chip[aria-current="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

/* Day section */

.day-heading {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 20px 0 4px;
}

.day-region {
  color: var(--tx3);
  font-size: 0.85rem;
  margin-bottom: 12px;
}

.tonight-strip {
  background: var(--raise);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tonight-label {
  font-size: 0.75rem;
  color: var(--tx3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tonight-name {
  font-weight: 600;
}

.tonight-detail {
  color: var(--tx2);
  font-size: 0.9rem;
}

.section-heading {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tx);
  margin: 28px 0 10px;
  padding-top: 16px;
  border-top: 1px solid var(--wash-divider);
}

.section-heading:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 18px;
}

/* Fixed rows */

.fixed-row {
  border-left: 3px solid var(--accent);
  background: var(--surface);
  border-radius: 0 10px 10px 0;
  padding: 10px 12px;
  margin-bottom: 8px;
}

.fixed-time {
  font-weight: 700;
  margin-right: 8px;
}

.fixed-note {
  display: block;
  color: var(--tx2);
  font-size: 0.85rem;
  margin-top: 2px;
}

.fixed-meal-type {
  display: block;
  margin-top: 6px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--raise);
  color: var(--tx2);
  font-size: 0.8rem;
}

/* Options rows */

.option-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
  background: var(--surface);
  border-radius: 10px;
  margin-bottom: 8px;
  overflow: hidden;
  border-top: 2px solid transparent;
}

.option-row.dragging {
  opacity: 0.5;
}

.option-row.drag-over {
  border-top-color: var(--accent);
}

.drag-handle {
  flex-shrink: 0;
  color: var(--tx3);
  cursor: grab;
  font-size: 0.8rem;
  line-height: 1;
  letter-spacing: -3px;
  padding: 0 2px;
  user-select: none;
  touch-action: none;
}

.drag-handle--inactive {
  cursor: default;
  opacity: 0.35;
}

.options-subheading {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--tx3);
  margin: 8px 0 4px;
}

.options-subheading:first-child {
  margin-top: 0;
}

.priority-bar {
  position: relative;
  flex: 0 0 32px;
  border: none;
  padding: 0;
  cursor: pointer;
  background: transparent;
}

.priority-bar::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  border-radius: 4px;
}

.priority-bar[data-priority="2"]::after { background: var(--priority-high); }
.priority-bar[data-priority="1"]::after { background: var(--priority-medium); }
.priority-bar[data-priority="0"]::after { background: var(--priority-low); }

.option-body {
  flex: 1;
  padding: 10px 12px 10px 4px;
  min-width: 0;
}

.option-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.option-done {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.option-label {
  font-weight: 600;
  flex: 1;
  min-width: 0;
  overflow-wrap: break-word;
}

.added-tag {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--on-accent);
  background: var(--accent-soft);
  border-radius: 4px;
  padding: 2px 5px;
  flex-shrink: 0;
}

.carried-tag {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--on-accent);
  background: var(--accent-soft);
  border-radius: 4px;
  padding: 2px 6px;
}

.added-by-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.option-remove {
  background: none;
  border: none;
  color: var(--tx3);
  font-size: 1rem;
  padding: 2px 6px;
  flex-shrink: 0;
}

.option-time-line {
  margin-top: 4px;
  font-size: 0.85rem;
  color: var(--tx2);
}

.option-time-line .suggested {
  font-weight: 700;
  color: var(--tx);
}

.hours-badge {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--on-accent);
  background: var(--priority-low);
  border-radius: 4px;
  padding: 2px 6px;
}

.option-note {
  margin-top: 4px;
  font-size: 0.85rem;
  color: var(--tx2);
  white-space: pre-wrap;
}

.item-note-edit-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  padding: 4px;
  color: var(--tx3);
  opacity: 0.5;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.item-note-edit-btn:hover {
  opacity: 1;
  color: var(--accent);
}

.item-note-editor {
  margin-top: 4px;
}

.item-note-field {
  width: 100%;
  min-height: 50px;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--raise);
  color: var(--tx);
  font: inherit;
  font-size: 0.85rem;
  resize: vertical;
}

.item-note-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  margin-top: 6px;
}

.item-note-actions button {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.8rem;
}

.item-note-actions button.primary {
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  font-weight: 600;
}

/* Add option form */

.add-option-form[hidden] {
  display: none;
}

.add-option-form {
  margin-top: 10px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.add-option-toggle {
  margin-top: 10px;
  background: none;
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  color: var(--tx2);
  width: 100%;
  text-align: left;
}

.add-option-form input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--raise);
  color: var(--tx);
}

.add-option-form input[type="checkbox"] {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
}

.add-eat-reserved-label {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  color: var(--tx2);
  font-size: 0.9rem;
}

.add-option-row {
  display: flex;
  gap: 8px;
}

.add-option-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.add-option-actions button {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--raise);
}

.add-option-actions button.primary {
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  font-weight: 600;
}

/* Eat drawer */

.eat-drawer {
  background: var(--surface);
  border-radius: 10px;
  margin-bottom: 10px;
  overflow: hidden;
}

.eat-drawer summary {
  padding: 10px 12px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--accent);
  border-radius: 10px;
  transition: background 0.15s ease;
}

.eat-drawer summary:hover {
  background: var(--raise);
}

.eat-drawer summary::-webkit-details-marker {
  display: none;
}

.eat-drawer summary::after {
  content: "";
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.15s ease;
  margin-left: 8px;
}

.eat-drawer[open] summary::after {
  transform: rotate(-135deg);
}

.eat-row {
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.eat-name {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.eat-detail {
  font-size: 0.85rem;
  color: var(--tx2);
}

.unconfirmed-flag {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--on-accent);
  background: var(--tx3);
  border-radius: 999px;
  padding: 2px 7px;
}

.eat-move-toggle {
  align-self: flex-start;
  margin-top: 4px;
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
}

.eat-move-form {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.eat-move-time {
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--raise);
  color: var(--tx);
  align-self: flex-start;
}

/* Notes + done count */

.notes-field {
  width: 100%;
  min-height: 70px;
  margin-top: 6px;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--raise);
  color: var(--tx);
  resize: vertical;
}

.notes-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 8px;
}

.notes-actions button {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--raise);
}

.notes-actions button.notes-bullet-btn {
  margin-right: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--tx3);
  transition: background 0.15s ease, color 0.15s ease;
}

.notes-actions button.notes-bullet-btn:hover {
  background: var(--raise);
  color: var(--accent);
}

.notes-actions button.primary {
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  font-weight: 600;
}

.notes-display {
  margin-top: 6px;
  padding: 10px;
  border-radius: 8px;
  background: var(--raise);
  color: var(--tx2);
  white-space: pre-wrap;
  min-height: 24px;
}

.notes-empty {
  color: var(--tx3);
  font-style: italic;
}

.notes-edit-btn {
  margin-top: 6px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  color: var(--tx2);
}

.done-count {
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--tx2);
}

.conclude-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  background: none;
  border: none;
  padding: 0;
  color: var(--tx2);
  font-size: 0.85rem;
}

.conclude-toggle-track {
  position: relative;
  flex-shrink: 0;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: var(--raise);
  border: 1px solid var(--border);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.conclude-toggle-thumb {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--tx3);
  transition: transform 0.15s ease, background 0.15s ease;
}

.conclude-toggle.is-on .conclude-toggle-track {
  background: var(--accent);
  border-color: var(--accent);
}

.conclude-toggle.is-on .conclude-toggle-thumb {
  transform: translateX(16px);
  background: var(--on-accent);
}

.conclude-toggle.is-on .conclude-toggle-label {
  color: var(--tx);
  font-weight: 600;
}

.traveler-legend {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--wash-divider);
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.traveler-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--tx3);
}

/* Toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  z-index: 100;
}

.toast-action {
  background: none;
  border: none;
  color: var(--accent);
  font-weight: 700;
}
