* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f3f4f6;
    color: #111827;
}

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

.topbar {
    min-height: 72px;
    padding: 16px 28px;
    background: #111827;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.subtitle {
    color: #9ca3af;
    font-size: 13px;
    margin-top: 2px;
}

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

nav a {
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
}

nav a:hover {
    background: rgba(255,255,255,0.18);
}

.page {
    max-width: 1180px;
    margin: 0 auto;
    padding: 28px;
}

.hero {
    background: linear-gradient(135deg, #111827, #374151);
    color: white;
    padding: 32px;
    border-radius: 22px;
    margin-bottom: 24px;
}

.hero h1 {
    margin: 0 0 8px;
    font-size: 36px;
}

.hero p {
    margin: 0;
    color: #d1d5db;
    font-size: 17px;
}

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

.card {
    background: white;
    border-radius: 18px;
    padding: 22px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
    margin-bottom: 20px;
}

.card.narrow {
    max-width: 520px;
}

.card h1,
.card h2 {
    margin-top: 0;
}

.big-number {
    font-size: 54px;
    font-weight: 800;
    line-height: 1;
    margin: 16px 0;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat {
    background: white;
    border-radius: 18px;
    padding: 22px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
}

.stat span {
    color: #6b7280;
    display: block;
    margin-bottom: 8px;
}

.stat strong {
    font-size: 42px;
}

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: radial-gradient(circle at top, #374151, #030712);
}

.login-card {
    width: min(420px, calc(100vw - 32px));
    background: white;
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.3);
}

.login-logo {
    font-size: 28px;
    font-weight: 900;
    letter-spacing: 0.05em;
}

.login-subtitle {
    color: #6b7280;
    margin: 4px 0 24px;
}

form {
    display: grid;
    gap: 12px;
}

label {
    font-weight: 700;
    font-size: 14px;
}

input {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 12px 14px;
    font: inherit;
}

button {
    border: 0;
    border-radius: 12px;
    padding: 13px 16px;
    font: inherit;
    font-weight: 800;
    background: #111827;
    color: white;
    cursor: pointer;
    margin-top: 8px;
}

button:hover {
    background: #374151;
}

.alert {
    background: #fee2e2;
    color: #991b1b;
    padding: 12px 14px;
    border-radius: 12px;
    margin: 14px 0;
}

code {
    display: block;
    background: #f3f4f6;
    padding: 10px 12px;
    border-radius: 10px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 10px 8px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    font-size: 14px;
}

th {
    color: #6b7280;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

@media (max-width: 820px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

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

    .page {
        padding: 18px;
    }

    .hero {
        padding: 24px;
    }

    .hero h1 {
        font-size: 30px;
    }
}

select {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 12px 14px;
    font: inherit;
    background: white;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    padding: 10px 14px;
    background: #111827;
    color: white;
    font-weight: 800;
}

.button-link:hover {
    background: #374151;
}

.actions {
    white-space: nowrap;
}

.actions a {
    display: inline-block;
    margin-right: 10px;
    color: #1d4ed8;
    font-weight: 700;
}

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

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}

.checkbox-row input {
    width: auto;
}

.form-footer {
    margin-top: 20px;
}

.form-footer a {
    color: #1d4ed8;
    font-weight: 700;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    text-align: left;
    vertical-align: top;
}

.table th {
    color: #9ca3af;
    font-weight: 600;
    font-size: 13px;
}

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    font-size: 12px;
}

.grid.two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.details {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 8px 14px;
}

.details dt {
    color: #9ca3af;
}

.details dd {
    margin: 0;
}

.form-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 16px;
}

.actions-card {
    margin-bottom: 16px;
}

@media (max-width: 800px) {
    .grid.two {
        grid-template-columns: 1fr;
    }

    .table {
        font-size: 14px;
    }
}

.field-group {
    margin: 14px 0;
}

.field-title {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.checkbox-list {
    display: grid;
    gap: 8px;
    padding: 10px;
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 10px;
    background: rgba(255,255,255,0.03);
}

.check-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin: 0;
}

.check-row input {
    width: auto;
}

.hint-box {
    padding: 10px 12px;
    margin: 12px 0;
    border-radius: 10px;
    background: rgba(255,255,255,0.06);
    color: #d1d5db;
}


/* Photo gallery */

.photo-section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.photo-section-header h2,
.photo-section-header p {
    margin-top: 0;
}

.photo-section-header h2 {
    margin-bottom: 0.2rem;
}

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

.photo-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid rgba(127, 127, 127, 0.22);
    border-radius: 12px;
    background: var(--card-background, #fff);
}

.photo-preview-link {
    display: block;
    position: relative;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background: #161616;
}

.photo-preview-link img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.18s ease;
}

.photo-preview-link:hover img {
    transform: scale(1.025);
}

.photo-card-body {
    padding: 0.8rem;
}

.photo-filename {
    overflow: hidden;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.photo-meta {
    min-height: 1.4em;
    margin-top: 0.3rem;
    color: var(--muted-color, #737373);
    font-size: 0.84rem;
}

.photo-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.8rem;
}

.photo-actions .button {
    flex: 1;
    justify-content: center;
    text-align: center;
}

.button.small {
    padding: 0.5rem 0.7rem;
    font-size: 0.84rem;
}

.empty-photo-state {
    padding: 2rem 1rem;
    text-align: center;
}

.empty-photo-state p {
    margin: 0.3rem 0;
}

@media (max-width: 640px) {
    .photo-grid {
        grid-template-columns: repeat(
            2,
            minmax(0, 1fr)
        );
        gap: 0.65rem;
    }

    .photo-card-body {
        padding: 0.65rem;
    }

    .photo-actions {
        flex-direction: column;
    }
}

@media (max-width: 420px) {
    .photo-grid {
        grid-template-columns: 1fr;
    }
}


/* Gallery selection and ZIP download */

.gallery-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
}

.gallery-toolbar button {
    margin: 0;
}

.operation-banner {
    margin-bottom: 1rem;
    padding: 0.8rem 1rem;
    border: 1px solid rgba(35, 107, 255, 0.25);
    border-radius: 10px;
    background: rgba(35, 107, 255, 0.08);
    font-weight: 600;
}

.photo-card {
    position: relative;
}

.photo-card.selected {
    outline: 3px solid rgba(35, 107, 255, 0.55);
    outline-offset: -3px;
}

.photo-select {
    position: absolute;
    z-index: 3;
    top: 0.65rem;
    left: 0.65rem;
    display: grid;
    width: 2rem;
    height: 2rem;
    cursor: pointer;
    place-items: center;
}

.photo-select input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.photo-select span {
    display: block;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid #fff;
    border-radius: 0.3rem;
    background: rgba(0, 0, 0, 0.45);
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.35);
}

.photo-select input:checked + span {
    background: #236bff;
}

.photo-select input:checked + span::after {
    display: block;
    width: 0.35rem;
    height: 0.65rem;
    margin: 0.12rem auto 0;
    border: solid #fff;
    border-width: 0 0.16rem 0.16rem 0;
    content: "";
    transform: rotate(45deg);
}

.photo-select input:focus-visible + span {
    outline: 3px solid rgba(35, 107, 255, 0.45);
    outline-offset: 2px;
}

@media (max-width: 760px) {
    .photo-section-header {
        flex-direction: column;
    }

    .gallery-toolbar {
        width: 100%;
        justify-content: flex-start;
    }

    .gallery-toolbar .button {
        flex: 1 1 calc(50% - 0.5rem);
    }
}

.client-checkbox-list {
    display: grid;
    gap: 0.75rem;
    margin: 1rem 0;
}

.client-checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border-color, #d8dde5);
    border-radius: 0.7rem;
    cursor: pointer;
}

.client-checkbox-item input {
    width: 1.1rem;
    height: 1.1rem;
    margin: 0;
}

.form-actions {
    margin-top: 1rem;
}

.err-auto-option {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color, #d8dde5);
}

.err-auto-description {
    display: block;
    margin-top: 0.3rem;
    line-height: 1.4;
}

.err-queue-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin-top: 0.8rem;
    font-size: 0.9rem;
}

.photo-err-status {
    margin-top: 0.55rem;
}

.err-badge {
    display: inline-flex;
    align-items: center;
    min-height: 1.6rem;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.2;
}

.err-pending {
    background: #fff3cd;
    color: #725700;
}

.err-sending {
    background: #dbeafe;
    color: #174c8c;
}

.err-sent {
    background: #dcfce7;
    color: #176534;
}

.err-failed {
    background: #fee2e2;
    color: #991b1b;
}

.err-none {
    background: #eef0f3;
    color: #626a75;
}

.err-recent-events {
    margin-top: 0.9rem;
    padding: 0.8rem;
    border: 1px solid var(--border-color, #d8dde5);
    border-radius: 0.65rem;
}

.err-recent-title {
    margin-bottom: 0.55rem;
    font-weight: 700;
}

.err-event-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 0.65rem;
    align-items: center;
    padding: 0.4rem 0;
    border-top: 1px solid var(--border-color, #e2e6eb);
    font-size: 0.85rem;
}

.err-event-row:first-of-type {
    border-top: 0;
}

.err-event-filename {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.err-event-status {
    font-weight: 700;
}

.err-event-sent {
    color: #176534;
}

.err-event-sending {
    color: #174c8c;
}

.err-event-pending {
    color: #725700;
}

.err-event-failed {
    color: #991b1b;
}

.err-event-row time {
    color: var(--muted-color, #68707b);
    white-space: nowrap;
}

@media (max-width: 680px) {
    .err-event-row {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .err-event-row time {
        grid-column: 1 / -1;
        font-size: 0.78rem;
    }
}

.inline-form {
    display: inline-flex;
    margin: 0;
}

.shoot-header-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.55rem;
}

.button.danger {
    border-color: #b42318;
    background: #b42318;
    color: #ffffff;
}

.button.danger:hover {
    border-color: #8f1c13;
    background: #8f1c13;
    color: #ffffff;
}

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