*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --border: rgba(0,0,0,0.08);
  --border-strong: rgba(0,0,0,0.15);
  --text: #1a1a18;
  --text-secondary: #5a5a56;
  --text-tertiary: #9a9a94;
  --radius: 12px;
  --radius-sm: 7px;
  --header-h: 60px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161614;
    --surface: #1e1e1c;
    --border: rgba(255,255,255,0.08);
    --border-strong: rgba(255,255,255,0.15);
    --text: #f0ede8;
    --text-secondary: #a0a09a;
    --text-tertiary: #606058;
  }
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 0.5px solid var(--border);
  height: var(--header-h);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

h1, .home-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
h1 .year, .home-title .year { color: var(--text-tertiary); font-weight: 400; }

.home-title {
  text-decoration: none;
  display: block;
}
.home-title:hover { text-decoration: underline; text-underline-offset: 3px; }

.subtitle {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 1px;
}

.upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 7px 13px;
  cursor: pointer;
  transition: background 0.12s;
  white-space: nowrap;
  background: var(--surface);
}
.upload-btn:hover { background: var(--bg); }
.upload-btn svg { opacity: 0.6; flex-shrink: 0; }

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.stat-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}
.stat-label { font-size: 11px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.stat-value { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; color: var(--text); }
.stat-sub { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }

.card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
  padding: 1rem 1.25rem;
  border-bottom: 0.5px solid var(--border);
}
.card-header h2 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-secondary);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-secondary);
}
.legend-swatch {
  width: 22px;
  height: 8px;
  border-radius: 3px;
}

.cal-scroll { overflow-x: auto; padding: 1rem 1.25rem 1.25rem; }

table#cal-table {
  border-collapse: collapse;
  font-size: 12px;
  white-space: nowrap;
}

table#cal-table th {
  font-weight: 400;
  color: var(--text-tertiary);
  text-align: center;
  padding: 2px 1px;
  min-width: 22px;
}
table#cal-table th.th-name {
  text-align: left;
  min-width: 90px;
  padding-right: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
table#cal-table th.month-start { border-left: 1px solid var(--border-strong); }

table#cal-table td.td-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  padding: 5px 12px 5px 0;
  vertical-align: middle;
}
table#cal-table td.td-day {
  padding: 2px 1px;
  vertical-align: middle;
}
table#cal-table td.month-start { border-left: 1px solid var(--border); }

.bar {
  height: 22px;
  width: 100%;
  min-width: 22px;
}

.traveler-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1px;
  background: var(--border);
}

.traveler-card {
  background: var(--surface);
  padding: 1rem 1.25rem;
}

.traveler-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.traveler-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.traveler-segment {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-top: 0.5px solid var(--border);
  font-size: 12px;
  color: var(--text-secondary);
}
.seg-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.seg-dest { font-weight: 500; color: var(--text); flex: 1; }
.seg-dates { color: var(--text-tertiary); font-size: 11px; }

.dest-grid-inner {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1px;
  background: var(--border);
}

.dest-card {
  background: var(--surface);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 10px;
}
.dest-color-bar {
  width: 4px;
  height: 36px;
  border-radius: 2px;
  flex-shrink: 0;
}
.dest-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  text-transform: capitalize;
}
.dest-id {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: var(--surface);
  font-size: 13px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 999;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Traveler card contact enrichment ─────────────────────────── */

.traveler-card {
  cursor: pointer;
  transition: background 0.12s;
}
.traveler-card:hover { background: var(--bg); }

.traveler-photo {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.traveler-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.traveler-fullname {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.traveler-contact-line {
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

table#cal-table td.td-name {
  cursor: pointer;
}
table#cal-table td.td-name:hover {
  color: var(--text-secondary);
  text-decoration: underline;
}

/* ── Contact modal ────────────────────────────────────────────── */

.contact-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.contact-modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.contact-modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 36px 28px 28px;
  max-width: 420px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  transform: translateY(10px);
  transition: transform 0.2s;
}
.contact-modal-overlay.open .contact-modal { transform: translateY(0); }

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 16px;
  line-height: 1;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}
.modal-close:hover { color: var(--text); background: var(--bg); }

.modal-avatar-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}

.modal-photo {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
}

.modal-initials {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 700;
}

.modal-name {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-align: center;
  color: var(--text);
  margin-bottom: 8px;
}

.modal-contact-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  margin-bottom: 12px;
}

.modal-link {
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
}
.modal-link:hover { color: var(--text); text-decoration: underline; }

.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-bottom: 12px;
}

.modal-tag {
  font-size: 11px;
  padding: 2px 9px;
  border-radius: 99px;
  background: var(--bg);
  border: 0.5px solid var(--border-strong);
  color: var(--text-secondary);
}

.modal-notes {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.6;
  margin-bottom: 16px;
}

.modal-itinerary {
  border-top: 0.5px solid var(--border);
  padding-top: 12px;
  margin-top: 4px;
}

.modal-section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-tertiary);
  font-weight: 600;
  margin-bottom: 8px;
}

/* ── Page navigation ──────────────────────────────────────────── */

.header-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.nav-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
}
.nav-link:hover { color: var(--text); text-decoration: underline; }

.nav-sep {
  font-size: 13px;
  color: var(--text-tertiary);
}

.nav-current {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.flights-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  transition: background 0.12s;
  background: var(--surface);
}
.flights-nav-link:hover { background: var(--bg); }
.flights-nav-link.nav-link-here {
  background: var(--bg);
  color: var(--text);
  font-weight: 600;
  pointer-events: none;
  border-color: var(--border-strong);
}

/* ── Flights page — import section ───────────────────────────── */

.import-body {
  padding: 1rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.url-input {
  flex: 1;
  background: var(--bg);
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 9px 13px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  min-width: 0;
}
.url-input:focus {
  border-color: rgba(0,0,0,0.3);
  box-shadow: 0 0 0 2px rgba(0,0,0,0.06);
}
@media (prefers-color-scheme: dark) {
  .url-input:focus { border-color: rgba(255,255,255,0.3); box-shadow: 0 0 0 2px rgba(255,255,255,0.06); }
}

.parse-btn {
  background: var(--text);
  color: var(--surface);
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.12s;
}
.parse-btn:hover { opacity: 0.85; }

.import-hint {
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.5;
}

/* ── Flights page — flight form ───────────────────────────────── */

.flight-form {
  padding: 1rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.flight-form-top,
.flight-form-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group-grow { flex: 1; min-width: 160px; }

.form-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-tertiary);
}

.form-input {
  background: var(--bg);
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  outline: none;
}
.form-input:focus {
  border-color: rgba(0,0,0,0.3);
  box-shadow: 0 0 0 2px rgba(0,0,0,0.06);
}
@media (prefers-color-scheme: dark) {
  .form-input:focus { border-color: rgba(255,255,255,0.3); box-shadow: 0 0 0 2px rgba(255,255,255,0.06); }
}

.f-airport {
  width: 72px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .04em;
  text-align: center;
}

.route-arrow {
  font-size: 18px;
  color: var(--text-tertiary);
  align-self: flex-end;
  padding-bottom: 8px;
}

.form-actions {
  display: flex;
  align-items: flex-end;
}

.save-btn {
  background: var(--text);
  color: var(--surface);
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 20px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.12s;
}
.save-btn:hover { opacity: 0.85; }

.form-cancel-btn {
  background: none;
  border: none;
  font-size: 16px;
  line-height: 1;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}
.form-cancel-btn:hover { color: var(--text); background: var(--bg); }

/* ── Flights page — flight list ───────────────────────────────── */

.flights-empty {
  padding: 2rem 1.25rem;
  font-size: 13px;
  color: var(--text-tertiary);
  text-align: center;
  line-height: 1.7;
}
.flights-empty strong { color: var(--text-secondary); }

.flight-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 13px 1.25rem;
  border-top: 0.5px solid var(--border);
}
.flight-item:first-child { border-top: none; }
.flight-item:hover { background: var(--bg); }

.flight-item-left {
  min-width: 0;
  flex-shrink: 0;
}

.flight-airports {
  display: flex;
  align-items: center;
  gap: 6px;
}

.fl-code {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.fl-arrow {
  font-size: 14px;
  color: var(--text-tertiary);
}

.flight-cities {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.flight-item-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.fl-tag {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg);
  border: 0.5px solid var(--border-strong);
  border-radius: 99px;
  padding: 3px 10px;
  white-space: nowrap;
}

.fl-tag-flight {
  color: var(--text);
  font-weight: 500;
}

.fl-tag-person {
  color: var(--text);
}

.fl-tag-notes {
  color: var(--text-tertiary);
  font-style: italic;
}

.flight-item-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.fl-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.1s, color 0.1s;
}
.fl-action-btn:hover { background: var(--bg); color: var(--text); }
.fl-action-delete:hover { color: #c0392b; }

.danger-link {
  background: none;
  border: none;
  font-size: 12px;
  color: var(--text-tertiary);
  cursor: pointer;
  font-family: inherit;
  padding: 0;
  text-decoration: underline;
}
.danger-link:hover { color: #c0392b; }

/* ── Status toggle ────────────────────────────────────────────── */

.form-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-toggle {
  display: flex;
  background: var(--bg);
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}

.status-opt {
  border: none;
  background: none;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  padding: 4px 13px;
  border-radius: 5px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}

.status-opt-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* ── Status badges ────────────────────────────────────────────── */

.fl-status-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: 3px 9px;
  border-radius: 99px;
  white-space: nowrap;
  flex-shrink: 0;
}

.fl-status-booked {
  background: #d6f0e0;
  color: #1a5c35;
}

.fl-status-saved {
  background: var(--bg);
  color: var(--text-tertiary);
  border: 0.5px solid var(--border-strong);
}

@media (prefers-color-scheme: dark) {
  .fl-status-booked { background: #1c3a28; color: #5fba80; }
  .fl-status-saved { background: var(--bg); color: var(--text-tertiary); }
}

/* ── Traveler form rows ───────────────────────────────────────── */

.form-travelers-section {
  padding: 4px 0 4px;
}

.form-travelers-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.add-traveler-btn {
  border: 0.5px solid var(--border-strong);
  background: none;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  transition: background 0.12s;
}
.add-traveler-btn:hover { background: var(--bg); }

.traveler-form-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.traveler-form-cols-hint {
  display: flex;
  gap: 8px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-tertiary);
  padding: 0 2px 2px;
}
.traveler-form-cols-hint span:nth-child(1) { flex: 2; min-width: 140px; }
.traveler-form-cols-hint span:nth-child(2) { width: 66px; }
.traveler-form-cols-hint span:nth-child(3) { flex: 1; min-width: 110px; }

.traveler-form-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.traveler-form-row .tr-name { flex: 2; min-width: 140px; }
.traveler-form-row .tr-seat { width: 66px; flex-shrink: 0; }
.traveler-form-row .tr-conf { flex: 1; min-width: 110px; }

.tr-name-wrap {
  flex: 2;
  min-width: 140px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.tr-name-wrap .tr-name-other { width: 100%; }

.form-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239a9a94' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 12px;
  padding-right: 28px;
  cursor: pointer;
}
.form-select:focus {
  border-color: rgba(0,0,0,0.3);
  box-shadow: 0 0 0 2px rgba(0,0,0,0.06);
}
@media (prefers-color-scheme: dark) {
  .form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23606058' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  }
  .form-select:focus { border-color: rgba(255,255,255,0.3); box-shadow: 0 0 0 2px rgba(255,255,255,0.06); }
}

.remove-traveler-btn {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  flex-shrink: 0;
  padding: 0;
  transition: color 0.1s, background 0.1s;
}
.remove-traveler-btn:hover { color: #c0392b; background: var(--bg); }

/* ── Flight cards ─────────────────────────────────────────────── */

.flight-date-sep {
  padding: 10px 1.25rem 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-tertiary);
  border-top: 0.5px solid var(--border);
  background: var(--bg);
}
#flights-list > .flight-date-sep:first-child { border-top: none; }

.flight-card {
  padding: 0;
  border-top: 0.5px solid var(--border);
  border-left: 3px solid transparent;
  transition: background 0.1s;
}
.flight-card:hover { background: var(--bg); }

.fcard-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.85rem 1.25rem;
  cursor: pointer;
  user-select: none;
}

.fcard-summary-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.fcard-avatar-stack {
  display: flex;
  align-items: center;
}
.fcard-avatar-sm {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg);
  border: 0.5px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.fcard-avatar-sm + .fcard-avatar-sm { margin-left: -5px; }

.fcard-chevron {
  color: var(--text-tertiary);
  flex-shrink: 0;
  transition: transform 0.18s;
}
.fcard-open .fcard-chevron { transform: rotate(180deg); }

.fcard-body {
  padding: 0 1.25rem 0.85rem;
}

.flight-card-booked { border-left-color: #3aaa6e; }
.flight-card-saved  { border-left-color: var(--border-strong); }

.fcard-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.fcard-route {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  gap: 0;
}

.fcard-airport {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.fcard-airport-right {
  align-items: flex-end;
  text-align: right;
}

.fcard-code {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1;
}

.fcard-city {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 3px;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fcard-mid {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 16px;
  min-width: 80px;
}

.fcard-flightlabel {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-bottom: 5px;
  white-space: nowrap;
  text-align: center;
}

.fcard-line-row {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 4px;
}

.fcard-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--border-strong);
  flex-shrink: 0;
}

.fcard-dash {
  flex: 1;
  height: 1px;
  background: var(--border-strong);
}

.fcard-plane {
  font-size: 15px;
  color: var(--text-secondary);
  flex-shrink: 0;
  line-height: 1;
}

.fcard-badge-wrap {
  flex-shrink: 0;
  padding-top: 2px;
}

.fcard-travelers {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 10px 0 8px;
  border-top: 0.5px solid var(--border);
}

.fcard-traveler {
  display: flex;
  align-items: center;
  gap: 9px;
}

.fcard-traveler-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg);
  border: 0.5px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.fcard-traveler-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  flex-wrap: wrap;
}

.fcard-traveler-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.fcard-traveler-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fcard-meta-item {
  font-size: 12px;
  color: var(--text-tertiary);
}

.fcard-conf {
  font-family: ui-monospace, 'Cascadia Code', 'SF Mono', monospace;
  font-size: 11px;
  background: var(--bg);
  border: 0.5px solid var(--border-strong);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--text-secondary);
}

.fcard-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
}
.fcard-footer:not(:has(.fcard-notes-text:not(:empty))) .fcard-actions { margin-left: auto; }

.fcard-notes-text {
  font-size: 12px;
  color: var(--text-tertiary);
  font-style: italic;
}

.fcard-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Itinerary section ────────────────────────────────────────── */

.itin-person {
  border-top: 0.5px solid var(--border);
}
.itin-person:first-child { border-top: none; }

.itin-person-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 1.25rem 10px;
}

.itin-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg);
  border: 0.5px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.itin-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.itin-count {
  font-size: 12px;
  color: var(--text-tertiary);
}

.itin-rows {
  padding: 0 1.25rem 14px;
}

.itin-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 0;
  border-top: 0.5px solid var(--border);
  flex-wrap: wrap;
}
.itin-row:first-child { border-top: none; }

.itin-row-date {
  font-size: 12px;
  color: var(--text-tertiary);
  min-width: 52px;
  flex-shrink: 0;
}

.itin-row-route {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 140px;
}

.itin-code {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.itin-arrow {
  font-size: 13px;
  color: var(--text-tertiary);
}

.itin-cities {
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.itin-row-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.itin-meta-chip {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg);
  border: 0.5px solid var(--border-strong);
  border-radius: 99px;
  padding: 2px 9px;
  white-space: nowrap;
}

.itin-chip-seat {
  color: var(--text);
  font-weight: 500;
}

.itin-chip-conf {
  font-family: ui-monospace, 'Cascadia Code', 'SF Mono', monospace;
  font-size: 11px;
}

/* ── Travel Day calendar + map ────────────────────────────────── */

.tday-layout {
  display: flex;
  height: 380px;
}

.tday-cal-panel {
  width: 230px;
  flex-shrink: 0;
  border-right: 0.5px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tday-map-panel {
  flex: 1;
  min-width: 0;
  z-index: 0;
}

.tday-cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 6px;
  flex-shrink: 0;
}

.tday-cal-month-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.tday-cal-nav-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 18px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
}
.tday-cal-nav-btn:hover { background: var(--bg); }

.tday-cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 0 10px 4px;
  flex-shrink: 0;
}

.tday-cal-weekday {
  text-align: center;
  font-size: 9px;
  font-weight: 600;
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
}

.tday-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  padding: 0 10px 10px;
  overflow-y: auto;
}

.tday-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  border-radius: 5px;
  color: var(--text-tertiary);
  cursor: default;
  position: relative;
  flex-direction: column;
}

.tday-cell-flight {
  cursor: pointer;
  color: var(--text);
  font-weight: 500;
}
.tday-cell-flight:hover { background: rgba(24,95,165,0.08); }

.tday-cell-selected {
  background: #185FA5 !important;
  color: white !important;
}

.tday-cell-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #185FA5;
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
}
.tday-cell-selected .tday-cell-dot { display: none; }

/* Map overlays */
.tday-map-traveler-row {
  display: flex;
  align-items: center;
  background: white;
  border-radius: 99px;
  padding: 2px 4px;
  box-shadow: 0 1px 5px rgba(0,0,0,0.25);
  gap: 0;
  pointer-events: none;
}

@media (prefers-color-scheme: dark) {
  .tday-map-traveler-row { background: #2a2a28; }
}

.tday-map-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 7px;
  font-weight: 700;
  flex-shrink: 0;
}
.tday-map-avatar + .tday-map-avatar { margin-left: -4px; }

.f-time { width: 110px; }

/* ── Calendar flight dot ──────────────────────────────────────── */

.cal-flight-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #5b9bd5;
  margin: 2px auto 0;
  cursor: default;
}

/* ── Contact modal flights ────────────────────────────────────── */

.modal-flight-row {
  align-items: flex-start;
}

.modal-flight-route {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.modal-flight-codes {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.modal-flight-detail {
  font-size: 11px;
  color: var(--text-tertiary);
}

.modal-flight-conf {
  font-family: ui-monospace, 'Cascadia Code', 'SF Mono', monospace;
  font-size: 10px;
  background: var(--bg);
  border: 0.5px solid var(--border-strong);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--text-secondary);
}

.modal-flight-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* ── Export dropdown ──────────────────────────────────────────── */

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

.export-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface);
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  z-index: 200;
  min-width: 150px;
  overflow: hidden;
}
.export-dropdown.open { display: block; }

.export-opt {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 9px 14px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s;
}
.export-opt:hover { background: var(--bg); }
.export-opt + .export-opt { border-top: 0.5px solid var(--border); }

/* ── Places page layout ───────────────────────────────────────── */

body.places-page {
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.places-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.places-sidebar {
  width: 300px;
  flex-shrink: 0;
  border-right: 0.5px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.places-sidebar-toolbar {
  flex-shrink: 0;
  padding: 8px 10px;
  border-bottom: 0.5px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

.places-filters {
  flex-shrink: 0;
  border-bottom: 0.5px solid var(--border);
}

.tag-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 10px 12px;
}

.tag-chip {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 99px;
  border: 0.5px solid var(--border-strong);
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
  white-space: nowrap;
}
.tag-chip:hover { background: var(--bg); }
.tag-chip-all-active {
  background: var(--text);
  color: var(--surface);
  border-color: var(--text);
}

.places-list {
  flex: 1;
  overflow-y: auto;
}

.places-empty {
  padding: 2.5rem 1.25rem;
  font-size: 13px;
  color: var(--text-tertiary);
  text-align: center;
  line-height: 1.8;
}
.places-empty strong { color: var(--text-secondary); }

.place-card {
  border-top: 0.5px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
}
.place-card:first-child { border-top: none; }
.place-card:hover { background: var(--bg); }
.place-card.active { background: var(--bg); border-left: 3px solid var(--text); }

.place-card-inner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
}

.place-card-photo {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.place-card-info {
  flex: 1;
  min-width: 0;
}

.place-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.place-card-sub {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-bottom: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.place-card-ig { font-style: italic; }

.place-card-type {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-tertiary);
  margin-bottom: 2px;
}

.place-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 5px;
}

.place-card-tag {
  font-size: 10px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 99px;
  border: 0.5px solid;
}

.place-card-edit-btn {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  flex-shrink: 0;
  padding: 0;
  opacity: 0;
  transition: opacity 0.1s, color 0.1s, background 0.1s;
}
.place-card:hover .place-card-edit-btn { opacity: 1; }
.place-card-edit-btn:hover { color: var(--text); background: rgba(0,0,0,0.06); }
@media (prefers-color-scheme: dark) {
  .place-card-edit-btn:hover { background: rgba(255,255,255,0.08); }
}

#map { flex: 1; z-index: 0; }

/* ── Leaflet popup ────────────────────────────────────────────── */

.pp-wrapper .leaflet-popup-content-wrapper {
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  border: 0.5px solid rgba(0,0,0,0.12);
  padding: 0;
  overflow: hidden;
}
.pp-wrapper .leaflet-popup-content { margin: 0; min-width: 200px; }
.pp-wrapper .leaflet-popup-tip-container { display: none; }

.place-popup { padding: 14px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }

.pp-photo {
  width: 100%;
  height: 110px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
  margin-bottom: 10px;
}

.pp-photos {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  margin-bottom: 10px;
  border-radius: 6px;
  scrollbar-width: none;
}
.pp-photos::-webkit-scrollbar { display: none; }
.pp-photo-multi {
  width: auto;
  flex-shrink: 0;
  height: 110px;
  border-radius: 6px;
  object-fit: cover;
  margin-bottom: 0;
}

.pp-name {
  font-size: 14px;
  font-weight: 700;
  color: #1a1a18;
  margin-bottom: 3px;
  line-height: 1.3;
}

.pp-type {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #9a9a94;
  margin-bottom: 4px;
}

.pp-address {
  font-size: 12px;
  color: #9a9a94;
  margin-bottom: 8px;
}
.pp-address a { color: inherit; text-decoration: none; }
.pp-address a:hover { text-decoration: underline; }

.pp-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}

.pp-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 99px;
  border: 0.5px solid;
}

.pp-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.pp-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #5a5a56;
  text-decoration: none;
}
.pp-link:hover { color: #1a1a18; text-decoration: underline; }
.pp-link svg { opacity: 0.7; flex-shrink: 0; }

.pp-notes {
  font-size: 12px;
  color: #5a5a56;
  line-height: 1.5;
  margin-bottom: 10px;
  border-top: 0.5px solid rgba(0,0,0,0.08);
  padding-top: 9px;
}

.pp-edit {
  width: 100%;
  background: none;
  border: 0.5px solid rgba(0,0,0,0.14);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  color: #5a5a56;
  transition: background 0.1s;
}
.pp-edit:hover { background: rgba(0,0,0,0.04); color: #1a1a18; }

/* ── Place form modal ─────────────────────────────────────────── */

.place-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.place-modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.place-modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 32px 28px 24px;
  max-width: 440px;
  width: 92%;
  max-height: 88vh;
  overflow-y: auto;
  position: relative;
  transform: translateY(12px);
  transition: transform 0.2s;
}
.place-modal-overlay.open .place-modal { transform: translateY(0); }

.place-modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 20px;
  letter-spacing: -0.01em;
}

.place-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.place-form-coords {
  display: flex;
  gap: 12px;
}

.form-hint {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 4px;
  min-height: 15px;
  line-height: 1.4;
}
.form-hint-ok   { color: #2d7a4f; }
.form-hint-warn { color: #9a6800; }
@media (prefers-color-scheme: dark) {
  .form-hint-ok   { color: #5fba80; }
  .form-hint-warn { color: #e0a040; }
}

.form-textarea {
  resize: vertical;
  min-height: 70px;
  line-height: 1.5;
}

.place-form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 4px;
  border-top: 0.5px solid var(--border);
  margin-top: 4px;
}

/* ── Current user button ──────────────────────────────────────── */

.current-user-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  cursor: pointer;
  background: var(--surface);
  font-family: inherit;
  transition: background 0.12s;
  white-space: nowrap;
}
.current-user-btn:hover { background: var(--bg); }
.current-user-btn svg { opacity: 0.55; flex-shrink: 0; }

/* ── Place card footer (addedBy + likes) ──────────────────────── */

.place-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 12px 8px;
}

.place-card-added-by {
  font-size: 11px;
  color: var(--text-tertiary);
  font-style: italic;
}

.place-like-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  font-size: 12px;
  font-family: inherit;
  font-weight: 500;
  transition: color 0.1s, background 0.1s;
}
.place-like-btn:hover { background: var(--bg); color: #c0392b; }
.place-like-btn.liked { color: #c0392b; }
.place-like-btn svg { flex-shrink: 0; }

/* ── Popup footer (addedBy + likes) ───────────────────────────── */

.pp-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-top: 0.5px solid rgba(0,0,0,0.08);
  padding-top: 9px;
  margin-bottom: 10px;
}

.pp-like-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.pp-added-by {
  font-size: 11px;
  color: #9a9a94;
  font-style: italic;
}

.pp-like-names {
  font-size: 11px;
  color: #9a9a94;
}

.pp-like-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 0.5px solid rgba(0,0,0,0.14);
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  color: #5a5a56;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.1s, color 0.1s;
}
.pp-like-btn:hover { background: rgba(0,0,0,0.04); color: #c0392b; }
.pp-like-btn.liked { color: #c0392b; border-color: rgba(192,57,43,0.3); background: rgba(192,57,43,0.05); }

/* ── User picker modal ────────────────────────────────────────── */

.user-picker-modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 32px 28px 28px;
  max-width: 360px;
  width: 92%;
  position: relative;
  transform: translateY(12px);
  transition: transform 0.2s;
}
.place-modal-overlay.open .user-picker-modal { transform: translateY(0); }

.user-picker-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.user-picker-chip {
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 99px;
  border: 0.5px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.1s, border-color 0.1s;
}
.user-picker-chip:hover { background: var(--border); }

/* ── Responsive sidebar collapse ─────────────────────────────── */

@media (max-width: 640px) {
  .places-body { flex-direction: column-reverse; }
  .places-sidebar { width: 100%; height: 240px; border-right: none; border-top: 0.5px solid var(--border); }
  #map { flex: 1; min-height: 200px; }
}

/* ── Stays page ───────────────────────────────────────────────── */

.stays-empty {
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--text-tertiary);
  line-height: 1.7;
}

.stay-card {
  border-bottom: 0.5px solid var(--border);
  padding: 16px 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.stay-card:last-child { border-bottom: none; }

.stay-card-main { display: flex; flex-direction: column; gap: 5px; }

.stay-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.stay-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.stay-card-edit-btn {
  border: none;
  background: none;
  padding: 4px;
  cursor: pointer;
  color: var(--text-tertiary);
  border-radius: 6px;
  flex-shrink: 0;
  transition: background 0.1s, color 0.1s;
}
.stay-card-edit-btn:hover { background: var(--bg); color: var(--text); }

.stay-card-place {
  font-size: 12px;
}

.stay-place-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #185FA5;
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
}
.stay-place-link:hover { text-decoration: underline; }

@media (prefers-color-scheme: dark) {
  .stay-place-link { color: #5a9fd4; }
}

.stay-card-dates {
  font-size: 12px;
  color: var(--text-secondary);
}

.stay-card-cost {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.stay-card-notes {
  font-size: 12px;
  color: var(--text-tertiary);
  white-space: pre-wrap;
}

.stay-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.stay-guests-row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.stay-guest-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg);
  border: 0.5px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
}

.stay-added-by {
  font-size: 11px;
  color: var(--text-tertiary);
}

/* Stay modal specific */
.stay-modal {
  max-width: 520px;
}

.stay-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}
.stay-modal-header .place-modal-title {
  margin-bottom: 0;
}
.stay-modal-header .modal-close {
  position: static;
  flex-shrink: 0;
}

.stay-cost-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.stay-cost-meta .form-hint { margin-top: 0; }

/* Stay status badges */
.stay-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 3px 8px;
  border-radius: 99px;
  white-space: nowrap;
  flex-shrink: 0;
}
.stay-badge-booked  { background: #d6f0e0; color: #1a5c35; }
.stay-badge-saved   { background: var(--bg); color: var(--text-tertiary); border: 0.5px solid var(--border-strong); }
.stay-badge-price-confirmed { background: #d6f0e0; color: #1a5c35; }
.stay-badge-price-estimate  { background: var(--bg); color: var(--text-tertiary); border: 0.5px solid var(--border-strong); }

@media (prefers-color-scheme: dark) {
  .stay-badge-booked, .stay-badge-price-confirmed { background: #1c3a28; color: #5fba80; }
}

.stay-cost-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.stay-cost-toggle {
  display: flex;
  background: var(--bg);
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
  flex-shrink: 0;
}

.stay-cost-opt {
  border: none;
  background: none;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  padding: 5px 12px;
  border-radius: 5px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}

.stay-cost-opt-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.stay-cost-input {
  flex: 1;
  min-width: 80px;
}

.stay-currency-select {
  width: auto;
  flex-shrink: 0;
}

.stay-guest-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 4px 0;
}

.stay-guest-chip {
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 99px;
  border: 0.5px solid var(--border-strong);
  background: var(--bg);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}
.stay-guest-chip:hover { background: var(--border); }
.stay-guest-chip.selected {
  background: #185FA5;
  border-color: #185FA5;
  color: #fff;
}

@media (prefers-color-scheme: dark) {
  .stay-guest-chip.selected { background: #2a6fa8; border-color: #2a6fa8; }
}

/* ── Custom date picker ────────────────────────────────────────── */

.dp-display { cursor: pointer; }
.dp-wrap { position: relative; }

.dp-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1999;
  display: none;
}

.dp-panel {
  position: fixed;
  z-index: 2000;
  background: var(--surface);
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 28px rgba(0,0,0,0.18);
  width: 256px;
  display: none;
  user-select: none;
  overflow: hidden;
}

.dp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 8px 6px;
  border-bottom: 0.5px solid var(--border);
}

.dp-month-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.dp-nav {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-secondary);
  padding: 0 5px;
  border-radius: 4px;
  line-height: 1.3;
  font-family: inherit;
  transition: background 0.1s;
}
.dp-nav:hover { background: var(--bg); }

.dp-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 4px 4px 0;
}

.dp-wd {
  text-align: center;
  font-size: 9px;
  font-weight: 700;
  color: var(--text-tertiary);
  padding: 2px 0;
}

.dp-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 2px 4px 8px;
  gap: 1px;
}

.dp-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 34px;
  font-size: 11px;
  color: var(--text);
  cursor: pointer;
  border-radius: 4px;
  gap: 2px;
  transition: background 0.08s;
  padding: 2px 0;
}
.dp-cell.dp-empty { cursor: default; pointer-events: none; }
.dp-cell:not(.dp-empty):not(.dp-selected):hover { background: var(--bg) !important; }
.dp-cell.dp-today .dp-num { color: #185FA5; font-weight: 700; }
.dp-cell.dp-selected { background: #185FA5 !important; border-radius: 4px; }
.dp-cell.dp-selected .dp-num { color: #fff !important; font-weight: 600; }
.dp-cell.dp-selected .dp-strips { opacity: 0.5; }
.dp-cell.dp-selected .dp-dot { background: rgba(255,255,255,0.8) !important; }

.dp-num { line-height: 1; flex-shrink: 0; }

.dp-strips {
  display: flex;
  width: calc(100% - 6px);
  height: 4px;
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
}

.dp-strip {
  flex: 1;
  height: 100%;
}

.dp-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #185FA5;
  flex-shrink: 0;
}

/* ── Routes page ──────────────────────────────────────────── */

.routes-voter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 0.1rem;
}

.routes-voter-label {
  font-size: 12px;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.routes-voter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.voter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface);
  border: 0.5px solid var(--border-strong);
  border-radius: 99px;
  padding: 4px 11px 4px 5px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}
.voter-chip:hover { background: var(--bg); }
.voter-chip.voter-chip-active {
  border-color: var(--vc, #185FA5);
  color: var(--text);
}

.voter-chip-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 7px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.routes-header-hint {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* ── Diagram wrap ─────────────────────────────────────────── */

.routes-diagram-wrap {
  position: relative;
  padding: 1.5rem 1.25rem 1.5rem;
}

/* ── Timeline ─────────────────────────────────────────────── */

.routes-timeline {
  display: flex;
  align-items: center;
  overflow-x: auto;
  padding-bottom: 2px;
  gap: 0;
}

.rt-connector {
  flex: 1;
  min-width: 28px;
  max-width: 60px;
  height: 2px;
  background: var(--border-strong);
  position: relative;
  flex-shrink: 0;
}
.rt-connector::after {
  content: '';
  position: absolute;
  right: -1px;
  top: -4px;
  border-left: 7px solid var(--border-strong);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
}
.rt-connector-dashed {
  background: repeating-linear-gradient(
    90deg,
    rgba(200,130,30,0.45) 0,
    rgba(200,130,30,0.45) 5px,
    transparent 5px,
    transparent 10px
  );
}
.rt-connector-dashed::after {
  border-left-color: rgba(200,130,30,0.45);
}

.rt-node {
  flex-shrink: 0;
  width: 160px;
  border-radius: var(--radius);
  padding: 13px 15px 11px;
  background: var(--surface);
  border: 0.5px solid var(--border-strong);
  position: relative;
}

.rt-node-confirmed {
  border-left: 3px solid var(--border-strong);
}

.rt-node-uncertain {
  border: 1.5px dashed rgba(200,130,30,0.5);
  background: rgba(255,190,60,0.04);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.rt-node-uncertain:hover {
  background: rgba(255,190,60,0.08);
  border-color: rgba(200,130,30,0.7);
}
.rt-node-open {
  background: rgba(255,190,60,0.1) !important;
  border-color: rgba(200,130,30,0.85) !important;
}

.rt-uncertain-pill {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: #9a6800;
  background: rgba(255,190,60,0.28);
  border-radius: 99px;
  padding: 1px 7px;
  margin-bottom: 5px;
}
@media (prefers-color-scheme: dark) {
  .rt-uncertain-pill { color: #e0a040; background: rgba(200,130,30,0.28); }
}

.rt-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
  line-height: 1.3;
}
.rt-sub {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.rt-meta {
  font-size: 11px;
  color: var(--text-tertiary);
}
.rt-caret {
  position: absolute;
  bottom: 8px;
  right: 10px;
  font-size: 8px;
  color: rgba(200,130,30,0.65);
}

/* ── Branch / options area ────────────────────────────────── */

.routes-branches {
  margin-top: 28px;
}

.routes-branch-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 12px;
}

.routes-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}

/* ── SVG connector overlay ────────────────────────────────── */

.routes-svg {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  overflow: visible;
}

/* ── Option cards ─────────────────────────────────────────── */

.opt-card {
  background: var(--surface);
  border: 0.5px solid var(--border-strong);
  border-top: 2.5px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 9px;
  transition: box-shadow 0.12s;
}
.opt-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.07); }

.opt-card-voted {
  border-top-color: #185FA5;
  background: rgba(24,95,165,0.04);
}
@media (prefers-color-scheme: dark) {
  .opt-card-voted { background: rgba(24,95,165,0.08); }
}

.opt-card-add {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 110px;
  border-style: dashed;
  border-top-style: dashed;
  border-top-width: 0.5px;
  background: none;
  cursor: pointer;
}
.opt-card-add:hover { background: var(--bg); box-shadow: none; }

.opt-add-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  padding: 0;
  transition: color 0.1s;
}
.opt-add-btn:hover { color: var(--text-secondary); }
.opt-add-btn svg { opacity: 0.45; }

.opt-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.opt-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.opt-sub {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
}
.opt-nights {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
  padding-top: 1px;
}

.opt-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.opt-tag {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 99px;
  border: 0.5px solid var(--border-strong);
  color: var(--text-secondary);
  background: var(--bg);
}

.opt-notes {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.55;
  flex: 1;
}

.opt-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
  padding-top: 8px;
  border-top: 0.5px solid var(--border);
}

.opt-voters {
  display: flex;
  align-items: center;
}
.opt-voter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 7px;
  font-weight: 700;
  color: #fff;
  border: 1.5px solid var(--surface);
  flex-shrink: 0;
}
.opt-voter + .opt-voter { margin-left: -5px; }

.opt-vote-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg);
  border: 0.5px solid var(--border-strong);
  border-radius: 99px;
  padding: 5px 13px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
  white-space: nowrap;
}
.opt-vote-btn:hover { background: var(--border); color: var(--text); }
.opt-vote-btn.voted {
  background: #185FA5;
  border-color: #185FA5;
  color: #fff;
}
.opt-vote-btn.voted:hover { opacity: 0.88; }

.opt-del-btn {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.1s, background 0.1s;
}
.opt-del-btn:hover { color: #c0392b; background: var(--bg); }

.opt-places-count {
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
}

/* ── Option detail modal ──────────────────────────────────── */

.odm-modal {
  max-width: 600px;
  padding: 32px 28px 24px;
}

.odm-head {
  margin-bottom: 20px;
}

.odm-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.odm-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.odm-sub {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 3px;
}

.odm-nights {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg);
  border: 0.5px solid var(--border-strong);
  border-radius: 99px;
  padding: 4px 12px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 2px;
}

.odm-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 10px;
}

.odm-notes {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

/* ── Places section ───────────────────────────────────────── */

.odm-section {
  border-top: 0.5px solid var(--border);
  padding-top: 18px;
  margin-bottom: 20px;
}

.odm-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.odm-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-tertiary);
}

.odm-places-link {
  font-size: 12px;
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color 0.1s;
}
.odm-places-link:hover { color: var(--text); text-decoration: underline; }

/* ── Place cards grid ─────────────────────────────────────── */

.odm-places-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

@media (max-width: 480px) {
  .odm-places-grid { grid-template-columns: repeat(2, 1fr); }
}

.odm-place-card {
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
}

.odm-photo-wrap {
  position: relative;
  height: 96px;
  background: var(--bg);
  overflow: hidden;
}

.odm-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.odm-photo-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.odm-type-badge {
  position: absolute;
  bottom: 5px;
  left: 5px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  background: rgba(0,0,0,0.55);
  color: #fff;
  border-radius: 3px;
  padding: 2px 6px;
  backdrop-filter: blur(4px);
}

.odm-place-info {
  padding: 8px 9px 9px;
}

.odm-place-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.odm-place-addr {
  font-size: 10px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Empty state ──────────────────────────────────────────── */

.odm-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-tertiary);
}

.odm-empty-icon {
  margin-bottom: 10px;
}

.odm-empty-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.odm-empty-hint {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-tertiary);
}

.odm-empty-hint code {
  font-family: ui-monospace, 'Cascadia Code', 'SF Mono', monospace;
  font-size: 11px;
  background: var(--bg);
  border: 0.5px solid var(--border-strong);
  border-radius: 3px;
  padding: 1px 5px;
  color: var(--text-secondary);
}

/* ── Modal footer ─────────────────────────────────────────── */

.odm-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 0.5px solid var(--border);
  padding-top: 16px;
}

/* Opt-card clickable hint */
.opt-card:not(.opt-card-add) {
  cursor: pointer;
}
.opt-card:not(.opt-card-add):hover {
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
}

/* ── Login page ────────────────────────────────────────────── */

body.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem 1rem;
}

.login-main {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.login-hero {
  text-align: center;
}

.login-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.login-sub {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.login-card {
  background: var(--surface);
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 2rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.login-card-heading {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.login-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.login-btn {
  width: 100%;
  background: var(--text);
  color: var(--surface);
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.12s;
  letter-spacing: -0.01em;
}
.login-btn:hover { opacity: 0.85; }

/* ── Home page ─────────────────────────────────────────────── */

.user-greeting {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.home-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.home-section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-secondary);
}

.home-new-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.trips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.trips-empty {
  text-align: center;
  padding: 4rem 1rem;
  font-size: 14px;
  color: var(--text-tertiary);
}

.trip-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
  display: flex;
  flex-direction: column;
}
.trip-card:hover {
  box-shadow: 0 4px 18px rgba(0,0,0,0.09);
  border-color: var(--border-strong);
}

.trip-card-bar {
  height: 6px;
  flex-shrink: 0;
}

.trip-card-body {
  padding: 1rem 1.1rem 0.75rem;
  flex: 1;
}

.trip-card-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}

.trip-card-date {
  font-size: 11px;
  color: var(--text-tertiary);
}

.trip-card-footer {
  padding: 0.6rem 1.1rem;
  border-top: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.trip-delete-btn {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  padding: 0;
  transition: color 0.1s, background 0.1s;
  opacity: 0;
}
.trip-card:hover .trip-delete-btn { opacity: 1; }
.trip-delete-btn:hover { color: #c0392b; background: var(--bg); }

.trip-create-modal {
  max-width: 400px;
}

.trip-color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.trip-color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.1s;
  padding: 0;
  outline: none;
}
.trip-color-swatch:hover { transform: scale(1.15); }
.trip-color-swatch.selected { border-color: var(--text); transform: scale(1.1); }

/* ── Calendar card toolbar ─────────────────────────────────── */
.cal-card-header {
  flex-wrap: wrap;
  gap: 10px;
}
.cal-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.leg-chips {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
.leg-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px 4px 7px;
  border-radius: 20px;
  border: 1.5px solid transparent;
  background: var(--bg);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: border-color 0.12s, background 0.12s;
  user-select: none;
}
.leg-chip:hover { border-color: var(--border-strong); }
.leg-chip-active {
  border-color: var(--text) !important;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--text);
}
.leg-chip-name { pointer-events: none; }
.leg-chip-del {
  border: none;
  background: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 11px;
  padding: 0 1px;
  line-height: 1;
  margin-left: 1px;
  transition: color 0.1s;
}
.leg-chip-del:hover { color: #c0392b; }

.leg-select-hint {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  background: var(--bg);
  border-top: 0.5px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
}

/* ── Traveler row delete button ────────────────────────────── */
.td-name {
  position: relative;
}
.td-name-label { pointer-events: none; }
.traveler-row-del {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 11px;
  padding: 2px 3px;
  border-radius: 3px;
  opacity: 0;
  transition: opacity 0.1s, color 0.1s;
  pointer-events: none;
}
.td-name:hover .traveler-row-del {
  opacity: 1;
  pointer-events: auto;
}
.traveler-row-del:hover { color: #c0392b; }

/* ── Leg-assign picker buttons ─────────────────────────────── */
.lap-legs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 20px;
}
.lap-leg-btn {
  display: flex;
  align-items: center;
  padding: 6px 13px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.1s, border-color 0.1s;
}
.lap-leg-btn:hover { background: var(--surface); border-color: var(--border-strong); }

/* ── Traveler chip (used in traveler popup pick list) ──────── */
.tc-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ── Overview page: shared popup ──────────────────────────── */
.ov-popup-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.32);
  z-index: 900;
  align-items: center;
  justify-content: center;
}
.ov-popup-overlay.open { display: flex; }
.ov-popup {
  background: var(--surface);
  border-radius: 14px;
  padding: 24px;
  width: 340px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ov-popup-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0;
}
.ov-popup-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 14px;
  margin-top: 4px;
}
.ov-popup-confirm-btn {
  background: var(--text);
  color: var(--surface);
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.ov-popup-confirm-btn:hover { opacity: 0.82; }
.ov-popup-divider {
  height: 0.5px;
  background: var(--border);
  margin: 2px 0;
}

/* ── Leg cards ─────────────────────────────────────────────── */
.legs-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 0 8px;
}
.ov-empty-hint {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 10px 0 6px;
}
.leg-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 9px;
  border: 0.5px solid var(--border);
  background: var(--bg);
  cursor: grab;
  user-select: none;
  transition: box-shadow 0.1s, opacity 0.15s;
}
.leg-card:active { cursor: grabbing; }
.leg-card.dragging { opacity: 0.4; box-shadow: 0 2px 12px rgba(0,0,0,0.1); }
.leg-drag-handle {
  color: var(--text-tertiary);
  font-size: 16px;
  line-height: 1;
  cursor: grab;
  padding: 0 2px;
}
.leg-color-bar {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  flex-shrink: 0;
}
.leg-name {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
}
.leg-delete-btn {
  border: none;
  background: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 13px;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.1s, background 0.1s;
}
.leg-delete-btn:hover { color: #c0392b; background: #fef0ef; }

/* ── Traveler chips ────────────────────────────────────────── */
.travelers-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0 12px;
}
.traveler-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px 6px 7px;
  border-radius: 20px;
  border: 0.5px solid var(--border);
  background: var(--bg);
  font-size: 13px;
}
.tc-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}
.tc-name { font-weight: 500; }
.tc-remove {
  border: none;
  background: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 11px;
  padding: 1px 3px;
  border-radius: 3px;
  line-height: 1;
  transition: color 0.1s;
}
.tc-remove:hover { color: #c0392b; }

/* ── Schedule grid ─────────────────────────────────────────── */
.schedule-grid {
  padding-top: 4px;
  overflow-x: auto;
}
.sched-table {
  border-collapse: collapse;
  min-width: 100%;
  font-size: 13px;
}
.sched-table th,
.sched-table td {
  padding: 8px 14px;
  text-align: left;
  white-space: nowrap;
}
.sched-table thead th {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 0.5px solid var(--border);
  padding-bottom: 10px;
}
.sched-table tbody tr + tr td { border-top: 0.5px solid var(--border); }
.sched-name-col { width: 100px; }
.sched-traveler { font-weight: 600; font-size: 13px; }
.sched-leg-head {
  display: flex;
  align-items: center;
  gap: 6px;
}
.sched-leg-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}
.sched-cell {
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.1s;
}
.sched-cell:hover { background: var(--bg); }
.sched-dates { font-weight: 500; }
.sched-add {
  color: var(--text-tertiary);
  font-size: 12px;
}
.sched-cell:hover .sched-add { color: var(--text-secondary); }

/* ── Contact pick list ─────────────────────────────────────── */
.contact-pick-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 180px;
  overflow-y: auto;
}
.contact-pick-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.1s;
}
.contact-pick-item:hover { background: var(--bg); }

/* ── Calendar empty state ──────────────────────────────────── */
.cal-empty {
  padding: 24px 0 12px;
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
}

/* ── Date picker ───────────────────────────────────────────── */
.date-picker-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.date-picker-overlay.open { display: flex; }
.date-picker-popup {
  background: var(--surface);
  border-radius: 16px;
  width: min(92vw, 840px);
  box-shadow: 0 10px 50px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.date-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 14px;
  border-bottom: 0.5px solid var(--border);
  font-weight: 600;
  font-size: 15px;
}
.date-picker-strip-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 16px 20px 12px;
  scrollbar-width: thin;
}
.date-picker-strip {
  display: flex;
  gap: 0;
  align-items: flex-start;
}
.dp-month {
  flex-shrink: 0;
}
.dp-month + .dp-month {
  border-left: 0.5px solid var(--border);
  margin-left: 8px;
  padding-left: 8px;
}
.dp-month-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0 2px 8px 2px;
  white-space: nowrap;
}
.dp-days-row {
  display: flex;
  gap: 2px;
}
.dp-day {
  width: 30px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  flex-shrink: 0;
  transition: background 0.08s, color 0.08s;
  font-weight: 500;
}
.dp-day:hover:not(.dp-start):not(.dp-end) { background: var(--bg); }
.date-picker-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px 16px;
  border-top: 0.5px solid var(--border);
}
.dp-range-label {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ── People section ─────────────────────────────────────────────── */
.people-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 4px 0;
}
.person-card {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  cursor: pointer;
  min-width: 200px;
  max-width: 280px;
  transition: background 0.13s;
}
.person-card:hover { background: var(--bg); }
.person-av-wrap {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}
.person-photo {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 50%;
  position: absolute;
  inset: 0;
}
.person-initials { position: relative; }
.person-card-body { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.person-name { font-size: 13px; font-weight: 600; color: var(--text); }
.person-email { font-size: 10px; color: var(--text-tertiary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-legs { display: flex; flex-direction: column; gap: 3px; margin-top: 1px; }
.person-leg-row { display: flex; align-items: center; gap: 6px; }
.person-leg-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.person-leg-name { font-size: 11px; font-weight: 600; color: var(--text-secondary); }
.person-leg-dates { font-size: 11px; color: var(--text-tertiary); }
.person-no-legs { font-size: 11px; color: var(--text-tertiary); font-style: italic; }

/* ── Person profile modal ───────────────────────────────────────── */
.person-modal {
  max-width: 400px;
  width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px 24px 20px;
  position: relative;
}
.person-modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1;
}
.person-modal-close:hover { background: var(--bg); }
.pm-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}
.pm-photo {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.pm-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 22px;
  flex-shrink: 0;
}
.pm-info { display: flex; flex-direction: column; gap: 5px; }
.pm-name { font-size: 18px; font-weight: 700; color: var(--text); }
.pm-link { font-size: 13px; color: var(--text-secondary); text-decoration: none; }
.pm-link:hover { text-decoration: underline; }
.pm-notes {
  font-size: 13px;
  color: var(--text-secondary);
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 4px;
  line-height: 1.5;
}
.person-modal .modal-tags { justify-content: flex-start; margin-bottom: 0; margin-top: 10px; }

/* Sync badge */
.sync-badge {
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
}

/* ── Trip card — member dots ────────────────────────────────── */
.trip-card-footer {
  justify-content: space-between;
}

.trip-card-members {
  display: flex;
  align-items: center;
  gap: 4px;
}

.trip-member-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 9px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0;
}

.trip-icon-btn {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  padding: 0;
  transition: color 0.1s, background 0.1s;
  opacity: 0;
}
.trip-card:hover .trip-icon-btn { opacity: 1; }
.trip-icon-btn:hover { color: var(--text); background: var(--bg); }

/* ── Members modal ──────────────────────────────────────────── */
.members-current {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.member-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  border-radius: 8px;
}

.member-row-av {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.member-row-name {
  font-size: 14px;
  color: var(--text);
}

/* ── Contact picker avatar (used in members modal + traveler picker) */
.cp-av {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ── Contacts section ───────────────────────────────────────── */
.contacts-list {
  border-radius: var(--radius);
  min-height: 60px;
  transition: background 0.15s;
}

.contacts-list.drop-active {
  background: var(--surface);
  outline: 2px dashed var(--border-strong);
  outline-offset: -2px;
}

.contacts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}

.contacts-empty {
  font-size: 13px;
  color: var(--text-tertiary);
  padding: 1.5rem 0;
  text-align: center;
  margin: 0;
}

.contact-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
}

.contact-chip-av {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.contact-chip-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.contact-chip-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-chip-detail {
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
