/* ===== Field Attendance — staff mobile app ===== */
:root{
  --navy:#001933; --navy2:#0a2a4f; --red:#C8102E; --gold:#D4A843; --green:#0E9F6E; --green-bg:#E7F7F0;
  --amber:#B7791F; --amber-bg:#FFF6E0; --red-bg:#FDECEE;
  --bg:#F2F5FA; --card:#FFFFFF; --text:#0F1B2D; --muted:#5B6B80; --line:#E3E8F0;
  --radius:16px; --shadow:0 4px 18px rgba(0,25,51,.08);
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;padding:0}
body{font-family:"Inter","Tajawal",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;background:var(--bg);color:var(--text);
  font-size:16px;line-height:1.45;min-height:100vh}
[dir=rtl] body{font-family:"Tajawal","Inter",system-ui,sans-serif}
button,input,textarea{font:inherit;color:inherit}
.hidden{display:none!important}

/* header */
.top{background:var(--navy);color:#fff;padding:14px 16px 64px;position:relative}
.top-row{display:flex;align-items:center;gap:10px;max-width:520px;margin:0 auto}
.top img.logo{height:34px;width:auto;background:#fff;border-radius:8px;padding:3px 6px}
.brand{flex:1;min-width:0}
.brand b{display:block;font-size:16px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.brand small{opacity:.7;font-size:12px}
.icon-btn{background:rgba(255,255,255,.12);border:0;color:#fff;height:38px;min-width:38px;padding:0 10px;border-radius:10px;
  display:inline-flex;align-items:center;justify-content:center;gap:6px;cursor:pointer;position:relative;font-size:13px}
.icon-btn svg{width:20px;height:20px}
.badge{position:absolute;top:-5px;inset-inline-end:-5px;background:var(--red);color:#fff;border-radius:10px;font-size:11px;
  min-width:18px;height:18px;padding:0 5px;display:flex;align-items:center;justify-content:center;font-weight:700}
.clock{max-width:520px;margin:14px auto 0;text-align:center}
.clock .t{font-size:40px;font-weight:700;letter-spacing:1px;font-variant-numeric:tabular-nums}
.clock .d{opacity:.75;font-size:14px}

main{max-width:520px;margin:-48px auto 0;padding:0 14px 40px;position:relative}
.card{background:var(--card);border-radius:var(--radius);box-shadow:var(--shadow);padding:16px;margin-bottom:12px}
.card h2{font-size:15px;margin:0 0 10px;color:var(--muted);font-weight:600}

/* login */
.pin-input{width:100%;font-size:26px;letter-spacing:6px;text-align:center;padding:14px;border:2px solid var(--line);
  border-radius:12px;outline:none;background:#fff;direction:ltr}
.pin-input:focus{border-color:var(--navy)}
.btn{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;border:0;border-radius:14px;padding:16px;
  font-size:17px;font-weight:700;cursor:pointer;transition:transform .05s,opacity .2s}
.btn:active{transform:scale(.98)}
.btn:disabled{opacity:.55;cursor:default}
.btn-primary{background:var(--navy);color:#fff}
.btn-in{background:var(--green);color:#fff}
.btn-out{background:var(--red);color:#fff}
.btn-ghost{background:transparent;color:var(--muted);font-weight:600;font-size:14px;padding:10px}
.btn-line{background:#fff;border:1.5px solid var(--line);color:var(--text);font-weight:600;font-size:15px;padding:12px}
.btn.secondary-choice{opacity:.9;background:#fff;border:2px solid currentColor;padding:13px}
.btn-in.secondary-choice{color:var(--green)} .btn-out.secondary-choice{color:var(--red)}
.mt{margin-top:12px}

/* staff header card */
.who{display:flex;align-items:center;gap:12px}
.avatar{width:48px;height:48px;border-radius:50%;background:var(--navy);color:var(--gold);display:flex;align-items:center;
  justify-content:center;font-weight:800;font-size:17px;flex-shrink:0}
.who .n{font-weight:700;font-size:17px}
.who .dp{color:var(--muted);font-size:13px}
.who .logout{margin-inline-start:auto;font-size:12px;color:var(--muted);background:none;border:0;text-decoration:underline;cursor:pointer;padding:6px}

.status{display:flex;align-items:center;gap:10px;margin-top:14px;padding:12px;border-radius:12px;font-weight:600;font-size:15px}
.status.in{background:var(--green-bg);color:var(--green)}
.status.out{background:#EEF2F7;color:var(--muted)}
.dot{width:10px;height:10px;border-radius:50%;background:currentColor;flex-shrink:0}
.status.in .dot{animation:pulse 1.6s infinite}
@keyframes pulse{0%{box-shadow:0 0 0 0 rgba(14,159,110,.5)}70%{box-shadow:0 0 0 9px rgba(14,159,110,0)}100%{box-shadow:0 0 0 0 rgba(14,159,110,0)}}

/* gps */
.gps{display:flex;align-items:flex-start;gap:12px}
.gps .ico{width:40px;height:40px;border-radius:12px;display:flex;align-items:center;justify-content:center;flex-shrink:0;background:#EEF2F7;color:var(--muted)}
.gps .ico svg{width:22px;height:22px}
.gps.ok .ico{background:var(--green-bg);color:var(--green)}
.gps.warn .ico{background:var(--amber-bg);color:var(--amber)}
.gps.err .ico{background:var(--red-bg);color:var(--red)}
.gps .txt{flex:1;font-size:14px}
.gps .txt b{display:block;font-size:15px}
.gps .sub{color:var(--muted);font-size:13px;margin-top:2px}
.gps .sub.warn{color:var(--amber)} .gps .sub.bad{color:var(--red)}
.spin{width:18px;height:18px;border:2.5px solid currentColor;border-top-color:transparent;border-radius:50%;animation:sp 0.8s linear infinite}
@keyframes sp{to{transform:rotate(360deg)}}

/* photo */
.photo-box{display:flex;align-items:center;gap:12px;border:2px dashed var(--line);border-radius:12px;padding:10px;cursor:pointer;background:#FAFBFD}
.photo-box img{width:64px;height:64px;object-fit:cover;border-radius:10px}
.photo-box .ph{width:64px;height:64px;border-radius:10px;background:#EEF2F7;display:flex;align-items:center;justify-content:center;color:var(--muted)}
.photo-box .ph svg{width:28px;height:28px}
.photo-box span{font-size:14px;font-weight:600;color:var(--muted)}
textarea{width:100%;border:1.5px solid var(--line);border-radius:12px;padding:10px 12px;resize:none;min-height:46px;outline:none;font-size:15px;margin-top:10px}
textarea:focus{border-color:var(--navy)}
.actions{display:grid;gap:10px;margin-top:14px}

/* recent */
.recent{list-style:none;margin:0;padding:0}
.recent li{display:flex;align-items:center;gap:10px;padding:9px 0;border-bottom:1px solid var(--line);font-size:14px}
.recent li:last-child{border-bottom:0}
.pill{font-size:12px;font-weight:700;padding:3px 9px;border-radius:20px}
.pill.in{background:var(--green-bg);color:var(--green)} .pill.out{background:var(--red-bg);color:var(--red)}
.pill.flag{background:var(--amber-bg);color:var(--amber)}
.recent .tm{margin-inline-start:auto;color:var(--muted);font-variant-numeric:tabular-nums;direction:ltr}
.empty{color:var(--muted);font-size:14px;text-align:center;padding:8px}

.notice{font-size:13px;color:var(--muted);display:flex;gap:8px;align-items:flex-start}
.notice svg{width:18px;height:18px;flex-shrink:0;color:var(--green);margin-top:1px}

/* toast */
#toast{position:fixed;left:50%;bottom:24px;transform:translateX(-50%) translateY(150%);background:#1B2533;color:#fff;
  padding:13px 18px;border-radius:12px;font-size:15px;max-width:92vw;width:max-content;z-index:99;transition:transform .25s,opacity .25s;opacity:0;visibility:hidden;box-shadow:0 8px 24px rgba(0,0,0,.25);text-align:center}
#toast.show{transform:translateX(-50%) translateY(0);opacity:1;visibility:visible}
#toast.err{background:var(--red)}

/* overlay: success / messages / confirm */
.overlay{position:fixed;inset:0;background:rgba(0,15,35,.55);z-index:50;display:flex;align-items:flex-end;justify-content:center}
.sheet{background:#fff;width:100%;max-width:520px;border-radius:20px 20px 0 0;padding:20px 16px 28px;max-height:85vh;overflow:auto;animation:up .25s}
@keyframes up{from{transform:translateY(40px);opacity:.5}}
.sheet h3{margin:0 0 12px;font-size:18px}
.msg{border-bottom:1px solid var(--line);padding:12px 0}
.msg:last-child{border:0}
.msg b{display:block}
.msg p{margin:4px 0;white-space:pre-wrap;font-size:15px}
.msg small{color:var(--muted)}
.msg.unread b::before{content:"";display:inline-block;width:8px;height:8px;border-radius:50%;background:var(--red);margin-inline-end:6px;vertical-align:middle}
.success{align-items:center}
.success .sheet{border-radius:20px;text-align:center;margin:16px;padding:30px 20px}
.success .big{width:84px;height:84px;border-radius:50%;margin:0 auto 14px;display:flex;align-items:center;justify-content:center}
.success .big svg{width:44px;height:44px}
.success .big.in{background:var(--green-bg);color:var(--green)} .success .big.out{background:var(--red-bg);color:var(--red)}
.success h3{font-size:24px;margin:0}
.success .when{font-size:34px;font-weight:700;margin:6px 0;font-variant-numeric:tabular-nums}
.success .meta{color:var(--muted);font-size:14px;margin-bottom:18px}
.confirm .sheet p{font-size:16px;margin:0 0 16px}
.row2{display:grid;grid-template-columns:1fr 1fr;gap:10px}
footer{text-align:center;color:var(--muted);font-size:12px;padding:10px}
