/* ألوان مستوحاة من شعار مؤسسة عبدالحميد الصانع التعليمية: أخضر زيتوني، أخضر فاتح، وكاكي */
:root {
  --olive-900: #2f3d14; --olive-700: #4e6620; --olive: #5e7a22; --lime: #a8c048; --khaki: #c9c77a;
  --bg: #f4f6ec; --card: #fff; --text: #1f2a10; --muted: #6a7358; --border: #e1e6d2;
  --primary: var(--olive); --on-primary: #fff; --primary-soft: #eef3dc;
  --green: #4e7a12; --green-bg: #e9f2d6; --red: #c0392b; --red-bg: #fbe9e6;
  --amber: #8a6d00; --amber-bg: #fbf3d1; --blue: #2d6a8a; --blue-bg: #e3f0f5; --gray-bg: #eef0e8;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12170b; --card: #1b2311; --text: #e8edd9; --muted: #a3ad8c; --border: #2f3b1d;
    --primary: #a8c048; --on-primary: #16200a; --primary-soft: #26321a;
    --green: #a8c048; --green-bg: #26321a; --red: #ff8a7a; --red-bg: #3a1c17; --amber: #e8c95a; --amber-bg: #332b10;
    --blue: #8cc5e0; --blue-bg: #16303b; --gray-bg: #242c1a;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: "Segoe UI", Tahoma, "Noto Sans Arabic", system-ui, sans-serif; font-size: 16px; }
body { border-top: 4px solid; border-image: linear-gradient(90deg, var(--olive-700), var(--lime), var(--khaki)) 1; }
[hidden] { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 13px; }
input, select { font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; width: 100%; }
input:focus, select:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.btn { font: inherit; border: 1px solid var(--border); background: var(--card); color: var(--text); border-radius: 12px; padding: 12px 16px; cursor: pointer; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); font-weight: 600; }
.btn.block { width: 100%; }
.btn.danger { color: var(--red); }
.err-text { color: var(--red); min-height: 1.4em; text-align: center; }
.link-btn { background: none; border: 0; color: var(--primary); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; padding: 2px 4px; }
.lang-btn { background: var(--primary-soft); color: var(--primary); border: 1px solid var(--border); border-radius: 99px; padding: 5px 12px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.lang-fixed { position: fixed; top: calc(14px + env(safe-area-inset-top)); inset-inline-end: 14px; }
.lang-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-box { width: 100%; max-width: 360px; text-align: center; }
.login-box h1 { margin: 10px 0 4px; color: var(--olive-700); }
@media (prefers-color-scheme: dark) { .login-box h1 { color: var(--lime); } }
.login-box form { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }
.login-box input { text-align: center; font-size: 20px; letter-spacing: 2px; }

#app { padding-bottom: calc(76px + env(safe-area-inset-bottom)); max-width: 560px; margin: 0 auto; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: calc(12px + env(safe-area-inset-top)) 18px 8px; }
.hello { font-size: 20px; font-weight: 700; }
.top-end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; max-width: 45%; }
.company { font-size: 12px; color: var(--muted); text-align: end; }
.screen.tab { display: none; padding: 0 14px; }
.screen.tab.active { display: block; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px; margin-bottom: 12px; }
.card-title { font-weight: 700; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.clock-card { text-align: center; padding: 6px 0 12px; }
.clock { font-size: 54px; font-weight: 700; font-variant-numeric: tabular-nums; direction: ltr; color: var(--olive-900); }
@media (prefers-color-scheme: dark) { .clock { color: var(--text); } }
.org-logo { display: block; margin: 4px auto 6px; width: 234px; max-width: 75%; height: auto; background: #fff; border-radius: 8px; padding: 6px 10px; }
.login-box .org-logo { margin-bottom: 14px; }

.video-card { padding: 12px; border-color: var(--lime); background: linear-gradient(180deg, var(--primary-soft), var(--card) 60%); }
.video-card .card-title { margin-bottom: 8px; font-size: 15px; }
.video-card video { display: block; width: 100%; max-height: 36vh; border-radius: 12px; background: #000; aspect-ratio: 9 / 16; object-fit: contain; }

.geo-row { display: flex; align-items: center; gap: 12px; }
.geo-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.geo-dot.ok { background: var(--green); box-shadow: 0 0 0 5px var(--green-bg); }
.geo-dot.bad { background: var(--red); box-shadow: 0 0 0 5px var(--red-bg); }
.geo-dot.wait { background: var(--amber); animation: pulse 1.2s infinite; }
.geo-text { flex: 1; }
.credit { text-align: left; font-size: 12px; color: var(--muted); padding: 2px 4px 10px; }
.credit-fixed { position: fixed; left: 16px; bottom: calc(10px + env(safe-area-inset-bottom)); padding: 0; }
.icon-btn { background: none; border: 1px solid var(--border); color: var(--text); border-radius: 50%; width: 38px; height: 38px; font-size: 20px; cursor: pointer; }

.punch-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.punch { border: 0; border-radius: 18px; padding: 22px 10px; font: inherit; font-size: 18px; font-weight: 700; color: #fff; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.punch .p-ic { font-size: 28px; }
.punch.in { background: linear-gradient(135deg, #8db53a, #5e7a22); }
.punch.out { background: linear-gradient(135deg, #d0503f, #a8301f); }
.punch:active { transform: scale(.97); }
.punch:disabled { opacity: .55; }
[dir="ltr"] .punch .p-ic { transform: scaleX(-1); }

.voice-card { display: flex; align-items: center; gap: 16px; }
.mic { width: 72px; height: 72px; border-radius: 50%; border: 0; background: linear-gradient(135deg, var(--lime), var(--olive)); color: #fff; font-size: 32px; cursor: pointer; flex-shrink: 0; }
.mic.listening { background: var(--red); animation: ring 1.2s infinite; }
.voice-title { font-weight: 700; }
.transcript { margin-top: 4px; font-size: 15px; color: var(--primary); min-height: 1.2em; }

.today-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; }
.big { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.punch-list, .day-list { list-style: none; margin: 10px 0 0; padding: 0; }
.punch-list li, .day-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 0; border-top: 1px solid var(--border); }
.day-list li .d { font-weight: 600; }

.pill { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.st-present, .st-in, .st-approved { background: var(--green-bg); color: var(--green); }
.st-late, .st-incomplete, .st-pending { background: var(--amber-bg); color: var(--amber); }
.st-absent, .st-out, .st-rejected { background: var(--red-bg); color: var(--red); }
.st-leave, .st-holiday { background: var(--blue-bg); color: var(--blue); }
.st-weekend, .st-upcoming { background: var(--gray-bg); color: var(--muted); }

.balance-card { border-color: var(--lime); background: linear-gradient(180deg, var(--primary-soft), var(--card) 70%); }
.bal-main { display: flex; align-items: baseline; gap: 8px; justify-content: center; margin: 4px 0 10px; }
.bal-n { font-size: 46px; font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; }
.bal-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; margin-bottom: 8px; }
.bal-grid .n { font-size: 18px; font-weight: 700; } .bal-grid .l { font-size: 11px; color: var(--muted); }
.bal-formula { text-align: center; margin-bottom: 4px; }
.row-label { display: flex; align-items: center; gap: 10px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 10px; text-align: center; }
.stat .n { font-size: 20px; font-weight: 700; color: var(--primary); }
.stat .l { font-size: 12px; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 10px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.two label { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }

.tabbar { position: fixed; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--card); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
.tabbar button { background: none; border: 0; color: var(--muted); font: inherit; font-size: 12px; padding: 8px 0 10px; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; border-top: 3px solid transparent; }
.tabbar button b { font-weight: inherit; }
.tabbar button span { font-size: 22px; filter: grayscale(1); opacity: .7; }
.tabbar button.active { color: var(--primary); font-weight: 700; border-top-color: var(--lime); }
.tabbar button.active span { filter: none; opacity: 1; }

.result { position: fixed; inset: 0; background: rgba(20,28,8,.5); display: grid; place-items: center; padding: 24px; z-index: 30; }
.result-box { background: var(--card); border-radius: 20px; padding: 26px 22px; width: 100%; max-width: 360px; text-align: center; border-top: 5px solid var(--lime); }
.result-icon { font-size: 56px; }
.result-text { font-size: 18px; margin: 10px 0 18px; line-height: 1.6; }
.toast { position: fixed; bottom: calc(86px + env(safe-area-inset-bottom)); left: 16px; right: 16px; background: var(--olive-900); color: #fff; padding: 12px 16px; border-radius: 12px; text-align: center; z-index: 40; }
.toast.err { background: var(--red); }

@keyframes pulse { 50% { opacity: .35; } }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(192,57,43,.5); } 100% { box-shadow: 0 0 0 22px rgba(192,57,43,0); } }
