:root {
  --navy: #111B2B; --navy-2: #1A2740; --navy-3: #25365A;
  --sand: #D4A24C; --sand-soft: #F6EBD6;
  --bg: #F3F4F7; --card: #FFFFFF; --line: #E3E6EC; --text: #151C28; --muted: #6B7485;
  --green: #1F9D6B; --green-soft: #E3F5EC; --red: #D64545; --red-soft: #FBE7E7;
  --amber: #C98A12; --amber-soft: #FDF3DC; --blue: #2F6FDB; --blue-soft: #E6EEFC; --gray-soft: #EEF0F3;
  --radius: 12px; --shadow: 0 1px 2px rgba(17,27,43,.06), 0 4px 16px rgba(17,27,43,.05);
  font-family: 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .num { font-variant-numeric: tabular-nums; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-brand { background: var(--navy); color: #fff; display: flex; flex-direction: column; justify-content: space-between; padding: 48px; position: relative; overflow: hidden; }
.login-brand::after { content: ''; position: absolute; inset: auto -120px -120px auto; width: 380px; height: 380px; border: 1px solid rgba(212,162,76,.25); border-radius: 50%; }
.login-brand img { width: 150px; }
.login-brand .tag { font-size: 28px; font-weight: 600; line-height: 1.3; max-width: 380px; }
.login-brand .tag span { color: var(--sand); }
.login-form { display: flex; align-items: center; justify-content: center; padding: 32px; }
.login-card { width: 100%; max-width: 360px; }
.login-card h1 { margin-bottom: 6px; }
.login-card .mobile-logo { display: none; }
@media (max-width: 820px) {
  .login { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-form { background: var(--navy); color: #fff; align-items: flex-start; padding-top: 12vh; }
  .login-card .mobile-logo { display: block; width: 90px; margin: 0 auto 28px; }
  .login-card .muted { color: #B5BDCC; }
  .login-card label.f > span { color: #C9D0DD; }
  .login-card input[type=text], .login-card input[type=password] { background: var(--navy-2); border-color: #3A4C73; color: #fff; caret-color: var(--sand); font-size: 16px; padding: 13px 14px; }
  .login-card input::placeholder { color: #6F7C95; }
  .login-card input:-webkit-autofill { -webkit-text-fill-color: #fff; -webkit-box-shadow: 0 0 0 40px var(--navy-2) inset; }
}

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--navy); color: #C9D0DD; padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 20px; color: #fff; }
.side .brand img { width: 34px; }
.side .brand b { font-size: 15px; letter-spacing: .5px; }
.side .sec { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: #6F7C95; padding: 14px 12px 6px; }
.side a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: #C9D0DD; font-weight: 500; }
.side a:hover { background: var(--navy-2); color: #fff; }
.side a.on { background: var(--navy-3); color: #fff; box-shadow: inset 3px 0 0 var(--sand); }
[dir=rtl] .side a.on { box-shadow: inset -3px 0 0 var(--sand); }
.side a .badge { margin-inline-start: auto; background: var(--sand); color: var(--navy); border-radius: 10px; padding: 0 7px; font-size: 11px; font-weight: 700; }
.side .foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--navy-3); display: flex; flex-direction: column; gap: 8px; }
.side .foot .who { color: #fff; font-weight: 600; }
.side .foot button { background: none; border: 1px solid var(--navy-3); color: #C9D0DD; border-radius: 8px; padding: 6px 10px; cursor: pointer; text-align: start; }
.side .foot button:hover { color: #fff; border-color: #3A4C73; }
.main { padding: 28px 32px 60px; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.topbar .grow { flex: 1; }
.mob-head { display: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  [dir=rtl] .side { inset: 0 0 0 auto; transform: translateX(100%); }
  .side.open { transform: none; }
  .mob-head { display: flex; align-items: center; gap: 12px; background: var(--navy); color: #fff; padding: 12px 16px; position: sticky; top: 0; z-index: 40; }
  .mob-head img { width: 26px; } .mob-head button { background: none; border: 0; color: #fff; font-size: 22px; cursor: pointer; }
  .main { padding: 18px 16px 60px; }
}

/* ---------- components ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card + .card { margin-top: 16px; }
.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-h .grow { flex: 1; }
.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-dash { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .g-dash, .g3 { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .g2 { grid-template-columns: 1fr; } }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; border-top: 3px solid var(--line); }
.kpi .v { font-size: 26px; font-weight: 700; } .kpi .l { color: var(--muted); font-size: 12px; margin-top: 2px; }
.kpi.green { border-color: var(--green); } .kpi.red { border-color: var(--red); } .kpi.amber { border-color: var(--amber); } .kpi.blue { border-color: var(--blue); } .kpi.sand { border-color: var(--sand); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 8px 14px; cursor: pointer; font-weight: 500; white-space: nowrap; }
.btn:hover { border-color: #C4C9D4; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-3); }
.btn.sand { background: var(--sand); border-color: var(--sand); color: var(--navy); font-weight: 600; }
.btn.danger { color: var(--red); } .btn.danger.solid { background: var(--red); color: #fff; border-color: var(--red); }
.btn.ok { color: var(--green); }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.block { width: 100%; padding: 11px; }

label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; font-weight: 500; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=time], input[type=month], input[type=search], select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; background: #fff; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--sand); box-shadow: 0 0 0 3px rgba(212,162,76,.18); }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline > input, .inline > select { width: auto; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; margin: 4px 14px 4px 0; }
[dir=rtl] .check { margin: 4px 0 4px 14px; }
.check input { width: 16px; height: 16px; accent-color: var(--navy); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); border-radius: 20px; padding: 5px 12px; cursor: pointer; user-select: none; background: #fff; font-weight: 500; }
.chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }

.table-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: start; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid #F0F1F4; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; } tr.click:hover td { background: #FAFAFC; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--gray-soft); color: var(--muted); }
.pill.green { background: var(--green-soft); color: var(--green); } .pill.red { background: var(--red-soft); color: var(--red); }
.pill.amber { background: var(--amber-soft); color: var(--amber); } .pill.blue { background: var(--blue-soft); color: var(--blue); }
.pill.sand { background: var(--sand-soft); color: #8A6420; } .pill.navy { background: var(--navy); color: #fff; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--navy-3); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 12px; flex: none; }
.person { display: flex; align-items: center; gap: 10px; }
.person .n { font-weight: 600; } .person .s { font-size: 12px; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.alert-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid #F0F1F4; }
.alert-item:last-child { border: 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: none; }
.dot.critical { background: var(--red); } .dot.warning { background: var(--amber); } .dot.info { background: var(--blue); }
.map { height: 360px; border-radius: 10px; overflow: hidden; background: #E8EBF0; z-index: 0; }
.map.tall { height: 480px; }

/* ---------- check-in panel ---------- */
.clock-card { background: var(--navy); color: #fff; border-radius: 16px; padding: 28px; text-align: center; position: relative; overflow: hidden; }
.clock-card .time { font-size: 46px; font-weight: 700; letter-spacing: 1px; font-variant-numeric: tabular-nums; }
.clock-card .date { color: #AEB8CB; margin-bottom: 20px; }
.clock-card .shift { display: inline-flex; gap: 8px; background: var(--navy-2); border-radius: 20px; padding: 6px 14px; font-size: 13px; margin-bottom: 24px; }
.punch { width: 170px; height: 170px; border-radius: 50%; border: 0; cursor: pointer; font-size: 18px; font-weight: 700; color: var(--navy); background: var(--sand);
  box-shadow: 0 0 0 10px rgba(212,162,76,.18), 0 0 0 22px rgba(212,162,76,.07); transition: transform .12s; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.punch:active { transform: scale(.97); }
.punch.out { background: #fff; box-shadow: 0 0 0 10px rgba(255,255,255,.12), 0 0 0 22px rgba(255,255,255,.05); }
.punch:disabled { opacity: .55; cursor: default; }
.punch small { font-size: 12px; font-weight: 500; opacity: .75; }
.clock-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 28px; }
.clock-stats div { background: var(--navy-2); border-radius: 10px; padding: 10px; }
.clock-stats b { display: block; font-size: 17px; } .clock-stats span { font-size: 11px; color: #AEB8CB; }

/* ---------- calendar ---------- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .hd { font-size: 11px; color: var(--muted); text-align: center; padding: 4px; font-weight: 600; }
.cal .d { min-height: 64px; border-radius: 8px; border: 1px solid var(--line); padding: 6px; font-size: 12px; cursor: pointer; background: #fff; position: relative; }
.cal .d:hover { border-color: var(--sand); }
.cal .d .n { font-weight: 700; }
.cal .d .t { font-size: 10.5px; margin-top: 4px; line-height: 1.3; }
.cal .d.off { background: #F6F7F9; color: var(--muted); }
.cal .d.present { background: var(--green-soft); border-color: #BFE6D2; }
.cal .d.absent { background: var(--red-soft); border-color: #F1C4C4; }
.cal .d.leave, .cal .d.sick, .cal .d.mission { background: var(--blue-soft); border-color: #C7D8F6; }
.cal .d.holiday { background: var(--sand-soft); border-color: #EBD3A8; }
.cal .d.ov::after { content: ''; position: absolute; top: 6px; inset-inline-end: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--sand); }
.cal .d.today { outline: 2px solid var(--navy); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 12px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 5px; vertical-align: -1px; }

/* ---------- modal / toast ---------- */
.overlay { position: fixed; inset: 0; background: rgba(17,27,43,.45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 100; overflow-y: auto; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 620px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { max-width: 860px; }
.modal-h { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.modal-h h2 { flex: 1; }
.modal-h .x { background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--muted); }
.modal-b { padding: 20px 22px; }
.modal-f { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
.sub { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; margin: 18px 0 10px; }
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--navy); color: #fff; padding: 11px 18px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: 90vw; }
.toast.err { background: var(--red); } .toast.ok { background: var(--green); }
.notif-card { display: flex; gap: 12px; align-items: center; justify-content: space-between; background: var(--sand-soft); border: 1px solid #EBD3A8; border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; }
.notif-card b { color: #6E4E14; }
.install-card { background: rgba(212,162,76,.12); border: 1px solid rgba(212,162,76,.45); border-radius: 12px; padding: 14px; margin-bottom: 18px; display: flex; flex-direction: column; gap: 8px; }
.install-card b { color: var(--sand); }
.err-box { background: var(--red-soft); color: var(--red); padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; font-size: 13px; }
.info-box { background: var(--blue-soft); color: #214E9E; padding: 10px 12px; border-radius: 8px; font-size: 13px; }
.lang-btn { background: none; border: 1px solid currentColor; border-radius: 6px; padding: 2px 8px; cursor: pointer; opacity: .8; }
.spin { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: sp .7s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
.loading { padding: 60px; text-align: center; color: var(--muted); }
.emp-marker { background: var(--navy); color: #fff; border: 2px solid #fff; border-radius: 50%; width: 30px !important; height: 30px !important; display: flex !important; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.emp-marker.outz { background: var(--red); }
.emp-marker.inz { background: var(--green); }

/* location check */
.check-card { max-width: 520px; text-align: center; padding: 28px 22px; }
.check-card .btn.big { font-size: 17px; padding: 14px 26px; width: 100%; max-width: 320px; }
.check-result { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 44px; line-height: 1.1; }
.check-result b { font-size: 19px; } .check-result span { font-size: 14px; color: var(--muted, #6B7485); }
.check-result.green { color: #1F8A5E; } .check-result.red { color: #C43B3B; } .check-result.amber { color: #B07A10; }
