:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #1d2433;
  --muted: #6b7385;
  --line: #e3e6ec;
  --accent: #f2a900;
  --accent-ink: #1d2433;
  --ok: #1f9d55;
  --err: #d64545;
  --radius: 14px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Tajawal", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }

.topbar {
  background: var(--ink);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar .logo {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-weight: 800; flex: none;
}
.topbar h1 { font-size: 17px; margin: 0; font-weight: 700; }
.topbar .sub { font-size: 13px; opacity: .7; }
.topbar .spacer { flex: 1; }
.topbar a, .topbar button.link { color: #fff; opacity: .8; font-size: 14px; background: none; border: 0; cursor: pointer; text-decoration: none; }

.wrap { max-width: 560px; margin: 0 auto; padding: 16px; }
.wrap.wide { max-width: 1200px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 1px 2px rgba(20, 30, 50, .06);
  margin-bottom: 14px;
}
.card h2 { margin: 0 0 4px; font-size: 18px; }
.muted { color: var(--muted); font-size: 14px; }

label { display: block; font-weight: 600; margin: 14px 0 6px; font-size: 15px; }
input[type=text], input[type=password], input[type=date], select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 16px;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px; padding: 13px 18px;
  font-weight: 700; font-size: 16px; cursor: pointer; text-decoration: none;
  background: var(--ink); color: #fff;
}
.btn.accent { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: var(--err); color: #fff; }
.btn.block { width: 100%; }
.btn.sm { padding: 8px 12px; font-size: 14px; border-radius: 9px; }
.btn:disabled { opacity: .5; cursor: default; }

.error { color: var(--err); font-size: 14px; margin-top: 10px; min-height: 1em; }

/* ---------- employee capture screen ---------- */
.who { display: flex; align-items: center; gap: 12px; }
.who .avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: #fff4d6; color: #8a6200; display: grid; place-items: center;
  font-weight: 800; font-size: 18px; flex: none;
}
.who .name { font-weight: 700; }
.who .spacer { flex: 1; }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.action {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  min-height: 130px; border-radius: var(--radius); cursor: pointer;
  font-weight: 700; font-size: 16px; border: 0; text-align: center; padding: 12px;
}
.action svg { width: 38px; height: 38px; }
.action.camera { background: var(--accent); color: var(--accent-ink); }
.action.gallery { background: var(--ink); color: #fff; }
.action input { display: none; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat { text-align: center; padding: 12px; background: var(--bg); border-radius: 10px; }
.stat b { display: block; font-size: 26px; line-height: 1.1; }
.stat span { font-size: 13px; color: var(--muted); }

.queue { list-style: none; margin: 0; padding: 0; }
.queue li { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.queue li:last-child { border-bottom: 0; }
.queue img { width: 54px; height: 54px; object-fit: cover; border-radius: 8px; background: var(--bg); flex: none; }
.queue .info { flex: 1; min-width: 0; font-size: 14px; }
.queue .bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.queue .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.queue .ok { color: var(--ok); }
.queue .err { color: var(--err); }

.thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.thumbs img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: var(--bg); display: block; }

.toast {
  position: fixed; inset-inline: 16px; bottom: 20px; max-width: 520px; margin: 0 auto;
  background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px;
  font-size: 15px; text-align: center; opacity: 0; transform: translateY(10px);
  transition: .25s; pointer-events: none; z-index: 50;
}
.toast.show { opacity: 1; transform: none; }

/* ---------- admin ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; overflow-x: auto; }
.tabs a {
  padding: 9px 16px; border-radius: 10px; text-decoration: none; font-weight: 600;
  background: var(--card); color: var(--muted); white-space: nowrap;
}
.tabs a.on { background: var(--ink); color: #fff; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--card); border-radius: var(--radius); padding: 14px 16px; }
.kpi b { display: block; font-size: 28px; line-height: 1.1; }
.kpi span { color: var(--muted); font-size: 14px; }

.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; align-items: end; }
.filters label { margin-top: 0; font-size: 13px; color: var(--muted); }
.filters .btns { display: flex; gap: 8px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.ph {
  background: var(--card); border-radius: 12px; overflow: hidden; cursor: pointer;
  box-shadow: 0 1px 2px rgba(20, 30, 50, .06); border: 0; padding: 0; text-align: inherit;
}
.ph img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: var(--line); }
.ph .cap { padding: 8px 10px; font-size: 13px; }
.ph .cap b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph .cap span { color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pager { display: flex; gap: 8px; justify-content: center; align-items: center; margin: 18px 0; }

table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: start; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
.table-wrap { overflow-x: auto; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 13px; background: var(--bg); }
.pill.off { background: #fde8e8; color: var(--err); }
.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; }

.lightbox {
  position: fixed; inset: 0; background: rgba(10, 14, 22, .92); z-index: 40;
  display: none; flex-direction: column;
}
.lightbox.open { display: flex; }
.lightbox .stage { flex: 1; display: grid; place-items: center; min-height: 0; padding: 12px; }
.lightbox .stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.lightbox .meta {
  background: var(--card); padding: 14px 16px; display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center;
}
.lightbox .meta .grow { flex: 1; min-width: 200px; font-size: 14px; }
.lightbox .meta .grow b { font-size: 16px; }
.lightbox .close, .lightbox .nav {
  position: absolute; background: rgba(255, 255, 255, .12); color: #fff; border: 0;
  width: 44px; height: 44px; border-radius: 50%; font-size: 22px; cursor: pointer;
}
.lightbox .close { top: 12px; inset-inline-start: 12px; }
.lightbox .nav { top: 45%; }
.lightbox .nav.prev { inset-inline-start: 12px; }
.lightbox .nav.next { inset-inline-end: 12px; }

@media (max-width: 480px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .lightbox .nav { display: none; }
}
