* { -webkit-tap-highlight-color: transparent; box-sizing: border-box; }

body {
    background: #f5f5f5;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #000;
    margin: 0;
    min-height: 100vh;
}

.app-container {
    max-width: 480px;
    margin: 0 auto;
    background: #fff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 30px rgba(0,0,0,0.08);
}

/* Header */
.app-header {
    background: #000;
    color: #fff;
    padding: 20px;
}
.header-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
}
.header-subtitle {
    font-size: 13px;
    opacity: 0.6;
    font-variant-numeric: tabular-nums;
}
.user-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.12);
    padding: 6px 12px;
    border-radius: 30px;
    font-size: 12px;
}
.user-badge i { font-size: 18px; }

/* Main */
.app-main { flex: 1; padding: 16px; position: relative; }

/* Loading overlay */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: #666;
    font-size: 13px;
    z-index: 10;
}
.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #eee;
    border-top-color: #000;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Shift card */
.shift-card {
    background: #000;
    color: #fff;
    padding: 14px 16px;
    border-radius: 14px;
    margin-bottom: 14px;
}
.shift-name {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 6px;
}
.shift-times {
    display: flex;
    gap: 16px;
    font-size: 13px;
    opacity: 0.85;
    font-variant-numeric: tabular-nums;
}
.shift-times i { margin-right: 4px; }
.shift-office {
    font-size: 12px;
    opacity: 0.7;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.15);
}

/* Type toggle */
.type-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    background: #f0f0f0;
    padding: 4px;
    border-radius: 12px;
    margin-bottom: 16px;
}
.toggle-btn {
    border: none;
    background: transparent;
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    color: #666;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.toggle-btn.active {
    background: #000;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* Camera */
.camera-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 3/4;
    background: #000;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 16px;
}
#video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}
#overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}
.camera-status {
    position: absolute;
    bottom: 12px;
    left: 12px;
    right: 12px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(10px);
}
.face-indicator {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    backdrop-filter: blur(10px);
    transition: all 0.3s;
}
.face-indicator.detected {
    background: #fff;
    color: #000;
}

/* Requirements */
.requirements {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}
.req-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f8f8f8;
    border-radius: 10px;
    border: 1px solid #ececec;
    transition: all 0.3s;
}
.req-item.valid {
    background: #000;
    color: #fff;
    border-color: #000;
}
.req-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    color: #999;
    transition: all 0.3s;
}
.req-item.valid .req-icon {
    background: #fff;
    color: #000;
}
.req-label { font-size: 13px; font-weight: 600; }
.req-detail { font-size: 11px; color: #999; margin-top: 2px; }
.req-item.valid .req-detail { color: rgba(255,255,255,0.6); }

/* Submit */
.btn-submit {
    width: 100%;
    padding: 16px;
    background: #ccc;
    color: #fff;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    cursor: not-allowed;
}
.btn-submit:not(:disabled) {
    background: #000;
    cursor: pointer;
}
.btn-submit:not(:disabled):active { transform: scale(0.98); }

/* Completed view */
.completed-card {
    background: #000;
    color: #fff;
    border-radius: 16px;
    padding: 24px 20px;
    text-align: center;
    margin-bottom: 16px;
}
.completed-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #fff;
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    margin: 0 auto 12px;
}
.completed-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.3px;
}
.completed-subtitle {
    font-size: 12px;
    opacity: 0.7;
    margin-top: 6px;
    line-height: 1.5;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}
.summary-item {
    background: #f8f8f8;
    border: 1px solid #ececec;
    border-radius: 12px;
    padding: 12px 8px;
    text-align: center;
}
.summary-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #999;
    font-weight: 600;
    margin-bottom: 6px;
}
.summary-value {
    font-size: 18px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.5px;
}
.summary-note {
    font-size: 10px;
    color: #999;
    margin-top: 4px;
    min-height: 14px;
}

.photos-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
}
.photo-thumb {
    aspect-ratio: 3/4;
    background: #f0f0f0;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.photo-thumb .photo-placeholder { font-size: 11px; color: #999; }
.photo-thumb .photo-label {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 1px;
    backdrop-filter: blur(4px);
}

/* Today log */
.today-log { margin-top: 20px; }
.today-log h6 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #999;
    margin-bottom: 10px;
    font-weight: 600;
}
.log-list { display: flex; flex-direction: column; gap: 6px; }
.log-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: #f8f8f8;
    border-radius: 8px;
    font-size: 13px;
}
.log-item .log-type {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}
.log-item .log-time { color: #999; font-variant-numeric: tabular-nums; }

.badge-status {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
    font-weight: 600;
    text-transform: uppercase;
}
.badge-status.late { background: #000; color: #fff; border: 1px solid #fff; }
.badge-status.ontime { background: #fff; color: #000; }
.badge-status.early { background: #666; color: #fff; }

/* Result modal */
.result-modal { border: none; border-radius: 20px; }
.result-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto;
    border-radius: 50%;
    background: #000;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 42px;
}
.result-modal.error .result-icon { background: #666; }
.result-meta {
    background: #f8f8f8;
    border-radius: 10px;
    padding: 12px;
    margin-top: 12px;
    font-size: 13px;
    text-align: left;
}
.result-meta .row-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
}
.result-meta .row-item .label { color: #999; }
.result-meta .row-item .value { font-weight: 600; }


/* ============================================================
   PROFILE PAGE
   ============================================================ */

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    text-decoration: none;
    transition: background 0.2s;
}
.icon-btn:hover { background: rgba(255,255,255,0.2); color: #fff; }

/* Profile header card */
.profile-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #000;
    color: #fff;
    padding: 18px 16px;
    border-radius: 16px;
    margin-bottom: 14px;
}
.profile-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    flex-shrink: 0;
}
.profile-info { min-width: 0; flex: 1; }
.profile-name {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.profile-code {
    font-size: 12px;
    opacity: 0.7;
    margin-top: 2px;
    letter-spacing: 0.5px;
}
.profile-email {
    font-size: 11px;
    opacity: 0.5;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Meta grid */
.meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 14px;
}
.meta-item {
    background: #f8f8f8;
    border: 1px solid #ececec;
    border-radius: 12px;
    padding: 12px 14px;
}
.meta-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #999;
    font-weight: 600;
    margin-bottom: 4px;
}
.meta-value {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Month picker */
.month-picker {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8f8f8;
    border: 1px solid #ececec;
    border-radius: 12px;
    padding: 6px;
    margin-bottom: 12px;
}
.month-nav {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background 0.2s;
}
.month-nav:hover:not(:disabled) { background: #e8e8e8; }
.month-nav:disabled { opacity: 0.3; cursor: not-allowed; }
.month-label {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: -0.2px;
}

/* Summary strip */
.summary-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 18px;
}
.summary-strip-item {
    background: #000;
    color: #fff;
    border-radius: 12px;
    padding: 12px 8px;
    text-align: center;
}
.strip-value {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.5px;
    font-variant-numeric: tabular-nums;
}
.strip-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.6;
    margin-top: 3px;
    font-weight: 600;
}

/* History list */
.history-section { margin-bottom: 20px; }
.history-section h6 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #999;
    margin-bottom: 10px;
    font-weight: 600;
}
.history-list { display: flex; flex-direction: column; gap: 6px; }

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #f8f8f8;
    border: 1px solid #ececec;
    border-radius: 12px;
    padding: 12px 14px;
    cursor: pointer;
    transition: all 0.15s;
}
.history-item:active {
    background: #f0f0f0;
    transform: scale(0.995);
}
.history-date { flex: 1; min-width: 0; }
.history-day {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: -0.2px;
}
.history-times {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    align-items: center;
    font-variant-numeric: tabular-nums;
}
.history-times i { margin-right: 2px; }
.history-right {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #999;
    font-size: 12px;
}
.history-worked {
    font-weight: 700;
    color: #000;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

/* Day modal */
.day-modal-date {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.3px;
}
.day-modal-sub {
    font-size: 12px;
    color: #999;
    margin-top: 2px;
}

/* Small spinner */
.spinner-sm {
    width: 22px;
    height: 22px;
    border: 2px solid #eee;
    border-top-color: #000;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

/* History link button (in completed view) */
.btn-history-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px;
    margin-top: 12px;
    background: #f8f8f8;
    border: 1px solid #ececec;
    border-radius: 12px;
    color: #000;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.15s;
}
.btn-history-link:hover { background: #f0f0f0; color: #000; }
.btn-history-link .ms-auto { margin-left: auto; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */

body.login-page {
    background: #fff;
}

.login-container {
    max-width: 400px;
    margin: 0 auto;
    min-height: 100vh;
    padding: 40px 24px 24px;
    display: flex;
    flex-direction: column;
}

.login-hero {
    text-align: center;
    padding: 40px 0 32px;
}
.login-logo {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #000;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    margin: 0 auto 18px;
}
.login-title {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
}
.login-subtitle {
    font-size: 13px;
    color: #999;
    margin-top: 4px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #000;
    margin-bottom: 6px;
    letter-spacing: 0.2px;
}

.input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8f8f8;
    border: 1.5px solid #ececec;
    border-radius: 12px;
    padding: 0 14px;
    transition: all 0.15s;
}
.input-wrapper:focus-within {
    border-color: #000;
    background: #fff;
}
.input-wrapper > i {
    font-size: 16px;
    color: #999;
    flex-shrink: 0;
}
.input-wrapper:focus-within > i { color: #000; }

.form-input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    padding: 14px 0;
    font-size: 14px;
    color: #000;
    font-family: inherit;
    min-width: 0;
}
.form-input::placeholder { color: #bbb; }

.input-toggle {
    background: transparent;
    border: none;
    color: #999;
    font-size: 16px;
    padding: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
}
.input-toggle:hover { color: #000; }

.login-error {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #000;
    color: #fff;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 13px;
    animation: shake 0.35s;
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

.btn-login {
    width: 100%;
    padding: 16px;
    background: #000;
    color: #fff;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.2px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.15s;
    margin-top: 8px;
    cursor: pointer;
}
.btn-login:not(:disabled):active { transform: scale(0.98); }
.btn-login:disabled { opacity: 0.7; cursor: not-allowed; }

.spinner-light {
    border-color: rgba(255,255,255,0.3);
    border-top-color: #fff;
}

.login-footer {
    margin-top: auto;
    padding-top: 24px;
    text-align: center;
}
.demo-hint {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #999;
    background: #f8f8f8;
    border: 1px solid #ececec;
    padding: 8px 12px;
    border-radius: 20px;
}
.demo-hint code {
    background: #000;
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* Header actions on index/profile */
.header-actions {
    display: flex;
    gap: 8px;
}
/* ============================================================
   CONFIRM CHECKOUT MODAL
   ============================================================ */
.confirm-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 4px;
    border-radius: 50%;
    background: #000;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
}
.result-modal .btn-outline-dark {
    border-width: 1.5px;
    font-weight: 600;
    padding: 10px;
}
.result-modal .btn-dark {
    font-weight: 700;
    padding: 12px;
}