:root {
    --brand: #0b6b50;
    --brand-soft: #e8f4ef;
    --ink: #17201d;
    --muted: #66736e;
    --line: #dce5e1;
}

body {
    color: var(--ink);
    background: #f7faf8;
}

[hidden] {
    display: none !important;
}

.install-prompt {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 2100;
    width: min(360px, calc(100vw - 2rem));
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 18px 40px rgba(23, 32, 29, 0.16);
}

.install-prompt[hidden] {
    display: none;
}

.install-prompt strong {
    display: block;
    margin-bottom: 0.25rem;
}

.install-prompt p {
    margin: 0 0 0.75rem;
    color: var(--muted);
}

.install-prompt-actions {
    display: flex;
    gap: 0.5rem;
}

.offline-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1rem;
}

.offline-card {
    width: min(460px, 100%);
    padding: 2rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    text-align: center;
}

.offline-card img {
    margin-bottom: 1rem;
    border-radius: 18px;
}

.offline-card h1 {
    font-size: 1.6rem;
}

.offline-card p {
    color: var(--muted);
}

.current-user-name {
    margin-right: auto;
    color: var(--brand);
    font-weight: 700;
}

.navbar-brand + .current-user-name {
    margin-left: 0.75rem;
}

.hero {
    min-height: calc(100vh - 64px);
    display: flex;
    align-items: center;
    background:
        linear-gradient(90deg, rgba(247, 250, 248, 0.96), rgba(247, 250, 248, 0.72)),
        url("https://images.unsplash.com/photo-1611284446314-60a58ac0deb9?auto=format&fit=crop&w=1600&q=80") center/cover;
}

.status-panel {
    display: grid;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.92);
    border-radius: 8px;
}

.status-panel > div,
.stat-card,
.location-row,
.preview-card,
.gps-card,
.nearest-card,
.manual-location-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

@media (max-width: 575px) {
    .current-user-name {
        max-width: 42vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

.status-panel > div {
    padding: 1.25rem;
}

.status-number {
    display: block;
    color: var(--brand);
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
}

.status-label {
    color: var(--muted);
}

.location-list {
    display: grid;
    gap: 1rem;
}

.location-row {
    display: grid;
    grid-template-columns: minmax(220px, 320px) 1fr;
    gap: 1rem;
    padding: 1rem;
}

.thumb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
    align-content: start;
}

.thumb-button {
    aspect-ratio: 4 / 3;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #eef4f1;
}

.thumb-button img,
.preview-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.privacy-canvas {
    width: 100%;
    max-height: 62vh;
    aspect-ratio: 4 / 3;
    display: block;
    touch-action: none;
    cursor: crosshair;
    background: #edf2ef;
}

.privacy-tools {
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.privacy-help {
    color: var(--muted);
}

.empty-note {
    color: var(--muted);
    align-self: center;
}

.public-date-form {
    min-width: min(100%, 220px);
}

.public-date-form .form-control {
    min-width: 180px;
}

.public-view-switch {
    display: inline-flex;
    gap: 0.5rem;
    padding: 0.25rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.public-map-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.public-photo-map {
    width: 100%;
    min-height: 520px;
}

.map-unavailable {
    display: grid;
    min-height: 320px;
    place-items: center;
    padding: 2rem;
    color: var(--muted);
    text-align: center;
}

.map-pin {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 3px solid #fff;
    border-radius: 50% 50% 50% 0;
    background: var(--brand);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
    box-shadow: 0 8px 18px rgba(11, 107, 80, 0.28);
    transform: rotate(-45deg);
}

.map-pin span {
    transform: rotate(45deg);
}

.map-popup {
    width: min(260px, 72vw);
}

.map-popup h3 {
    margin: 0 0 0.2rem;
    font-size: 1rem;
}

.map-popup p {
    margin: 0 0 0.5rem;
    color: var(--muted);
}

.map-popup-thumbs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.35rem;
    margin-bottom: 0.75rem;
}

.map-popup-thumbs img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 6px;
    background: #edf2ef;
}

.map-popup-count {
    display: inline-block;
    margin-bottom: 0.6rem;
    color: var(--brand);
    font-weight: 700;
}


.capture-shell {
    min-height: calc(100vh - 64px);
}

.app-camera {
    display: grid;
    gap: 0.75rem;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.app-camera[hidden] {
    display: none;
}

.app-camera-frame {
    overflow: hidden;
    border-radius: 8px;
    background: #000;
}

.app-camera-frame video {
    display: block;
    width: 100%;
    max-height: 55vh;
    object-fit: cover;
    background: #000;
}

.app-camera-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.auth-shell {
    min-height: calc(100vh - 64px);
    display: grid;
    place-items: center;
}

.auth-card {
    width: min(100%, 460px);
    padding: 1.25rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.demo-logins {
    display: grid;
    gap: 0.25rem;
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
    background: var(--brand-soft);
    color: var(--muted);
    font-size: 0.92rem;
}

.demo-logins strong {
    color: var(--ink);
}

.audit-table code {
    white-space: normal;
    word-break: break-word;
}

.admin-photo-filters,
.admin-photo-upload {
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.admin-photo-filters {
    display: grid;
    grid-template-columns: minmax(160px, 220px) minmax(260px, 1fr) auto;
    gap: 0.85rem;
    align-items: end;
}

.admin-photo-actions {
    display: flex;
    align-items: end;
}

.admin-photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.admin-photo-card {
    display: grid;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.admin-photo-card .thumb-button {
    width: 100%;
}

.admin-photo-card img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.admin-photo-meta {
    display: grid;
    gap: 0.25rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.audit-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.85rem;
    align-items: end;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.audit-search {
    grid-column: span 2;
}

.audit-filter-actions {
    display: flex;
    gap: 0.5rem;
}

@media (max-width: 700px) {
    .audit-search {
        grid-column: auto;
    }

    .audit-filter-actions {
        flex-direction: column;
    }

    .admin-photo-filters {
        grid-template-columns: 1fr;
    }
}

.gps-card {
    padding: 1rem;
    color: var(--muted);
}

.gps-card.ready {
    color: var(--brand);
    background: var(--brand-soft);
}

.nearest-card {
    padding: 1rem;
    color: var(--brand);
    background: var(--brand-soft);
    font-weight: 700;
}

.gps-card.warning {
    color: #8a5a00;
    background: #fff6df;
}

.manual-location-card {
    padding: 1rem;
}

.manual-location-card select {
    min-height: 11rem;
}

.preview-card {
    overflow: hidden;
}

.preview-card img {
    aspect-ratio: 4 / 3;
    background: #edf2ef;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.stat-card {
    padding: 1rem;
}

.stat-card strong {
    display: block;
    color: var(--brand);
    font-size: 2rem;
}

.stat-card span {
    color: var(--muted);
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.86);
}

.lightbox[hidden] {
    display: none;
}

.lightbox img {
    max-width: min(1100px, 96vw);
    max-height: 82vh;
    border-radius: 8px;
}

.lightbox-caption {
    color: #fff;
    margin-top: 0.75rem;
    text-align: center;
}

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    min-width: 44px;
    min-height: 44px;
    border-radius: 999px;
    font-size: 1.4rem;
    font-weight: 700;
}

.lightbox-prev {
    left: 1rem;
}

.lightbox-next {
    right: 1rem;
}

@media (max-width: 800px) {
    .hero {
        min-height: auto;
    }

    .location-row,
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .public-photo-map {
        min-height: 430px;
    }
}
