/* Trip Packing (trips-ui.js). Scoped to the Trips sheet and the calendar entry. */
.cal-head-actions { display: flex; gap: 8px; align-items: center; flex: 0 0 auto; }
.trips-open { display: inline-flex; align-items: center; gap: 6px; }
.cal-day .cal-trip { position: absolute; z-index: 2; right: 4px; bottom: 4px; width: 7px; height: 7px; border-radius: 50%; background: var(--sage); box-shadow: 0 0 0 2px var(--surface-2); }
.cal-day.cal-trip-day { border-color: color-mix(in srgb, var(--sage) 55%, transparent); }
.weather-credit { margin: 10px 2px 0; font-size: 12px; }
.weather-credit a, .trip-credit a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }

.trips-dialog { height: 94dvh; }
.trips-dialog .trips-content { height: 94dvh; box-sizing: border-box; padding-top: 6px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.trips-dialog * { box-sizing: border-box; }
.trips-content .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.trip-head { position: sticky; top: -6px; z-index: 3; display: grid; grid-template-columns: 40px minmax(0, 1fr) 40px; align-items: center; gap: 6px; margin: 0 -4px 12px; padding: 10px 0 10px; background: var(--surface); }
.trip-head-text { min-width: 0; text-align: center; }
.trip-head h2 { margin: 0; font-size: 24px; line-height: 1.15; overflow-wrap: anywhere; }
.trip-head p { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.trip-head .close-button { justify-self: end; }
.trip-head-gap { width: 40px; }
.trip-icon-btn { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: var(--surface-2); color: var(--ink); }

.trip-new { margin-bottom: 16px; }
.trip-list { display: grid; gap: 10px; margin-bottom: 16px; }
.trip-card { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%; padding: 12px; text-align: left; border: 1px solid var(--line); border-radius: 18px; background: var(--surface-2); color: var(--ink); }
.trip-card-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; background: var(--hero); color: var(--on-hero); }
.trip-card-text { min-width: 0; display: grid; gap: 2px; }
.trip-card-text b { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trip-card-text small, .trip-card-side small { color: var(--muted); font-size: 12px; }
.trip-card-side { display: grid; justify-items: end; gap: 4px; }
.trip-status { font-size: 11px; font-weight: 800; letter-spacing: .04em; padding: 3px 8px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); }
.trip-status.now { background: var(--hero); color: var(--on-hero); border-color: var(--hero); }
.trip-status.past { color: var(--muted); }
.trip-empty { text-align: center; padding: 26px 18px; border: 1px dashed var(--line); border-radius: 20px; color: var(--muted); }
.trip-empty span { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--surface-2); color: var(--ink); }
.trip-empty p { margin: 12px 0 0; line-height: 1.5; }
.trip-past-label { margin-top: 8px; }

/* setup */
.trip-city-wrap { position: relative; margin-bottom: 16px; }
.trip-city-list { display: grid; gap: 6px; margin-top: 6px; }
.trip-city-list:empty { display: none; }
.trip-city-opt { display: grid; gap: 1px; width: 100%; text-align: left; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); color: var(--ink); }
.trip-city-opt b { font-size: 15px; }
.trip-city-opt small { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.trip-city-note { margin: 4px 2px; color: var(--muted); font-size: 12.5px; }
.trip-dates { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.trip-dates label { min-width: 0; }
.trip-dates input[type="date"] { min-width: 0; width: 100%; min-height: 46px; -webkit-appearance: none; appearance: none; color: var(--ink); }
.trip-hint { color: var(--muted); font-size: 12.5px; line-height: 1.45; margin: 10px 2px 14px; }
.trip-error { color: var(--danger, #a03732); font-size: 13px; font-weight: 700; margin: 0 2px 10px; min-height: 0; }
.trip-error:empty { display: none; }
.trip-question { font-size: 18px; font-weight: 800; margin: 2px 2px 4px; }
.trip-needs, .trip-rules { display: grid; gap: 8px; margin-bottom: 14px; }
.trip-need { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 10px 10px 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2); }
.trip-need:not(.on) .trip-need-name b { color: var(--muted); }
.trip-need-name { min-width: 0; display: grid; gap: 1px; }
.trip-need-name b { font-size: 15px; overflow-wrap: anywhere; }
.trip-need-name small { color: var(--muted); font-size: 12px; }
.trip-stepper { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px; }
.trip-stepper button { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 19px; line-height: 1; }
.trip-stepper button:disabled { opacity: .35; }
.trip-stepper output { min-width: 34px; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }
.trip-toggle { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2); }
.trip-toggle input { flex: 0 0 auto; width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--hero); }
.trip-toggle span { display: grid; gap: 2px; min-width: 0; }
.trip-toggle small { color: var(--muted); font-size: 12px; line-height: 1.4; }
.trip-toggle.compact { margin: 0; padding: 10px 12px; align-items: center; flex: 1 1 auto; }
.trip-toggle.compact input { margin: 0; }

/* trip view */
.trip-busy { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); color: var(--muted); font-weight: 700; margin: 0 0 12px; }
.trip-spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--sage); animation: tripSpin .8s linear infinite; }
@keyframes tripSpin { to { transform: rotate(360deg); } }
.trip-changes { padding: 13px 14px; margin-bottom: 12px; border-radius: 16px; background: var(--warn-bg, #f7ecc9); color: var(--warn-ink, #5b4710); }
.trip-changes ul { margin: 6px 0 8px; padding-left: 18px; line-height: 1.45; }
.trip-change-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.trip-change-actions .secondary-button { flex: 0 1 auto; padding: 10px 14px; }
.trip-change-actions .text-button { color: inherit; }
.trip-tabs { position: sticky; top: 60px; z-index: 2; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.trip-tabs button { min-height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 800; font-size: 14px; }
.trip-tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.trip-count { font-variant-numeric: tabular-nums; font-weight: 700; opacity: .8; }
.trip-days { display: grid; gap: 12px; }
.trip-day { padding: 14px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface-2); }
.trip-day.is-today { border-color: var(--sage); }
.trip-day-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.trip-day-top h3 { margin: 0; font-size: 16px; }
.trip-day-top h3 span { color: var(--muted); font-weight: 650; font-size: 13.5px; margin-left: 4px; }
.trip-src { font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 99px; white-space: nowrap; }
.trip-src.forecast { background: var(--hero); color: var(--on-hero); }
.trip-src.typical { background: var(--surface); border: 1px solid var(--line); color: var(--muted); white-space: normal; }
.trip-wx { display: grid; grid-template-columns: 34px auto minmax(0, 1fr); align-items: center; gap: 10px; }
.trip-wx.none { display: block; color: var(--muted); font-size: 13px; }
.trip-wx-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--hero); color: var(--on-hero); }
.trip-wx-icon svg { width: 19px; height: 19px; }
.trip-wx-temps { display: grid; font-variant-numeric: tabular-nums; font-size: 15px; white-space: nowrap; }
.trip-wx-temps b { font-size: 18px; }
.trip-wx-temps small { color: var(--muted); font-size: 12px; }
.trip-wx-sum { justify-self: end; text-align: right; color: var(--muted); font-size: 13px; font-weight: 650; }
.trip-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.trip-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 9px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.trip-chip.warn { background: var(--warn-bg, #f7ecc9); color: var(--warn-ink, #5b4710); border-color: transparent; }
.trip-notes { margin: 8px 0 0; padding-left: 18px; color: var(--ink); font-size: 12.5px; line-height: 1.45; }
.trip-cover { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; font-weight: 700; }
.trip-cover input { width: 19px; height: 19px; accent-color: var(--hero); }
.trip-outfit { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.trip-outfit-top { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.trip-group-tag { flex: 1 1 auto; min-width: 0; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trip-move select { min-height: 36px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; }
.trip-swap { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px; min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); color: var(--ink); font-weight: 800; font-size: 13px; }
.trip-pieces { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 7px; }
.trip-piece { position: relative; aspect-ratio: 1; border-radius: 12px; background: var(--lay); overflow: hidden; display: grid; place-items: center; color: #77776f; font-weight: 800; }
.trip-piece img { width: 100%; height: 100%; object-fit: cover; }
.trip-piece img.is-cut { object-fit: contain; padding: 5px; }
.trip-piece.over { box-shadow: inset 0 0 0 2px var(--warn-ink, #b08a1c); }
.trip-piece i { position: absolute; right: 3px; top: 3px; font-style: normal; font-size: 10px; font-weight: 800; padding: 1px 5px; border-radius: 99px; background: var(--warn-bg, #f7ecc9); color: var(--warn-ink, #5b4710); }
.trip-empty-outfit, .trip-warn-line { margin: 0; font-size: 13px; line-height: 1.45; color: var(--warn-ink, #5b4710); background: var(--warn-bg, #f7ecc9); padding: 9px 11px; border-radius: 12px; }
.trip-warn-line { margin-top: 8px; }
.trip-foot-actions { margin-top: 16px; }
.trip-delete { display: block; margin: 14px auto 0; color: var(--danger, #a03732); }
.trip-credit { text-align: center; margin: 16px 0 6px; font-size: 12px; }

/* packing */
.trip-progress { display: grid; gap: 9px; padding: 14px; border-radius: 18px; background: var(--hero); color: var(--on-hero); margin-bottom: 10px; }
.trip-progress div { display: grid; gap: 2px; }
.trip-progress b { font-size: 17px; }
.trip-progress small { opacity: .8; font-size: 12.5px; }
.trip-bar { display: block; height: 7px; border-radius: 99px; background: rgba(255,255,255,.22); overflow: hidden; }
.trip-bar i { display: block; height: 100%; border-radius: inherit; background: var(--on-hero); transition: width .25s ease; }
.trip-pack-tools { display: flex; gap: 8px; align-items: stretch; margin-bottom: 12px; flex-wrap: wrap; }
.trip-pack-tools .secondary-button { flex: 0 0 auto; }
.trip-overworn { padding: 12px 14px; border-radius: 16px; margin-bottom: 12px; background: var(--warn-bg, #f7ecc9); color: var(--warn-ink, #5b4710); font-size: 13px; }
.trip-overworn ul { margin: 6px 0; padding-left: 18px; line-height: 1.45; }
.trip-pack-sec { margin-bottom: 14px; }
.trip-pack-sec .field-label { margin: 0 2px 7px; }
.trip-check { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 7px 10px; margin-bottom: 6px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); color: var(--ink); cursor: pointer; }
.trip-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.trip-box { flex: 0 0 auto; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; border: 2px solid var(--line); background: var(--surface); color: transparent; transition: background .15s, border-color .15s; }
.trip-check input:checked + .trip-box { background: var(--hero); border-color: var(--hero); color: var(--on-hero); }
.trip-check input:focus-visible + .trip-box { outline: 2px solid var(--sage); outline-offset: 2px; }
.trip-check-img { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 10px; object-fit: cover; background: var(--lay); }
.trip-check-img.is-cut { object-fit: contain; padding: 3px; }
.trip-check-text { min-width: 0; display: grid; gap: 1px; }
.trip-check-text b { font-size: 14.5px; overflow-wrap: anywhere; }
.trip-check-text b::first-letter { text-transform: uppercase; }
.trip-check-text small { color: var(--muted); font-size: 12px; }
.trip-check.done .trip-check-text b { color: var(--muted); text-decoration: line-through; }
.trip-check.done .trip-check-img { opacity: .55; }
.trip-rule-actions { margin-top: 4px; }

.trip-toast { position: fixed; z-index: 5; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom, 0px)); max-width: calc(100% - 32px); width: max-content; transform: translate(-50%, 16px); padding: 11px 18px; border-radius: 99px; background: rgba(32, 34, 31, .94); color: #fff; font-size: 13px; text-align: center; opacity: 0; pointer-events: none; transition: opacity .2s, transform .3s; }
.trip-toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 359px) {
  .trip-head h2 { font-size: 21px; }
  .trip-dates { grid-template-columns: 1fr; }
  .trip-wx { grid-template-columns: 30px minmax(0, 1fr); }
  .trip-wx-sum { grid-column: 1 / -1; justify-self: start; text-align: left; }
  .trip-swap span { display: none; }
  .trip-swap { padding: 0 10px; }
}
@media (prefers-reduced-motion: reduce) { .trip-spin { animation: none; } .trip-bar i, .trip-toast { transition: none; } }
.trip-rec { margin: 10px 0 0; padding: 9px 11px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; line-height: 1.45; }
.trip-rec b { color: var(--sage); }
.trip-why { margin: 8px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.trip-alerts { margin: 0 0 12px; padding: 12px 12px 8px 14px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); }
.trip-alerts-title { margin: 0 0 6px; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.trip-alerts ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.trip-alerts li { display: grid; grid-template-columns: 10px minmax(0, 1fr) 34px; gap: 8px; align-items: start; padding: 6px 0; border-top: 1px solid var(--line); }
.trip-alerts li:first-child { border-top: 0; }
.trip-alert-dot { width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--sage); }
.trip-alerts li.essential .trip-alert-dot { background: var(--warn-ink, #6a4e0c); box-shadow: 0 0 0 3px var(--warn-bg, #f6e3b4); }
.trip-alert-text { display: grid; gap: 2px; min-width: 0; }
.trip-alert-text b { font-size: 13.5px; font-weight: 750; line-height: 1.4; }
.trip-alert-text small { color: var(--muted); font-size: 12px; line-height: 1.4; }
.trip-alert-hide { width: 34px; height: 34px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 20px; line-height: 1; }
.trip-alerts .text-button, .trip-alerts-show { padding: 6px 2px; font-size: 12.5px; }

/* What to buy (buys-ui.js): reuses the Trips sheet frame */
.buys-dialog .buy-groups { margin: 0 0 12px; }
.buy-summary { display: flex; align-items: baseline; gap: 8px; padding: 14px 16px; border-radius: 18px; background: var(--hero); color: var(--on-hero); margin-bottom: 12px; }
.buy-summary b { font-size: 34px; line-height: 1; }
.buy-summary span { font-size: 14px; }
.buy-note { margin: 0 2px 10px; font-size: 13.5px; line-height: 1.45; color: var(--muted); }
.buy-label { margin: 16px 2px 8px; }
.buy-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 10px; }
.buy-card { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface-2); }
.buy-swatch { width: 34px; height: 34px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.14); }
.buy-text { min-width: 0; display: grid; gap: 3px; }
.buy-text b { font-size: 15.5px; overflow-wrap: anywhere; }
.buy-text small { color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.buy-text .buy-rescue { color: var(--ink); }
.buy-fit { margin-left: 6px; padding: 1px 7px; border-radius: 99px; border: 1px solid var(--line); font-size: 11px; font-weight: 700; color: var(--muted); vertical-align: 2px; }
.buy-gain { display: grid; justify-items: end; line-height: 1.05; }
.buy-gain b { font-size: 22px; }
.buy-gain small { font-size: 11px; color: var(--muted); }
.buy-plenty { margin-top: 4px; }
.buy-foot { margin: 14px 2px 24px; font-size: 12px; line-height: 1.45; color: var(--muted); }
.buy-wait { margin: 30px 0; text-align: center; color: var(--muted); }
