/* Christmas Lights Map – one stylesheet, mobile first. */
:root {
  --night: #0b1d33;
  --night-2: #13304f;
  --ink: #1b2430;
  --muted: #5f6b7a;
  --line: #dde3ea;
  --bg: #f6f7f9;
  --card: #fff;
  --red: #c62828;
  --red-dark: #9e1c1c;
  --gold: #f6b400;
  --green: #1f8a4c;
  --confirmed: #f6b400;
  --unconfirmed: #7d8ea3;
  --reported: #b23a3a;
  --seen: #1f8a4c;
  --radius: 12px;
  --shadow: 0 6px 24px rgba(11, 29, 51, .18);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink); background: var(--bg);
}
a { color: #1559b5; }
h1, h2 { line-height: 1.2; }
h1 { font-size: 1.6rem; margin: .2em 0 .5em; }
h2 { font-size: 1.15rem; margin: .2em 0 .5em; }
code { background: #eef1f5; padding: 0 .3em; border-radius: 4px; }
.small { font-size: .875rem; }
.muted { color: var(--muted); }
.pre { white-space: pre-line; }
.sr-only, .hp { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; left: -9999px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 8px; top: 8px; z-index: 9999; background: #fff; padding: 8px; }
[hidden] { display: none !important; }

/* Header */
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 12px; background: var(--night); color: #fff; position: relative; z-index: 1001;
}
.brand { color: #fff; text-decoration: none; font-weight: 700; display: flex; align-items: center; gap: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px var(--gold), 14px 0 0 -2px var(--red), 26px 0 0 -2px var(--green); margin-right: 26px; flex: none; }
.site-nav { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.site-nav a, .site-nav .linkish { color: #dfe8f3; text-decoration: none; padding: 6px 8px; border-radius: 8px; font-size: .95rem; }
.site-nav a[aria-current="page"] { background: var(--night-2); color: #fff; }
.site-nav .nav-add { background: var(--red); color: #fff; font-weight: 600; }
@media (max-width: 480px) { .site-nav a[href="/about"] { display: none; } .site-nav a[href="/"] { display: none; } }
.banner { background: #fff4cf; color: #5b4500; text-align: center; padding: 6px 12px; font-size: .9rem; }

/* Buttons + forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--red);
  background: var(--red); color: #fff; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--red-dark); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: #f1f4f7; }
.btn-small { min-height: 34px; padding: 4px 10px; font-size: .9rem; }
.btn-big { min-height: 52px; font-size: 1.05rem; width: 100%; }
.btn-danger { background: #fff; color: var(--red); border-color: var(--red); }
.btn-danger:hover { background: #fdecec; }
.btn-lit { background: var(--gold); border-color: #d99e00; color: #2b2100; }
.btn-lit:hover { background: #e8a900; }
.is-picked { outline: 3px solid rgba(31, 138, 76, .45); outline-offset: 1px; }
.btn.is-picked.btn-ghost { background: #e9f6ee; border-color: var(--green); color: #135a31; }
.linkish { background: none; border: 0; padding: 0; color: #1559b5; font: inherit; cursor: pointer; text-decoration: underline; text-align: left; }
label { display: block; margin: 10px 0; font-weight: 500; }
input[type=text], input[type=search], input[type=email], input[type=password], input[type=number], input:not([type]), select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 10px 12px; font: inherit; font-size: 16px;
  border: 1px solid #c4ccd6; border-radius: 10px; background: #fff; color: var(--ink);
}
textarea { resize: vertical; }
fieldset { border: 0; padding: 0; margin: 10px 0; }
legend { font-weight: 600; margin-bottom: 6px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row input { flex: 1; margin-top: 0; min-width: 0; }
.row.wrap label { margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-weight: 500; cursor: pointer; }
.chip:has(input:checked) { border-color: var(--green); background: #e9f6ee; }
.toggle { display: flex; gap: 10px; align-items: center; font-weight: 500; }
.toggle input { width: 20px; height: 20px; }
.form-msg { min-height: 1.4em; color: var(--red-dark); font-weight: 500; }
.field-error { display: block; color: var(--red); font-size: .875rem; }
.flash { padding: 10px 12px; border-radius: 10px; margin: 8px 0; }
.flash-ok { background: #e9f6ee; color: #135a31; }
.flash-error { background: #fdecec; color: #8a1c1c; }
.flash-warn { background: #fff4cf; color: #5b4500; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.card.narrow { max-width: 420px; margin: 32px auto; }
.card.warn { border-color: #e5c766; background: #fffaf0; }
.prose, .submit-page, .display-page { max-width: 720px; margin: 0 auto; padding: 16px; }
.site-footer { text-align: center; padding: 24px 16px calc(24px + var(--safe-b)); color: var(--muted); font-size: .9rem; }
.toast { position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translate(-50%, 120px); background: var(--night); color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 3000; transition: transform .25s; max-width: calc(100% - 32px); box-shadow: var(--shadow); }
.toast.show { transform: translate(-50%, 0); }
.toast-error { background: var(--red-dark); }

/* Status dots + pins */
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25); vertical-align: middle; margin-right: 6px; flex: none; }
.dot-confirmed { background: var(--confirmed); }
.dot-unconfirmed { background: var(--unconfirmed); }
.dot-reported { background: var(--reported); }
.dot-seen { background: var(--seen); }
.pin span { display: block; width: 100%; height: 100%; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.45); background: var(--unconfirmed); }
.pin-confirmed span { background: var(--confirmed); box-shadow: 0 0 10px 2px rgba(246, 180, 0, .7), 0 1px 4px rgba(0,0,0,.45); }
.pin-reported span { background: var(--reported); }
.pin-seen span { background: var(--seen); }
.pin-seen span::after { content: "✓"; display: block; color: #fff; font: bold 12px/18px system-ui, sans-serif; text-align: center; }
.pin-inactive { opacity: .55; }
.pin-open span { border-color: var(--night); transform: scale(1.25); }
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large { background-color: rgba(198, 40, 40, .25) !important; }
.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div { background-color: rgba(198, 40, 40, .85) !important; color: #fff; font-weight: 700; }

/* Map page */
.page-map { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.page-map main { flex: 1; min-height: 0; }
.map-layout { display: flex; height: 100%; }
.map-wrap { position: relative; flex: 1; min-width: 0; }
#map { position: absolute; inset: 0; background: #dfe6ec; }
.map-search { position: absolute; top: 10px; left: 10px; right: 64px; z-index: 1000; display: flex; max-width: 460px; }
.map-search input { margin: 0; border-radius: 10px 0 0 10px; box-shadow: var(--shadow); border-right: 0; }
.map-search button { border: 1px solid #c4ccd6; border-left: 0; background: var(--red); color: #fff; font-weight: 600; padding: 0 14px; border-radius: 0 10px 10px 0; box-shadow: var(--shadow); cursor: pointer; }
.search-results { position: absolute; top: 48px; left: 0; right: 0; margin: 0; padding: 4px; list-style: none; background: #fff; border-radius: 10px; box-shadow: var(--shadow); max-height: 50vh; overflow: auto; }
.search-results li { padding: 0; }
.search-results li.muted { padding: 10px; }
.search-results button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 10px; font: inherit; cursor: pointer; border-radius: 8px; }
.search-results button:hover { background: #f1f4f7; }
.map-buttons { position: absolute; top: 10px; right: 10px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.fab { position: relative; width: 46px; height: 46px; border-radius: 50%; border: 0; background: #fff; color: var(--night); font-size: 20px; box-shadow: var(--shadow); cursor: pointer; }
.fab[aria-expanded="true"] { background: var(--night); color: #fff; }
.fab-badge { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--red); color: #fff; font-size: 12px; line-height: 20px; font-weight: 700; }
.legend { position: absolute; left: 10px; bottom: calc(24px + var(--safe-b)); z-index: 999; background: rgba(255,255,255,.92); border-radius: 10px; padding: 6px 10px; font-size: .78rem; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow); }
.map-note { position: absolute; top: 62px; left: 50%; transform: translateX(-50%); z-index: 999; background: var(--night); color: #fff; padding: 6px 12px; border-radius: 999px; font-size: .85rem; white-space: nowrap; }
.panel, .sheet {
  position: absolute; z-index: 1002; left: 0; right: 0; bottom: 0; max-height: 75%; overflow: auto;
  background: #fff; border-radius: 16px 16px 0 0; box-shadow: var(--shadow); padding: 14px 16px calc(16px + var(--safe-b));
  animation: slideup .2s ease-out;
}
@keyframes slideup { from { transform: translateY(30px); opacity: .4; } to { transform: none; opacity: 1; } }
.panel-head { display: flex; justify-content: space-between; align-items: center; }
.panel-close { border: 0; background: #eef1f5; width: 36px; height: 36px; border-radius: 50%; font-size: 22px; line-height: 1; cursor: pointer; flex: none; }
.sheet-close { position: absolute; top: 10px; right: 10px; }
.seen-list { padding-left: 1.4em; }
.seen-list li { margin: 6px 0; }

/* Details card */
.details-title { margin-right: 44px; }
.details-address { margin: 0 0 6px; }
.status-line { font-weight: 600; margin: 8px 0; }
.status-confirmed { color: #7a5a00; }
.status-reported { color: var(--reported); }
.type-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.type-chip { background: #eef1f5; border-radius: 999px; padding: 3px 10px; font-size: .85rem; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 8px 0; }
.facts dt { font-weight: 600; color: var(--muted); }
.facts dd { margin: 0; }
.details-desc { white-space: pre-line; }
.btn-row { display: flex; gap: 8px; margin: 8px 0; flex-wrap: wrap; align-items: center; }
.btn-row .btn { flex: 1 1 140px; }
.btn-row.directions .btn { flex: 0 1 auto; }
.details-foot { margin-top: 12px; }

/* Side list (desktop) */
.side-list { display: none; }
@media (min-width: 900px) {
  .side-list { display: flex; flex-direction: column; width: 360px; border-left: 1px solid var(--line); background: #fff; }
  .side-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .side-head h2 { margin: 0; }
  #list { list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1; }
  #list li.empty { padding: 16px; }
  .list-item { display: flex; gap: 8px; align-items: flex-start; width: 100%; text-align: left; border: 0; border-bottom: 1px solid #eef1f5; background: none; padding: 10px 14px; font: inherit; cursor: pointer; }
  .list-item:hover { background: #f6f8fa; }
  .list-item .dot { margin-top: 4px; }
  .list-text { display: flex; flex-direction: column; min-width: 0; }
  .list-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .side-foot { padding: 8px 14px; border-top: 1px solid var(--line); }
  .panel, .sheet { left: 12px; right: auto; bottom: 12px; width: 380px; max-height: calc(100% - 80px); border-radius: 16px; }
  .legend { bottom: 24px; left: auto; right: 60px; }
}

/* Display page */
.display-page { padding-top: 0; }
.display-map { height: 240px; margin: 0 -16px; }
@media (min-width: 720px) { .display-map { height: 320px; margin: 16px 0 0; border-radius: var(--radius); } }
.display-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-top: -24px; position: relative; z-index: 500; box-shadow: var(--shadow); }
.report { margin-top: 24px; }
.back { margin-top: 16px; }

/* Submit */
.steps { list-style: none; margin: 0; padding: 0; }
.step { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; scroll-margin-top: 12px; }
.choices { list-style: none; padding: 0; margin: 10px 0; display: flex; flex-direction: column; gap: 6px; }
.choice { width: 100%; text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 10px 12px; font: inherit; cursor: pointer; }
.choice:hover { background: #f6f8fa; }
.choice.is-picked { border-color: var(--green); background: #e9f6ee; outline: none; }
.mini-map { height: 300px; border-radius: 10px; margin: 8px 0; background: #dfe6ec; }
.mini-map.tall { height: 360px; }
.turnstile { margin: 12px 0; min-height: 65px; }

/* Admin */
.admin-main { max-width: 1100px; margin: 0 auto; padding: 16px; }
.inline { display: inline; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 12px 0; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; color: var(--ink); text-decoration: none; }
.stat b { display: block; font-size: 2rem; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 12px 0; }
.toolbar input, .toolbar select { width: auto; margin: 0; flex: 1 1 200px; }
.queue-item { display: grid; gap: 16px; }
.queue-item .mini-map { height: 220px; margin: 0; }
@media (min-width: 760px) { .queue-item { grid-template-columns: 320px 1fr; } }
.queue-item p { margin: 4px 0; }
.pick { margin: 0; color: var(--muted); }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; background: #fff; }
.table th, .table td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr.voided td { color: var(--muted); text-decoration: line-through; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: #eef1f5; vertical-align: middle; }
.tag-approved { background: #e9f6ee; color: #135a31; }
.tag-pending { background: #fff4cf; color: #5b4500; }
.tag-rejected, .tag-removed { background: #fdecec; color: #8a1c1c; }
.grid2, .grid3 { display: grid; gap: 0 12px; }
@media (min-width: 600px) { .grid2 { grid-template-columns: 1fr 1fr; } .grid3 { grid-template-columns: 1fr 1fr 1fr; } }
input.short { width: 120px; display: inline-block; }
.pager { display: flex; gap: 16px; justify-content: center; }

/* ---- Phase 2: My tour ---------------------------------------------- */
.tour-summary { margin: 4px 0 10px; }
.tour-start-box { margin: 0 0 10px; }
.tour-start-box .toggle { display: inline-flex; margin: 4px 16px 4px 0; }
.tour-stops { list-style: none; margin: 0 0 8px; padding: 0; }
.tour-stop { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 8px 0; border-bottom: 1px solid #eef1f5; background: #fff; }
.tour-stop.dragging { opacity: .85; box-shadow: var(--shadow); border-radius: 8px; position: relative; z-index: 2; }
.tour-stop.is-seen .tour-name { text-decoration: line-through; color: var(--muted); }
.drag-handle { cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; font-size: 20px; color: var(--muted); padding: 6px 4px; }
.tour-num { flex: none; width: 26px; height: 26px; border-radius: 7px; background: var(--night); border: 2px solid var(--gold); color: #fff; font-weight: 700; font-size: .85rem; display: inline-flex; align-items: center; justify-content: center; }
.tour-stop.is-seen .tour-num { background: var(--seen); border-color: var(--seen); }
.tour-text { flex: 1 1 150px; min-width: 0; display: flex; flex-direction: column; }
.tour-controls { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; flex: none; }
.tour-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.tour-seen { display: inline-flex; align-items: center; gap: 4px; margin: 0; flex: none; }
.tour-seen input { width: 20px; height: 20px; }
.tour-tools { display: inline-flex; gap: 2px; flex: none; }
.icon-btn { width: 34px; height: 34px; border: 1px solid var(--line); background: #fff; border-radius: 8px; font-size: 16px; cursor: pointer; }
.icon-btn:disabled { opacity: .35; cursor: default; }
.tour-links h3 { font-size: 1rem; margin: 14px 0 6px; }
.tour-links summary { cursor: pointer; font-weight: 600; margin: 14px 0 6px; }
.btn-leg { margin: 0 6px 6px 0; }
.apple-links li { margin: 6px 0; }
.tour-pin span { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; border-radius: 8px; background: var(--night); color: #fff; font: 700 13px/1 system-ui, sans-serif; border: 3px solid var(--gold); box-shadow: 0 1px 5px rgba(0,0,0,.5); }
.tour-pin-seen span { background: var(--seen); border-color: #fff; }
.tour-start span { display: block; text-align: center; background: var(--night); color: #fff; font: 700 12px/24px system-ui, sans-serif; border-radius: 12px; border: 2px solid #fff; }
.btn-tour { flex: 1 1 100%; }
.tour-page { max-width: 900px; margin: 0 auto; padding: 0 16px 16px; }
.tour-map { height: 300px; margin: 0 -16px; }
@media (min-width: 720px) { .tour-map { height: 380px; margin: 16px 0 0; border-radius: var(--radius); } }
.tour-card { margin-top: -24px; position: relative; z-index: 500; box-shadow: var(--shadow); }
.page-tour .tour-tools, .page-tour .drag-handle { display: none; }
