/* ألوان مستوحاة من شعار مؤسسة عبدالحميد الصانع التعليمية: أخضر زيتوني، أخضر فاتح، وكاكي */
:root {
  --olive-900: #2f3d14; --olive-700: #4e6620; --olive: #5e7a22; --lime: #a8c048; --khaki: #c9c77a;
  --bg: #f4f6ec;
  --panel: #ffffff;
  --text: #1f2a10;
  --muted: #6a7358;
  --border: #e1e6d2;
  --primary: var(--olive);
  --primary-ink: #ffffff;
  --primary-soft: #eef3dc;
  --side: var(--olive-900);
  --side-text: #d6dfc0;
  --green: #4e7a12; --green-bg: #e9f2d6;
  --amber: #8a6d00; --amber-bg: #fbf3d1;
  --red: #c0392b; --red-bg: #fbe9e6;
  --blue: #2d6a8a; --blue-bg: #e3f0f5;
  --gray-bg: #eef0e8;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12170b; --panel: #1b2311; --text: #e8edd9; --muted: #a3ad8c; --border: #2f3b1d;
    --primary: #a8c048; --primary-ink: #16200a; --primary-soft: #26321a;
    --side: #0d1207; --side-text: #c4cfae;
    --green: #a8c048; --green-bg: #26321a; --amber: #e8c95a; --amber-bg: #332b10;
    --red: #ff8a7a; --red-bg: #3a1c17; --blue: #8cc5e0; --blue-bg: #16303b; --gray-bg: #242c1a;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; display: flex; min-height: 100vh; background: var(--bg); color: var(--text);
  font-family: "Segoe UI", Tahoma, "Noto Sans Arabic", Arial, sans-serif; font-size: 15px;
}
.sidebar { width: 240px; flex-shrink: 0; background: var(--side); color: var(--side-text); padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 18px; }
.logo { width: 40px; height: 40px; border-radius: 10px; background: var(--primary); display: grid; place-items: center; font-size: 22px; }
.side-logo { display: block; width: 100%; background: #fff; border-radius: 10px; padding: 8px 10px; margin-bottom: 10px; }
.brand { flex-direction: column; align-items: stretch; gap: 0; padding: 0 2px 14px; border-bottom: 1px solid rgba(255,255,255,.1); margin-bottom: 12px; }
.brand-title { text-align: center; }
.brand-sub { text-align: center; }
.sidebar { border-left: 4px solid var(--lime); }
nav button.active { box-shadow: inset -4px 0 0 var(--lime); }
.view-head h1 { color: var(--olive-700); }
@media (prefers-color-scheme: dark) { .view-head h1 { color: var(--lime); } }
.panel { border-top: 3px solid var(--primary-soft); }
.card .num { color: var(--olive-700); }
th { color: var(--olive-700) !important; background: var(--primary-soft) !important; }
@media (prefers-color-scheme: dark) { .card .num, th { color: var(--lime) !important; } }
.kiosk { border-top: 5px solid var(--lime); }
.kiosk-clock { color: var(--olive-900); }
@media (prefers-color-scheme: dark) { .kiosk-clock { color: var(--text); } }
.auth-box { border-top: 5px solid var(--lime); }
.auth-box .org-logo { margin-bottom: 6px; }
/* شعار التقارير أسفل يسار الشاشة */
.report-logo { position: fixed; left: 16px; bottom: 32px; width: 180px; background: #fff; padding: 6px 8px; border-radius: 8px; box-shadow: 0 2px 10px rgba(47,61,20,.18); z-index: 14; pointer-events: none; }
#view-daily, #view-monthly { padding-bottom: 80px; }
.brand-title { color: #fff; font-weight: 700; }
.brand-sub { font-size: 12px; opacity: .8; }
nav button {
  display: flex; justify-content: space-between; align-items: center; width: 100%; text-align: right; background: none; border: 0; color: inherit;
  padding: 10px 12px; border-radius: 8px; font: inherit; cursor: pointer; margin-bottom: 2px;
}
nav button:hover { background: rgba(255,255,255,.07); color: #fff; }
nav button.active { background: var(--primary); color: #fff; }
.nav-sep { font-size: 12px; opacity: .6; padding: 14px 12px 6px; }
.badge { background: var(--red); color: #fff; border-radius: 99px; font-size: 11px; padding: 1px 7px; }

main { flex: 1; padding: 24px 28px; min-width: 0; }
.view { display: none; }
.view.active { display: block; }
.view-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 16px; }
h1 { font-size: 24px; margin: 0; }
h2 { font-size: 17px; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.spacer { flex: 1; }

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 18px; }
.panel-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin: 6px 0 14px; }
.form-grid { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px dashed var(--border); }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
label.check { flex-direction: row; align-items: center; color: var(--text); padding-bottom: 8px; }
.actions { display: flex; gap: 8px; }
input, select {
  font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; min-width: 150px;
}
input[type=checkbox] { min-width: 0; }
input:focus, select:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.btn { font: inherit; border: 1px solid var(--border); background: var(--panel); color: var(--text); border-radius: 8px; padding: 8px 14px; cursor: pointer; }
.btn:hover { border-color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn.danger { color: var(--red); }
.btn.ok { color: var(--green); }
fieldset.weekdays { border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px 10px; }
fieldset.weekdays legend { font-size: 13px; color: var(--muted); }
#weekendBoxes { display: flex; flex-wrap: wrap; gap: 12px; }
#weekendBoxes label { flex-direction: row; align-items: center; color: var(--text); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.card .num { font-size: 28px; font-weight: 700; }
.card .lbl { color: var(--muted); font-size: 13px; }
.card.green .num { color: var(--green); } .card.amber .num { color: var(--amber); }
.card.red .num { color: var(--red); } .card.blue .num { color: var(--blue); }
.small-cards .card { padding: 10px 14px; } .small-cards .num { font-size: 22px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
th { color: var(--muted); font-weight: 600; background: var(--bg); position: sticky; top: 0; }
tbody tr:hover { background: var(--bg); }
tfoot td { font-weight: 700; background: var(--bg); }
td.num, th.num { text-align: center; font-variant-numeric: tabular-nums; }
a.link { color: var(--primary); cursor: pointer; text-decoration: none; }
a.link:hover { text-decoration: underline; }
.empty { text-align: center; color: var(--muted); padding: 24px; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.st-present { background: var(--green-bg); color: var(--green); }
.st-late, .st-incomplete, .st-pending { background: var(--amber-bg); color: var(--amber); }
.st-absent, .st-rejected { background: var(--red-bg); color: var(--red); }
.st-leave, .st-holiday, .st-approved { background: var(--blue-bg); color: var(--blue); }
.st-weekend, .st-upcoming, .st-inactive { background: var(--gray-bg); color: var(--muted); }
.warn { color: var(--red); }

.kiosk { max-width: 560px; margin: 40px auto; text-align: center; background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 36px 28px; }
.kiosk-clock { font-size: 64px; font-weight: 700; font-variant-numeric: tabular-nums; direction: ltr; }
.kiosk-date { color: var(--muted); margin-bottom: 24px; }
.kiosk-form input { width: 100%; font-size: 26px; text-align: center; padding: 14px; letter-spacing: 3px; }
.kiosk-buttons { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px; margin-top: 12px; }
.btn.big { font-size: 18px; padding: 14px; }
.btn.in { color: var(--green); } .btn.out { color: var(--red); }
.kiosk-result { margin-top: 18px; padding: 16px; border-radius: 10px; font-size: 18px; }
.kiosk-result.ok { background: var(--green-bg); color: var(--green); }
.kiosk-result.err { background: var(--red-bg); color: var(--red); }

.toast { position: fixed; bottom: 20px; left: 20px; background: #1d2433; color: #fff; padding: 12px 18px; border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.2); z-index: 10; }
.toast.err { background: var(--red); }

.nav-link { display: block; color: inherit; text-decoration: none; padding: 10px 12px; border-radius: 8px; }
.nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
nav button.nav-logout { opacity: .75; }
.auth-overlay { position: fixed; inset: 0; background: var(--bg); display: grid; place-items: center; z-index: 20; padding: 16px; }
.auth-box { width: 100%; max-width: 360px; background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 28px; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.auth-box h1 { font-size: 20px; }
.auth-box input { width: 100%; }
.big-logo { margin: 0 auto; width: 56px; height: 56px; font-size: 30px; color: #fff; }
.print-head { display: none; }
.org-logo { display: block; margin: 0 auto 18px; width: 234px; max-width: 80%; height: auto; background: #fff; border-radius: 8px; padding: 6px 10px; }
.sync-box { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; background: var(--primary-soft); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.sync-box label.check { padding-bottom: 0; }
main { padding-bottom: 48px; }
.howto { background: var(--primary-soft); border-radius: 8px; padding: 10px 16px; margin-bottom: 14px; line-height: 1.8; }
.howto ul { margin: 4px 0; padding-inline-start: 20px; }
label.inline { flex-direction: row; align-items: center; gap: 6px; }
.ok-t { color: var(--green); } .amber-t { color: var(--amber); }
.map-wrap { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin: 10px 0 16px; }
.map-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: var(--primary-soft); }
#mapFrame { display: block; width: 100%; height: 340px; border: 0; }
.sub-h { font-size: 15px; margin: 6px 0 10px; color: var(--olive-700); }
.gmaps-paste { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 10px; }
.edit-banner { background: var(--amber-bg); color: var(--amber); border-radius: 8px; padding: 8px 12px; margin: -6px 0 14px; font-size: 14px; }
.credit { position: fixed; left: 16px; bottom: 10px; font-size: 12px; color: var(--muted); z-index: 15; pointer-events: none; }
.toast { bottom: 40px; }
@media print { .credit { display: none; } }
@media (max-width: 800px) {
  body { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  nav { display: flex; flex-wrap: wrap; gap: 4px; }
  nav button { width: auto; }
  .nav-sep { display: none; }
  main { padding: 16px; }
}
@media print {
  @page { size: A4 landscape; margin: 12mm; }
  body { background: #fff; color: #000; display: block; }
  .sidebar, .no-print, .toast, .view-head, form { display: none !important; }
  main { padding: 0; }
  .panel { border: 0; padding: 0; }
  .print-head { display: block; text-align: center; margin-bottom: 10px; }
  .print-head h2, .print-head h3 { margin: 2px 0; }
  th { background: #eef3dc !important; color: #2f3d14 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #view-daily, #view-monthly { padding-bottom: 0; }
  .report-logo { position: static; display: block; width: 50mm; margin: 8mm auto 0 0; box-shadow: none; padding: 0; break-inside: avoid; }
  .print-head h2 { color: #2f3d14; }
  th, td { padding: 5px 6px; font-size: 11px; border: 1px solid #bbb; }
  .pill { padding: 0; background: none !important; color: #000 !important; }
  .card { border: 1px solid #bbb; }
}
