/* Harvest Visitation Map. Colors from the Harvest Baptist handouts. */
:root {
  --brown: #4f3822;
  --brown-2: #6b4e30;
  --tan: #b3a593;
  --tan-2: #e2d4bd;
  --cream: #fbf6ec;
  --paper: #fff9ee;
  --navy: #173b55;
  --navy-2: #0d2236;
  --gold: #c9a15a;
  --gold-2: #f0b429;
  --green: #2e7d4f;
  --green-2: #e3efe6;
  --ink: #17354a;
  --muted: #6b5a45;
  --danger: #8a3b22;
  --blue: #173b55; /* location uses the navy accent, not a default blue */
  --radius: 12px;
  --shadow: 0 4px 16px #3a2a1a26;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--cream);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { overscroll-behavior: none; }
h1, h2, h3 { font-family: "Libre Caslon Text", Georgia, serif; font-weight: 400; margin: 0; text-wrap: balance; }
.num, table, .bar-row, .big-number, .chip { font-variant-numeric: tabular-nums; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #b07d2c; outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

/* Buttons */
.btn { min-height: 44px; border-radius: 10px; border: 0; padding: 0 16px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: 15px; white-space: nowrap; }
.btn-primary { background: var(--navy); color: #fff8e8; }
.btn-green { background: var(--green); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline { background: #fff; border: 1px solid #d8c6a6; color: var(--navy); }
.btn-quiet { background: transparent; color: inherit; border: 1px solid #ffffff40; }
.btn-big { min-height: 54px; font-size: 17px; width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.link-btn { background: none; border: 0; color: var(--navy); text-decoration: underline; padding: 8px; min-height: 44px; }

/* Inputs */
input[type=text], input[type=search], input[type=password], input[type=number], input[type=date], input:not([type]), select, textarea {
  min-height: 44px; border: 1px solid #d8c6a6; border-radius: 10px; padding: 0 12px; background: #fff; width: 100%;
}
textarea { padding: 10px 12px; min-height: 72px; resize: vertical; }
label { font-weight: 600; font-size: 15px; }

/* Sign in */
.signin { min-height: 100%; display: grid; place-items: center; padding: 24px; background: var(--cream); }
.signin-card { width: min(100%, 400px); background: var(--paper); border: 1px solid #dbcdb7; border-radius: 22px; padding: 28px; display: flex; flex-direction: column; gap: 14px; text-align: center; }
.signin-card form { text-align: left; }
.signin-logo { width: 100%; max-width: 300px; margin: 0 auto; }
.signin-card h1 { font-size: 32px; color: var(--brown); }
.form-error { color: var(--danger); min-height: 1.2em; margin: 0; font-weight: 600; }

/* Layout */
#app { height: 100%; display: flex; flex-direction: column; }
.layout { flex: 1; display: flex; min-height: 0; }
.map-wrap { position: relative; flex: 1; min-width: 0; }
#map { position: absolute; inset: 0; background: #efe9de; }
.desk-only { display: none !important; }
body.desktop .desk-only { display: flex !important; }
body.desktop .mobile-only { display: none !important; }
body:not(.pastor) .pastor-only { display: none !important; }

/* Top bar (desktop) */
.topbar { align-items: center; gap: 14px; padding: 8px 20px; background: var(--paper); border-bottom: 3px solid var(--brown); }
.topbar-logo { height: 40px; }
.topbar-title { font-family: "Libre Caslon Text", Georgia, serif; font-size: 20px; color: var(--brown); }
.topbar-spacer { flex: 1; }
.topbar-round { font-size: 15px; color: var(--muted); }
.topbar-role { font-size: 15px; color: var(--brown); font-weight: 600; }
.topbar .btn-quiet { border-color: #d8c6a6; color: var(--navy); min-height: 38px; }

/* Side panel (desktop) */
.panel { width: 480px; max-width: 46vw; flex-direction: column; background: var(--paper); border-right: 1px solid var(--tan-2); min-height: 0; }
.tabs { display: flex; border-bottom: 1px solid var(--tan-2); }
.tabs button { flex: 1; min-height: 48px; border: 0; background: transparent; border-bottom: 3px solid transparent; color: var(--muted); font-weight: 550; }
.tabs button[aria-selected=true] { border-bottom-color: var(--brown); color: var(--brown); font-weight: 750; }
.panel-body { flex: 1; overflow: auto; padding: 20px 22px 40px; display: flex; flex-direction: column; gap: 16px; }
.eyebrow { margin: 0; font-size: 15px; color: var(--muted); }
.panel-body h1 { font-size: 32px; }
.status-done { color: var(--green); font-weight: 650; margin: 0; }
.status-todo { color: #8a5a1c; font-weight: 650; margin: 0; }
.card { background: #fff; border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.card.voided { opacity: .6; }
.card.voided .card-title { text-decoration: line-through; }
.card-title { font-weight: 700; }
.card-meta { font-size: 15px; color: #5e4e3b; }
.card-note { font-size: 15px; background: #faf3e6; border-radius: 8px; padding: 8px 10px; margin: 0; white-space: pre-wrap; }
.edit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; border-top: 1px solid #efe4d2; padding-top: 10px; }
.edit-grid .full { grid-column: 1 / -1; }
.checks { display: flex; flex-wrap: wrap; gap: 6px; }
.checks label { font-weight: 500; display: inline-flex; align-items: center; gap: 6px; background: #f6efe2; border-radius: 8px; padding: 6px 10px; min-height: 36px; }
.edit-log { font-size: 14px; color: var(--muted); margin: 0; padding-left: 18px; }
.bar { height: 10px; background: #e8dcc8; border-radius: 5px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--green); }
.bar-row { display: flex; flex-direction: column; gap: 6px; }
.bar-row header { display: flex; justify-content: space-between; font-size: 15px; }
.list-btn { display: flex; justify-content: space-between; gap: 10px; width: 100%; text-align: left; border: 0; border-bottom: 1px solid #efe4d2; background: transparent; padding: 10px 2px; min-height: 44px; }
.list-btn:hover { background: #faf3e6; }
.big-number { font-family: "Libre Caslon Text", Georgia, serif; font-size: 36px; }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid #e8dcc8; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; color: #8a6a44; font-weight: 700; padding: 10px; position: sticky; top: 0; background: #fff; }
td { padding: 9px 10px; border-top: 1px solid #efe4d2; vertical-align: top; }
td button { white-space: nowrap; }
.filters-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.filters-grid .full { grid-column: 1 / -1; }

/* Map overlay controls */
.map-top { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; z-index: 2; }
.map-top > * { pointer-events: auto; }
body.desktop .map-top { flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
.search { position: relative; display: flex; align-items: center; background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding-left: 40px; width: 100%; }
body.desktop .search { width: 360px; }
.search-icon { position: absolute; left: 13px; width: 18px; height: 18px; fill: none; stroke: #5e4e3b; stroke-width: 2; }
.search input { border: 0; min-height: 50px; background: transparent; font-size: 16px; padding-left: 4px; }
.search input:focus { outline: none; }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; margin: 0; padding: 0; list-style: none; background: #fff; border-radius: 14px; box-shadow: var(--shadow); max-height: 50vh; overflow: auto; }
.search-results button { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; border: 0; border-bottom: 1px solid #eee3d2; background: #fff; padding: 10px 14px; min-height: 52px; text-align: left; }
.search-results .sub { display: block; font-size: 14px; color: var(--muted); }
.search-results .st { font-size: 14px; font-weight: 600; white-space: nowrap; }
.map-chips { display: flex; gap: 6px; flex-wrap: wrap; pointer-events: none; }
.chip { border-radius: 10px; padding: 7px 12px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow); }
.chip-navy { background: var(--navy); color: #fff8e8; }
.chip-gold { background: var(--paper); color: var(--brown); }
.chip-blue { background: var(--paper); color: var(--navy); }
.desk-filters { gap: 8px; align-items: center; background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 6px 10px; }
.desk-filters label { display: flex; align-items: center; gap: 6px; font-size: 14px; white-space: nowrap; }
.desk-filters select { min-height: 36px; width: auto; }
.map-fab { position: absolute; right: 14px; bottom: 128px; width: 54px; height: 54px; border-radius: 50%; border: 0; background: #fff; box-shadow: var(--shadow); display: grid; place-items: center; z-index: 2; }
body.desktop .map-fab { bottom: 142px; right: 10px; }
.map-fab { transition: background-color .2s, transform .15s; }
.map-fab:active, .tool-btn:active { transform: scale(.94); }
.map-fab.following { box-shadow: 0 0 0 4px #173b5540, var(--shadow); }

/* Map view tools: satellite, whole area */
.map-tools { position: absolute; right: 14px; bottom: 196px; z-index: 2; display: flex; flex-direction: column; gap: 8px; }
body.desktop .map-tools { right: 10px; bottom: 208px; }
.tool-btn { display: flex; align-items: center; gap: 8px; min-height: 48px; min-width: 48px; justify-content: center; border: 0; border-radius: 14px; background: #fff; color: var(--navy); box-shadow: var(--shadow); font-size: 14px; font-weight: 600; padding: 0 12px; transition: background-color .2s, color .2s, transform .15s; }
.tool-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; flex: none; }
.tool-btn:hover { background: #f3ebdd; }
.tool-btn[aria-pressed=true] { background: var(--navy); color: #fff8e8; }
body:not(.desktop) .tool-btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
body:not(.desktop) .tool-btn { padding: 0; width: 48px; }
body.desktop .map-tools .tool-btn { justify-content: flex-start; }
.map-fab svg { width: 24px; height: 24px; fill: none; stroke: var(--blue); stroke-width: 2.2; }
.map-fab .fill { fill: var(--blue); }
.map-fab[aria-pressed=true] { background: var(--blue); }
.map-fab[aria-pressed=true] svg { stroke: #fff; }
.map-fab[aria-pressed=true] .fill { fill: #fff; }
.legend { position: absolute; left: 14px; bottom: 48px; z-index: 2; background: #fff; border-radius: 12px; box-shadow: var(--shadow); padding: 10px 12px; flex-direction: column; gap: 6px; font-size: 14px; }
.legend span, .legend label { display: flex; align-items: center; gap: 8px; }
.lg-toggle { cursor: pointer; font-weight: 400; }
.lg-toggle input { width: 18px; height: 18px; min-height: 0; margin: 0; accent-color: var(--green); }
.legend i { display: inline-block; width: 28px; border-radius: 3px; }
.lg-done { height: 6px; background: var(--green); }
.lg-todo { height: 4px; background: #9a8f80; }
.lg-section { height: 14px; background: #2e7d4f55; }
.lg-hl { height: 6px; background: var(--navy); }

/* Mobile bottom bar and sheet */
.mobile-bar { position: absolute; left: 12px; right: 12px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 2; background: var(--paper); border-radius: 16px; padding: 10px 12px 10px 16px; box-shadow: 0 6px 20px #3a2a1a33; display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 15px; color: #5e4e3b; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; background: var(--paper); border-radius: 22px 22px 0 0; padding: 10px 18px calc(22px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 30px #3a2a1a33; display: flex; flex-direction: column; gap: 12px; max-height: 82%; overflow: auto; }
.sheet .grip { width: 40px; height: 5px; border-radius: 3px; background: #d8c6a6; align-self: center; flex: none; }
.sheet h2 { font-size: 32px; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.icon-btn { border: 0; background: #efe4d2; width: 44px; height: 44px; border-radius: 50%; font-size: 20px; color: #5e4e3b; flex: none; }
.street-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.street-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--green-2); color: #1f5c39; border-radius: 10px; padding: 4px 4px 4px 12px; font-size: 15px; font-weight: 600; }
.street-chip button { border: 0; background: #c9e0d0; color: #1f5c39; width: 36px; height: 36px; border-radius: 8px; }
.add-street { border: 1px dashed #b39a74; background: transparent; border-radius: 10px; padding: 4px 14px; min-height: 44px; font-size: 15px; color: #5e4e3b; }
.people { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.person { min-height: 48px; border-radius: 12px; font-weight: 600; border: 2px solid #e0d2bb; background: #fff; color: var(--ink); }
.person[aria-pressed=true] { background: var(--navy); border-color: var(--navy); color: #fff8e8; }
.person.more { border-style: dashed; }
.details { border: 1px solid #e8dcc8; border-radius: 12px; background: #fff; }
.details summary { padding: 12px 14px; font-weight: 600; min-height: 44px; cursor: pointer; }
.details .stack { padding: 0 14px 14px; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button { width: 44px; height: 44px; border-radius: 10px; border: 1px solid #d8c6a6; background: #fff; font-size: 20px; flex: none; }
.stepper input { text-align: center; }
.add-banner { position: absolute; left: 12px; right: 12px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 4; background: var(--navy); color: #fff8e8; border-radius: 16px; padding: 10px 12px 10px 16px; display: flex; justify-content: space-between; align-items: center; gap: 10px; box-shadow: 0 6px 20px #0d223655; }
.add-banner .btn-primary { background: #fff8e8; color: var(--navy); }
body.desktop .add-banner { left: auto; right: 90px; width: 380px; bottom: 30px; }

/* Toast */
.toast { position: fixed; left: 50%; top: 16px; transform: translateX(-50%); z-index: 50; background: var(--green); color: #fff; padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow); font-weight: 600; max-width: calc(100% - 32px); }
.toast.error { background: var(--danger); }
.toast:not([hidden]) { animation: toast-in .28s cubic-bezier(.2,.9,.3,1.2); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -14px); } }
/* browsers without morphing get a simple slide */
@supports not (view-transition-name: none) {
  .sheet:not([hidden]) { animation: sheet-up .32s cubic-bezier(.2,.9,.3,1); }
  .mobile-bar:not([hidden]), .add-banner:not([hidden]) { animation: rise .25s ease-out; }
}
@keyframes sheet-up { from { transform: translateY(40%); opacity: .4; } }
@keyframes rise { from { transform: translateY(16px); opacity: 0; } }
.search-results:not([hidden]) { animation: drop .18s ease-out; transform-origin: top; }
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } }
.street-chip { animation: pop .22s ease-out; }
@keyframes pop { from { transform: scale(.8); opacity: 0; } }
.person { transition: background-color .15s, border-color .15s, color .15s, transform .12s; }
.person:active { transform: scale(.96); }
.chip.bump { animation: bump .5s ease-out; }
@keyframes bump { 40% { transform: scale(1.08); } }
.bar i { animation: grow .9s cubic-bezier(.2,.8,.2,1); }
@keyframes grow { from { width: 0; } }
.panel-body > * { animation: fade-in .2s ease-out; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Confirm dialog */
.confirm { border: 1px solid #dac7a9; border-radius: 18px; padding: 22px; max-width: 440px; background: var(--paper); color: var(--ink); }
.confirm::backdrop { background: #0d2236aa; }
.confirm h2 { font-size: 24px; margin-bottom: 8px; }

/* Sheaf celebration (from the approved mascot demo) */
.celebration { width: min(430px, calc(100% - 26px)); max-height: calc(100% - 26px); border: 1px solid #dac7a9; border-radius: 26px; padding: 15px clamp(16px, 5vw, 33px) 25px; text-align: center; color: var(--ink); background: #fff8eb; box-shadow: 0 24px 90px #0d22366b; }
.celebration::backdrop { background: #0d2236aa; }
.celebration .stage { position: relative; isolation: isolate; }
.celebration .mascot { position: relative; display: block; margin: auto; width: min(100%, 310px); border: 0; background: none; padding: 0; border-radius: 20px; color: inherit; }
.celebration .mascot svg { display: block; width: 100%; height: auto; }
#confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 1; }
#confetti i { position: absolute; left: 50%; top: 46%; background: var(--foil); opacity: 0; }
.celebration .hint { font-size: 14px; color: #715537; margin: 0 0 11px; }
.celebration h2 { font-size: clamp(2rem, 8vw, 2.7rem); }
.celebration p { color: #5e4e3b; margin: 8px 0 18px; }
.celebration .done { width: 100%; min-height: 50px; }
@media (max-height: 520px) { .celebration .mascot { width: min(100%, 210px); } }

/* MapLibre tweaks */
.maplibregl-ctrl-bottom-right { bottom: 0; }
body:not(.desktop) .maplibregl-ctrl-bottom-right { bottom: 84px; right: 4px; }
body:not(.desktop) .maplibregl-ctrl-bottom-left { bottom: 84px; }
body.desktop .maplibregl-ctrl-bottom-left { left: 8px; }
.maplibregl-ctrl-scale { border-color: var(--brown); color: var(--brown); background: #fff9eecc; font-size: 12px; }
.street-popup .maplibregl-popup-content strong { display: block; font-size: 15px; }
.street-popup { pointer-events: none; }
.maplibregl-popup-content { border-radius: 10px; padding: 8px 12px; font-size: 14px; background: var(--ink); color: #fff8e8; }
.maplibregl-popup-tip { border-top-color: var(--ink) !important; border-bottom-color: var(--ink) !important; }
.me-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--navy); border: 3px solid #fff; box-shadow: 0 0 0 8px #173b5526; position: relative; }
.me-dot::after { content: ''; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid var(--navy); animation: ping 2s ease-out infinite; }
@keyframes ping { from { transform: scale(1); opacity: .7; } to { transform: scale(3.2); opacity: 0; } }
.celebration-actions { display: flex; flex-direction: column; gap: 10px; }
.celebration-actions .btn { width: 100%; min-height: 50px; }

/* Demo build only */
.demo-note { text-align: left; background: #fff; border-radius: 12px; padding: 12px 14px; font-size: 15px; }
.demo-note p { margin: 0 0 8px; }
.demo-note .link-btn { padding: 0; min-height: 32px; }

/* Street sheet actions */
.sheet-actions { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; }
a.btn { text-decoration: none; }
.away { color: var(--muted); font-weight: 400; }
body:not(.desktop) .maplibregl-ctrl-top-right { top: 150px; }

/* Orange area picked on the Progress tab */
.lg-area { height: 8px; background: #e07b1f; }
.area-btn { border: 0; background: transparent; text-align: left; padding: 8px 10px; margin: 0 -10px; border-radius: 12px; color: inherit; font: inherit; cursor: pointer; transition: background-color .2s; }
.area-btn .bar { display: block; }
.area-btn:hover { background: #faf3e6; }
.area-btn[aria-pressed=true], .list-btn[aria-pressed=true] { background: #fbe9d6; box-shadow: inset 4px 0 0 #e07b1f; }
.list-btn[aria-pressed=true] { padding-left: 12px; }
.pick-note { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: #fbe9d6; border-radius: 12px; padding: 8px 8px 8px 14px; font-weight: 600; color: #7a3d0a; view-transition-name: pick-note; }
.pick-note span { display: flex; align-items: center; gap: 8px; }
.pick-note i { display: inline-block; width: 22px; border-radius: 3px; }

/* Tab underline slides between tabs */
.tabs { position: relative; }
.tabs button[aria-selected=true] { border-bottom-color: transparent; }
.tab-indicator { position: absolute; left: 0; bottom: -1px; height: 3px; background: var(--brown); border-radius: 3px 3px 0 0; transition: transform .35s cubic-bezier(.2,.9,.3,1), width .35s cubic-bezier(.2,.9,.3,1); }

.tool-btn[aria-expanded=true] { background: var(--navy); color: #fff8e8; }

/* Morph animations (View Transitions): named parts change shape and slide into place */
::view-transition-old(root), ::view-transition-new(root) { animation: none; }
::view-transition-group(*) { animation-duration: .32s; animation-timing-function: cubic-bezier(.2,.9,.3,1); }
.sheet, .mobile-bar, .add-banner { view-transition-name: bottom-card; }
#basemap-btn { view-transition-name: basemap-btn; }
#progress-chip { view-transition-name: progress-chip; }
.panel-body { view-transition-name: panel; }
.toast { view-transition-name: toast; }
.street-chip { animation: none; }
body:not(.desktop):has(#sheet:not([hidden])) .map-tools { display: none; }
