* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #f4f6f8;
    color: #202124;
}

.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 390px;
    background: #fff;
    border-radius: 18px;
    padding: 26px;
    box-shadow: 0 14px 40px rgba(0,0,0,.10);
}

.login-card h1 {
    margin: 0 0 6px;
    font-size: 26px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
}

.topbar-center {
    flex: 1;
    text-align: center;
}

.topbar-logo {
    height: 44px;
    display: inline-block;
}

.topbar-menu-btn {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: #f3f4f6;
    border: 0;
    color: #374151;
    font-size: 22px;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    cursor: pointer;
    line-height: 38px;
    text-align: center;
    padding: 0;
}

.container {
    width: 100%;
    max-width: 860px;
    margin: 0 auto;
    padding: 16px;
}

.card {
    background: #fff;
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 16px;
    box-shadow: 0 6px 24px rgba(0,0,0,.06);
}

.card h2 {
    margin: 0 0 16px;
    font-size: 20px;
}

label {
    display: block;
    margin-bottom: 6px;
    font-weight: bold;
    font-size: 14px;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 12px;
    font-size: 16px;
    background: #fff;
}

textarea {
    resize: vertical;
}

.form-row {
    position: relative;
    margin-bottom: 14px;
}

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

.btn {
    border: 0;
    border-radius: 12px;
    padding: 13px 16px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
}

.btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.btn-primary {
    background: #1f6feb;
    color: #fff;
}

.btn-secondary {
    background: #e5e7eb;
    color: #111827;
}

.btn-success {
    background: #15803d;
    color: #fff;
}

.btn-full {
    width: 100%;
}

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

.notice {
    background: #fff7ed;
    border: 1px solid #fdba74;
    color: #7c2d12;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 16px;
    font-size: 15px;
}

.alert {
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 14px;
}

.alert-error {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: #7f1d1d;
}

.muted {
    color: #6b7280;
}

.small {
    font-size: 13px;
}

.hidden {
    display: none !important;
}

.camera-card {
    padding: 12px !important;
}

.btn-camara {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    border: 2px dashed #1f6feb;
    background: #eff6ff;
    border-radius: 14px;
    padding: 28px 16px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.btn-camara:active {
    background: #dbeafe;
    border-color: #1a5ac9;
}

.btn-camara-icon {
    font-size: 42px;
    line-height: 1;
}

.btn-camara-text {
    font-size: 18px;
    font-weight: 800;
    color: #1f6feb;
    letter-spacing: 1px;
}

.preview-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
    min-height: 20px;
}

.preview-item {
    background: #f3f4f6;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

.preview-item img {
    width: 100%;
    height: 110px;
    object-fit: cover;
    display: block;
}

.preview-item span {
    display: block;
    padding: 7px;
    font-size: 13px;
    color: #374151;
}

.upload-status {
    margin-top: 12px;
    font-weight: bold;
}

.upload-status.ok {
    color: #15803d;
}

.upload-status.error {
    color: #b91c1c;
}

.upload-status.loading {
    color: #1f6feb;
}

.search-results {
    display: none;
    position: absolute;
    z-index: 20;
    top: 78px;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0,0,0,.12);
    overflow: hidden;
}

.search-results.visible {
    display: block;
}

.search-item {
    width: 100%;
    border: 0;
    background: #fff;
    padding: 12px;
    text-align: left;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
}

.search-item strong {
    display: block;
    color: #111827;
}

.search-item span {
    display: block;
    color: #6b7280;
    font-size: 13px;
    margin-top: 2px;
}

.search-empty {
    padding: 12px;
    color: #6b7280;
}

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

.table th,
.table td {
    border-bottom: 1px solid #e5e7eb;
    padding: 10px;
    text-align: left;
    vertical-align: top;
}

.table th {
    width: 40%;
    background: #f9fafb;
}

@media (max-width: 640px) {
    .grid-2 {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .container {
        padding: 12px;
    }

    .card {
        padding: 14px;
        border-radius: 14px;
    }

    .camera-box {
        min-height: 220px;
    }
}


.search-item em {
    display: block;
    color: #6b7280;
    font-size: 12px;
    margin-top: 2px;
    font-style: normal;
}


/* ===== OVERLAY CÁMARA FULL-SCREEN ===== */
.camera-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    overscroll-behavior: none;
}

.co-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 18px;
    background: rgba(0,0,0,0.5);
    z-index: 2;
    position: relative;
}

.co-fotocount {
    color: #fff;
    font-size: 15px;
    font-weight: 600;
}

.co-close {
    background: rgba(255,255,255,0.15);
    border: 0;
    color: #fff;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    font-size: 22px;
    cursor: pointer;
    line-height: 38px;
    text-align: center;
    transition: background 0.2s;
}
.co-close:hover {
    background: rgba(255,255,255,0.3);
}
.co-close:active {
    background: rgba(255,255,255,0.5);
}

.co-viewfinder {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    background: #000;
}

.co-viewfinder video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.co-flash {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    pointer-events: none;
    animation: flashAnim 0.25s ease-out forwards;
}
@keyframes flashAnim {
    0% { opacity: 0.7; }
    100% { opacity: 0; }
}

/* Zoom */
.co-zoom-wrap {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    z-index: 10;
}

.co-zoom-slider {
    -webkit-appearance: none;
    appearance: none;
    writing-mode: vertical-lr;
    direction: rtl;
    width: 4px;
    height: 120px;
    background: rgba(255,255,255,0.25);
    border-radius: 4px;
    cursor: pointer;
}
.co-zoom-slider::-webkit-slider-runnable-track {
    width: 4px;
    height: 120px;
    background: rgba(255,255,255,0.25);
    border-radius: 4px;
}
.co-zoom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    margin-left: -10px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    cursor: pointer;
}
.co-zoom-slider::-moz-range-track {
    width: 4px;
    height: 120px;
    background: rgba(255,255,255,0.25);
    border-radius: 4px;
    border: none;
}
.co-zoom-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    border: 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.co-zoom-label {
    font-size: 11px;
    color: #fff;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.co-footer {
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 16px 20px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    background: #111;
}

.co-thumb-wrapper {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #444;
    position: relative;
    background: #222;
}
.co-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.co-thumb-count {
    position: absolute;
    bottom: -4px;
    right: -4px;
    background: #1f6feb;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.co-shutter {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 5px solid #fff;
    background: transparent;
    cursor: pointer;
    position: relative;
    transition: transform 0.1s;
}
.co-shutter:disabled {
    opacity: 0.5;
    cursor: default;
}
.co-shutter::after {
    content: '';
    display: block;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: #fff;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: transform 0.1s;
}
.co-shutter:active:not(:disabled)::after {
    transform: translate(-50%, -50%) scale(0.82);
}

.co-spacer {
    width: 60px;
}

/* ===== DRAWER LATERAL ===== */
.drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99998;
    pointer-events: none;
}
.drawer.active {
    pointer-events: auto;
}

.drawer-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    transition: opacity 0.25s;
}
.drawer.active .drawer-backdrop {
    opacity: 1;
}

.drawer-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 280px;
    max-width: 80vw;
    height: 100%;
    background: #fff;
    transform: translateX(100%);
    transition: transform 0.25s ease-out;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 30px rgba(0,0,0,0.2);
}
.drawer.active .drawer-panel {
    transform: translateX(0);
}

.drawer-header {
    padding: 24px 20px 12px;
    border-bottom: 1px solid #e5e7eb;
}
.drawer-logo {
    height: 40px;
}

.drawer-user {
    padding: 12px 20px;
    font-size: 14px;
    color: #374151;
    border-bottom: 1px solid #e5e7eb;
}

.drawer-menu {
    list-style: none;
    margin: 0;
    padding: 8px 0;
    flex: 1;
}
.drawer-menu li {
    margin: 0;
}
.drawer-item {
    display: block;
    padding: 14px 20px;
    text-decoration: none;
    color: #374151;
    font-size: 15px;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: background 0.15s;
}
.drawer-item:hover,
.drawer-item:active {
    background: #f3f4f6;
}
.drawer-item.active {
    border-left-color: #1f6feb;
    color: #1f6feb;
    font-weight: 700;
    background: #eff6ff;
}

.drawer-footer {
    padding: 8px 0;
    border-top: 1px solid #e5e7eb;
}
.drawer-logout {
    color: #dc2626;
}
