:root {
    --ink: #181817;
    --muted: #65625d;
    --paper: #fffdf8;
    --panel: rgba(255, 253, 248, 0.9);
    --line: rgba(24, 24, 23, 0.12);
    --green: #176b55;
    --blue: #2f5f98;
    --coral: #bd5660;
    --gold: #c28c32;
    --shadow: 0 22px 60px rgba(30, 26, 21, 0.14);
}

body {
    background:
        linear-gradient(120deg, rgba(23, 107, 85, 0.12), transparent 34%),
        linear-gradient(300deg, rgba(189, 86, 96, 0.11), transparent 38%),
        linear-gradient(180deg, #fff8eb 0%, #edf4ef 48%, #fbf5f0 100%) !important;
    color: var(--ink) !important;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif !important;
}

.page {
    width: min(1180px, calc(100% - 36px)) !important;
    padding: 28px 0 56px !important;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    margin: 0 0 28px !important;
    padding: 14px 0 !important;
    backdrop-filter: blur(16px);
}

.topbar > div:first-child {
    position: relative;
}

h1 {
    color: var(--ink) !important;
    font-size: clamp(38px, 7vw, 72px) !important;
    font-weight: 850 !important;
}

.subtitle,
.copy,
.switch,
.empty {
    color: var(--muted) !important;
}

.subtitle {
    max-width: 680px !important;
    font-size: 17px !important;
}

.button,
button.button {
    min-height: 46px !important;
    border-radius: 8px !important;
    background: linear-gradient(135deg, var(--green), var(--blue)) !important;
    color: #ffffff !important;
    box-shadow: 0 14px 28px rgba(47, 95, 152, 0.24) !important;
    transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease !important;
}

a.button,
a.button:visited,
a.button:hover,
a.button:focus {
    color: #ffffff !important;
}

.button:hover,
button.button:hover {
    filter: saturate(1.08);
    transform: translateY(-2px) !important;
    box-shadow: 0 18px 38px rgba(23, 107, 85, 0.28) !important;
}

.logout,
.back,
.menu-link {
    transition: transform 180ms ease, background 180ms ease, border-color 180ms ease !important;
}

.logout {
    border-color: var(--line) !important;
    background: rgba(255, 253, 248, 0.76) !important;
    color: var(--ink) !important;
    box-shadow: 0 10px 26px rgba(30, 26, 21, 0.08);
}

.logout:hover {
    border-color: rgba(189, 86, 96, 0.35) !important;
    background: #fff !important;
}

.grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)) !important;
    gap: 24px !important;
}

.card {
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.84) !important;
    background: var(--panel) !important;
    box-shadow: var(--shadow) !important;
}

.card::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88);
}

.card:hover {
    transform: translateY(-6px) !important;
    box-shadow: 0 28px 70px rgba(30, 26, 21, 0.2) !important;
}

.card img {
    aspect-ratio: 1 / 1 !important;
}

.card-body {
    padding: 16px !important;
}

.meta {
    color: var(--muted) !important;
}

.tag {
    background: rgba(23, 107, 85, 0.1) !important;
    color: var(--green) !important;
}

.card:nth-child(3n + 2) .tag {
    background: rgba(189, 86, 96, 0.1) !important;
    color: #9e3f49 !important;
}

.card:nth-child(3n) .tag {
    background: rgba(194, 140, 50, 0.14) !important;
    color: #8f651d !important;
}

.caption,
.lightbox-caption {
    color: #2b2a27 !important;
}

.status,
.empty,
.panel {
    border: 1px solid rgba(255, 255, 255, 0.8) !important;
    border-radius: 8px !important;
    background: var(--panel) !important;
    box-shadow: var(--shadow) !important;
    backdrop-filter: blur(14px);
}

.status {
    border-left: 5px solid var(--green) !important;
}

.lightbox {
    background: rgba(16, 17, 16, 0.86) !important;
}

.lightbox-panel {
    background: #fffdf8 !important;
    box-shadow: 0 34px 90px rgba(0, 0, 0, 0.48) !important;
}

.lightbox-stage,
.lightbox-image {
    background: #111412 !important;
}

.lightbox-nav,
.lightbox-close {
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
}

body:has(.panel) {
    place-items: center !important;
}

.panel {
    width: min(500px, 100%) !important;
    padding: 28px !important;
}

form.panel {
    width: min(760px, 100%) !important;
}

.panel h1 {
    font-size: clamp(34px, 7vw, 52px) !important;
}

.field {
    margin-bottom: 18px !important;
}

label {
    color: #34332f !important;
}

input,
select,
textarea {
    border: 1px solid var(--line) !important;
    background: rgba(255, 255, 255, 0.74) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: rgba(23, 107, 85, 0.55) !important;
    background: #fff !important;
    box-shadow: 0 0 0 4px rgba(23, 107, 85, 0.12);
}

input[type="file"] {
    padding: 12px !important;
}

a {
    color: var(--green) !important;
}

.menu-link,
.back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 253, 248, 0.72);
    color: var(--ink) !important;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
}

.menu-link:hover,
.back:hover {
    background: #fff;
    transform: translateY(-1px);
}

@media (hover: none) {
    .button:hover,
    button.button:hover,
    .card:hover,
    .logout:hover,
    .menu-link:hover,
    .back:hover {
        transform: none !important;
    }
}

@media (max-width: 720px) {
    body {
        min-width: 0;
        overflow-x: hidden;
    }

    .page {
        width: min(100% - 24px, 1180px) !important;
        padding: 16px 0 34px !important;
    }

    .topbar {
        position: static;
        align-items: stretch !important;
        gap: 18px !important;
        margin-bottom: 20px !important;
        padding: 6px 0 0 !important;
    }

    h1 {
        font-size: clamp(32px, 11vw, 48px) !important;
        line-height: 0.96 !important;
    }

    .subtitle,
    .copy {
        max-width: 100% !important;
        font-size: 15px !important;
        line-height: 1.55 !important;
    }

    .actions,
    .nav {
        display: grid !important;
        grid-template-columns: 1fr !important;
        width: 100% !important;
        gap: 10px !important;
    }

    .actions form,
    .nav form {
        width: 100% !important;
    }

    .button,
    button.button,
    .logout,
    .menu-link,
    .back {
        width: 100% !important;
        min-height: 48px !important;
        padding: 0 14px !important;
        font-size: 15px !important;
        text-align: center;
    }

    .grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    .card {
        border-radius: 8px !important;
        box-shadow: 0 14px 34px rgba(30, 26, 21, 0.12) !important;
    }

    .card img {
        aspect-ratio: 4 / 3 !important;
    }

    .card-body {
        padding: 14px !important;
    }

    .meta {
        align-items: flex-start !important;
        font-size: 13px !important;
    }

    .tag {
        flex: 0 0 auto;
    }

    .caption {
        font-size: 15px;
    }

    .card-footer {
        margin-top: 12px !important;
    }

    .remove-button {
        width: 100%;
        min-height: 42px;
    }

    .empty,
    .status {
        padding: 18px !important;
    }

    .panel {
        width: 100% !important;
        padding: 20px !important;
    }

    form.panel {
        width: 100% !important;
    }

    input,
    select,
    textarea {
        min-height: 48px !important;
        font-size: 16px !important;
    }

    textarea {
        min-height: 112px !important;
    }

    label {
        font-size: 14px !important;
    }

    .field {
        margin-bottom: 16px !important;
    }

    .lightbox {
        align-items: flex-end !important;
        padding: 10px !important;
    }

    .lightbox-panel {
        width: 100% !important;
        max-height: calc(100dvh - 20px) !important;
        border-radius: 8px !important;
    }

    .lightbox-image {
        max-height: 62dvh !important;
    }

    .lightbox-details {
        align-items: flex-start !important;
        flex-direction: column !important;
        gap: 10px !important;
        padding: 14px !important;
    }

    .lightbox-nav {
        width: 42px !important;
        height: 42px !important;
        font-size: 28px !important;
    }

    .lightbox-prev {
        left: 10px !important;
    }

    .lightbox-next {
        right: 10px !important;
    }

    .lightbox-close {
        top: 10px !important;
        right: 10px !important;
        width: 42px !important;
        height: 42px !important;
    }
}

@media (max-width: 420px) {
    .page {
        width: min(100% - 18px, 1180px) !important;
        padding-top: 10px !important;
    }

    h1 {
        font-size: clamp(30px, 12vw, 42px) !important;
    }

    .panel {
        padding: 18px !important;
    }

    .card img {
        aspect-ratio: 1 / 1 !important;
    }
}
