/* CampSavvy web trip planner — builds on ../style.css (colors, fonts, .brand) */

:root { color-scheme: light; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { color-scheme: dark; } }
body.tp { font-size: 15px; line-height: 1.45; height: 100vh; display: flex; flex-direction: column; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.tp-top { display: flex; align-items: center; gap: 14px; padding: 10px 18px; border-bottom: 1px solid var(--border); background: var(--bg); flex: none; }
.tp-top .brand { font-size: 18px; }
.tp-title { font-weight: 800; color: var(--muted); padding-left: 14px; border-left: 1px solid var(--border); }
.tp-top-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.tp-save { font-size: 13px; color: var(--muted); font-weight: 700; }
.tp-save.ok { color: var(--primary); }
.tp-save.bad { color: var(--red); }

.tp-link { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; color: var(--primary); cursor: pointer; text-decoration: none; }
.tp-link:hover { text-decoration: underline; }
.tp-link.danger { color: var(--red); margin: 18px 0 8px; }

.tp-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 999px; background: var(--primary); color: #fff;
  font: inherit; font-weight: 800; padding: 11px 20px; cursor: pointer; }
.tp-btn:hover { background: var(--primary-dark); }
.tp-btn:disabled { opacity: .55; cursor: default; }
.tp-btn.small { padding: 8px 14px; font-size: 14px; }
.tp-btn.soft { background: var(--teal-bg); color: var(--teal-text); }

input, select { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 9px 12px; min-width: 0; }
input:focus, select:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
label { display: block; font-weight: 700; margin: 10px 0 6px; }

.tp-center { flex: 1; display: grid; place-items: center; padding: 24px 16px; }
.tp-spin { width: 34px; height: 34px; border-radius: 50%; border: 4px solid var(--border); border-top-color: var(--primary); animation: tpspin .8s linear infinite; }
@keyframes tpspin { to { transform: rotate(360deg); } }

.tp-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; box-shadow: 0 20px 50px rgba(20, 50, 74, .08); }
.tp-auth { width: 100%; max-width: 440px; }
.tp-auth h1 { font-size: 24px; line-height: 1.2; margin: 0 0 8px; }
.tp-auth form input { width: 100%; }
.tp-auth form .tp-btn { width: 100%; margin-top: 12px; }
.tp-auth .tp-link { display: block; margin: 12px auto 0; }
.tp-tabs { display: flex; background: var(--surface); border-radius: 999px; padding: 4px; margin: 18px 0 14px; }
.tp-tabs button { flex: 1; border: 0; background: none; font: inherit; font-weight: 800; color: var(--muted); border-radius: 999px; padding: 8px; cursor: pointer; }
.tp-tabs button.on { background: var(--bg); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .08); }
.tp-steps { margin: 0 0 10px; padding-left: 20px; }
.tp-steps li { margin: 3px 0; }
.tp-code { font-size: 34px; font-weight: 900; letter-spacing: 4px; text-align: center; background: var(--teal-bg); color: var(--teal-text); border-radius: 16px; padding: 14px; font-variant-numeric: tabular-nums; }
.tp-err { color: var(--red); font-weight: 700; margin: 10px 0 0; }

/* Planner */
.tp-app { flex: 1; display: grid; grid-template-columns: 420px minmax(0, 1fr); min-height: 0; }
.tp-panel { overflow-y: auto; padding: 16px 18px 30px; border-right: 1px solid var(--border); min-width: 0; }
.tp-mapwrap { position: relative; min-height: 0; }
.tp-map { position: absolute; inset: 0; background: var(--surface); }
.tp-mapoff { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-weight: 700; padding: 20px; text-align: center; }

.tp-tripbar { display: flex; gap: 8px; margin-bottom: 14px; }
.tp-tripbar select { flex: 1; font-weight: 700; }
.tp-empty { text-align: center; padding: 40px 10px; }
.tp-empty h2 { margin: 0 0 6px; }
.tp-name { width: 100%; font-size: 22px; font-weight: 900; border: 0; background: none; padding: 4px 0; border-radius: 0; border-bottom: 2px solid transparent; }
.tp-name:focus { outline: 0; border-bottom-color: var(--primary); }

.tp-totals { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; background: var(--teal-bg); color: var(--teal-text); border-radius: 18px; padding: 14px 16px; margin: 10px 0 6px; }
.tp-totals .k { font-size: 12px; font-weight: 700; opacity: .8; }
.tp-totals .v { font-size: 19px; font-weight: 900; }
.tp-totals .wide { grid-column: 1 / -1; }

.tp-stops { list-style: none; padding: 0; margin: 14px 0 10px; }
.tp-stop { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center; background: var(--surface); border-radius: 14px; padding: 10px 12px; cursor: grab; border: 2px solid transparent; }
.tp-stop.drag { opacity: .4; }
.tp-stop.over { border-color: var(--primary); }
.tp-num { width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 900; font-size: 13px; display: grid; place-items: center; }
.tp-stop .nm { font-weight: 800; overflow-wrap: anywhere; }
.tp-stop .sub { font-size: 12px; color: var(--muted); }
.tp-nights { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 13px; font-weight: 700; color: var(--muted); }
.tp-nights button, .tp-arrows button { width: 24px; height: 24px; border-radius: 50%; border: 0; background: var(--bg); color: var(--text); font: inherit; font-weight: 900; cursor: pointer; line-height: 1; }
.tp-nights button:hover, .tp-arrows button:hover:not(:disabled) { background: var(--teal-bg); color: var(--teal-text); }
.tp-arrows { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.tp-arrows button:disabled { opacity: .3; cursor: default; }
.tp-arrows .rm { font-size: 12px; width: auto; background: none; color: var(--red); font-weight: 700; padding: 0 2px; }
.tp-leg { margin: 0 0 0 24px; padding: 6px 0 6px 18px; border-left: 2px dashed var(--border); font-size: 13px; color: var(--muted); font-weight: 700; }
.tp-leg .over { display: block; color: var(--orange); }

.tp-gmaps { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 2px; }
.tp-gmaps .tp-btn { text-decoration: none; }
.tp-gmaps .muted { flex-basis: 100%; }
.tp-stop .nm.link { cursor: pointer; text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 3px; }
.tp-stop .nm.link:hover { text-decoration-color: var(--primary); }
.tp-stoplinks { display: flex; gap: 12px; margin-top: 6px; font-size: 13px; font-weight: 800; }
.tp-stoplinks a, .tp-stoplinks button { color: var(--primary); background: none; border: 0; padding: 0; font: inherit; cursor: pointer; text-decoration: none; }
.tp-stopinfo { grid-column: 1 / -1; background: var(--bg); border-radius: 12px; padding: 10px 12px; font-size: 13px; }
.tp-stopinfo .sub { color: var(--muted); }
.tp-stopinfo a { color: var(--primary); font-weight: 700; margin-right: 12px; }
.tp-layers { position: absolute; top: 10px; left: 10px; display: flex; flex-wrap: wrap; gap: 6px; max-width: calc(100% - 70px); z-index: 2; }
.tp-layers button { border: 0; border-radius: 999px; padding: 7px 13px; font: inherit; font-size: 13px; font-weight: 800; background: #fff; color: #14324a; box-shadow: 0 2px 8px rgba(0,0,0,.18); cursor: pointer; }
.tp-layers button.on { background: #14324a; color: #fff; }
.tp-area { position: absolute; top: 54px; left: 50%; transform: translateX(-50%); z-index: 2; border: 0; border-radius: 999px; padding: 8px 16px; font: inherit; font-size: 13px; font-weight: 800; background: #fff; color: #0f8b76; box-shadow: 0 2px 8px rgba(0,0,0,.2); cursor: pointer; }
.tp-area:hover { background: #f0faf7; }
.tp-landkey { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 4px 10px; background: rgba(255,255,255,.92); color: #14324a; border-radius: 10px; padding: 6px 10px; font-size: 12px; font-weight: 700; }
.tp-landkey i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.tp-card { border-radius: 14px; padding: 12px 14px; margin: 10px 0; font-size: 13px; }
.tp-card b { display: block; font-size: 14px; margin-bottom: 4px; }
.tp-card .row { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; cursor: pointer; }
.tp-card .row:hover { text-decoration: underline; }
.tp-card .fine { opacity: .8; margin-top: 6px; }
.tp-card.fire { background: var(--red-bg); color: var(--red-text); }
.tp-card.grade { background: var(--orange-bg); color: var(--orange-text); }
.tp-card.flat { background: var(--teal-bg); color: var(--teal-text); }
.tp-card.due { background: var(--purple-bg); color: var(--purple-text); }
.tp-card.wind { background: var(--blue-bg); color: var(--blue-text); }
.tp-wx { font-size: 12px; color: var(--muted); margin-top: 4px; }
.tp-wx .alert { color: var(--red); font-weight: 800; display: block; }
.tp-exp { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); }
.tp-exp h3 { margin: 0 0 6px; font-size: 17px; display: flex; justify-content: space-between; }
.tp-exp .budget { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-weight: 700; }
.tp-exp .budget input { width: 110px; }
.tp-exp .cats { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); margin: 6px 0 10px; }
.tp-exp form { display: grid; grid-template-columns: auto 90px 1fr auto; gap: 6px; }
.tp-exp ul { list-style: none; padding: 0; margin: 10px 0 0; }
.tp-exp li { display: flex; gap: 8px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.tp-exp li .n { flex: 1; color: var(--muted); overflow-wrap: anywhere; }
.tp-exp li button { border: 0; background: none; color: var(--muted); cursor: pointer; font: inherit; }
.tp-over { color: var(--red); }
.tp-vehpanel { background: var(--surface); border-radius: 14px; padding: 12px; margin: 6px 0 10px; font-size: 13px; }
.tp-vehpanel .veh { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.tp-vehpanel .veh b { display: block; font-size: 14px; }
.tp-vehpanel .veh .acts { display: flex; gap: 10px; align-items: center; white-space: nowrap; }
.tp-vehpanel form { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 8px; margin-top: 10px; }
.tp-vehpanel form label { margin: 0; font-size: 12px; color: var(--muted); }
.tp-vehpanel form input, .tp-vehpanel form select { width: 100%; }
.tp-vehpanel form .wide { grid-column: 1 / -1; }
.tp-day select { flex: 1; font-weight: 700; }
.tp-day { display: flex; align-items: center; gap: 8px; margin: 12px 0 4px; font-weight: 700; }
.tp-day label { margin: 0; }
.tp-day input { width: 86px; text-align: center; font-weight: 800; }
.tp-day input[type="date"] { width: auto; min-width: 160px; }
.tp-daynote { background: var(--yellow-bg); color: var(--yellow-text); border-radius: 14px; padding: 10px 12px; font-size: 13px; margin: 8px 0; }
.tp-daynote b { display: block; font-size: 14px; }
.tp-daynote .tp-btn { margin-top: 8px; }
.tp-daybtn { display: inline-block; margin-top: 6px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; font-size: 12px; font-weight: 800;
  border-radius: 999px; padding: 3px 10px; cursor: pointer; }
.tp-daybtn:hover { border-color: var(--yellow); }
.tp-daybtn.on { background: var(--yellow); border-color: var(--yellow); color: #3b2a00; }
.tp-add { display: flex; gap: 8px; }
.tp-add input { flex: 1; }
.tp-find { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); }
.tp-find h3 { margin: 0 0 10px; font-size: 17px; }
.tp-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.tp-chips button { border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; font-size: 13px; font-weight: 700; border-radius: 999px; padding: 4px 10px; cursor: pointer; }
.tp-chips button:hover { border-color: var(--primary); }
.tp-results { list-style: none; padding: 0; margin: 8px 0 0; }
.tp-results li { display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: center; padding: 9px 4px; border-bottom: 1px solid var(--border); cursor: pointer; }
.tp-results li:hover, .tp-results li.on { background: var(--surface); }
.tp-dot { width: 12px; height: 12px; border-radius: 50%; }
.tp-results .nm { font-weight: 800; }
.tp-results .sub { font-size: 12px; color: var(--muted); }

.tp-warn { margin-top: 22px; background: var(--orange-bg); color: var(--orange-text); border-radius: 14px; padding: 12px 14px; font-size: 13px; }

/* Map info window (Google draws it white in both themes) */
.tp-iw { font-family: "Nunito", system-ui, sans-serif; color: #14324a; max-width: 260px; font-size: 14px; }
.tp-iw b { font-size: 15px; display: block; margin-bottom: 2px; }
.tp-iw .sub { color: #647585; font-size: 12px; margin-bottom: 8px; }
.tp-iw a { color: #0f8b76; font-weight: 700; margin-right: 10px; }
.tp-iw .tp-btn { margin-top: 10px; width: 100%; }
.tp-iw.inline { grid-column: 1 / -1; max-width: none; color: var(--text); background: var(--bg); border-radius: 12px; padding: 12px; cursor: default; }
.tp-iw.inline .sub { color: var(--muted); }
.tp-iw.inline a { color: var(--primary); }

.tp-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #14324a; color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 700; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); z-index: 10; max-width: calc(100% - 32px); }

@media (max-width: 860px) {
  body.tp { height: auto; min-height: 100vh; }
  .tp-title { display: none; }
  .tp-app { grid-template-columns: minmax(0, 1fr); }
  .tp-panel { border-right: 0; overflow: visible; padding: 14px 16px 30px; }
  .tp-mapwrap { order: -1; height: 46vh; }
}
