:root {
  --bg: #f3f6f6; --card: #fff; --text: #17222b; --muted: #6a7682; --line: #e2e8ea;
  --primary: #0f766e; --primary-dark: #0b5953; --primary-soft: #dff3f0;
  --ok: #15803d; --ok-soft: #e5f5ea; --warn: #b45309; --warn-soft: #fdf0de; --bad: #b91c1c; --bad-soft: #fde8e8;
  --out: #9a3412; --out-soft: #ffedd5;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; }
.hidden { display: none !important; }
.sub { color: var(--muted); font-size: 13px; }
h2 { font-size: 18px; margin: 0; } h3 { font-size: 15px; margin: 0 0 8px; }
.screen { max-width: 480px; margin: 0 auto; min-height: 100%; }

/* ---------- الدخول ---------- */
.login { display: flex; flex-direction: column; background: var(--primary); }
.login-top { color: #fff; text-align: center; padding: 56px 24px 32px; }
.login-top h1 { margin: 12px 0 4px; font-size: 26px; }
.login-top p { margin: 0; opacity: .85; }
.logo { width: 68px; height: 68px; border-radius: 20px; background: #fff; color: var(--primary); display: grid; place-items: center; font-size: 34px; font-weight: 600; margin: 0 auto; }
.sheet { flex: 1; background: var(--bg); border-radius: 26px 26px 0 0; padding: 28px 22px; display: grid; gap: 14px; align-content: start; }
label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
input { font: inherit; font-size: 16px; color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fff; width: 100%; }
input:focus { outline: 3px solid var(--primary-soft); border-color: var(--primary); }
.btn { font: inherit; font-weight: 500; border: 0; border-radius: 12px; padding: 14px; width: 100%; cursor: pointer; background: #fff; color: var(--text); border: 1px solid var(--line); }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.danger { color: var(--bad); margin-top: 10px; }
.btn.ghost { margin-top: 10px; }
.btn:disabled { opacity: .6; }
.error { color: var(--bad); font-size: 13px; min-height: 18px; }
.hint { color: var(--muted); font-size: 12px; line-height: 1.8; text-align: center; margin: 4px 0 0; }

/* ---------- التطبيق ---------- */
#appScreen { padding: 0 16px calc(84px + env(safe-area-inset-bottom)); }
.top { display: flex; justify-content: space-between; align-items: center; padding: calc(18px + env(safe-area-inset-top)) 2px 14px; }
.hello { font-size: 19px; font-weight: 600; }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 600; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px; margin-bottom: 12px; }
.clock-card { text-align: center; }
.clock { font-size: 44px; font-weight: 600; letter-spacing: 1px; direction: ltr; }

.loc-card { display: flex; align-items: center; gap: 14px; transition: background .3s, border-color .3s; }
.loc-card.ok { background: var(--ok-soft); border-color: #bfe5cb; }
.loc-card.out { background: var(--out-soft); border-color: #fbd3a5; }
.loc-card.bad { background: var(--bad-soft); border-color: #f6c5c5; }
.loc-title { font-weight: 600; }
.radar { position: relative; width: 54px; height: 54px; flex: none; }
.radar .ring { position: absolute; inset: 0; border-radius: 50%; border: 2px dashed currentColor; opacity: .5; }
.radar .dot { position: absolute; width: 14px; height: 14px; border-radius: 50%; background: currentColor; top: 50%; left: 50%; transform: translate(-50%, -50%); }
.radar::after { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 2px solid currentColor; animation: ping 1.8s infinite; }
@keyframes ping { from { transform: scale(.3); opacity: .8; } to { transform: scale(1.15); opacity: 0; } }
.loc-card { color: var(--muted); } .loc-card .loc-text { color: var(--text); }
.loc-card.ok { color: var(--ok); } .loc-card.out { color: var(--out); } .loc-card.bad { color: var(--bad); }

.punch { width: 100%; border: 0; border-radius: 22px; padding: 22px; font: inherit; font-size: 20px; font-weight: 600; color: #fff; background: var(--primary); display: flex; align-items: center; justify-content: center; gap: 12px; cursor: pointer; transition: transform .1s, background .2s; margin-top: 4px; }
.punch:active:not(:disabled) { transform: scale(.98); }
.punch.out { background: #c2410c; }
.punch:disabled { background: #b8c3c6; cursor: not-allowed; }
.punch.busy { opacity: .75; }
.punch-ico { display: grid; }
.msg { text-align: center; min-height: 22px; margin: 10px 0; font-size: 14px; }
.msg.ok { color: var(--ok); } .msg.err { color: var(--bad); }

.times { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.time-box { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px; text-align: center; }
.time-box .t { font-weight: 600; font-size: 17px; margin-top: 2px; }

.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 6px 0 12px; }
.row-between input { width: auto; padding: 8px 10px; font-size: 14px; }
.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.summary div { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px; text-align: center; }
.summary b { display: block; font-size: 20px; }
.list { display: grid; gap: 8px; }
.item { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.item .d { font-weight: 600; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.badge.ok { background: var(--ok-soft); color: var(--ok); } .badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.gray { background: #eef1f3; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.kv { display: grid; gap: 8px; margin-top: 10px; font-size: 14px; }
.kv div { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--line); padding-bottom: 6px; }
.form { display: grid; gap: 10px; }

.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--line); display: flex; justify-content: space-around; padding: 6px 0 calc(6px + env(safe-area-inset-bottom)); z-index: 10; }
.bottom-nav button { border: 0; background: none; font: inherit; font-size: 12px; color: var(--muted); display: grid; justify-items: center; gap: 2px; padding: 4px 6px; cursor: pointer; flex: 1; }
.bottom-nav button span { font-size: 20px; line-height: 1; }
.bottom-nav button.active { color: var(--primary); font-weight: 600; }

/* ---------- تفعيل البصمة ---------- */
.enroll { display: grid; place-items: center; padding: 24px 20px; min-height: 100vh; }
.enroll-box { background: var(--card); border: 1px solid var(--line); border-radius: 24px; padding: 28px 22px; text-align: center; display: grid; gap: 12px; }
.enroll-box h1 { font-size: 22px; margin: 4px 0 0; }
.enroll-box p { color: var(--muted); line-height: 1.8; margin: 0; }
.enroll-box ul { text-align: right; margin: 0; padding: 12px 28px 12px 12px; background: var(--primary-soft); border-radius: 14px; line-height: 2; font-size: 14px; color: var(--primary-dark); }
.face-ico { width: 104px; height: 104px; border-radius: 30px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; margin: 0 auto; }
.verified { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ok); }

.toast { position: fixed; top: 16px; left: 50%; transform: translate(-50%, -140%); background: var(--text); color: #fff; padding: 10px 18px; border-radius: 12px; transition: transform .25s; z-index: 50; max-width: 92vw; text-align: center; }
.toast.show { transform: translate(-50%, 0); }
.toast.err { background: var(--bad); }

/* ---------- الطلبات والراتب ---------- */
select { font: inherit; font-size: 16px; color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fff; width: 100%; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: #e5eaec; border-radius: 14px; padding: 4px; margin: 6px 0 12px; }
.seg button { border: 0; background: none; font: inherit; padding: 10px; border-radius: 11px; color: var(--muted); cursor: pointer; }
.seg button.active { background: #fff; color: var(--text); font-weight: 600; }
.balance { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; padding: 12px; }
.balance b { display: block; font-size: 20px; color: var(--primary); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: #e8efff; color: #1d4ed8; }
.req .act { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.link-btn { border: 0; background: none; color: var(--bad); font: inherit; font-size: 12px; cursor: pointer; padding: 0; }
.slip { display: block; }
.slip summary { display: flex; justify-content: space-between; align-items: center; cursor: pointer; list-style: none; }
.slip summary::-webkit-details-marker { display: none; }
.slip .net { font-size: 18px; font-weight: 600; color: var(--primary); }
.slip .rows { margin-top: 10px; display: grid; gap: 6px; font-size: 14px; }
.slip .rows div { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--line); padding-bottom: 4px; }
.slip .neg { color: var(--bad); } .slip .pos { color: var(--ok); }
.form { grid-template-columns: minmax(0, 1fr); }
.two > label, .form input, .form select { min-width: 0; }

/* ---------- التناسق على الكمبيوتر والتابلت ---------- */
.bottom-nav { max-width: 480px; margin: 0 auto; }
select, input, button { -webkit-appearance: none; appearance: none; }
input[type=checkbox] { -webkit-appearance: auto; appearance: auto; }
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: 18px 50%, 13px 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-left: 32px; }
@media (hover: hover) {
  .btn:hover:not(:disabled) { filter: brightness(.97); }
  .bottom-nav button:hover { color: var(--primary); }
  .item:hover { border-color: #cfd8db; }
}
@media (min-width: 600px) {
  body { background: radial-gradient(1200px 600px at 50% -10%, #d7ede9 0%, var(--bg) 60%); }
  .screen { min-height: 100vh; }
  #appScreen { background: var(--bg); box-shadow: 0 0 0 1px var(--line), 0 20px 60px rgba(15, 50, 48, .08); padding-bottom: 110px; }
  .bottom-nav { bottom: 16px; left: 50%; right: auto; transform: translateX(-50%); width: min(448px, calc(100% - 32px));
    border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 10px 30px rgba(15, 50, 48, .12); padding: 8px 0; }
  .login { border-radius: 0 0 0 0; min-height: 100vh; }
  .login-top { padding-top: 72px; }
  .sheet { border-radius: 26px 26px 0 0; }
  .enroll { min-height: 100vh; }
  .toast { top: 24px; }
}
@media (min-width: 1000px) {
  .screen { max-width: 520px; }
  .bottom-nav { width: 488px; }
  .clock { font-size: 52px; }
}
/* داخل نافذة التطبيق المثبّت على الكمبيوتر */
@media (display-mode: standalone) and (min-width: 600px) {
  body { background: var(--bg); }
}
.toast { visibility: hidden; opacity: 0; transition: transform .25s, opacity .25s, visibility .25s; }
.toast.show { visibility: visible; opacity: 1; }
