:root {
    --primary: #194f8a;
    --primary-dark: #103866;
    --success: #16834b;
    --warning: #9a6500;
    --danger: #bd2631;
    --light: #f5f8fc;
    --border: #dce4ef;
    --text: #1f2937;
    --muted: #64748b;
    --white: #ffffff;
    --shadow: 0 12px 32px rgba(20, 49, 87, 0.09);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--text);
    background: var(--light);
    font-family: Arial, Helvetica, sans-serif;
}

.container {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
}

.hero {
    color: var(--white);
    padding: 48px 0;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
}

.admin-hero {
    padding: 28px 0;
}

.hero h1 {
    margin: 4px 0 10px;
    font-size: clamp(2rem, 5vw, 3rem);
}

.brand-subtitle {
    margin: 0;
    color: #cfe5ff;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.hero-description {
    max-width: 650px;
    margin: 0;
    color: #e8f3ff;
    line-height: 1.65;
}

.admin-link {
    display: inline-block;
    margin-top: 22px;
    color: var(--white);
    font-weight: 700;
}

.content {
    padding: 32px 0 48px;
}

.card,
.stat-card {
    margin-bottom: 24px;
    padding: 28px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.card-heading,
.camera-header,
.topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.card-heading {
    margin-bottom: 24px;
}

.card h2,
.card h3 {
    margin: 0 0 7px;
}

.card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.form-grid,
.filter-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 700;
}

.form-group small {
    color: var(--muted);
    font-size: 0.82rem;
}

input,
select {
    width: 100%;
    min-height: 45px;
    padding: 10px 12px;
    color: var(--text);
    background: var(--white);
    border: 1px solid #bac8d8;
    border-radius: 9px;
    font: inherit;
}

input:focus,
select:focus {
    outline: 3px solid rgba(25, 79, 138, 0.18);
    border-color: var(--primary);
}

.required {
    color: var(--danger);
}

.camera-section {
    margin-top: 28px;
    padding-top: 25px;
    border-top: 1px solid var(--border);
}

.camera-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.camera-box {
    position: relative;
    min-height: 280px;
    overflow: hidden;
    background: #0f172a;
    border: 1px solid #26344a;
    border-radius: 14px;
}

video,
#previewFoto {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 280px;
    object-fit: cover;
}

#previewFoto {
    display: none;
}

.camera-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    color: #d4deed;
    text-align: center;
}

.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.button-group.center {
    justify-content: center;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 43px;
    padding: 10px 16px;
    color: var(--white);
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: 9px;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    transition: 0.2s ease;
}

.btn:hover {
    filter: brightness(0.95);
    transform: translateY(-1px);
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.58;
    transform: none;
}

.btn-primary {
    background: var(--primary);
}

.btn-secondary {
    background: #475569;
}

.btn-success {
    background: var(--success);
}

.btn-danger {
    background: var(--danger);
}

.btn-outline {
    color: var(--primary);
    background: var(--white);
    border-color: var(--primary);
}

.btn-light {
    color: var(--primary-dark);
    background: var(--white);
}

.btn-small {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 0.82rem;
}

.form-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-top: 26px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.privacy-note {
    max-width: 700px;
    font-size: 0.88rem;
}

.badge {
    display: inline-block;
    flex: 0 0 auto;
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}

.badge-success {
    color: #0a5c33;
    background: #d9f7e7;
}

.badge-warning {
    color: #825600;
    background: #fff1c8;
}

.badge-danger {
    color: #9d1720;
    background: #ffe0e3;
}

.badge-neutral {
    color: #475569;
    background: #e8edf5;
}

.alert {
    margin: 0 0 20px;
    padding: 13px 15px;
    border-radius: 9px;
    line-height: 1.5;
}

.alert-error {
    color: #8f1820;
    background: #ffe3e5;
    border: 1px solid #ffc3c8;
}

.alert-success {
    color: #0c5b35;
    background: #dcf8e8;
    border: 1px solid #b7edce;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.stat-card {
    margin: 0;
    padding: 20px;
}

.stat-card span {
    display: block;
    color: var(--muted);
    font-size: 0.88rem;
}

.stat-card strong {
    display: block;
    margin-top: 8px;
    color: var(--primary-dark);
    font-size: 2rem;
}

.filter-grid {
    grid-template-columns: 2fr 1fr 1fr 1fr;
    align-items: end;
}

.filter-actions {
    display: flex;
    gap: 10px;
    grid-column: 1 / -1;
}

.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th,
td {
    padding: 13px 12px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
}

th {
    color: #334155;
    background: #f8fafc;
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

td small,
.no-photo,
.face-count {
    color: var(--muted);
    font-size: 0.8rem;
}

.photo-thumb {
    display: block;
    width: 54px;
    height: 54px;
    object-fit: cover;
    border-radius: 9px;
    border: 1px solid var(--border);
}

.empty-state {
    padding: 35px;
    color: var(--muted);
    text-align: center;
}

.result-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
}

.result-card {
    width: min(650px, 100%);
    text-align: center;
}

.result-icon {
    display: grid;
    width: 62px;
    height: 62px;
    margin: 0 auto 18px;
    place-items: center;
    border-radius: 50%;
    color: var(--white);
    font-size: 2rem;
    font-weight: 700;
}

.result-icon.success {
    background: var(--success);
}

.result-icon.danger {
    background: var(--danger);
}

.result-description {
    margin-bottom: 22px !important;
}

.receipt {
    margin: 22px 0;
    overflow: hidden;
    text-align: left;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.receipt div {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border);
}

.receipt div:last-child {
    border-bottom: 0;
}

.receipt span {
    color: var(--muted);
}

.error-list {
    display: inline-block;
    margin: 0 auto 22px;
    color: var(--danger);
    text-align: left;
}

footer {
    padding: 25px 0;
    color: #dce8f7;
    background: #102a43;
    text-align: center;
}

@media (max-width: 860px) {
    .form-grid,
    .camera-grid,
    .stats-grid,
    .filter-grid {
        grid-template-columns: 1fr 1fr;
    }

    .topbar,
    .form-footer {
        flex-direction: column;
    }
}

@media (max-width: 560px) {
    .form-grid,
    .camera-grid,
    .stats-grid,
    .filter-grid {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 20px;
    }

    .card-heading,
    .camera-header {
        flex-direction: column;
    }

    .form-footer .btn {
        width: 100%;
    }

    .receipt div {
        flex-direction: column;
        gap: 4px;
    }
}