:root {
    --ink: #1f2933;
    --muted: #64748b;
    --brand: #2f6f4e;
    --brand-dark: #24583e;
    --paper: #fffaf0;
    --surface: #ffffff;
    --line: #e2e8f0;
    --field-bg: #ffffff;
    --field-ink: #1f2933;
    --field-border: #cbd5e1;
    --field-placeholder: #64748b;
    --button-ink: #ffffff;
    --shadow: 0 18px 40px rgb(15 23 42 / 0.08);
}

html[data-theme="gulf"] {
    --ink: #17324d;
    --muted: #52718a;
    --brand: #0f7490;
    --brand-dark: #0b5d73;
    --paper: #edf9fb;
    --surface: #ffffff;
    --line: #bfdbfe;
}

html[data-theme="hill-country"] {
    --ink: #302318;
    --muted: #735f4a;
    --brand: #b45309;
    --brand-dark: #8a3e07;
    --paper: #fff7ed;
    --surface: #fffaf3;
    --line: #fed7aa;
}

html[data-theme="night-market"] {
    --ink: #eef2ff;
    --muted: #bfdbfe;
    --brand: #a78bfa;
    --brand-dark: #8b5cf6;
    --paper: #0f172a;
    --surface: #172033;
    --line: #334155;
    --field-bg: #111827;
    --field-ink: #f8fafc;
    --field-border: #64748b;
    --field-placeholder: #cbd5e1;
    --button-ink: #ffffff;
    --shadow: 0 18px 40px rgb(0 0 0 / 0.35);
}

html[data-theme="starfleet-gold"] {
    --ink: #f8e7a1;
    --muted: #e7c96a;
    --brand: #f5c542;
    --brand-dark: #d59f17;
    --paper: #050505;
    --surface: #111111;
    --line: #6f5411;
    --field-bg: #0a0a0a;
    --field-ink: #fff7cc;
    --field-border: #b68a1d;
    --field-placeholder: #d7bd72;
    --button-ink: #050505;
    --shadow: 0 18px 40px rgb(245 197 66 / 0.14);
}

html[data-theme="pipboy"] {
    --ink: #b8ff9a;
    --muted: #6dff6d;
    --brand: #39ff14;
    --brand-dark: #21c90a;
    --paper: #031a0c;
    --surface: #062711;
    --line: #1f7a2e;
    --field-bg: #021107;
    --field-ink: #d4ffc4;
    --field-border: #2bd446;
    --field-placeholder: #8cff7a;
    --button-ink: #021107;
    --shadow: 0 18px 40px rgb(57 255 20 / 0.14);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    background: linear-gradient(180deg, var(--paper), #f8fafc 45%);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    transition: background 180ms ease, color 180ms ease;
}

html[data-theme="night-market"] body {
    background: linear-gradient(180deg, var(--paper), #111827 55%);
}

html[data-theme="starfleet-gold"] body {
    background: radial-gradient(circle at top left, #2f2203, transparent 32%), linear-gradient(180deg, var(--paper), #0f0f0f 58%);
}

html[data-theme="pipboy"] body {
    background: radial-gradient(circle at top left, #0d4f1d, transparent 34%), linear-gradient(180deg, var(--paper), #010904 60%);
}

a {
    color: var(--brand);
    font-weight: 700;
}

/* Critical map layout rules are included locally because mobile review devices
   may fail to load the CDN stylesheets before the map initializes. */
.leaflet-container,
.maplibregl-map {
    overflow: hidden;
    background: #dbeafe;
    outline: 0;
}

.maplibregl-canvas,
.maplibregl-canvas-container {
    width: 100%;
    height: 100%;
}

.maplibregl-ctrl-attrib {
    border-radius: 6px 0 0;
    background: rgb(255 255 255 / 0.82);
    font-size: 0.72rem;
}

.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-pane > svg,
.leaflet-pane > canvas,
.leaflet-zoom-box,
.leaflet-image-layer,
.leaflet-layer {
    position: absolute;
    top: 0;
    left: 0;
}

.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow {
    user-select: none;
    -webkit-user-drag: none;
}

.leaflet-tile {
    visibility: hidden;
}

.leaflet-tile-loaded {
    visibility: inherit;
}

.leaflet-marker-icon,
.leaflet-marker-shadow {
    display: block;
}

.leaflet-control-container .leaflet-control {
    position: relative;
    z-index: 800;
    pointer-events: auto;
}

.leaflet-bottom,
.leaflet-top {
    position: absolute;
    z-index: 700;
    pointer-events: none;
}

.leaflet-bottom {
    bottom: 0;
}

.leaflet-right {
    right: 0;
}

.leaflet-control-attribution {
    padding: 2px 6px;
    background: rgb(255 255 255 / 0.82);
    font-size: 0.72rem;
}

.site-header,
.page-shell {
    width: min(1440px, calc(100% - 32px));
    margin-inline: auto;
}

.site-header {
    padding: 40px 0 24px;
}

.compact-header {
    padding-bottom: 10px;
}

.masthead {
    display: flex;
    gap: 18px;
    align-items: flex-start;
    justify-content: space-between;
}

.site-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.site-nav {
    flex: 0 0 auto;
    justify-content: flex-end;
    margin-top: 10px;
}

.site-nav a,
.theme-toggle {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    text-decoration: none;
}

.site-nav a {
    padding: 8px 12px;
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    width: 66px;
    height: 36px;
    padding: 3px;
    border-color: color-mix(in srgb, var(--brand) 34%, var(--line));
    background: linear-gradient(135deg, #f6c37a, #fdf0d5 58%, #d9824b);
    cursor: pointer;
    font: inherit;
    box-shadow: inset 0 1px 2px rgb(255 255 255 / 55%), inset 0 -2px 4px rgb(124 75 36 / 20%), 0 10px 22px rgb(48 35 24 / 13%);
    transition: background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.theme-toggle-knob {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 50%;
    background: #fffaf0;
    color: #92400e;
    box-shadow: 0 2px 8px rgb(15 23 42 / 20%);
    transform: translateX(0);
    transition: transform 180ms ease, background 180ms ease, color 180ms ease;
}

html[data-theme="night-market"] .theme-toggle {
    background: linear-gradient(135deg, #111827, #312e81 60%, #4c1d95);
}

html[data-theme="night-market"] .theme-toggle-knob {
    background: #1f2937;
    color: #e0e7ff;
    transform: translateX(30px);
}


.theme-toggle[data-theme-state="night"] .theme-toggle-knob {
    transform: translateX(30px);
}

.local-map-label {
    display: inline-block;
    border-radius: 999px;
    padding: 3px 8px;
    background: rgb(255 255 255 / 0.86);
    color: #1f2933;
    font-size: 0.75rem;
    font-weight: 800;
    box-shadow: 0 4px 10px rgb(15 23 42 / 0.16);
}

.hero-content {
    max-width: 860px;
}

.compact-title h1 {
    margin-bottom: 0;
    font-size: clamp(1.7rem, 3.2vw, 3rem);
}
.eyebrow {
    margin: 0 0 8px;
    color: var(--brand);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 10px;
    font-size: clamp(2rem, 5vw, 4rem);
    letter-spacing: -0.05em;
}

.lede {
    max-width: 760px;
    color: var(--muted);
    font-size: 1.08rem;
    line-height: 1.6;
}

.search-panel {
    margin-bottom: 18px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow);
}

.search-panel h2 {
    margin-bottom: 14px;
    font-size: 1.15rem;
}

.search-form {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(200px, 280px) auto;
    gap: 14px;
    align-items: end;
}

.search-form label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 700;
}

.search-form input,
.search-form select,
.search-form button {
    min-height: 48px;
    border-radius: 14px;
    font: inherit;
}

.search-form input,
.search-form select {
    width: 100%;
    border: 1px solid var(--field-border);
    padding: 0 14px;
    background: var(--field-bg);
    color: var(--field-ink);
}

.search-form input::placeholder {
    color: var(--field-placeholder);
    opacity: 1;
}

.search-form button,
.toggle-button {
    border: 0;
    background: var(--brand);
    color: var(--button-ink);
    cursor: pointer;
    font-weight: 800;
}

.search-form button:hover,
.toggle-button:hover {
    background: var(--brand-dark);
}

.mobile-toggle {
    display: none;
}

.results-layout {
    display: grid;
    grid-template-columns: minmax(300px, 1fr) minmax(0, 2fr);
    gap: 18px;
    align-items: start;
    padding-bottom: 40px;
}

.cards-panel,
.map-panel {
    min-width: 0;
}

.cards-panel {
    display: grid;
    gap: 14px;
    max-height: calc(100vh - 190px);
    overflow: auto;
    padding-right: 4px;
}

.results-summary,
.business-card,
.empty-state {
    border: 1px solid var(--line);
    border-radius: 22px;
    background: var(--surface);
    box-shadow: 0 10px 24px rgb(15 23 42 / 0.06);
}

.results-summary,
.empty-state {
    padding: 18px;
}

.results-summary h2,
.empty-state h3 {
    margin-bottom: 6px;
    font-size: 1.05rem;
}

.results-summary p,
.empty-state p {
    margin-bottom: 0;
    color: var(--muted);
    line-height: 1.5;
}

.business-card-list {
    display: grid;
    gap: 14px;
}

.business-card {
    padding: 18px;
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.business-card.selected-business-card {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 28%, transparent), var(--shadow);
    transform: translateY(-2px);
}

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

.card-header h3 {
    margin-bottom: 10px;
    font-size: 1.1rem;
    line-height: 1.2;
}

.card-header span {
    flex: 0 0 auto;
    border-radius: 999px;
    padding: 5px 9px;
    background: #dcfce7;
    color: #166534;
    font-size: 0.74rem;
    font-weight: 800;
}

.description {
    color: var(--muted);
    line-height: 1.5;
}

.business-meta {
    display: grid;
    gap: 8px;
    margin: 0;
}

.business-meta div {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 10px;
}

.business-meta dt {
    color: var(--muted);
    font-weight: 800;
}

.business-meta dd {
    margin: 0;
}

.website-link {
    display: inline-flex;
    margin-top: 14px;
}

.card-actions,
.contact-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.secondary-link {
    color: var(--muted);
}

.map-panel {
    position: sticky;
    top: 16px;
}

.map-frame {
    position: relative;
}

#business-map {
    min-height: calc(100vh - 190px);
    height: 720px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: #dbeafe;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.map-zoom-controls {
    position: absolute;
    top: 50%;
    right: 14px;
    z-index: 650;
    display: grid;
    gap: 8px;
    justify-items: center;
    padding: 0;
    transform: translateY(-50%);
}

.map-zoom-controls button {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 999px;
    background: var(--brand);
    color: var(--button-ink);
    cursor: pointer;
    font: inherit;
    font-size: 1.25rem;
    font-weight: 900;
    line-height: 1;
}

.map-zoom-controls button:hover {
    background: var(--brand-dark);
}

.map-zoom-controls input[type="range"] {
    width: 112px;
    accent-color: var(--brand);
    writing-mode: vertical-rl;
    direction: rtl;
}

.commonplace-marker {
    display: grid;
    place-items: center;
}

.commonplace-marker span {
    display: block;
    width: 22px;
    height: 22px;
    border: 3px solid white;
    border-radius: 999px 999px 999px 4px;
    background: var(--brand);
    box-shadow: 0 6px 14px rgb(15 23 42 / 0.28);
    transform: rotate(-45deg);
}

.commonplace-marker span::after {
    display: block;
    width: 6px;
    height: 6px;
    margin: 5px auto 0;
    border-radius: 999px;
    background: white;
    content: "";
}

.leaflet-popup-content {
    line-height: 1.45;
}

.content-page {
    padding-bottom: 48px;
}

.about-card {
    max-width: 920px;
    border: 1px solid var(--line);
    border-radius: 28px;
    padding: clamp(24px, 5vw, 52px);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.about-card h1 {
    margin-bottom: 16px;
}

.about-card h2 {
    margin: 28px 0 8px;
}

.about-card p {
    color: var(--muted);
    font-size: 1.02rem;
    line-height: 1.7;
}

.business-page {
    padding-bottom: 56px;
}

.business-hero {
    max-width: 920px;
    margin-bottom: 20px;
}

.business-tagline {
    margin: 6px 0 10px;
    color: var(--brand-dark);
    font-size: clamp(1.05rem, 2vw, 1.35rem);
    font-weight: 800;
}

.business-profile-layout {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(0, 2fr);
    gap: 20px;
    align-items: start;
}

.business-contact-card,
.business-main-card {
    border: 1px solid var(--line);
    border-radius: 26px;
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow);
}

.business-contact-card {
    position: sticky;
    top: 16px;
    padding: 20px;
}

.business-main-card {
    display: grid;
    gap: 26px;
    padding: clamp(22px, 4vw, 38px);
}

.profile-meta {
    margin-top: 14px;
}

.profile-meta div {
    grid-template-columns: 88px 1fr;
}

.service-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
}

.service-list li {
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 12px 14px;
    background: var(--field-bg);
    color: var(--field-ink);
    font-weight: 750;
}

@media (max-width: 768px) {
    .site-header,
    .page-shell {
        width: min(100% - 24px, 720px);
    }

    .site-header {
        padding-top: 28px;
    }

    .masthead {
        flex-direction: column;
        gap: 14px;
    }

    .site-nav {
        justify-content: flex-start;
        margin-top: 0;
    }

    .theme-select {
        max-width: 170px;
    }

    .search-form {
        grid-template-columns: 1fr;
    }

    .mobile-toggle {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        margin-bottom: 14px;
    }

    .toggle-button {
        min-height: 44px;
        border-radius: 999px;
        background: #e2e8f0;
        color: var(--ink);
    }

    .toggle-button.is-active {
        background: var(--brand);
        color: white;
    }

    .results-layout {
        display: block;
    }

    .business-profile-layout {
        display: block;
    }

    .business-contact-card {
        position: static;
        margin-bottom: 16px;
    }

    .service-list {
        grid-template-columns: 1fr;
    }

    .selected-section {
        display: none;
    }

    .selected-section.is-visible {
        display: grid;
    }

    .cards-panel {
        max-height: none;
        overflow: visible;
        padding-right: 0;
    }

    .map-panel {
        position: static;
    }

    #business-map {
        min-height: 460px;
        height: 65vh;
    }
}


.owner-shell {
    padding-bottom: 56px;
}

.owner-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
    align-items: start;
}

.owner-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 28px;
    box-shadow: var(--shadow);
    padding: 28px;
}

.owner-card h2,
.owner-card h3 {
    margin-top: 0;
}

.owner-form {
    display: grid;
    gap: 16px;
}

.owner-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.owner-form label,
.owner-form fieldset {
    display: grid;
    gap: 7px;
    margin: 0;
}

.owner-form fieldset {
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 16px;
}

.owner-form input,
.owner-form select,
.owner-form textarea {
    width: 100%;
    border: 1px solid var(--field-border);
    border-radius: 14px;
    background: var(--field-bg);
    color: var(--field-ink);
    padding: 11px 12px;
    font: inherit;
}

.owner-form textarea {
    resize: vertical;
}

.owner-form ul {
    display: grid;
    gap: 8px;
    padding-left: 20px;
}

.owner-form button,
.link-button {
    justify-self: start;
    border: 0;
    border-radius: 999px;
    background: var(--brand);
    color: var(--button-ink);
    padding: 12px 18px;
    font-weight: 800;
    cursor: pointer;
}

.inline-logout-form {
    margin: 0;
}

.link-button {
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--brand);
}

.danger-link {
    color: #b91c1c;
}

.wide-field,
.form-actions {
    grid-column: 1 / -1;
}

.form-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.owner-summary-list {
    display: grid;
    gap: 12px;
    margin: 18px 0;
}

.owner-summary-list div {
    border-top: 1px solid var(--line);
    padding-top: 12px;
}

.owner-summary-list dt {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.owner-summary-list dd {
    margin: 4px 0 0;
}

.message-list {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.message {
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    padding: 12px 16px;
    font-weight: 700;
}

.message.success {
    border-color: #86efac;
}

.muted-note {
    color: var(--muted);
}

.business-logo-block,
.logo-preview-wrap {
    display: grid;
    gap: 10px;
    justify-items: start;
    margin-bottom: 18px;
}

.business-logo-image,
.owner-logo-preview,
.business-logo-placeholder {
    width: 128px;
    height: 128px;
    border: 1px solid var(--line);
    border-radius: 28px;
    background: var(--field-bg);
    box-shadow: 0 12px 30px rgb(15 23 42 / 0.1);
}

.business-logo-image,
.owner-logo-preview {
    object-fit: contain;
    padding: 10px;
}

.business-logo-placeholder {
    display: grid;
    place-items: center;
    color: var(--brand);
    font-size: 3rem;
    font-weight: 900;
}

.business-gallery-grid,
.owner-photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
}

.business-gallery-card,
.owner-photo-card {
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 20px;
    overflow: hidden;
    background: var(--field-bg);
}

.business-gallery-card img,
.owner-photo-card img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.business-gallery-card figcaption,
.owner-photo-card figcaption {
    padding: 10px 12px;
    color: var(--field-ink);
    font-weight: 700;
}

.owner-photo-card form {
    padding: 0 12px 12px;
}

.media-form {
    margin-top: 18px;
}

.payment-options ul {
    display: grid;
    gap: 14px;
    padding-left: 20px;
}

.payment-options li span {
    display: block;
    color: var(--muted);
    margin-top: 4px;
}

.stripe-connect-panel {
    display: grid;
    gap: 12px;
    margin-top: 24px;
    border-top: 1px solid var(--line);
    padding-top: 20px;
}

.stripe-connect-panel h3 {
    margin-bottom: 0;
}

.stripe-connect-panel button:disabled,
.owner-form button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.setup-list {
    display: grid;
    gap: 6px;
    margin: 0;
    padding-left: 20px;
    color: var(--muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 0.9rem;
}

.owner-form .radiolist,
.owner-form ul[id^="id_plan"] {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.owner-form .radiolist li,
.owner-form ul[id^="id_plan"] li {
    margin: 0;
}

.owner-form .radiolist label,
.owner-form ul[id^="id_plan"] label {
    display: flex;
    align-items: center;
    gap: 10px;
    line-height: 1.35;
}

.owner-form .radiolist input[type="radio"],
.owner-form ul[id^="id_plan"] input[type="radio"] {
    width: auto;
    margin: 0;
    flex: 0 0 auto;
}

.owner-form div[id^="id_plan"] {
    display: grid;
    gap: 10px;
}

.owner-form div[id^="id_plan"] > div {
    margin: 0;
}

.owner-form div[id^="id_plan"] label {
    display: flex;
    align-items: center;
    gap: 10px;
    line-height: 1.35;
}

.owner-form div[id^="id_plan"] input[type="radio"] {
    width: auto;
    margin: 0;
    flex: 0 0 auto;
}

@media (max-width: 760px) {
    .owner-dashboard-grid,
    .owner-form-grid,
    .media-dashboard-grid {
        grid-template-columns: 1fr;
    }

    .owner-card {
        padding: 20px;
        border-radius: 22px;
    }
}
