:root {
    --bg-1: #eef6f8;
    --bg-2: #d9e9ef;
    --surface: #ffffff;
    --surface-muted: #f4f8fb;
    --line: #d4dde3;
    --ink: #11212b;
    --ink-soft: #435764;
    --brand: #0a7ea4;
    --brand-2: #0b5f7c;
    --accent: #f59e0b;
    --danger: #b91c1c;
    --ok: #0f766e;
    --radius: 16px;
    --shadow: 0 20px 40px rgba(17, 33, 43, 0.12);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    color: var(--ink);
    font-family: "Manrope", "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at 80% 8%, rgba(10, 126, 164, 0.2), transparent 26%),
        radial-gradient(circle at 20% 10%, rgba(245, 158, 11, 0.16), transparent 28%),
        linear-gradient(155deg, var(--bg-1), var(--bg-2));
}

a {
    color: var(--brand-2);
}

.shell {
    max-width: 1280px;
    margin: 0 auto;
    padding: 22px 18px 40px;
}

.topbar {
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

.brand img {
    width: 42px;
    height: 42px;
    object-fit: contain;
}

.brand h1 {
    margin: 0;
    font-family: "Bebas Neue", "Trebuchet MS", sans-serif;
    font-size: 34px;
    letter-spacing: 0.06em;
    line-height: 1;
}

.nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.nav a {
    text-decoration: none;
    color: var(--ink);
    background: var(--surface-muted);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 14px;
    font-weight: 700;
    font-size: 14px;
}

.nav a.active {
    background: linear-gradient(180deg, var(--brand), var(--brand-2));
    color: #fff;
    border-color: transparent;
}

.layout {
    margin-top: 16px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

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

.card h2,
.card h3 {
    margin: 0 0 12px;
    font-family: "Bebas Neue", "Trebuchet MS", sans-serif;
    letter-spacing: 0.04em;
    font-weight: 500;
}

.toolbar {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 10px;
    align-items: end;
}

.toolbar .field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.toolbar .field label {
    font-size: 12px;
    font-weight: 700;
    color: var(--ink-soft);
}

.toolbar .grow {
    grid-column: span 4;
}

.toolbar .short {
    grid-column: span 2;
}

.toolbar input,
.toolbar select,
.form input,
.form select,
.form textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    background: #fff;
    color: var(--ink);
}

.btn-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn {
    border: 0;
    border-radius: 10px;
    padding: 10px 14px;
    font-weight: 800;
    letter-spacing: 0.01em;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(180deg, var(--brand), var(--brand-2));
    color: #fff;
}

.btn-muted {
    background: var(--surface-muted);
    color: var(--ink);
    border: 1px solid var(--line);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

th,
td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
    text-align: left;
}

th {
    font-size: 12px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.pill {
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    display: inline-block;
    padding: 4px 9px;
    background: #e7eef2;
    color: #204050;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px 16px;
}

.meta-item {
    background: var(--surface-muted);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 12px;
}

.meta-item .k {
    margin: 0 0 4px;
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.meta-item .v {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
}

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

.gallery .gallery-item {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, #f8fafc, #e8eef3);
    display: block;
    box-shadow: 0 8px 18px rgba(17, 33, 43, 0.12);
    transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.gallery .gallery-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 24px rgba(17, 33, 43, 0.2);
}

.gallery img {
    width: 100%;
    height: 190px;
    object-fit: cover;
    display: block;
    transition: transform 0.25s ease;
}

.gallery .gallery-item:hover img {
    transform: scale(1.05);
}

.gallery .gallery-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 8px 10px;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.66), rgba(0, 0, 0, 0));
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.doc-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 10px;
}

.doc-item {
    border: 1px solid var(--line);
    background: var(--surface-muted);
    border-radius: 12px;
    padding: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.doc-item img {
    width: 28px;
    height: 28px;
}

.comment {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    padding: 10px 12px;
}

.comment .head {
    font-size: 12px;
    color: var(--ink-soft);
    margin-bottom: 6px;
    font-weight: 700;
}

.map {
    width: 100%;
    min-height: 420px;
    border-radius: 14px;
    border: 1px solid var(--line);
}

.map-small {
    min-height: 440px;
}

.leaflet-control-layers {
    border-radius: 10px;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: rgba(0, 0, 0, 0.84);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.lightbox.open {
    display: flex;
}

.lightbox-frame {
    position: relative;
    width: min(96vw, 1200px);
    max-height: 92vh;
    display: grid;
    grid-template-rows: 1fr auto;
    gap: 10px;
}

.lightbox-image-wrap {
    min-height: 0;
    background: #0b1320;
    border-radius: 14px;
    overflow: hidden;
    display: grid;
    place-items: center;
}

.lightbox-image {
    width: 100%;
    height: auto;
    max-height: calc(92vh - 96px);
    object-fit: contain;
}

.lightbox-caption {
    color: #e5e7eb;
    font-weight: 700;
    font-size: 14px;
    text-align: center;
}

.lightbox-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.lightbox-btn.prev {
    left: 10px;
}

.lightbox-btn.next {
    right: 10px;
}

.lightbox-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}

.flash {
    border-radius: 12px;
    padding: 10px 12px;
    margin-bottom: 8px;
    border: 1px solid transparent;
    font-weight: 700;
}

.flash.success {
    background: #dcfce7;
    border-color: #86efac;
    color: #14532d;
}

.flash.error {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #7f1d1d;
}

.flash.info {
    background: #e0f2fe;
    border-color: #7dd3fc;
    color: #0c4a6e;
}

.footer-note {
    margin-top: 16px;
    color: var(--ink-soft);
    font-size: 13px;
}

.login-wrap {
    max-width: 460px;
    margin: 8vh auto 0;
}

@media (max-width: 960px) {
    .toolbar .grow,
    .toolbar .short {
        grid-column: span 6;
    }
    .grid-2,
    .meta-grid {
        grid-template-columns: 1fr;
    }
    .brand h1 {
        font-size: 28px;
    }
}

@media (max-width: 640px) {
    .shell {
        padding: 14px 12px 24px;
    }
    .topbar {
        padding: 12px;
        align-items: flex-start;
        flex-direction: column;
    }
    .toolbar .grow,
    .toolbar .short {
        grid-column: span 12;
    }
    .btn {
        width: 100%;
    }
    .btn-row {
        width: 100%;
    }
    .map-small {
        min-height: 340px;
    }
    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    .gallery img {
        height: 140px;
    }
    .lightbox-btn {
        width: 38px;
        height: 38px;
        font-size: 20px;
    }
}
