.app-boot-splash {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: #F4F6F8;
    background: var(--bg, #F4F6F8);
}

.app-boot-spinner {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 4px solid #CCFBF1;
    border-top-color: #0D9488;
    animation: app-boot-spin 0.8s linear infinite;
}

.app-boot-text {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #64748B;
}

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

/* "Dispatch Console" direction, worker side — same teal-on-light language as AdminWeb,
   kept warm and thumb-friendly since this is a phone in a guard's hand, not a desk */
:root {
    --accent: #0D9488;
    --accent-dark: #0F766E;
    --accent-light: #CCFBF1;
    --accent-50: #F0FDFA;
    --ink: #0F172A;
    --ink-soft: #334155;
    --muted: #64748B;
    --muted-light: #94A3B8;
    --bg: #F4F6F8;
    --surface: #FFFFFF;
    --border: #E2E8F0;
    --success: #0D9488;
    --success-bg: #F0FDFA;
    --warning: #B45309;
    --warning-bg: #FFFBEB;
    --error: #DC2626;
    --error-bg: #FEF2F2;
    --radius-lg: 18px;
    --radius-md: 13px;
    --shadow-md: 0 10px 26px rgba(15, 23, 42, 0.08);
    --shadow-btn: 0 10px 24px rgba(13, 148, 136, 0.30);
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --ease: cubic-bezier(0.34, 1.2, 0.64, 1);
}

/* Default size for every Icon.razor <svg class="icon">. Without this, a bare SVG
   renders at browser-default intrinsic size (often huge). More specific selectors
   below (e.g. .status-ring svg) override this by source order at equal specificity. */
svg.icon { width: 16px; height: 16px; }

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

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior-y: contain;
}

.app-shell {
    max-width: 460px;
    margin: 0 auto;
    min-height: 100vh;
    padding: calc(20px + var(--safe-top)) 18px calc(28px + var(--safe-bottom));
    background:
        radial-gradient(120% 60% at 50% -10%, var(--accent-light) 0%, transparent 60%),
        var(--bg);
}

.checkin-page { display: flex; flex-direction: column; min-height: calc(100vh - 48px); }

/* ---- Header ---- */
.checkin-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 22px;
}
.checkin-header .greeting-eyebrow { font-size: 12.5px; color: var(--muted); font-weight: 600; margin: 0 0 2px; }
.checkin-header h1 { font-size: 24px; font-weight: 800; color: var(--ink); margin: 0; letter-spacing: -0.3px; }
.worker-avatar {
    width: 46px; height: 46px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: white; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 16px; box-shadow: var(--shadow-btn);
    flex-shrink: 0;
}

/* ---- Status card ---- */
.status-hero {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 28px 22px;
    box-shadow: var(--shadow-md);
    text-align: center;
    margin-bottom: 18px;
}
.status-ring {
    width: 88px; height: 88px; border-radius: 50%;
    margin: 0 auto 16px;
    display: flex; align-items: center; justify-content: center;
    position: relative;
}
.status-ring.idle { background: var(--accent-50); color: var(--accent-dark); }
.status-ring.present { background: var(--success-bg); color: var(--success); }
.status-ring.done { background: #F1F5F9; color: var(--muted); }
.status-ring svg { width: 40px; height: 40px; }

.status-ring.idle::after {
    content: ""; position: absolute; inset: -6px; border-radius: 50%;
    border: 2px solid var(--accent-light); animation: pulse-ring 2.2s ease-out infinite;
}
@keyframes pulse-ring {
    0% { transform: scale(0.92); opacity: 0.9; }
    80% { transform: scale(1.18); opacity: 0; }
    100% { opacity: 0; }
}

.status-title { font-size: 17px; font-weight: 700; color: var(--ink); margin: 0 0 4px; }
.status-sub { font-size: 13.5px; color: var(--muted); margin: 0; }
.status-time { font-variant-numeric: tabular-nums; font-family: var(--mono); }

.geofence-warning {
    display: flex; align-items: flex-start; gap: 8px;
    color: var(--warning); background: var(--warning-bg);
    font-size: 13px; margin-top: 14px; padding: 10px 12px; border-radius: 10px; text-align: left;
}
.error-banner {
    display: flex; align-items: flex-start; gap: 8px;
    color: var(--error); background: var(--error-bg);
    font-size: 13.5px; padding: 12px 14px; border-radius: 12px; margin-bottom: 16px;
}
.error-banner svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }

/* Location-off blocker (location-guard.js toggles this) — full-screen and opaque on
   purpose, so a guard with location off physically can't reach the check-in/check-out
   buttons underneath, not just see a warning they can tap past. */
.location-guard-overlay {
    display: none; position: fixed; inset: 0; z-index: 200;
    background: var(--bg);
    flex-direction: column; align-items: center; justify-content: center;
    padding: 32px; text-align: center;
}
.location-guard-icon {
    width: 72px; height: 72px; border-radius: 50%;
    background: var(--warning-bg); color: var(--warning);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 20px;
}
.location-guard-icon svg { width: 32px; height: 32px; }
.location-guard-overlay h2 { font-size: 18px; font-weight: 800; color: var(--ink); margin: 0 0 8px; }
.location-guard-overlay p { font-size: 14px; color: var(--muted); max-width: 300px; margin: 0 0 24px; line-height: 1.6; }
/* Descendant selector, not a bare class — needs to outrank .btn-checkin's own
   width/height/border-radius (168px circle) declared later in this file, regardless of
   source order. */
.location-guard-overlay .location-guard-btn { width: auto; height: auto; min-height: 52px; padding: 0 28px; border-radius: 26px; }

/* Offline check-in/check-out status (offline-checkin.js writes into #offline-status
   directly — plain DOM text, not a Blazor-rendered element, since it has to work even
   when the Blazor circuit itself isn't up). */
.offline-status {
    align-items: center; gap: 8px;
    font-size: 13px; font-weight: 600;
    padding: 10px 14px; border-radius: 12px; margin-bottom: 14px; text-align: left;
}
.offline-status.pending { color: var(--warning); background: var(--warning-bg); }
.offline-status.error { color: var(--error); background: var(--error-bg); }
.offline-status.synced { color: var(--success); background: var(--success-bg); }

/* ---- No deployment / loading ---- */
.info-card {
    background: var(--surface); border-radius: var(--radius-lg); padding: 30px 22px;
    box-shadow: var(--shadow-md); text-align: center; color: var(--muted);
}
.info-card svg { width: 40px; height: 40px; color: var(--muted-light); margin-bottom: 12px; }

.spacer { flex: 1; }

/* ---- Big circular action button — the single most important control in the app.
   A large thumb-friendly circle (Uber/Swiggy-style) reads as "native app control,"
   not "web form button," and the pulse communicates "working" while GPS resolves
   instead of leaving the tap feeling frozen. ---- */
.action-zone {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 16px; padding: 12px 0 4px;
}
.action-hint { color: var(--muted); font-size: 13px; text-align: center; max-width: 240px; margin: 0; }
a.action-hint { display: inline-flex; align-items: center; justify-content: center; gap: 6px; margin-top: 14px; }
a.action-hint svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-checkin, .btn-checkout {
    width: 168px; height: 168px;
    border-radius: 50%;
    border: none;
    font-size: 19px;
    font-weight: 800;
    color: white;
    cursor: pointer;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
    transition: transform 0.15s var(--ease, ease), box-shadow 0.15s ease, opacity 0.15s ease;
    font-family: inherit;
}
.btn-checkin svg, .btn-checkout svg { width: 26px; height: 26px; }

.btn-checkin { background: radial-gradient(circle at 30% 30%, var(--accent), var(--accent-dark)); box-shadow: var(--shadow-btn); }
.btn-checkin:active { transform: scale(0.94); }

.btn-checkout { background: radial-gradient(circle at 30% 30%, var(--warning), #B45309); box-shadow: 0 10px 30px rgba(217, 119, 6, 0.35); }
.btn-checkout:active { transform: scale(0.94); }

button:disabled { opacity: 0.65; transform: none; }

/* Pulse while acquiring GPS — communicates "working," not frozen */
.btn-checkin.loading { animation: btn-pulse 1.4s ease-in-out infinite; }
.btn-checkout.loading { animation: btn-pulse-warn 1.4s ease-in-out infinite; }
@keyframes btn-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(13, 148, 136, 0.40); }
    50% { box-shadow: 0 0 0 20px rgba(13, 148, 136, 0); }
}
@keyframes btn-pulse-warn {
    0%, 100% { box-shadow: 0 0 0 0 rgba(217, 119, 6, 0.4); }
    50% { box-shadow: 0 0 0 20px rgba(217, 119, 6, 0); }
}

.done-note { text-align: center; color: var(--muted); font-size: 13px; margin-top: 12px; }

/* ---- Link expired ---- */
.expired-page {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: calc(100vh - 48px); text-align: center; padding: 20px;
}
.expired-page .expired-icon {
    width: 72px; height: 72px; border-radius: 50%; background: var(--error-bg); color: var(--error);
    display: flex; align-items: center; justify-content: center; margin-bottom: 20px;
}
.expired-page .expired-icon svg { width: 32px; height: 32px; }
.expired-page h2 { font-size: 19px; margin: 0 0 8px; color: var(--ink); }
.expired-page p { font-size: 14px; color: var(--muted); max-width: 300px; margin: 0; line-height: 1.6; }

/* ---- Payslips ---- */
.badge {
    display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 700;
    padding: 4px 10px; border-radius: 999px;
}
.badge-paid { background: var(--success-bg); color: var(--success); }
.badge-pending { background: var(--warning-bg); color: var(--warning); }

.payslip-card {
    background: var(--surface); border-radius: var(--radius-lg); padding: 18px 20px;
    box-shadow: var(--shadow-md); margin-bottom: 14px;
}
.payslip-card-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.payslip-period { font-size: 15px; font-weight: 800; color: var(--ink); }
.payslip-role { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.payslip-net { font-size: 28px; font-weight: 800; color: var(--accent-dark); line-height: 1; }
.payslip-net-label { font-size: 12px; color: var(--muted); margin-top: 4px; margin-bottom: 14px; }

.payslip-note {
    display: flex; align-items: flex-start; gap: 8px;
    background: var(--warning-bg); color: var(--warning);
    font-size: 12.5px; padding: 10px 12px; border-radius: 10px; margin-bottom: 14px;
}
.payslip-note svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; }

.payslip-breakdown { border-top: 1px solid var(--border); padding-top: 12px; }
.payslip-breakdown div { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-soft); padding: 3px 0; }
.payslip-breakdown div span:last-child { font-variant-numeric: tabular-nums; }

/* ---- PWA install / update toasts (injected by js/pwa.js, outside the Blazor render
   tree on purpose — they need to survive a circuit reconnect) ---- */
.wp-toast {
    /* Top, not bottom — the bottom of this screen is the big circular Check In/Check Out
       button plus the support FAB, both things a worker mid-action needs to actually tap.
       A toast sitting down there risks physically blocking the one control that matters. */
    position: fixed; left: 16px; right: 16px; top: calc(16px + var(--safe-top));
    z-index: 40;
    background: var(--navy, #0B1520); color: white;
    border-radius: var(--radius-md); box-shadow: var(--shadow-md);
    padding: 12px 14px; display: flex; align-items: center; gap: 10px;
    font-size: 13px; line-height: 1.4;
    animation: wp-toast-in 0.25s var(--ease, ease-out);
}
.wp-toast span { flex: 1; }
.wp-toast b { color: #5EEAD4; }
.wp-toast-action {
    background: var(--accent); color: white; border: none;
    border-radius: 8px; padding: 8px 14px; font-weight: 700; font-size: 13px;
    flex-shrink: 0; cursor: pointer; font-family: inherit;
}
.wp-toast-dismiss {
    background: none; border: none; color: rgba(255,255,255,0.6);
    font-size: 15px; cursor: pointer; flex-shrink: 0; padding: 4px;
}
.wp-toast-update { background: var(--accent-dark); }
@keyframes wp-toast-in {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---- Support FAB (Message Us / Report a Problem) ---- */
.support-fab {
    position: fixed; right: 18px; bottom: calc(18px + var(--safe-bottom)); z-index: 30;
    display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
}
.support-fab .fab-btn {
    width: 48px; height: 48px; border-radius: 50%; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-md); color: white; text-decoration: none;
}
.support-fab .fab-whatsapp { background: #25D366; }
.support-fab .fab-bug { background: var(--ink-soft); }
.support-fab svg { width: 20px; height: 20px; }

.sheet-overlay {
    position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45);
    z-index: 50; display: flex; align-items: flex-end;
}
.sheet-card {
    background: var(--surface); width: 100%; border-radius: 20px 20px 0 0;
    padding: 10px 10px calc(20px + var(--safe-bottom));
    box-shadow: var(--shadow-md);
}
.sheet-handle { width: 40px; height: 4px; border-radius: 999px; background: var(--border); margin: 4px auto 14px; }

.sheet-btn {
    width: 100%; padding: 14px; border: none; border-radius: 14px;
    font-size: 15px; font-weight: 700; font-family: inherit; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.sheet-btn-warn { background: linear-gradient(135deg, var(--warning), #B45309); color: white; box-shadow: 0 10px 24px rgba(217, 119, 6, 0.28); }
.sheet-btn-ghost { background: #F1F5F9; color: var(--ink-soft); margin-top: 10px; }

/* Blazor Server reconnect UI — replaces the framework's default full-screen
   "Attempting to reconnect..." overlay with a slim top-of-page sliding bar +
   status pill. Blazor only auto-injects its default modal when no element with
   id="components-reconnect-modal" exists in the DOM, so providing our own here
   (see _Host.cshtml) fully replaces it; blazor.server.js just toggles the
   components-reconnect-* classes below. */
#components-reconnect-modal {
    position: fixed; top: 0; left: 0; right: 0;
    z-index: 9999; pointer-events: none; display: none;
}
#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected { display: block; }
#components-reconnect-modal .reconnect-bar {
    height: 3px; width: 100%;
    background: linear-gradient(90deg, transparent, var(--accent), var(--accent-dark), var(--accent), transparent);
    background-size: 200% 100%;
    animation: reconnect-slide 1.4s linear infinite;
}
@keyframes reconnect-slide {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
#components-reconnect-modal .reconnect-label {
    pointer-events: auto;
    position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
    display: flex; align-items: center; gap: 8px; white-space: nowrap;
    background: var(--ink); color: #fff;
    font-size: 12.5px; font-weight: 700;
    padding: 6px 14px; border-radius: 999px;
    box-shadow: var(--shadow-md);
}
#components-reconnect-modal .reconnect-label::before {
    content: ""; width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
    background: #FBBF24; animation: reconnect-dot 1s ease-in-out infinite;
}
@keyframes reconnect-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
#components-reconnect-modal .reconnect-text-failed,
#components-reconnect-modal .reconnect-text-rejected { display: none; }
#components-reconnect-modal.components-reconnect-failed .reconnect-text-show,
#components-reconnect-modal.components-reconnect-rejected .reconnect-text-show { display: none; }
#components-reconnect-modal.components-reconnect-failed .reconnect-text-failed { display: inline; }
#components-reconnect-modal.components-reconnect-rejected .reconnect-text-rejected { display: inline; }
#components-reconnect-modal.components-reconnect-failed .reconnect-bar,
#components-reconnect-modal.components-reconnect-rejected .reconnect-bar { animation: none; background: #DC2626; }
#components-reconnect-modal.components-reconnect-failed .reconnect-label::before,
#components-reconnect-modal.components-reconnect-rejected .reconnect-label::before { background: #DC2626; animation: none; }
#components-reconnect-modal .reconnect-label a { color: #93C5FD; text-decoration: underline; margin-left: 2px; }
