/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
    height: 100%; width: 100%;
    font-family: 'Inter', -apple-system, sans-serif;
    background: linear-gradient(135deg, #0a0f1e 0%, #0d1b2a 40%, #1b2838 100%);
    color: #e0e6ed;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

/* === SCREENS === */
.screen {
    position: fixed; inset: 0;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none;
    transition: opacity 0.4s ease, transform 0.4s ease;
    transform: scale(0.97);
    z-index: 1;
}
.screen.active {
    opacity: 1; pointer-events: auto;
    transform: scale(1);
    z-index: 10;
}

/* === HOME === */
.home-container {
    width: 100%; height: 100%;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 40px;
    position: relative;
}
.home-top {
    position: absolute; top: 24px; right: 24px;
}
.icon-btn {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.4);
    border-radius: 12px; padding: 10px;
    cursor: pointer; transition: all 0.3s;
}
.icon-btn:hover { background: rgba(255,255,255,0.12); color: rgba(255,255,255,0.7); }

.home-center { text-align: center; margin-bottom: 60px; }
.company-name {
    font-size: 3.2rem; font-weight: 800;
    background: linear-gradient(135deg, #4fd1c5, #63b3ed, #b794f4);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 16px;
    letter-spacing: -1px;
}
.clock {
    font-size: 5rem; font-weight: 200;
    color: rgba(255,255,255,0.9);
    letter-spacing: 4px;
    line-height: 1.1;
}
.date {
    font-size: 1.2rem; color: rgba(255,255,255,0.4);
    margin-top: 8px; font-weight: 300;
}

.home-actions {
    display: flex; gap: 32px;
}
.action-btn {
    display: flex; flex-direction: column;
    align-items: center; gap: 12px;
    padding: 36px 56px;
    border-radius: 24px; border: none;
    font-size: 1.3rem; font-weight: 600;
    cursor: pointer; transition: all 0.3s ease;
    font-family: inherit;
    min-width: 220px;
}
.action-btn:active { transform: scale(0.96); }

.signin-btn {
    background: linear-gradient(135deg, #0d9488, #14b8a6);
    color: white;
    box-shadow: 0 8px 32px rgba(13,148,136,0.35);
}
.signin-btn:hover { box-shadow: 0 12px 40px rgba(13,148,136,0.5); transform: translateY(-2px); }

.signout-btn {
    background: linear-gradient(135deg, #d97706, #f59e0b);
    color: white;
    box-shadow: 0 8px 32px rgba(217,119,6,0.35);
}
.signout-btn:hover { box-shadow: 0 12px 40px rgba(217,119,6,0.5); transform: translateY(-2px); }

.home-footer {
    position: absolute; bottom: 32px;
    font-size: 0.95rem; color: rgba(255,255,255,0.3);
}

/* === PANELS === */
.panel {
    background: rgba(255,255,255,0.04);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 28px;
    padding: 40px; max-width: 560px; width: 90%;
    position: relative;
}
.wide-panel { max-width: 720px; }
.panel h2 {
    font-size: 1.8rem; font-weight: 700;
    margin-bottom: 28px; text-align: center;
}

.back-btn {
    background: none; border: none; color: rgba(255,255,255,0.5);
    font-size: 1rem; cursor: pointer; font-family: inherit;
    padding: 4px 8px; border-radius: 8px;
    transition: color 0.2s;
    position: absolute; top: 20px; left: 20px;
}
.back-btn:hover { color: #fff; }

/* === TYPE BUTTONS === */
.type-buttons { display: flex; gap: 24px; justify-content: center; }
.type-btn {
    display: flex; flex-direction: column;
    align-items: center; gap: 12px;
    padding: 36px 48px; border-radius: 20px;
    border: 2px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.03);
    color: #e0e6ed; cursor: pointer;
    transition: all 0.3s; font-family: inherit;
    min-width: 200px;
}
.type-btn:hover {
    border-color: rgba(255,255,255,0.25);
    background: rgba(255,255,255,0.07);
    transform: translateY(-4px);
}
.type-btn:active { transform: scale(0.97); }
.type-label { font-size: 1.3rem; font-weight: 600; }
.type-desc { font-size: 0.85rem; color: rgba(255,255,255,0.4); }

.visitor-type:hover { border-color: #4fd1c5; box-shadow: 0 8px 32px rgba(79,209,197,0.15); }
.employee-type:hover { border-color: #63b3ed; box-shadow: 0 8px 32px rgba(99,179,237,0.15); }

/* === FORMS === */
.signin-form { display: flex; flex-direction: column; gap: 20px; }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label {
    font-size: 0.85rem; font-weight: 500;
    color: rgba(255,255,255,0.5); text-transform: uppercase;
    letter-spacing: 0.5px;
}
.form-group input, .form-group select {
    padding: 14px 16px; border-radius: 14px;
    border: 1.5px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
    color: #fff; font-size: 1.05rem;
    font-family: inherit; transition: border-color 0.2s;
    outline: none;
}
.form-group input::placeholder { color: rgba(255,255,255,0.2); }
.form-group input:focus, .form-group select:focus {
    border-color: #4fd1c5;
    background: rgba(255,255,255,0.08);
}
.form-group select option { background: #1b2838; color: #e0e6ed; }

.consent-group { margin-top: 4px; }
.consent-label {
    display: flex; align-items: flex-start; gap: 12px;
    cursor: pointer; line-height: 1.4;
}
.consent-label input[type="checkbox"] {
    width: 22px; height: 22px; flex-shrink: 0;
    accent-color: #4fd1c5; cursor: pointer;
    margin-top: 2px;
}
.consent-label span { font-size: 0.9rem; color: rgba(255,255,255,0.6); }

.form-actions { display: flex; justify-content: center; margin-top: 8px; }
.submit-btn {
    padding: 16px 56px; border-radius: 16px;
    border: none; font-size: 1.15rem; font-weight: 600;
    cursor: pointer; font-family: inherit; transition: all 0.3s;
}
.submit-btn:active { transform: scale(0.96); }

/* === SEARCH === */
.search-input {
    width: 100%; padding: 14px 20px;
    border-radius: 14px;
    border: 1.5px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
    color: #fff; font-size: 1.05rem;
    font-family: inherit; outline: none;
    margin-bottom: 16px; transition: border-color 0.2s;
}
.search-input::placeholder { color: rgba(255,255,255,0.2); }
.search-input:focus { border-color: #63b3ed; }

/* === PERSON LIST === */
.person-list {
    display: flex; flex-direction: column; gap: 8px;
    max-height: 400px; overflow-y: auto;
    padding-right: 4px;
}
.person-list::-webkit-scrollbar { width: 4px; }
.person-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

.person-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-radius: 14px;
    border: 1.5px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.03);
    cursor: pointer; transition: all 0.25s;
}
.person-item:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.15);
    transform: translateX(4px);
}
.person-item:active { transform: scale(0.98); }
.person-info { display: flex; flex-direction: column; gap: 2px; }
.person-name { font-weight: 600; font-size: 1.1rem; }
.person-detail { font-size: 0.82rem; color: rgba(255,255,255,0.4); }
.person-badge {
    padding: 4px 12px; border-radius: 8px;
    font-size: 0.75rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.badge-visitor { background: rgba(79,209,197,0.15); color: #4fd1c5; }
.badge-employee { background: rgba(99,179,237,0.15); color: #63b3ed; }
.badge-dept { background: rgba(183,148,244,0.15); color: #b794f4; }

.hint-text { text-align: center; font-size: 0.85rem; color: rgba(255,255,255,0.25); margin-top: 16px; }
.subtitle { text-align: center; color: rgba(255,255,255,0.4); margin-bottom: 20px; font-size: 0.95rem; }

.empty-state {
    display: flex; flex-direction: column;
    align-items: center; gap: 12px;
    padding: 40px 0; color: rgba(255,255,255,0.3);
}

/* === CONFIRMATION === */
.confirm-container {
    text-align: center;
    animation: confirmPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes confirmPop {
    0% { opacity: 0; transform: scale(0.5); }
    100% { opacity: 1; transform: scale(1); }
}
.confirm-icon { margin-bottom: 20px; color: #4fd1c5; }
.confirm-icon.signout-icon { color: #f59e0b; }
.confirm-container h2 { font-size: 2rem; margin-bottom: 8px; }
.confirm-container p { font-size: 1.15rem; color: rgba(255,255,255,0.5); }
.confirm-time { font-size: 1.5rem; margin-top: 16px; color: rgba(255,255,255,0.3); font-weight: 200; }

/* === PIN PAD === */
.pin-panel { max-width: 380px; text-align: center; }
.pin-display {
    display: flex; gap: 16px; justify-content: center;
    margin: 20px 0;
}
.pin-dot {
    width: 18px; height: 18px; border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.2);
    transition: all 0.2s;
}
.pin-dot.filled { background: #4fd1c5; border-color: #4fd1c5; }
.pin-pad {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 10px; max-width: 280px; margin: 0 auto;
}
.pin-key {
    padding: 18px; border-radius: 14px;
    border: 1.5px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.04);
    color: #e0e6ed; font-size: 1.4rem;
    font-family: inherit; cursor: pointer;
    transition: all 0.2s;
}
.pin-key:hover { background: rgba(255,255,255,0.08); }
.pin-key:active { transform: scale(0.94); }
.pin-enter { background: rgba(13,148,136,0.2); border-color: rgba(13,148,136,0.3); color: #4fd1c5; }
.pin-error { color: #f87171; margin-top: 12px; font-size: 0.9rem; animation: shake 0.4s; }
@keyframes shake {
    0%,100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

/* === ADMIN === */
.admin-container {
    width: 90%; max-width: 1000px;
    height: 85vh;
    background: rgba(255,255,255,0.04);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 28px;
    display: flex; flex-direction: column;
    overflow: hidden;
}
.admin-header {
    padding: 20px 28px 0;
    position: relative;
}
.admin-header h2 {
    text-align: center; font-size: 1.5rem;
    margin-bottom: 16px;
}
.admin-header .back-btn { top: 20px; left: 28px; }

.admin-tabs {
    display: flex; gap: 4px;
    background: rgba(255,255,255,0.04);
    border-radius: 12px; padding: 4px;
}
.tab-btn {
    flex: 1; padding: 10px 16px;
    border-radius: 10px; border: none;
    background: transparent; color: rgba(255,255,255,0.4);
    font-size: 0.9rem; font-weight: 500;
    cursor: pointer; font-family: inherit;
    transition: all 0.25s;
}
.tab-btn.active {
    background: rgba(255,255,255,0.1);
    color: #fff;
}
.tab-btn:hover { color: rgba(255,255,255,0.7); }

.tab-content {
    display: none; flex: 1;
    overflow-y: auto; padding: 20px 28px 28px;
}
.tab-content.active { display: flex; flex-direction: column; }

.tab-toolbar {
    display: flex; gap: 10px; margin-bottom: 16px;
    align-items: center; flex-wrap: wrap;
}
.toolbar-input {
    padding: 10px 14px; border-radius: 10px;
    border: 1.5px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
    color: #fff; font-size: 0.9rem; font-family: inherit;
    outline: none; flex: 1; min-width: 120px;
}
.toolbar-input::placeholder { color: rgba(255,255,255,0.2); }
.toolbar-input:focus { border-color: #4fd1c5; }
.date-input {
    padding: 10px 14px; border-radius: 10px;
    border: 1.5px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
    color: #fff; font-size: 0.9rem; font-family: inherit;
    outline: none; color-scheme: dark;
}

.small-btn {
    padding: 10px 18px; border-radius: 10px;
    border: 1.5px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.06);
    color: #e0e6ed; font-size: 0.9rem;
    font-family: inherit; cursor: pointer;
    transition: all 0.2s; white-space: nowrap;
}
.small-btn:hover { background: rgba(255,255,255,0.12); }
.danger-btn { border-color: rgba(248,113,113,0.3); color: #f87171; }
.danger-btn:hover { background: rgba(248,113,113,0.1); }

.admin-table-wrap { flex: 1; overflow-y: auto; }
.admin-table {
    width: 100%; border-collapse: separate;
    border-spacing: 0 6px;
}
.admin-table th {
    text-align: left; padding: 8px 14px;
    font-size: 0.78rem; text-transform: uppercase;
    letter-spacing: 0.5px; color: rgba(255,255,255,0.35);
    font-weight: 500;
}
.admin-table td {
    padding: 12px 14px;
    background: rgba(255,255,255,0.03);
    font-size: 0.92rem;
}
.admin-table tr td:first-child { border-radius: 10px 0 0 10px; }
.admin-table tr td:last-child { border-radius: 0 10px 10px 0; }

.delete-btn {
    background: none; border: none; color: rgba(248,113,113,0.6);
    cursor: pointer; font-size: 1.1rem; padding: 4px 8px;
    border-radius: 6px; transition: all 0.2s;
}
.delete-btn:hover { color: #f87171; background: rgba(248,113,113,0.1); }

/* === SETTINGS === */
.settings-form {
    display: flex; flex-direction: column;
    gap: 20px; max-width: 400px;
    margin: 0 auto; width: 100%;
}
.settings-form .submit-btn { align-self: center; }

/* === VISITOR LOOKUP === */
.visitor-new-prompt {
    flex-direction: column; align-items: center;
    gap: 16px; padding: 24px 0;
}

/* === TOAST === */
.toast {
    position: fixed; bottom: 32px; left: 50%;
    transform: translateX(-50%) translateY(80px);
    padding: 14px 28px; border-radius: 14px;
    background: rgba(79,209,197,0.9); color: #000;
    font-weight: 600; font-size: 0.95rem;
    opacity: 0; transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 100; backdrop-filter: blur(10px);
}
.toast.show {
    opacity: 1; transform: translateX(-50%) translateY(0);
}

/* === RESPONSIVE iPad === */
@media (max-width: 768px) {
    .company-name { font-size: 2.2rem; }
    .clock { font-size: 3.5rem; }
    .home-actions { flex-direction: column; gap: 16px; }
    .action-btn { padding: 28px 40px; min-width: 180px; }
    .form-row { flex-direction: column; }
    .type-buttons { flex-direction: column; }
    .admin-tabs { flex-wrap: wrap; }
}
