@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --bg: #f4f5f8; --bg-2: #e8eaef; --panel: #ffffff; --panel-2: #f0f1f5; --text: #14171f;
    --muted: #8b93a1; --accent: #2b4fd8; --accent-2: #4f74e6; --accent-glow: rgba(43,79,216,.25);
    --danger: #e5484d; --warn: #e8962e; --border: #ececf1;
    --shadow: 0 10px 28px rgba(20,23,31,.07);
    --ok: #1fa971;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
.ico { display: inline-flex; vertical-align: -4px; }
html, body { height: 100%; }
body {
    margin: 0; background: var(--bg); color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 480px; margin: 0 auto; padding: 18px 16px 100px; min-height: 100vh; animation: rise .4s cubic-bezier(.22,.61,.36,1) both; }

/* On tablet/desktop, frame the app like a phone screen instead of stretching
   it edge to edge — this is still fundamentally a mobile check-in tool
   (camera + GPS), so a wider reflow would look broken, not "responsive". */
@media (min-width: 640px) {
    body { background: var(--bg-2, #eceef2); }
    .wrap {
        max-width: 460px; margin: 24px auto; min-height: calc(100vh - 48px);
        background: var(--bg); border-radius: 28px; box-shadow: 0 30px 70px rgba(20,23,31,.14), 0 0 0 1px var(--border);
        padding-bottom: 110px;
    }
    .tabbar { max-width: 460px; left: 50%; transform: translateX(-50%); border-radius: 0 0 28px 28px; }
    .modal-backdrop { align-items: center; }
    .modal { border-radius: 28px; overflow: hidden; max-height: 90vh; }
}

/* Top status row: location + notification bell, à la Pips */
.topline { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.topline .loc { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.topline .loc strong { color: var(--text); font-size: 13px; text-transform: none; letter-spacing: 0; display: block; margin-top: 2px; }
.bell {
    width: 38px; height: 38px; border-radius: 50%; background: var(--panel); border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center; font-size: 16px; box-shadow: var(--shadow);
    flex-shrink: 0; cursor: pointer;
}
.hint { color: var(--muted); font-size: 14px; margin: 0 0 14px; }

.brand {
    display: flex; align-items: center; justify-content: center; gap: 9px;
    font-weight: 800; font-size: 22px; margin-bottom: 22px; letter-spacing: -.02em;
}
.brand-mark { flex-shrink: 0; }

/* Hero: the gradient "today" card, styled after Pips' clock-in card */
.hero {
    background: linear-gradient(135deg, var(--accent-2), var(--accent) 70%);
    border-radius: 22px; padding: 20px; margin-bottom: 18px; color: #fff;
    box-shadow: 0 14px 30px var(--accent-glow); position: relative; overflow: hidden;
    animation: hero-in .5s cubic-bezier(.22,.61,.36,1) both; animation-delay: .05s;
}
.hero::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: radial-gradient(120px 120px at 90% -10%, rgba(255,255,255,.25), transparent 70%);
}
.hero .who { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.hero .who .avatar { background: rgba(255,255,255,.22); color: #fff; }
.hero .who .name { font-weight: 700; font-size: 15px; }
.hero .who .role { font-size: 12px; opacity: .85; }
.hero .schedule {
    display: flex; align-items: center; gap: 8px; background: rgba(0,0,0,.14); border-radius: 12px;
    padding: 10px 12px; font-size: 13px; font-weight: 600; margin-bottom: 14px; flex-wrap: wrap;
}
.hero .schedule .sep { opacity: .5; }
.hero .progress { color: rgba(255,255,255,.92); font-size: 13px; margin-bottom: 0; }
.hero-btn {
    display: block; width: 100%; padding: 14px 16px; border-radius: 14px; border: none;
    background: #fff; color: var(--accent); font-weight: 800; cursor: pointer; font-size: 15px;
    text-align: center; text-decoration: none; transition: transform .12s ease;
}
.hero-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,0,0,.12); }
.hero-btn:active { transform: scale(.97); }
.hero-btn.faded { background: rgba(255,255,255,.18); color: #fff; }

/* Quick-action icon grid */
.icon-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.icon-tile {
    display: flex; flex-direction: column; align-items: center; gap: 8px; background: none; border: none; cursor: pointer;
    font-family: inherit; color: inherit; text-decoration: none;
    animation: pop .45s cubic-bezier(.34,1.56,.64,1) both;
}
.icon-tile:hover { text-decoration: none; }
.icon-tile:active .sq { transform: scale(.9); }
.icon-tile .sq {
    width: 52px; height: 52px; border-radius: 16px; display: flex; align-items: center; justify-content: center;
    font-size: 21px; box-shadow: var(--shadow); transition: transform .15s cubic-bezier(.34,1.56,.64,1), box-shadow .15s ease;
}
.icon-tile:hover .sq { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(20,23,31,.12); }
.icon-tile .lbl { font-size: 11px; color: var(--text); font-weight: 600; text-align: center; line-height: 1.2; }
.tone-a { background: #e8f6ee; color: var(--ok); } .tone-b { background: #eaf1ff; color: var(--accent); } .tone-c { background: #fff1e6; color: var(--warn); }
.tone-d { background: #ffe9ec; color: var(--danger); } .tone-e { background: #f1ecff; color: #7c5cff; } .tone-f { background: #eafaf7; color: var(--ok); }

.icon-tile:nth-child(1) { animation-delay: .08s; }
.icon-tile:nth-child(2) { animation-delay: .14s; }
.icon-tile:nth-child(3) { animation-delay: .20s; }
.icon-tile:nth-child(4) { animation-delay: .26s; }
.list-item { animation: rise .35s cubic-bezier(.22,.61,.36,1) both; }
.list-item:nth-child(1) { animation-delay: .02s; } .list-item:nth-child(2) { animation-delay: .06s; }
.list-item:nth-child(3) { animation-delay: .10s; } .list-item:nth-child(4) { animation-delay: .14s; }
.list-item:nth-child(5) { animation-delay: .18s; } .list-item:nth-child(n+6) { animation-delay: .2s; }

.card {
    background: var(--panel); border: 1px solid var(--border); border-radius: 18px; padding: 18px; margin-bottom: 16px;
    box-shadow: var(--shadow); animation: rise .4s cubic-bezier(.22,.61,.36,1) both;
}
h2, h3 { margin-top: 0; font-weight: 700; letter-spacing: -.01em; }
.muted { color: var(--muted); font-size: 14px; }
label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 13px; font-weight: 500; }
.field { margin-bottom: 14px; }
input {
    width: 100%; padding: 13px 14px; border-radius: 12px; border: 1px solid var(--border);
    background: var(--panel-2); color: var(--text); font-size: 16px; font-family: inherit;
    transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.btn {
    display: block; width: 100%; padding: 15px 16px; border-radius: 14px; border: none;
    background: var(--accent); color: #fff; font-weight: 700; cursor: pointer; font-size: 16px;
    text-align: center; text-decoration: none; transition: transform .12s ease, box-shadow .12s ease, background .15s ease;
    box-shadow: 0 6px 18px var(--accent-glow);
}
.btn:hover { background: var(--accent-2); }
.btn:active { transform: scale(.98); }
.btn.ghost { background: var(--panel-2); border: 1px solid var(--border); color: var(--text); font-weight: 600; box-shadow: none; }
.btn.ghost:hover { background: #e8e9ee; }
.btn.small { padding: 10px 14px; font-size: 14px; width: auto; display: inline-block; border-radius: 10px; }
.btn.danger { background: var(--danger); box-shadow: 0 6px 18px rgba(229,72,77,.25); }
.btn[disabled] { opacity: .5; }
.msg { padding: 13px 16px; border-radius: 12px; margin-bottom: 16px; font-size: 14px; font-weight: 500; }
.msg.err { background: #fdecec; color: #c23a3e; border: 1px solid #f6cfd0; }
.msg.ok { background: #e8f6ee; color: #1a8a5c; border: 1px solid #c9ecd9; }

.list-item {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 13px 2px; border-bottom: 1px solid var(--border);
    transition: background .15s ease; border-radius: 10px;
}
.list-item:last-child { border-bottom: none; }
.list-item:hover { background: var(--panel-2); }
.mark-btn { transition: transform .12s cubic-bezier(.34,1.56,.64,1), background .15s ease, box-shadow .15s ease; }
.mark-btn:active { transform: scale(.93); }
.badge { display: inline-block; padding: 4px 11px; border-radius: 99px; font-size: 12px; font-weight: 700; }
.badge.pending { background: #fdf1e0; color: var(--warn); }
.badge.approved, .badge.auto_approved { background: #e8f6ee; color: var(--ok); }
.badge.rejected, .badge.absent { background: #fdecec; color: var(--danger); }
.badge.late { background: #fdf1e0; color: var(--warn); }
.badge.waiting { background: var(--panel-2); color: var(--muted); }

.avatar {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: 38px; height: 38px; border-radius: 50%; font-size: 13px; font-weight: 700; color: #fff;
    background: linear-gradient(135deg, var(--accent-2), var(--accent));
}
.person { display: flex; align-items: center; gap: 12px; }

/* Bottom tab bar */
.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: var(--panel); border-top: 1px solid var(--border);
    display: flex; padding: 8px max(10px, env(safe-area-inset-left)) calc(8px + env(safe-area-inset-bottom));
    box-shadow: 0 -6px 20px rgba(20,23,31,.05);
}
.tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 600; padding: 4px 0;
    transition: color .15s ease, transform .15s cubic-bezier(.34,1.56,.64,1);
}
.tabbar a .ic { font-size: 19px; transition: transform .15s cubic-bezier(.34,1.56,.64,1); }
.tabbar a.active { color: var(--accent); }
.tabbar a.active .ic { transform: translateY(-2px) scale(1.1); }
.tabbar a:active:not([style*="pointer-events: none"]) { transform: scale(.92); }

/* Camera capture, restyled: full-bleed viewfinder + face-frame brackets + bottom sheet */
.modal-backdrop {
    position: fixed; inset: 0; background: #05070a; display: flex; align-items: stretch;
    justify-content: center; z-index: 50; animation: fadeIn .15s ease both;
}
.modal { background: #05070a; border-radius: 0; padding: 0; width: 100%; max-width: 480px; margin: 0 auto; display: flex; flex-direction: column; position: relative; }
.cam-header {
    display: flex; align-items: center; justify-content: space-between; padding: 16px 18px;
    color: #fff; position: absolute; top: 0; left: 0; right: 0; z-index: 2;
}
.cam-header .title { font-weight: 700; font-size: 15px; }
.cam-header button {
    width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.12); border: none;
    color: #fff; font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.cam-stage { position: relative; flex: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; background: #000; min-height: 380px; }
video, canvas.preview { width: 100%; height: 100%; object-fit: cover; }
.face-frame {
    position: absolute; inset: 14% 14% 24% 14%; border-radius: 32px; pointer-events: none;
    border: 3px solid transparent;
}
.face-frame::before, .face-frame::after {
    content: ""; position: absolute; width: 34px; height: 34px; border-color: #fff;
}
.corner { position: absolute; width: 30px; height: 30px; border: 3px solid #fff; opacity: .9; }
.corner.tl { top: 0; left: 0; border-right: none; border-bottom: none; border-top-left-radius: 16px; }
.corner.tr { top: 0; right: 0; border-left: none; border-bottom: none; border-top-right-radius: 16px; }
.corner.bl { bottom: 0; left: 0; border-right: none; border-top: none; border-bottom-left-radius: 16px; }
.corner.br { bottom: 0; right: 0; border-left: none; border-top: none; border-bottom-right-radius: 16px; }
.cam-sheet {
    background: var(--panel); border-radius: 24px 24px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
    animation: sheet-up .35s cubic-bezier(.22,.61,.36,1) both; animation-delay: .05s;
}
.cam-sheet .locrow {
    display: flex; align-items: center; gap: 10px; background: var(--panel-2); border-radius: 12px;
    padding: 11px 13px; font-size: 13px; margin-bottom: 14px;
}
.cam-sheet .locrow .ok-dot { color: var(--ok); font-weight: 700; }
.cam-shutter-wrap { display: flex; justify-content: center; padding: 22px 0; }
.cam-shutter {
    width: 72px; height: 72px; border-radius: 50%; background: #fff; border: 5px solid var(--accent);
    cursor: pointer; box-shadow: 0 4px 16px var(--accent-glow), inset 0 0 0 2px #fff;
}
.cam-shutter:active { background: var(--panel-2); }
.hidden { display: none !important; }
.spinner {
    width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
    border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; margin-right: 8px;
    vertical-align: -3px;
}
.btn .spinner { border-color: rgba(43,79,216,.35); border-top-color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes hero-in { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes pop { from { opacity: 0; transform: scale(.7); } to { opacity: 1; transform: scale(1); } }
@keyframes sheet-up { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }
.progress { color: var(--muted); font-size: 13px; margin-bottom: 12px; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
