
:root {
    --bg: #f5f5f2;
    --panel: #ffffff;
    --ink: #050505;
    --muted: #6f6f6f;
    --line: #e4e4df;
    --soft: #ededE8;
    --accent: #e50914;
    --ok: #087a43;
    --danger: #bd1f2d;
    --shadow: 0 18px 45px rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100%;
    color: var(--ink);
    background: var(--bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

body.lock-scroll {
    overflow: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    display: block;
    max-width: 100%;
}

button,
input,
select {
    font: inherit;
}

.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 16px clamp(18px, 4vw, 48px);
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(16px);
}

.brand,
.top-actions,
.card-actions,
.form-actions,
.share-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand {
    font-weight: 800;
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    color: #fff;
    background: #000;
    border-radius: 8px;
    font-weight: 900;
}

.brand-mark.large {
    width: 56px;
    height: 56px;
    margin: 0 auto;
}

.top-actions a,
.card-actions a,
.client-link {
    font-size: 14px;
    font-weight: 700;
}

.top-actions a {
    padding: 10px 12px;
    border-radius: 8px;
}

.top-actions a:hover {
    background: var(--soft);
}

.admin-shell,
.gallery-shell {
    width: min(1440px, 100%);
    margin: 0 auto;
    padding: clamp(20px, 4vw, 48px);
}

.admin-shell.narrow {
    width: min(980px, 100%);
}

.page-head,
.gallery-hero,
.section-title {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 28px;
}

.page-head h1,
.gallery-hero h1,
.brand-lockup h1 {
    margin: 0;
    font-size: clamp(34px, 5vw, 64px);
    line-height: 0.98;
    letter-spacing: 0;
}

.section-title h2,
.summary-panel h2,
.share-box h2,
.danger-panel h2 {
    margin: 0;
    font-size: 22px;
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.btn,
button.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 18px;
    border: 1px solid #000;
    border-radius: 8px;
    background: #fff;
    color: #000;
    font-weight: 800;
    cursor: pointer;
}

.btn.primary {
    color: #fff;
    background: #000;
}

.btn.light {
    color: #000;
    background: #fff;
    border-color: #fff;
}

.btn.ghost {
    background: transparent;
}

.btn.danger,
.icon-button.danger {
    color: #fff;
    background: var(--danger);
    border-color: var(--danger);
}

.btn.disabled {
    pointer-events: none;
    opacity: 0.4;
}

.auth-page {
    background: #050505;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-panel {
    width: min(440px, 100%);
    padding: 34px;
    background: #fff;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.brand-lockup {
    text-align: center;
    margin-bottom: 28px;
}

.brand-lockup p {
    color: var(--muted);
}

.stack-form,
.form-panel,
.danger-panel,
.upload-panel,
.summary-panel,
.list-panel,
.share-box,
.empty-state {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

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

.stack-form,
.form-panel,
.danger-panel,
.upload-panel,
.summary-panel,
.list-panel,
.share-box,
.empty-state {
    padding: 22px;
}

label {
    display: grid;
    gap: 8px;
}

label span {
    color: #222;
    font-size: 13px;
    font-weight: 800;
}

input,
select {
    width: 100%;
    min-height: 48px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: #000;
}

input:focus,
select:focus {
    outline: 2px solid #000;
    outline-offset: 1px;
}

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

.wide {
    grid-column: 1 / -1;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
}

.check-row input {
    width: 18px;
    min-height: 18px;
}

.form-actions {
    justify-content: flex-end;
    margin-top: 22px;
    flex-wrap: wrap;
}

.inline-form {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 120px auto;
    align-items: end;
    gap: 14px;
    margin-bottom: 18px;
}

.alert {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 8px;
    font-weight: 700;
}

.alert-success {
    color: #064527;
    background: #e6f5ee;
}

.alert-error {
    color: #7c111a;
    background: #ffe9eb;
}

.client-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 18px;
}

.client-card {
    display: grid;
    gap: 16px;
    min-height: 265px;
    padding: 22px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.client-card h2 {
    margin: 0;
    font-size: 28px;
    line-height: 1.04;
}

.client-card p {
    margin: 0;
    color: var(--muted);
}

.card-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.status-pill {
    padding: 6px 10px;
    color: #fff;
    background: #777;
    border-radius: 999px;
}

.status-pill.published {
    background: var(--ok);
}

.metric-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 0;
}

.metric-row div,
.summary-panel dl div,
.modal-details div {
    padding: 12px;
    background: var(--bg);
    border-radius: 8px;
}

dt {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

dd {
    margin: 4px 0 0;
    font-size: 20px;
    font-weight: 900;
}

.card-actions {
    flex-wrap: wrap;
}

.card-actions a {
    padding: 9px 12px;
    background: var(--bg);
    border-radius: 8px;
}

.client-link {
    color: var(--accent);
    overflow-wrap: anywhere;
}

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

.list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px;
    background: var(--bg);
    border-radius: 8px;
}

.list-row div {
    display: grid;
    gap: 4px;
}

.list-row span,
.muted {
    color: var(--muted);
}

.icon-button {
    min-height: 38px;
    padding: 0 12px;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
}

.danger-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-top: 24px;
    border-color: #f0c7cb;
}

.danger-panel p {
    margin: 8px 0 0;
    color: var(--muted);
}

.upload-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 18px;
    align-items: start;
}

.upload-controls {
    display: grid;
    grid-template-columns: minmax(180px, 240px) minmax(220px, 1fr) auto;
    gap: 14px;
    align-items: end;
}

.upload-note {
    margin-top: 14px;
    color: var(--muted);
    font-size: 14px;
}

.upload-queue {
    display: grid;
    gap: 10px;
    max-height: 520px;
    margin-top: 16px;
    overflow: auto;
}

.upload-row {
    display: grid;
    gap: 8px;
    padding: 12px;
    background: var(--bg);
    border-radius: 8px;
}

.upload-row-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
}

.upload-row-head strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.progress-track {
    height: 8px;
    overflow: hidden;
    background: #d9d9d2;
    border-radius: 99px;
}

.progress-bar {
    width: 0;
    height: 100%;
    background: #000;
    transition: width 0.18s ease;
}

.upload-row.done .progress-bar {
    background: var(--ok);
}

.upload-row.failed .progress-bar {
    background: var(--danger);
}

.summary-panel dl,
.modal-details {
    display: grid;
    gap: 10px;
    margin: 16px 0;
}

.admin-gallery {
    margin-top: 34px;
}

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

.photo-admin-card {
    position: relative;
    margin: 0;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.photo-admin-card img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    background: #ddd;
}

.photo-admin-card figcaption {
    display: grid;
    gap: 2px;
    padding: 10px;
    font-weight: 900;
}

.photo-admin-card small {
    color: var(--muted);
    font-weight: 700;
}

.photo-delete {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 7px 9px;
    color: #fff;
    background: rgba(0, 0, 0, 0.75);
    border: 0;
    border-radius: 8px;
    cursor: pointer;
}

.modal-backdrop,
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.76);
}

.modal-backdrop.active,
.lightbox.active {
    display: flex;
}

.publish-modal {
    width: min(620px, 100%);
    padding: 28px;
    background: #fff;
    border-radius: 8px;
}

.public-page {
    background: #050505;
    color: #fff;
}

.gallery-shell {
    width: min(1600px, 100%);
}

.gallery-hero {
    min-height: 160px;
    padding: clamp(18px, 4vw, 34px);
    background: #111;
    border: 1px solid #242424;
    border-radius: 8px;
}

.gallery-hero .eyebrow {
    color: #a9a9a9;
}

.filter-tabs {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    gap: 10px;
    margin: 18px 0;
    padding: 10px;
    overflow-x: auto;
    background: rgba(5, 5, 5, 0.9);
    border: 1px solid #242424;
    border-radius: 8px;
    backdrop-filter: blur(16px);
}

.filter-tabs button {
    flex: 0 0 auto;
    min-height: 42px;
    padding: 0 16px;
    color: #fff;
    background: #171717;
    border: 1px solid #2f2f2f;
    border-radius: 8px;
    cursor: pointer;
}

.filter-tabs button.active {
    color: #000;
    background: #fff;
}

.masonry-grid {
    columns: 4 220px;
    column-gap: 12px;
}

.photo-tile {
    position: relative;
    display: inline-block;
    width: 100%;
    margin: 0 0 12px;
    overflow: hidden;
    background: #171717;
    border-radius: 8px;
    break-inside: avoid;
}

.image-button {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    overflow: hidden;
    background: #111;
    border: 0;
    cursor: zoom-in;
}

.image-button img:first-child {
    width: 100%;
    height: auto;
    min-height: 180px;
    object-fit: contain;
    background: #111;
}

.watermark {
    position: absolute;
    right: 12px;
    bottom: 12px;
    width: min(34%, 150px);
    max-height: 90px;
    object-fit: contain;
    opacity: 0.62;
    pointer-events: none;
}

.watermark.large {
    width: min(24vw, 220px);
    max-height: 140px;
}

.heart-button {
    position: absolute;
    top: 10px;
    right: 10px;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    padding: 0;
    color: #fff;
    background: rgba(0, 0, 0, 0.62);
    border: 1px solid rgba(255, 255, 255, 0.26);
    border-radius: 999px;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.photo-tile.selected .heart-button,
.lightbox-heart {
    color: #fff;
}

.photo-tile.selected .heart-button {
    background: var(--accent);
    border-color: var(--accent);
}

.photo-code {
    position: absolute;
    left: 10px;
    bottom: 10px;
    padding: 6px 8px;
    color: #fff;
    background: rgba(0, 0, 0, 0.66);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 900;
}

.lightbox figure {
    position: relative;
    display: grid;
    gap: 12px;
    width: min(1180px, 100%);
    max-height: 94vh;
    margin: 0;
}

.lightbox-image-wrap {
    position: relative;
    display: grid;
    place-items: center;
    max-height: calc(94vh - 74px);
}

.lightbox img#lightboxImage {
    max-width: 100%;
    max-height: calc(94vh - 74px);
    object-fit: contain;
    background: #111;
}

.lightbox figcaption {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    min-height: 50px;
    color: #fff;
    font-weight: 900;
}

.lightbox .heart-button {
    position: static;
}

.lightbox-close,
.lightbox-nav {
    position: absolute;
    z-index: 2;
    color: #fff;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 8px;
    cursor: pointer;
}

.lightbox-close {
    top: 18px;
    right: 18px;
    min-height: 42px;
    padding: 0 14px;
}

.lightbox-nav {
    top: 50%;
    width: 46px;
    height: 58px;
    font-size: 44px;
    line-height: 1;
    transform: translateY(-50%);
}

.lightbox-nav.prev {
    left: 18px;
}

.lightbox-nav.next {
    right: 18px;
}

.share-actions {
    justify-content: flex-end;
    margin-bottom: 18px;
}

.share-box h3 {
    margin: 20px 0 6px;
}

.share-box p {
    margin: 0;
    overflow-wrap: anywhere;
}

.public-empty {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 24px;
    text-align: center;
}

.empty-state {
    text-align: center;
}

.empty-state h2 {
    margin: 0 0 8px;
}

.empty-state p {
    margin: 0 0 16px;
    color: var(--muted);
}

.empty-state.public {
    color: #000;
}

@media (max-width: 900px) {
    .admin-topbar,
    .page-head,
    .gallery-hero,
    .danger-panel {
        align-items: stretch;
        flex-direction: column;
    }

    .upload-layout,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .upload-controls,
    .inline-form {
        grid-template-columns: 1fr;
    }

    .summary-panel {
        order: -1;
    }

    .page-head h1,
    .gallery-hero h1,
    .brand-lockup h1 {
        font-size: clamp(34px, 12vw, 54px);
    }
}

@media (max-width: 560px) {
    .admin-shell,
    .gallery-shell {
        padding: 16px;
    }

    .auth-panel,
    .form-panel,
    .danger-panel,
    .upload-panel,
    .summary-panel,
    .list-panel,
    .share-box,
    .empty-state {
        padding: 16px;
    }

    .metric-row {
        grid-template-columns: 1fr;
    }

    .masonry-grid {
        columns: 2 150px;
        column-gap: 8px;
    }

    .photo-tile {
        margin-bottom: 8px;
    }

    .heart-button {
        width: 38px;
        height: 38px;
    }

    .lightbox-nav {
        width: 40px;
        height: 52px;
    }

    .lightbox-nav.prev {
        left: 8px;
    }

    .lightbox-nav.next {
        right: 8px;
    }
}

