* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #0f0f0f;
    color: #e0e0e0;
    min-height: 100vh;
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: #1a1a1a;
    padding: max(1rem, env(safe-area-inset-top)) 1rem 1rem;
    border-bottom: 1px solid #333;
}

.admin-link {
    color: #00ff88;
    font-size: 0.85rem;
    text-decoration: none;
}

.admin-icon-link {
    display: grid;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    place-items: center;
    color: #00ff88;
    background: #1a1a1a;
    border: 1px solid #3b3b3b;
    border-radius: 50%;
    text-decoration: none;
}

.admin-icon-link:focus-visible {
    outline: 3px solid rgba(0, 255, 136, 0.35);
    outline-offset: 2px;
}

.admin-icon-link svg {
    width: 23px;
    height: 23px;
}

.app-header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #fff;
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.clock-section {
    text-align: center;
    margin-bottom: 2rem;
}

.clock {
    font-family: 'Courier New', monospace;
    font-size: 5rem;
    font-weight: 700;
    color: #00ff88;
    text-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
    margin-bottom: 0.5rem;
}

.clock-time {
    font-size: 1rem;
    color: #888;
}

.face-section {
    width: min(100%, 420px);
    background: #1a1a1a;
    border-radius: 1rem;
    padding: 1rem;
    margin: 1rem 0;
}

.face-view {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    margin: 0 auto 1rem;
    overflow: hidden;
    background: #050505;
    border-radius: 8px;
}

.face-placeholder {
    width: 100%;
    height: 100%;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
    justify-content: center;
}

.face-placeholder[hidden] {
    display: none;
}

.face-placeholder svg {
    width: 60px;
    height: 60px;
    color: #333;
}

.face-placeholder p {
    color: #333;
    font-size: 0.85rem;
    text-align: center;
}

#face-cam,
#enroll-video {
    display: none;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
}

#face-cam.active,
#enroll-video.active {
    display: block;
}

#face-cam.mirror,
#enroll-video.mirror {
    transform: scaleX(-1);
}

.face-guide {
    display: none;
    position: absolute;
    inset: 10% 20%;
    border: 3px solid #00ff88;
    border-radius: 45% 45% 40% 40%;
    box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.25);
    pointer-events: none;
}

.face-guide.active {
    display: block;
}


.btn-capture {
    width: 100%;
    background: #00ff88;
    color: #0f0f0f;
    border: none;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-capture:hover {
    background: #00cc6a;
}

.btn-capture:disabled {
    background: #555;
    cursor: not-allowed;
}

.status {
    margin-top: 1rem;
    padding: 0.75rem;
    background: #2a2a2a;
    border-radius: 6px;
    font-size: 0.875rem;
}

.status.success {
    border-left: 3px solid #00ff88;
}

.status.error {
    border-left: 3px solid #ff4444;
}

.status.info {
    border-left: 3px solid #00aaff;
}

.status-section {
    width: min(100%, 420px);
}

.offline-status {
    margin-top: 0.65rem;
    padding: 0.7rem;
    color: #d8d8d8;
    background: #242424;
    border-left: 3px solid #888;
    border-radius: 6px;
    font-size: 0.76rem;
    line-height: 1.35;
}

.offline-status.online {
    border-left-color: #00ff88;
}

.offline-status.offline {
    color: #ffe7a1;
    border-left-color: #ffc928;
}

.btn-configure-offline {
    width: 100%;
    min-height: 44px;
    margin-top: 0.55rem;
    padding: 0.65rem;
    color: #e8e8e8;
    background: #303030;
    border: 1px solid #555;
    border-radius: 7px;
    font-weight: 600;
    cursor: pointer;
}

.btn-configure-offline:hover {
    border-color: #00ff88;
}

.field-label {
    display: block;
    margin-bottom: 0.4rem;
    color: #bbb;
    font-size: 0.85rem;
    font-weight: 600;
}

.install-app {
    position: fixed;
    right: max(1rem, env(safe-area-inset-right));
    bottom: max(1rem, env(safe-area-inset-bottom));
    z-index: 20;
    min-height: 48px;
    padding: 0.8rem 1rem;
    color: #052b19;
    background: #8bffc1;
    border: 1px solid #00ff88;
    border-radius: 999px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
}

.install-app:hover {
    background: #00ff88;
}

.text-input {
    width: 100%;
    min-height: 46px;
    margin-bottom: 1rem;
    padding: 0.75rem;
    color: #fff;
    background: #292929;
    border: 1px solid #444;
    border-radius: 8px;
    font-size: 1rem;
}

.identified-user,
.result-success {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 1rem;
    padding: 0.85rem;
    color: #072c1c;
    background: #bfffdc;
    border-radius: 8px;
}

.identified-user[hidden] {
    display: none;
}

.privacy-note {
    margin-top: 0.85rem;
    color: #999;
    font-size: 0.72rem;
    line-height: 1.35;
}

.admin-main {
    justify-content: flex-start;
}

.enroll-section {
    max-width: 520px;
}

.enroll-warning {
    margin-bottom: 1rem;
    padding: 0.8rem;
    color: #ffe7a1;
    background: #3a2f0b;
    border-left: 3px solid #ffc928;
    border-radius: 6px;
    font-size: 0.82rem;
    line-height: 1.4;
}

.consent-row {
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
    margin-bottom: 1rem;
    color: #ddd;
    font-size: 0.85rem;
    line-height: 1.4;
}

.consent-row input {
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
}

.button-stack {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.btn-secondary {
    width: 100%;
    min-height: 50px;
    padding: 0.8rem;
    color: #fff;
    background: #3d3d3d;
    border: 1px solid #666;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
}

.btn-secondary:disabled {
    opacity: 0.5;
}

[hidden] {
    display: none !important;
}

.header-subtitle {
    margin-top: 0.15rem;
    color: #999;
    font-size: 0.78rem;
}

.admin-page {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.25rem;
}

.admin-login-card {
    width: min(100%, 460px);
    margin: 5vh auto 0;
    padding: 1.25rem;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 14px;
}

.admin-login-card h2,
.admin-tools-panel h2,
.admin-list-panel h2,
.admin-editor-panel h2 {
    margin-bottom: 0.35rem;
}

.admin-login-card > p,
.panel-heading p {
    margin-bottom: 1rem;
    color: #999;
    font-size: 0.82rem;
}

.admin-panel {
    display: grid;
    grid-template-columns: minmax(300px, 0.8fr) minmax(420px, 1.4fr);
    gap: 1rem;
    align-items: start;
}

.admin-tools-panel,
.admin-list-panel,
.admin-editor-panel {
    padding: 1rem;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 14px;
}

.admin-tools-panel {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: minmax(220px, 1fr) minmax(280px, 1.5fr) minmax(190px, auto);
    gap: 1rem;
    align-items: center;
}

.admin-tools-panel p {
    margin-top: 0.35rem;
    color: #999;
    font-size: 0.82rem;
}

.admin-tools-panel .offline-status,
.admin-tools-panel .btn-secondary {
    margin: 0;
}

.admin-editor-panel {
    min-width: 0;
}

.panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.search-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.search-row .text-input {
    margin-bottom: 0;
}

.btn-secondary.compact {
    width: auto;
    min-height: 42px;
    padding: 0.55rem 0.75rem;
    font-size: 0.85rem;
}

.employee-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 65vh;
    overflow-y: auto;
    padding-right: 0.2rem;
}

.employee-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem;
    color: #e8e8e8;
    text-align: left;
    background: #252525;
    border: 1px solid #3a3a3a;
    border-radius: 9px;
    cursor: pointer;
}

.employee-list-item:hover,
.employee-list-item.selected {
    border-color: #00ff88;
    background: #183328;
}

.employee-identity {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 0.2rem;
}

.employee-identity strong,
.employee-identity small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.employee-identity small {
    color: #aaa;
}

.face-badge {
    flex: 0 0 auto;
    padding: 0.3rem 0.5rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
}

.face-badge.has-face {
    color: #052b19;
    background: #8bffc1;
}

.face-badge.no-face {
    color: #4a2d00;
    background: #ffd37a;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 0.7fr;
    gap: 0.75rem;
}

.employee-metadata {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    color: #bbb;
    background: #242424;
    border-radius: 8px;
    font-size: 0.75rem;
}

.editor-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.btn-danger {
    width: 100%;
    min-height: 50px;
    padding: 0.8rem;
    color: #fff;
    background: #8f2929;
    border: 1px solid #b94343;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
}

.btn-danger:disabled {
    opacity: 0.45;
}

.panel-divider {
    margin: 1.25rem 0;
    border: 0;
    border-top: 1px solid #3a3a3a;
}

.face-maintenance-camera {
    max-width: 460px;
}

.text-button {
    margin-top: 1rem;
    padding: 0.4rem 0;
    background: transparent;
    border: 0;
    cursor: pointer;
    text-decoration: underline;
}

.danger-text {
    color: #ff8989;
}

.empty-list {
    padding: 1rem;
    color: #999;
    text-align: center;
    background: #242424;
    border-radius: 8px;
}

/* Tela inicial do tablet: aproveita melhor a altura sem alterar o painel administrativo. */
.kiosk-page .app-main {
    justify-content: flex-start;
    padding: clamp(1.25rem, 6vh, 4rem) 1rem 0.5rem;
}

.kiosk-page .clock-section {
    margin-bottom: 0.45rem;
    line-height: 1;
}

.kiosk-page .clock {
    margin-bottom: 0.1rem;
    line-height: 0.95;
}

.kiosk-page .clock-time {
    line-height: 1.15;
}

.kiosk-page .face-section {
    margin: 0.25rem 0 0.45rem;
    padding: 0.8rem;
}

.kiosk-page .face-view {
    margin-bottom: 0.65rem;
}

.kiosk-page .privacy-note {
    margin-top: 0.55rem;
}

.kiosk-page .status {
    margin-top: 0.35rem;
    padding: 0.5rem 0.65rem;
}

.kiosk-page .offline-status {
    margin-top: 0.35rem;
    padding: 0.45rem 0.6rem;
    line-height: 1.2;
}

.kiosk-page .btn-configure-offline {
    min-height: 38px;
    margin-top: 0.35rem;
    padding: 0.45rem 0.6rem;
}

@media (max-width: 820px) {
    .admin-page {
        padding: 0.75rem;
    }

    .admin-panel {
        grid-template-columns: 1fr;
    }

    .admin-tools-panel {
        grid-template-columns: 1fr;
    }

    .employee-list {
        max-height: 42vh;
    }

    .employee-metadata {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .clock {
        font-size: 3.5rem;
    }

    .app-header {
        align-items: flex-start;
    }

    .form-grid,
    .editor-actions,
    .button-stack {
        grid-template-columns: 1fr;
    }

    .panel-heading {
        flex-direction: column;
    }

    .face-badge {
        align-self: flex-start;
    }
}
