:root {
    color: #151515;
    font-synthesis: none;
    background: #fff;
    font-family: Arial, Helvetica, sans-serif
}

* {
    box-sizing: border-box
}

body {
    margin: 0
}

button,
input,
select {
    font: inherit
}

button {
    cursor: pointer
}

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

.app-shell {
    min-height: 100vh;
    display: flex
}

.sidebar {
    color: #fff;
    background: linear-gradient(160deg, #78002c, #560020 70%, #450019);
    flex-direction: column;
    flex: none;
    width: 232px;
    padding: 26px 9px;
    display: flex
}

.brand {
    border-bottom: 1px solid #ffffff80;
    grid-template-rows: 45px 1fr;
    grid-template-columns: 48px 1fr;
    align-items: center;
    column-gap: 8px;
    height: 163px;
    margin: 0 9px 22px;
    display: grid
}

.brand-mark {
    color: #fff;
    grid-row: 1
}

.brand strong {
    letter-spacing: -1px;
    font-size: 28px;
    line-height: 1
}

.brand span {
    text-align: center;
    grid-column: 1/3;
    align-self: start;
    margin-top: 7px;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.3
}

.sidebar nav {
    flex-direction: column;
    gap: 6px;
    display: flex
}

.sidebar nav button,
.sidebar-logout {
    color: #fff;
    text-align: left;
    background: 0 0;
    border: 0;
    border-radius: 5px;
    align-items: center;
    gap: 16px;
    width: 100%;
    padding: 14px 15px;
    font-size: 17px;
    font-weight: 600;
    display: flex
}

.sidebar nav button:hover,
.sidebar nav button.selected {
    background: #ffffff2a
}

.sidebar-logout {
    opacity: .87;
    margin-top: auto;
    font-size: 14px
}

.main {
    flex: 1;
    min-width: 0;
    padding: 0 24px 32px
}

.topbar {
    border-bottom: 1px solid #d7d7d7;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    height: 74px;
    margin-bottom: 28px;
    display: flex;
    position: relative
}

.topbar:after {
    content: "";
    background: #80002c;
    width: 118px;
    height: 5px;
    position: absolute;
    bottom: -2px;
    left: 0
}

.topbar h1 {
    letter-spacing: -1.4px;
    margin: 0;
    font-size: 37px;
    font-weight: 750;
    line-height: 1
}

.admin-button {
    background: 0 0;
    border: 0;
    align-items: center;
    gap: 10px;
    padding: 10px;
    font-size: 15px;
    font-weight: 700;
    display: flex
}

.stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin: 0 0 31px;
    display: grid
}

.stat {
    color: #690025;
    border: 1px solid #c9cbd0;
    border-left: 8px solid #8a0035;
    border-radius: 6px;
    align-items: center;
    gap: 30px;
    min-height: 113px;
    padding: 18px 24px;
    display: flex
}

.stat div {
    color: #111;
    flex-direction: column;
    gap: 7px;
    display: flex
}

.stat span {
    font-size: 21px;
    font-weight: 600
}

.stat strong {
    font-size: 39px;
    line-height: 1
}

.dashboard-grid {
    grid-template-columns: minmax(0, 1.7fr) minmax(380px, .9fr);
    gap: 18px;
    display: grid
}

.panel {
    background: #fff;
    border: 1px solid #d1d3d8;
    border-radius: 5px;
    min-width: 0
}

.section-title {
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 16px 14px 12px;
    display: flex
}

.section-title h2 {
    letter-spacing: -.9px;
    margin: 0;
    font-size: 28px
}

.header-actions {
    align-items: center;
    gap: 10px;
    display: flex
}

.button,
button:not(.icon-button):not(.admin-button):not(.text-button):not(.mini):not(.sidebar-logout):not(.sidebar nav button) {
    color: #fff;
    white-space: nowrap;
    background: #79002b;
    border: 1px solid #79002b;
    border-radius: 5px;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 10px 17px;
    font-size: 14px;
    font-weight: 700;
    display: inline-flex
}

.button.secondary,
button.secondary {
    color: #79002b !important;
    background: #fff !important
}

.button:hover,
button:hover {
    filter: brightness(.96)
}

.filters {
    align-items: center;
    gap: 20px;
    padding: 13px 14px 20px;
    display: flex
}

.search {
    color: #525966;
    border: 1px solid #bfc3c9;
    align-items: center;
    gap: 10px;
    width: min(340px, 60%);
    height: 42px;
    padding: 0 12px;
    display: flex
}

.search input {
    border: 0;
    outline: 0;
    width: 100%;
    font-size: 14px
}

.filter-label {
    white-space: nowrap;
    font-size: 14px
}

.filter-label select {
    background: #fff;
    border: 1px solid #bfc3c9;
    border-radius: 4px;
    margin-left: 8px;
    padding: 9px 28px 9px 12px
}

.table-wrap {
    overflow: auto
}

.panel table {
    border-collapse: collapse;
    width: 100%;
    font-size: 13px
}

.panel th {
    text-align: left;
    white-space: nowrap;
    background: #e6e6e7;
    font-weight: 700
}

.panel th,
.panel td {
    vertical-align: middle;
    border-bottom: 1px solid #d5d7da;
    padding: 11px 10px
}

.panel tbody tr:last-child td {
    border-bottom: 0
}

.panel td:first-child {
    min-width: 175px;
    font-weight: 600
}

.panel td:nth-child(2) {
    white-space: nowrap
}

.status {
    text-align: center;
    background: #dedfe0;
    border-radius: 5px;
    min-width: 64px;
    padding: 5px 10px;
    font-weight: 700;
    display: inline-block
}

.status.dentro,
.status.entrada {
    background: #a9eba9
}

.status.salida,
.status.fuera {
    background: #e1e2e3
}

.outline-button {
    color: #79002b;
    white-space: nowrap;
    border: 1px solid #79002b;
    border-radius: 4px;
    align-items: center;
    gap: 5px;
    padding: 6px 7px;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex
}

.table-footer {
    border-top: 1px solid #e0e0e0;
    padding: 14px;
    font-size: 13px
}

.empty {
    text-align: center;
    color: #777;
    padding: 40px
}

.movement-panel .section-title {
    padding-bottom: 20px
}

.movement-panel td:first-child {
    min-width: 116px;
    font-weight: 400
}

.movement-panel td:nth-child(2) {
    min-width: 160px
}

.movement-panel .table-wrap {
    padding: 0 10px 14px
}

.movement-panel th,
.movement-panel td {
    font-size: 12px
}

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

.mini {
    color: #77002d;
    background: 0 0;
    border: 0;
    align-items: center;
    gap: 4px;
    padding: 5px;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex
}

.personnel:not(.dashboard-grid .personnel) {
    max-width: 1400px
}

.scanner-page {
    text-align: center;
    max-width: 660px;
    margin: 0 auto;
    padding: 20px 0
}

.scanner-page h1 {
    margin: 0 0 12px;
    font-size: 31px
}

.scanner-page p {
    color: #575a61;
    margin: 0 0 27px;
    line-height: 1.5
}

.camera-area {
    aspect-ratio: 4/3;
    color: #fff;
    background: #17181b;
    border-radius: 8px;
    width: 100%;
    max-height: 440px;
    position: relative;
    overflow: hidden
}

.camera-area video {
    object-fit: cover;
    width: 100%;
    height: 100%
}

.camera-frame {
    pointer-events: none;
    border: 3px solid #fff;
    border-radius: 15px;
    justify-content: center;
    align-items: center;
    width: 210px;
    height: 210px;
    display: flex;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 0 100vw #0004
}

.camera-area:has(video[srcObject]) .camera-frame {
    background: 0 0
}

.camera-message {
    color: #fff;
    background: #202126;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 24px;
    font-size: 14px;
    display: flex;
    position: absolute;
    inset: 0
}

.code-form {
    text-align: left;
    align-items: end;
    gap: 10px;
    margin-top: 20px;
    display: flex
}

.code-form label {
    flex: 1
}

.code-form input {
    width: 100%
}

.scan-result {
    text-align: left;
    border-radius: 5px;
    align-items: center;
    gap: 14px;
    margin-top: 18px;
    padding: 18px;
    display: flex
}

.scan-result div {
    flex-direction: column;
    gap: 5px;
    display: flex
}

.scan-result.success {
    color: #124d19;
    background: #e5f6e5
}

.scan-result.error {
    color: #861b1b;
    background: #ffeaea
}

.auth-shell {
    grid-template-columns: minmax(320px, 42%) 1fr;
    min-height: 100vh;
    display: grid
}

.auth-brand {
    color: #fff;
    background: linear-gradient(140deg, #800033, #4f001e);
    flex-direction: column;
    justify-content: center;
    gap: 18px;
    padding: 11vw 6vw;
    display: flex
}

.auth-brand strong {
    letter-spacing: -5px;
    font-size: clamp(50px, 7vw, 105px);
    line-height: 1
}

.auth-brand span {
    font-size: clamp(20px, 2.3vw, 31px);
    font-weight: 600;
    line-height: 1.25
}

.auth-panel {
    align-self: center;
    width: min(420px, 100% - 48px);
    margin: 50px auto
}

.auth-panel h1 {
    letter-spacing: -1px;
    margin: 0 0 10px;
    font-size: 34px
}

.auth-panel p {
    color: #53565d;
    margin: 0 0 28px;
    line-height: 1.5
}

.auth-panel form,
.modal form {
    flex-direction: column;
    gap: 17px;
    display: flex
}

.auth-panel form>button:last-child {
    width: 100%;
    margin-top: 6px
}

.auth-panel .camera-area {
    height: 220px
}

.auth-panel .camera-frame {
    width: 130px;
    height: 130px
}

.auth-panel label,
.modal label,
.code-form label {
    flex-direction: column;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    display: flex
}

.auth-panel input,
.modal input,
.code-form input {
    border: 1px solid #bfc2c7;
    border-radius: 4px;
    outline-color: #870037;
    padding: 12px 13px;
    font-size: 15px
}

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

.admin-qr,
.new-admin-qr img {
    object-fit: contain;
    width: 220px;
    height: 220px;
    margin: 0 auto 22px;
    display: block
}

.auth-icon {
    color: #80002c;
    margin-bottom: 10px
}

.text-button {
    color: #77002c;
    background: 0 0;
    border: 0;
    align-items: center;
    gap: 8px;
    padding: 0;
    font-size: 14px;
    font-weight: 700;
    display: inline-flex
}

.error {
    color: #8c1325;
    background: #ffeaea;
    border-radius: 4px;
    margin: 9px 0;
    padding: 11px 13px;
    font-size: 14px
}

.modal-backdrop {
    z-index: 20;
    background: #1d122080;
    justify-content: center;
    align-items: center;
    padding: 20px;
    display: flex;
    position: fixed;
    inset: 0
}

.modal {
    background: #fff;
    border-radius: 8px;
    width: min(480px, 100%);
    max-height: 90vh;
    padding: 22px;
    overflow: auto;
    box-shadow: 0 16px 60px #0003
}

.modal-head {
    justify-content: space-between;
    align-items: center;
    margin-bottom: 21px;
    display: flex
}

.modal-head h2 {
    margin: 0;
    font-size: 25px
}

.icon-button {
    background: 0 0;
    border: 0;
    padding: 6px;
    display: inline-flex
}

.modal-actions {
    justify-content: flex-end;
    gap: 10px;
    margin-top: 12px;
    display: flex
}

.hint {
    color: #5f6268;
    margin: 0;
    font-size: 13px;
    line-height: 1.5
}

.admin-list {
    border-top: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
    margin-bottom: 20px
}

.admin-list div {
    border-bottom: 1px solid #eee;
    align-items: center;
    gap: 10px;
    padding: 12px;
    display: flex
}

.admin-list div:last-child {
    border: 0
}

.modal h3 {
    margin: 0 0 2px
}

.new-admin-qr {
    text-align: center
}

.loading {
    padding: 50px
}

.mobile-menu {
    display: none !important
}

@media (width<=1150px) {
    .dashboard-grid {
        grid-template-columns: 1fr
    }

    .movement-panel .table-wrap {
        max-height: 450px
    }

    .topbar h1 {
        font-size: 30px
    }

    .stat {
        gap: 18px;
        padding: 15px
    }

    .stat span {
        font-size: 17px
    }
}

@media (width<=760px) {
    .sidebar {
        z-index: 10;
        transition: transform .2s;
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        transform: translate(-100%);
        box-shadow: 10px 0 30px #0002
    }

    .sidebar.open {
        transform: none
    }

    .main {
        padding: 0 14px 24px
    }

    .mobile-menu {
        display: inline-flex !important
    }

    .topbar {
        height: 66px;
        margin-bottom: 22px
    }

    .topbar h1 {
        letter-spacing: -.5px;
        flex: 1;
        font-size: 22px
    }

    .topbar:after {
        left: 45px
    }

    .admin-button {
        gap: 0;
        font-size: 0
    }

    .admin-button svg {
        width: 21px
    }

    .stats {
        gap: 8px;
        margin-bottom: 18px
    }

    .stat {
        text-align: center;
        border-left-width: 4px;
        flex-direction: column;
        justify-content: center;
        gap: 6px;
        min-height: 88px;
        padding: 10px 6px
    }

    .stat svg {
        width: 21px;
        height: 21px
    }

    .stat span {
        font-size: 11px
    }

    .stat strong {
        font-size: 25px
    }

    .section-title {
        flex-direction: column;
        align-items: start
    }

    .section-title h2 {
        font-size: 23px
    }

    .header-actions {
        flex-wrap: wrap;
        width: 100%
    }

    .header-actions .button,
    .header-actions button {
        flex: 1
    }

    .filters {
        flex-wrap: wrap;
        gap: 7px
    }

    .search {
        width: 100%
    }

    .panel th,
    .panel td {
        padding: 9px 8px
    }

    .auth-shell {
        grid-template-columns: 1fr
    }

    .auth-brand {
        min-height: 165px;
        padding: 27px
    }

    .auth-brand strong {
        letter-spacing: -2px;
        font-size: 48px
    }

    .auth-brand span {
        font-size: 16px
    }

    .auth-panel {
        margin: 35px auto
    }

    .code-form {
        flex-direction: column;
        align-items: stretch
    }

    .code-form label {
        width: 100%
    }
}

@media (width>=761px) and (width<=1400px) {
    .dashboard-grid {
        grid-template-columns: 1fr
    }

    .movement-panel .table-wrap {
        max-height: 450px
    }
}

.panel button.outline-button {
    color: #79002b !important;
    background: #fff !important;
    border: 1px solid #79002b !important;
    border-radius: 4px !important;
    padding: 6px 7px !important;
    font-size: 12px !important
}