:root {
    --green: #1d5e55;
    --green-dark: #164840;
    --green-light: #e9f2ef;
    --bg: #f6f3ee;
    --card: #ffffff;
    --text: #1f2a2a;
    --muted: #6b7474;
    --border: #ded8cf;
    --danger: #b42318;
    --shadow: 0 3px 12px rgba(0, 0, 0, 0.06);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100%;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    padding-bottom: 112px;
}

body.lightbox-open {
    overflow: hidden;
}

img,
video {
    max-width: 100%;
    height: auto;
}

a {
    color: var(--green);
    text-decoration: none;
}

h1,
h2,
h3 {
    margin-top: 0;
    line-height: 1.15;
}

h1 {
    font-size: clamp(28px, 5vw, 38px);
    margin-bottom: 10px;
}

h2 {
    font-size: 24px;
    margin-top: 0;
    margin-bottom: 6px;
}

h3 {
    font-size: 19px;
    margin-bottom: 6px;
}

p {
    line-height: 1.45;
}

.container {
    width: min(1100px, 100%);
    margin: 0 auto;
    padding: 20px;
}

.container.narrow {
    width: min(760px, 100%);
}

.topbar {
    background: var(--green);
    color: #fff;
    padding: 13px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    position: relative;
    z-index: 10000;
}

.topbar-brand {
    min-width: 0;
}

.topbar-title {
    display: inline-flex;
    color: #fff;
    font-weight: 850;
    line-height: 1.1;
}

.topbar-title:hover {
    color: #fff;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.topbar-actions a {
    color: #fff;
    font-weight: 750;
    font-size: 14px;
    opacity: 0.95;
}

.topbar-actions a:hover {
    opacity: 1;
    text-decoration: underline;
}

.user {
    display: block;
    font-size: 13px;
    opacity: 0.88;
    margin-top: 2px;
}

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

.alert {
    background: #fee4e2;
    color: var(--danger);
    border: 1px solid #fda29b;
    padding: 12px;
    border-radius: 12px;
    margin: 14px 0;
}

.grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    gap: 14px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.kpi {
    text-align: center;
}

.kpi-number {
    font-size: 34px;
    font-weight: 850;
    color: var(--green);
    line-height: 1;
}

.kpi-label {
    margin-top: 8px;
    font-size: 14px;
    color: var(--muted);
}

.stat-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.stat-list li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid var(--border);
    padding: 10px 0;
}

.stat-list li:first-child {
    border-top: 0;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
}

.login-card {
    width: min(420px, 100%);
    background: var(--card);
    border-radius: 18px;
    border: 1px solid var(--border);
    padding: 24px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
}

label {
    display: block;
    font-weight: 650;
    margin-top: 14px;
    margin-bottom: 6px;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    font: inherit;
    background: #fff;
}

textarea {
    resize: vertical;
}

button {
    width: 100%;
    border: 0;
    background: var(--green);
    color: #fff;
    border-radius: 12px;
    padding: 13px 16px;
    font-weight: 750;
    font-size: 16px;
    margin-top: 18px;
    cursor: pointer;
}

button:hover {
    background: var(--green-dark);
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 16px;
}

.page-header .muted {
    margin-bottom: 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 12px;
}

.section-header .muted {
    margin: 0;
}

.button-small,
.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--green);
    color: #fff;
    border-radius: 12px;
    padding: 10px 14px;
    font-weight: 750;
    white-space: nowrap;
    border: 1px solid var(--green);
}

.button-small:hover,
.button-link:hover {
    background: var(--green-dark);
    color: #fff;
}

.button-link {
    margin-top: 10px;
}

.form-card {
    margin-bottom: 22px;
}

.secondary-button {
    background: var(--green-light);
    color: var(--green);
    border: 1px solid #c5ded8;
    margin-top: 8px;
}

.secondary-button:hover {
    background: #dbece7;
}

.light-button {
    background: #fff;
    color: var(--muted);
    border: 1px solid var(--border);
    margin-top: 8px;
}

.light-button:hover {
    background: #f7f4ef;
}

.cancel-link {
    display: block;
    text-align: center;
    margin-top: 14px;
    color: var(--muted);
}

.gps-box {
    border: 1px dashed var(--border);
    border-radius: 12px;
    padding: 12px;
    background: #fbfaf7;
    overflow: hidden;
}

.gps-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.location-picker-map {
    width: 100%;
    height: 340px;
    min-height: 340px;
    border-radius: 14px;
    border: 1px solid var(--border);
    overflow: hidden;
    position: relative;
    background: #e9eee9;
    margin-top: 12px;
}

.map-card {
    margin-bottom: 22px;
}

.map {
    width: 100%;
    height: 380px;
    min-height: 380px;
    border-radius: 14px;
    border: 1px solid var(--border);
    overflow: hidden;
    position: relative;
    background: #e9eee9;
}

.detail-map-block {
    margin-top: 18px;
}

.detail-map-block strong {
    display: block;
    margin-bottom: 10px;
    font-size: 12px;
    font-weight: 800;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.detail-map {
    width: 100%;
    height: 340px;
    min-height: 340px;
    border-radius: 14px;
    border: 1px solid var(--border);
    overflow: hidden;
    position: relative;
    background: #e9eee9;
}

.location-section {
    margin-top: 24px;
    padding-top: 22px;
    border-top: 1px solid var(--border);
}

.description-block strong,
.photo-block strong,
.photo-section-title {
    display: block;
    margin-bottom: 10px;
    font-size: 12px;
    font-weight: 800;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.location-fields {
    margin-top: 0;
    margin-bottom: 18px;
}

.location-section .detail-map-block {
    margin-top: 18px;
    padding-top: 0;
    border-top: 0;
}

.leaflet-container {
    width: 100%;
    font: inherit;
    border-radius: 14px;
    z-index: 1;
}

.map.leaflet-container {
    height: 380px !important;
    min-height: 380px !important;
}

.location-picker-map.leaflet-container,
.detail-map.leaflet-container {
    height: 340px !important;
    min-height: 340px !important;
}

.leaflet-container img,
.leaflet-container .leaflet-tile {
    max-width: none !important;
    max-height: none !important;
}

.leaflet-pane,
.leaflet-map-pane,
.leaflet-tile-pane,
.leaflet-overlay-pane,
.leaflet-shadow-pane,
.leaflet-marker-pane,
.leaflet-tooltip-pane,
.leaflet-popup-pane {
    position: absolute;
}

.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow {
    position: absolute;
    left: 0;
    top: 0;
}

.leaflet-popup-content a {
    font-weight: 750;
}

.small-pill {
    display: inline-flex;
    align-items: center;
    background: var(--green-light);
    color: var(--green);
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.list-section {
    margin-top: 18px;
}

.compact-list {
    display: grid;
    gap: 10px;
}

.compact-row {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    color: var(--text);
    box-shadow: var(--shadow);
}

.compact-row:hover {
    border-color: #b9cec8;
    background: #fbfdfc;
}

.compact-main {
    min-width: 0;
}

.compact-title {
    font-weight: 850;
    margin-bottom: 4px;
}

.compact-meta {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 5px;
}

.compact-description {
    color: var(--text);
    font-size: 14px;
}

.compact-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

.compact-region {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.gps-indicator {
    display: inline-flex;
    align-items: center;
    background: #eef4ff;
    color: #2559a8;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 850;
}

.list-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

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

.list-card-header h3 {
    margin-bottom: 4px;
}

.badge {
    display: inline-block;
    background: var(--green-light);
    color: var(--green);
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.field-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 22px 34px;
    margin: 26px 0 8px;
    padding: 0;
}

.field-list div {
    min-width: 0;
}

.field-list dt {
    margin: 0 0 6px;
    font-size: 12px;
    font-weight: 800;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.field-list dd {
    margin: 0;
    font-size: 17px;
    color: var(--text);
    word-break: break-word;
    line-height: 1.35;
}

.detail-card {
    margin-top: 18px;
    padding: 26px;
}

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

.detail-fields {
    margin-top: 30px;
    margin-bottom: 20px;
}

.description-block {
    margin-top: 24px;
    padding-top: 22px;
    border-top: 1px solid var(--border);
}

.description-block p {
    margin: 0;
    font-size: 17px;
    line-height: 1.5;
}

.photo-section {
    margin-top: 24px;
    padding-top: 22px;
    border-top: 1px solid var(--border);
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

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

.photo-block {
    margin: 0;
    padding: 0;
    border: 0;
}

.photo-lightbox-trigger {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: inherit;
    cursor: zoom-in;
    position: relative;
    overflow: hidden;
}

.photo-lightbox-trigger:hover {
    background: transparent;
}

.photo-hint {
    position: absolute;
    right: 12px;
    bottom: 12px;
    background: rgba(29, 94, 85, 0.92);
    color: #fff;
    border-radius: 999px;
    padding: 7px 11px;
    font-size: 12px;
    font-weight: 800;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
}

.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 20000;
}

.lightbox.is-open {
    display: block;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: rgba(0, 0, 0, 0.78);
    cursor: zoom-out;
}

.lightbox-backdrop:hover {
    background: rgba(0, 0, 0, 0.78);
}

.lightbox-content {
    position: absolute;
    inset: 24px;
    display: grid;
    place-items: center;
    pointer-events: none;
}

.lightbox-content img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
    pointer-events: auto;
}

.lightbox-close {
    position: absolute;
    top: 0;
    right: 0;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border-radius: 999px;
    background: #fff;
    color: var(--text);
    font-size: 30px;
    line-height: 1;
    display: grid;
    place-items: center;
    z-index: 2;
    pointer-events: auto;
}

.lightbox-close:hover {
    background: #f0f0f0;
}

.map-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 10px;
    background: var(--green);
    color: #fff;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 15px;
    font-weight: 800;
    border: 1px solid var(--green);
    box-shadow: 0 2px 8px rgba(29, 94, 85, 0.16);
}

.map-link:hover {
    background: var(--green-dark);
    color: #fff;
    text-decoration: none;
}

.back-link {
    display: inline-flex;
    margin-bottom: 16px;
    font-weight: 750;
    font-size: 18px;
}

.meta-list {
    list-style: none;
    margin: 8px 0 4px;
    padding: 0;
    color: var(--muted);
    font-size: 14px;
}

.meta-list li {
    margin: 4px 0;
}

.thumb,
.list-card img,
.detail-photo {
    display: block;
    width: 100%;
    max-width: 100%;
    object-fit: cover;
    border-radius: 14px;
    margin-top: 10px;
    border: 1px solid var(--border);
}

.thumb,
.list-card img {
    max-height: 260px;
}

.detail-photo {
    aspect-ratio: 4 / 3;
    max-height: 420px;
    object-fit: cover;
    background: #f7f7f7;
}

.photo-grid-single .detail-photo {
    aspect-ratio: auto;
    max-height: 620px;
    object-fit: contain;
}

.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    z-index: 10000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
}

.bottom-nav a {
    padding: 8px 4px 9px;
    text-align: center;
    font-size: 11px;
    line-height: 1.15;
    color: var(--muted);
    min-height: 66px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-top: 3px solid transparent;
}

.bottom-nav a.active {
    color: var(--green);
    font-weight: 850;
    border-top-color: var(--green);
    background: #f7fbfa;
}

.nav-icon {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.nav-icon svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
    display: block;
}

@media (min-width: 720px) {
    .grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    body {
        padding-bottom: 124px;
    }

    .container {
        padding: 16px;
    }

    .topbar {
        padding: 12px 14px;
    }

    .topbar-actions {
        gap: 10px;
    }

    .topbar-actions a {
        font-size: 13px;
    }

    .page-header,
    .section-header {
        align-items: stretch;
        flex-direction: column;
    }

    .button-small {
        width: 100%;
    }

    .card {
        border-radius: 14px;
        padding: 15px;
    }

    .map,
    .map.leaflet-container {
        height: 320px !important;
        min-height: 320px !important;
    }

    .location-picker-map,
    .location-picker-map.leaflet-container,
    .detail-map,
    .detail-map.leaflet-container {
        height: 300px !important;
        min-height: 300px !important;
    }

    .gps-actions {
        grid-template-columns: 1fr;
    }

    .compact-row {
        flex-direction: column;
    }

    .compact-side {
        align-items: flex-start;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .list-card-header {
        flex-direction: column;
    }

    .badge {
        align-self: flex-start;
    }

    .field-list {
        grid-template-columns: 1fr;
        gap: 18px;
        margin-top: 24px;
    }

    .location-fields {
        margin-top: 0;
        margin-bottom: 18px;
    }

    .field-list dd {
        font-size: 16px;
    }

    .detail-card {
        padding: 18px;
    }

    .back-link {
        font-size: 16px;
    }

    .photo-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

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

    .detail-photo {
        aspect-ratio: 1 / 1;
        max-height: none;
    }

    .photo-grid-single .detail-photo {
        aspect-ratio: auto;
        max-height: 520px;
        object-fit: contain;
    }

    .photo-hint {
        display: none;
    }

    .lightbox-content {
        inset: 12px;
    }

    .lightbox-close {
        top: 8px;
        right: 8px;
    }

    .bottom-nav a {
        min-height: 70px;
        font-size: 10.5px;
        padding-left: 3px;
        padding-right: 3px;
    }

    .nav-icon,
    .nav-icon svg {
        width: 23px;
        height: 23px;
    }
}