:root {
    --ios-blue: #007AFF;
    --ios-blue-dark: #0060cc;
    --ios-green: #34C759;
    --ios-red: #FF3B30;
    --ios-gray: #8E8E93;
    --ios-bg: #F2F2F7;
    --ios-card: #FFFFFF;
    --ios-text: #1C1C1E;
    --radius: 18px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--ios-bg);
    color: var(--ios-text);
    min-height: 100vh;
}

.screen {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 24px 20px 40px;
}

.top-badge {
    text-align: center;
    margin-top: 10px;
    margin-bottom: 6px;
}

.top-badge img, .logo-circle {
    width: 84px;
    height: 84px;
    border-radius: 22px;
    background: var(--ios-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 28px;
    margin: 0 auto 18px;
}

h1.welcome-title {
    text-align: center;
    font-size: 26px;
    font-weight: 700;
    margin: 8px 0 4px;
}

p.welcome-sub {
    text-align: center;
    color: var(--ios-gray);
    font-size: 15px;
    margin: 0 0 30px;
    line-height: 1.5;
}

.card {
    background: var(--ios-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    margin-bottom: 16px;
}

.field-group {
    margin-bottom: 16px;
}

label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--ios-gray);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

input[type=text],
input[type=tel],
textarea,
select {
    width: 100%;
    padding: 13px 14px;
    border-radius: 12px;
    border: 1px solid #E5E5EA;
    background: #F9F9FB;
    font-size: 16px;
    color: var(--ios-text);
    outline: none;
    font-family: inherit;
}

input[readonly] {
    width: 100%;
    padding: 13px 14px;
    border-radius: 12px;
    border: 1px solid #E5E5EA;
    background: #ECECEE;
    font-size: 16px;
    color: var(--ios-gray);
    font-family: inherit;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

input:focus, textarea:focus, select:focus {
    border-color: var(--ios-blue);
    background: #fff;
}

.btn-ios {
    display: block;
    width: 100%;
    text-align: center;
    padding: 16px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--ios-green), var(--ios-blue));
    color: #fff;
    font-size: 17px;
    font-weight: 600;
    border: none;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: opacity 0.15s ease, transform 0.1s ease;
    box-shadow: 0 4px 14px rgba(0, 122, 255, 0.25);
}

.btn-ios:active { opacity: 0.8; transform: scale(0.98); }

.btn-secondary {
    background: #E5E5EA;
    color: var(--ios-text);
    box-shadow: none;
}

.btn-danger {
    background: linear-gradient(135deg, #FF9500, var(--ios-red));
    box-shadow: 0 4px 14px rgba(255, 59, 48, 0.25);
}

.file-upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    border: 1.5px dashed #C7C7CC;
    background: #F9F9FB;
    color: var(--ios-blue);
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
}

.selfie-preview {
    display: none;
    margin-top: 12px;
    text-align: center;
}

.selfie-preview img {
    width: 140px;
    height: 140px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid var(--ios-blue);
}

.file-name-display {
    margin-top: 8px;
    font-size: 13px;
    color: var(--ios-gray);
    text-align: center;
}

.token-box {
    text-align: center;
    background: linear-gradient(135deg, var(--ios-blue), #5AC8FA);
    border-radius: var(--radius);
    padding: 30px 20px;
    color: white;
    margin-bottom: 20px;
}

.token-box .token-number {
    font-size: clamp(20px, 7vw, 32px);
    font-weight: 800;
    letter-spacing: 0.5px;
    margin: 10px 0;
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.3;
    padding: 0 4px;
}

.token-box .token-label {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.85;
}

.checkmark-circle {
    width: 70px;
    height: 70px;
    background: var(--ios-green);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 36px;
    color: white;
}

.priority-msg {
    text-align: center;
    font-size: 15px;
    color: var(--ios-text);
    line-height: 1.6;
    margin: 16px 0 26px;
}

table.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 14px;
}

table.admin-table th, table.admin-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #EEE;
    text-align: left;
    white-space: nowrap;
}

table.admin-table th {
    background: #F2F2F7;
    font-weight: 600;
    position: sticky;
    top: 0;
}

table.admin-table img.thumb {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}

.admin-wrap {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.table-scroll {
    overflow-x: auto;
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.error-msg {
    background: #FFE5E5;
    color: var(--ios-red);
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 16px;
    text-align: center;
}

.stat-pill {
    background: #E8F0FE;
    color: var(--ios-blue);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.required-star { color: var(--ios-red); }

/* Visually hidden but still focusable/scrollable, so native "required"
   validation works correctly on these camera/file inputs across browsers */
.visually-hidden-file {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.warning-box {
    background: #FFF4E5;
    border: 1px solid #FFD8A8;
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 16px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.warning-box .warning-icon {
    font-size: 20px;
    line-height: 1;
}

.warning-box p {
    margin: 0;
    font-size: 13.5px;
    color: #9A5B00;
    line-height: 1.5;
}

.screenshot-note {
    text-align: center;
    font-size: 13px;
    color: var(--ios-gray);
    margin-top: 10px;
}

/* Pending verification spinner */
.spinner-circle {
    width: 70px;
    height: 70px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner-ring {
    width: 56px;
    height: 56px;
    border: 5px solid #E5E5EA;
    border-top-color: var(--ios-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Status badges (admin / gatekeeper tables) */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.badge-pending {
    background: #FFF4E5;
    color: #B26A00;
}

.badge-approved {
    background: #E3F8E9;
    color: #1C7C3F;
}

.badge-exited {
    background: #EFEFF4;
    color: #636366;
}

/* Small action buttons used inside admin/gatekeeper tables */
.btn-action {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 10px;
    border: none;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

.btn-approve {
    background: linear-gradient(135deg, var(--ios-green), var(--ios-blue));
}

.btn-exit {
    background: linear-gradient(135deg, #FF9500, var(--ios-red));
}

.section-heading {
    font-size: 18px;
    font-weight: 700;
    margin: 26px 0 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.gatekeeper-card-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.gk-entry-card {
    background: white;
    border-radius: 14px;
    padding: 14px 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    gap: 14px;
}

.gk-entry-card img.thumb {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.gk-entry-info {
    flex: 1;
    min-width: 0;
}

.gk-entry-info .gk-token {
    font-weight: 700;
    font-size: 14px;
    color: var(--ios-blue);
}

.gk-entry-info .gk-name {
    font-weight: 600;
    font-size: 15px;
    margin: 2px 0;
}

.gk-entry-info .gk-meta {
    font-size: 12.5px;
    color: var(--ios-gray);
}

/* ---------- Gatekeeper: mobile-first layout ---------- */

.gk-wrap {
    max-width: 520px;
    margin: 0 auto;
    padding: 0 0 40px;
    min-height: 100vh;
}

.gk-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.gk-refresh-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #E8F0FE;
    color: var(--ios-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 17px;
    border: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.4s ease;
}

.gk-refresh-btn.spinning {
    transform: rotate(360deg);
}

.gk-header {
    position: sticky;
    top: 0;
    z-index: 15;
    background: rgba(242, 242, 247, 0.92);
    backdrop-filter: saturate(180%) blur(10px);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
    padding: 14px 16px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #E5E5EA;
}

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

.gk-header-title .gk-logo {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--ios-green), var(--ios-blue));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.gk-header-title h1 {
    font-size: 17px;
    margin: 0;
    font-weight: 700;
}

.gk-header-title .gk-clock {
    font-size: 11.5px;
    color: var(--ios-gray);
}

.gk-logout-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #E5E5EA;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 16px;
    flex-shrink: 0;
}

.gk-body {
    padding: 14px 16px 0;
}

.gk-tabs {
    display: flex;
    background: #E5E5EA;
    border-radius: 12px;
    padding: 3px;
    margin-bottom: 16px;
    gap: 3px;
}

.gk-tab {
    flex: 1;
    text-align: center;
    padding: 10px 8px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #48484A;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.gk-tab.active {
    background: #FFFFFF;
    color: var(--ios-text);
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.gk-tab .gk-tab-count {
    display: inline-block;
    margin-left: 4px;
    background: var(--ios-blue);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 10px;
    padding: 1px 7px;
}

.gk-tab.active .gk-tab-count {
    background: linear-gradient(135deg, var(--ios-green), var(--ios-blue));
}

.gk-panel { display: none; }
.gk-panel.active { display: block; }

.gk-empty-state {
    text-align: center;
    padding: 50px 16px;
    color: var(--ios-gray);
}

.gk-empty-state .gk-empty-icon {
    font-size: 40px;
    margin-bottom: 10px;
}

.gk-empty-state p {
    font-size: 14px;
    margin: 0;
}

/* Card gets bigger touch targets and stacks the action button below the
   info on narrow phones so nothing feels cramped */
.gk-entry-card {
    padding: 14px;
    gap: 12px;
    align-items: flex-start;
}

.gk-entry-card img.thumb {
    width: 48px;
    height: 48px;
    margin-top: 2px;
}

.gk-entry-card form {
    flex-shrink: 0;
}

.gk-entry-card .btn-action {
    min-height: 40px;
    min-width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 9px 14px;
    font-size: 13.5px;
}

@media (max-width: 400px) {
    .gk-entry-card {
        flex-wrap: wrap;
    }
    .gk-entry-card form {
        width: 100%;
    }
    .gk-entry-card .btn-action {
        width: 100%;
        min-height: 46px;
        font-size: 15px;
    }
}
