/* SHABAB TIME ATTENDANCE — shared look. Themes = CSS variables (same idea as SHABAB POS themes). */
:root, [data-theme="shabab"] {
  --bg: #EEF3FB; --bg2: #E3EBF8; --card: #FFFFFF; --text: #0B1630; --muted: #5B6880; --line: #DFE6F2;
  --primary: #1E4FD8; --primary2: #4EA8FF; --primaryText: #FFFFFF; --accent: #D4AF37; --silver: #C9D3E3;
  --side: #061233; --side2: #0C1E4F; --sideText: #DCE7FF; --sideMute: #8FA6D6; --hero1: #2B63F0; --hero2: #061233;
  --ok: #16A34A; --okBg: #E7F7EC; --warn: #D97706; --warnBg: #FEF3E2; --bad: #DC2626; --badBg: #FDECEC; --info: #0EA5E9; --infoBg: #E3F4FC;
  --shadow: 0 1px 2px rgba(11,22,48,.05), 0 8px 24px rgba(11,22,48,.07); --radius: 18px;
}
[data-theme="babil"] { --bg: #EDF5EF; --bg2: #E0EEE4; --primary: #0B7A3E; --primary2: #3DBE6E; --accent: #7ED957; --side: #06381D; --side2: #0A4A27; --sideText: #DDF3E4; --sideMute: #8CC4A2; --hero1: #11934D; --hero2: #06381D; --silver: #C6DCCD; --line: #D6E6DB; }
[data-theme="midnight"] { --bg: #0A1020; --bg2: #0F172A; --card: #121B30; --text: #E6EDFA; --muted: #93A3BF; --line: #22304D; --primary: #4E7CFF; --primary2: #7FB3FF; --accent: #E2BE52;
  --side: #060B17; --side2: #0E1629; --sideText: #D8E2F7; --sideMute: #7E8DAA; --hero1: #1E3A8A; --hero2: #060B17; --okBg: #0F2D1C; --warnBg: #33240C; --badBg: #3A1414; --infoBg: #0C2A3A; --silver: #33415E;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35); }
[data-theme="royal"] { --bg: #F3F0FB; --bg2: #E9E3F7; --primary: #6D28D9; --primary2: #A78BFA; --accent: #F59E0B; --side: #1E0B47; --side2: #2B1263; --sideText: #EDE7FF; --sideMute: #A898D6; --hero1: #7C3AED; --hero2: #1E0B47; --line: #E3DCF3; }
[data-theme="ocean"] { --bg: #EAF6F7; --bg2: #DDEFF1; --primary: #0E7490; --primary2: #22D3EE; --accent: #F2B33D; --side: #062A33; --side2: #0A3A46; --sideText: #DDF5F9; --sideMute: #86BFCB; --hero1: #0891B2; --hero2: #062A33; --line: #D3E8EB; }
[data-theme="sunset"] { --bg: #FBF2EC; --bg2: #F5E5DA; --primary: #C2410C; --primary2: #FB923C; --accent: #1E4FD8; --side: #2A1006; --side2: #3D170A; --sideText: #FCE9DD; --sideMute: #CFA08A; --hero1: #EA580C; --hero2: #2A1006; --line: #F0DDD0; }
[data-theme="classic"] { --bg: #F5F7FA; --bg2: #EBEFF5; --primary: #1E4FD8; --primary2: #4EA8FF; --accent: #D4AF37; --side: #FFFFFF; --side2: #F1F5FB; --sideText: #1B2A4A; --sideMute: #6B7A96; --hero1: #1E4FD8; --hero2: #0B2A7A; --line: #E2E8F0; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Noto Sans", "Noto Sans Arabic", "Noto Sans Malayalam", system-ui, sans-serif; font-size: 15px; line-height: 1.45; }
[dir="rtl"] body { font-family: "Segoe UI", Tahoma, "Noto Sans Arabic", system-ui, sans-serif; }
a { color: var(--primary); }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .tiny { font-size: 11px; } .b { font-weight: 700; } .bb { font-weight: 800; }
.row { display: flex; gap: 10px; align-items: center; } .col { display: flex; flex-direction: column; gap: 10px; } .grow { flex: 1; min-width: 0; } .wrap { flex-wrap: wrap; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; border: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.card h3 { margin: 0 0 12px; font-size: 15.5px; display: flex; align-items: center; gap: 8px; }
.btn { border: 0; border-radius: 12px; padding: 10px 16px; font-weight: 700; cursor: pointer; background: var(--primary); color: var(--primaryText); display: inline-flex; align-items: center; justify-content: center; gap: 7px; transition: transform .08s, filter .15s; white-space: nowrap; }
.btn:hover { filter: brightness(1.07); } .btn:active { transform: scale(.98); } .btn[disabled] { opacity: .5; pointer-events: none; }
.btn.ghost { background: transparent; color: var(--primary); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--primary) 45%, transparent); }
.btn.soft { background: color-mix(in srgb, var(--primary) 12%, var(--card)); color: var(--primary); }
.btn.ok { background: var(--ok); color: #fff; } .btn.bad { background: var(--bad); color: #fff; } .btn.gold { background: var(--accent); color: #1A1406; }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 10px; } .btn.lg { padding: 14px 22px; font-size: 16.5px; border-radius: 16px; }
.input, select.input, textarea.input { width: 100%; padding: 11px 13px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); outline: none; transition: border .15s, box-shadow .15s; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 15%, transparent); }
label.f { display: block; font-size: 12.5px; font-weight: 700; color: var(--muted); margin: 0 0 5px; }
.field { margin-bottom: 12px; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.s-WORKING { background: var(--infoBg); color: var(--info); } .s-PRESENT { background: var(--okBg); color: var(--ok); } .s-HALF, .s-SHORT { background: var(--warnBg); color: var(--warn); }
.s-ABSENT { background: var(--badBg); color: var(--bad); } .s-LEAVE { background: #EDE9FE; color: #6D28D9; } .s-OFF, .s-HOLIDAY { background: var(--bg2); color: var(--muted); } .s-NOT_YET, .s-FUTURE { background: var(--bg2); color: var(--muted); }
[data-theme="midnight"] .s-LEAVE { background: #2A1E4A; color: #C4B5FD; }
.flag { background: var(--badBg); color: var(--bad); } .chip { background: var(--bg2); color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.avatar { width: 38px; height: 38px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; color: #fff; flex: none; font-size: 14px; background: linear-gradient(135deg, var(--primary), var(--primary2)); overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: #0B1630; color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 600; z-index: 9999; box-shadow: 0 10px 30px rgba(0,0,0,.25); max-width: 92vw; animation: up .25s ease; }
.toast.bad { background: var(--bad); } .toast.ok { background: var(--ok); }
@keyframes up { from { transform: translate(-50%, 20px); opacity: 0 } to { transform: translate(-50%, 0); opacity: 1 } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0 } 70% { transform: scale(1.06) } 100% { transform: scale(1); opacity: 1 } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ring) 55%, transparent) } 100% { box-shadow: 0 0 0 26px transparent } }
@keyframes spin { to { transform: rotate(360deg) } }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid color-mix(in srgb, var(--primary) 25%, transparent); border-top-color: var(--primary); animation: spin .8s linear infinite; display: inline-block; }
.modal-back { position: fixed; inset: 0; background: rgba(6,12,30,.55); backdrop-filter: blur(3px); z-index: 900; display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .2s; }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.modal { background: var(--card); border-radius: 22px; width: 560px; max-width: 100%; max-height: 92vh; overflow: auto; box-shadow: 0 30px 80px rgba(0,0,0,.35); animation: pop .22s ease; }
.modal .mh { padding: 18px 20px 8px; display: flex; align-items: center; gap: 10px; } .modal .mh h3 { margin: 0; flex: 1; font-size: 18px; }
.modal .mb { padding: 8px 20px 18px; } .modal .mf { padding: 12px 20px 18px; display: flex; gap: 10px; justify-content: flex-end; border-top: 1px solid var(--line); }
.x { border: 0; background: var(--bg2); width: 34px; height: 34px; border-radius: 10px; cursor: pointer; font-size: 18px; color: var(--muted); }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; }
table.t th { text-align: start; font-size: 11.5px; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); font-weight: 800; padding: 9px 10px; border-bottom: 1px solid var(--line); background: var(--card); position: sticky; top: 0; z-index: 1; }
table.t td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr.click { cursor: pointer; } table.t tr.click:hover td { background: color-mix(in srgb, var(--primary) 5%, var(--card)); }
.empty { text-align: center; padding: 30px 10px; color: var(--muted); }
.seg { display: inline-flex; background: var(--bg2); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 9px; font-weight: 700; color: var(--muted); cursor: pointer; font-size: 13px; }
.seg button.on { background: var(--card); color: var(--primary); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.switch { position: relative; width: 46px; height: 26px; flex: none; } .switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--silver); border-radius: 99px; transition: .2s; cursor: pointer; } .switch span:before { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--primary); } .switch input:checked + span:before { transform: translateX(20px); }
.logo-sq { border-radius: 14px; object-fit: contain; background: #fff; }

/* 1.3 chat */
.chat { display: flex; flex-direction: column; gap: 8px; }
.chat-note:empty { display: none; } .chat-note { background: color-mix(in srgb, var(--warn) 14%, var(--card)); color: var(--text); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); border-radius: 12px; padding: 8px 12px; font-size: 13px; }
.chat-list { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px; height: min(56vh, 520px); overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.bub { max-width: 82%; padding: 8px 12px 6px; border-radius: 16px; font-size: 14.5px; line-height: 1.35; overflow-wrap: anywhere; white-space: normal; }
.bub.me { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 5px; }
.bub.them { align-self: flex-start; background: var(--bg); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.bub .by { font-size: 11.5px; font-weight: 800; color: var(--primary); margin-bottom: 2px; } .bub .tm { font-size: 10.5px; opacity: .7; text-align: end; margin-top: 3px; } .bub .tm .seen { color: #9EF0C0; font-weight: 800; }
.chat-bar { display: flex; gap: 8px; align-items: flex-end; } .chat-bar textarea { flex: 1; resize: none; min-height: 46px; max-height: 120px; font: inherit; } .chat-bar .btn { min-width: 52px; height: 46px; font-size: 18px; }
.thread { display: flex; gap: 12px; align-items: center; padding: 10px 4px; border-bottom: 1px solid var(--line); cursor: pointer; } .thread:last-child { border-bottom: 0; }
.thread .un { background: var(--bad); color: #fff; border-radius: 99px; font-size: 11px; font-weight: 800; padding: 1px 7px; } .thread .lm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60vw; }
.dnd { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; }
.dchat { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 14px; align-items: stretch; } .dchat > * { min-width: 0; } .chat, .chat-list { min-width: 0; }
.dlist { padding: 12px; max-height: 72vh; overflow-y: auto; } .dlist .thread { border-radius: 12px; padding: 9px 8px; border-bottom: 0; } .dlist .thread.on { background: color-mix(in srgb, var(--primary) 12%, var(--card)); } .dlist .thread:hover { background: var(--bg); }
.dlist .lm { max-width: 100%; }
.dconv { display: flex; flex-direction: column; gap: 10px; min-height: 60vh; padding: 14px; } .dconv .chat-list { height: 52vh; } .dhead { display: flex; gap: 12px; align-items: center; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.quick { display: flex; flex-wrap: wrap; gap: 6px; } .quick .chip { border: 1px solid var(--line); background: var(--bg); border-radius: 99px; padding: 5px 11px; font-size: 12.5px; cursor: pointer; font-weight: 600; color: var(--text); }
@media (max-width: 860px) { .dchat { grid-template-columns: 1fr; } }

/* 1.4 licence */
.lic { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 18px; background: linear-gradient(150deg, var(--hero1, #061233), var(--hero2, #1E4FD8)); }
.lic-card { background: var(--card); color: var(--text); border-radius: 22px; padding: 26px 24px; width: 520px; max-width: 100%; text-align: center; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.lic-ic { width: 72px; height: 72px; border-radius: 18px; } .lic h1 { font-size: 15px; letter-spacing: 2px; margin: 10px 0 2px; color: var(--muted); } .lic h2 { font-size: 22px; margin: 4px 0 6px; }
.lic-note { background: color-mix(in srgb, var(--warn) 14%, var(--card)); border-radius: 12px; padding: 9px 12px; font-size: 13px; margin: 10px 0; }
.lic-ids { display: grid; gap: 8px; margin: 14px 0; } .lic-ids > div { display: flex; align-items: center; gap: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; text-align: start; }
.lic-ids span { font-size: 12px; color: var(--muted); width: 100px; flex: none; } .lic-ids b { flex: 1; font-family: Consolas, monospace; font-size: 14.5px; word-break: break-all; }
.lic-banner { background: color-mix(in srgb, var(--warn) 16%, var(--card)); color: var(--text); border-bottom: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); padding: 7px 14px; font-size: 13px; font-weight: 600; display: flex; gap: 10px; align-items: center; }

/* 1.6 message pop-up */
.msgpop { position: fixed; right: 18px; bottom: 18px; width: 360px; max-width: calc(100vw - 24px); background: var(--card, #fff); color: var(--text, #0f172a); border-radius: 18px; box-shadow: 0 18px 50px rgba(2,8,30,.35); z-index: 9000; overflow: hidden; animation: mpin .22s ease-out; border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent); }
@keyframes mpin { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.msgpop .mp-h { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--primary); color: #fff; }
.msgpop .mp-i { font-size: 22px; } .msgpop .mp-k { font-size: 11.5px; opacity: .85; letter-spacing: .5px; text-transform: uppercase; } .msgpop .mp-f { font-size: 15.5px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msgpop .x { background: rgba(255,255,255,.18); color: #fff; border: 0; width: 32px; height: 32px; border-radius: 10px; font-size: 20px; cursor: pointer; }
.msgpop .mp-b { padding: 12px 14px 4px; max-height: 190px; overflow-y: auto; }
.msgpop .mp-m { background: color-mix(in srgb, var(--primary) 9%, transparent); border-radius: 14px 14px 14px 4px; padding: 9px 12px; margin-bottom: 8px; font-size: 15px; line-height: 1.4; word-wrap: break-word; }
.msgpop .mp-t { font-size: 11px; opacity: .6; margin-top: 3px; text-align: right; }
.msgpop .mp-r { padding: 4px 14px 14px; } .msgpop textarea { width: 100%; resize: none; font-size: 15px; }
.msgpop .mp-a { display: flex; gap: 8px; justify-content: space-between; margin-top: 8px; }
@media (max-width: 600px) { .msgpop { left: 8px; right: 8px; bottom: 74px; width: auto; } }

/* 1.7 map / satellite switch (like Google Maps) */
.mapmode { display: flex; background: #fff; border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,.25); overflow: hidden; }
.mapmode button { border: 0; background: #fff; color: #0f172a; font: 600 13px system-ui, sans-serif; padding: 7px 12px; cursor: pointer; }
.mapmode button + button { border-left: 1px solid #e2e8f0; }
.mapmode button.on { background: var(--primary); color: #fff; }
/* 1.7 attendance map tools */
.maptools { background: #fff; border-radius: 12px; box-shadow: 0 2px 12px rgba(0,0,0,.22); padding: 5px; width: 200px; max-width: calc(100vw - 90px); font: 13px system-ui, sans-serif; color: #0f172a; }
.maptools .mt-search { position: relative; } .maptools input { width: 100%; box-sizing: border-box; border: 1px solid #cbd5e1; border-radius: 8px; padding: 5px 8px; font-size: 12.5px; }
.maptools .mt-res { position: absolute; left: 0; right: -60px; top: 30px; background: #fff; border-radius: 8px; box-shadow: 0 8px 22px rgba(0,0,0,.2); z-index: 1000; max-height: 240px; overflow-y: auto; }
.maptools .mt-res div { padding: 8px 10px; cursor: pointer; border-bottom: 1px solid #f1f5f9; } .maptools .mt-res div:hover { background: #eff6ff; } .maptools .mt-res span { color: #64748b; font-size: 11.5px; float: right; } .maptools .mt-res .none { color: #64748b; cursor: default; }
.maptools .mt-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; margin-top: 5px; }
.maptools .mt-row button { border: 1px solid #e2e8f0; background: #f8fafc; border-radius: 8px; padding: 4px 1px; font: 600 10.5px system-ui, sans-serif; cursor: pointer; color: #0f172a; } .maptools .mt-row button.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.maplegend { background: rgba(255,255,255,.92); border-radius: 10px; padding: 5px 9px; font: 12px system-ui, sans-serif; color: #0f172a; display: flex; gap: 10px; box-shadow: 0 2px 8px rgba(0,0,0,.18); }
.maplegend i { display: inline-block; width: 10px; height: 10px; border-radius: 5px; margin-right: 4px; vertical-align: -1px; }
.routebar { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 800; background: #fff; color: #0f172a; border-radius: 12px; padding: 7px 10px; box-shadow: 0 6px 20px rgba(0,0,0,.25); font: 13px system-ui, sans-serif; align-items: center; gap: 8px; max-width: 92%; }
.route-dot { width: 26px; height: 26px; border-radius: 13px; background: #1E4FD8; color: #fff; border: 2px solid #fff; display: flex; align-items: center; justify-content: center; font: 700 12px system-ui, sans-serif; box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.route-dot.IN { background: #16A34A; } .route-dot.OUT { background: #DC2626; } .route-dot.VISIT { background: #7C3AED; }
.mp-btn { border: 1px solid #cbd5e1; background: #f8fafc; color: #0f172a !important; border-radius: 8px; padding: 4px 8px; font: 600 12px system-ui, sans-serif; cursor: pointer; text-decoration: none; display: inline-block; }
.map-full { position: fixed !important; inset: 0 !important; z-index: 9500 !important; margin: 0 !important; border-radius: 0 !important; padding: 0 !important; background: #000; }
.map-full > div, .map-full #map, .map-full .leaflet-container { height: 100vh !important; width: 100vw !important; }
body.map-full-open { overflow: hidden; }
