@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 400; font-display: swap; src: url("/assets/fonts/ibm-plex-sans-arabic-arabic-400-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 400; font-display: swap; src: url("/assets/fonts/ibm-plex-sans-arabic-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 500; font-display: swap; src: url("/assets/fonts/ibm-plex-sans-arabic-arabic-500-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 500; font-display: swap; src: url("/assets/fonts/ibm-plex-sans-arabic-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 600; font-display: swap; src: url("/assets/fonts/ibm-plex-sans-arabic-arabic-600-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 600; font-display: swap; src: url("/assets/fonts/ibm-plex-sans-arabic-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 700; font-display: swap; src: url("/assets/fonts/ibm-plex-sans-arabic-arabic-700-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 700; font-display: swap; src: url("/assets/fonts/ibm-plex-sans-arabic-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Readex Pro"; font-weight: 700; font-display: swap; src: url("/assets/fonts/readex-pro-arabic-700-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Readex Pro"; font-weight: 700; font-display: swap; src: url("/assets/fonts/readex-pro-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
:root {
  --bg: #e6eee8;
  --surface: #fbfdfb;
  --surface-2: #f0f5f1;
  --ink: #16302a;
  --muted: #5a6e66;
  --line: #cfddd3;
  --primary: #0f4c45;
  --primary-ink: #ffffff;
  --primary-soft: #d3e6dc;
  --accent: #e8a23a;
  --in: #157a4f;
  --in-soft: #dff2e7;
  --out: #b4452f;
  --out-soft: #fbe6df;
  --warn: #8a5a00;
  --warn-soft: #fdf0d3;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(29,42,40,.06), 0 8px 24px rgba(29,42,40,.06);
  --font: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111816; --surface: #18211f; --surface-2: #1e2826; --ink: #e9eeec; --muted: #9aa8a4;
    --line: #2b3633; --primary: #3fb39f; --primary-ink: #06201b; --primary-soft: #183632;
    --in: #4cc98c; --in-soft: #16352a; --out: #f08a71; --out-soft: #3a211b; --warn: #f1c46a; --warn-soft: #3a2f16;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
[hidden] { display: none !important; }

/* ---------- layout ---------- */
.shell { max-width: 1080px; margin: 0 auto; padding: 0 16px calc(32px + env(safe-area-inset-bottom)); }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 14px 0; position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 10px; font-family: "Readex Pro", var(--font); font-weight: 700; font-size: 20px; letter-spacing: 0; }
.brand img { width: 32px; height: 32px; }
.topbar .spacer { flex: 1; }
.who { font-size: 14px; color: var(--muted); text-align: left; line-height: 1.3; }
.who b { color: var(--ink); display: block; font-weight: 600; }


.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card + .card, .stack > * + * { margin-top: 14px; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid { display: grid; gap: 14px; }
@media (min-width: 760px) { .grid.cols-2 { grid-template-columns: 1fr 1fr; } .grid.cols-3 { grid-template-columns: repeat(3, 1fr); } .grid.cols-4 { grid-template-columns: repeat(4, 1fr); } }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 22px 0 10px; }
.ltr { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }

/* ---------- buttons & fields ---------- */
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--surface); padding: 10px 16px; border-radius: 12px;
  cursor: pointer; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
  text-decoration: none; color: var(--ink);
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--out); border-color: color-mix(in srgb, var(--out) 40%, var(--line)); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { min-height: 34px; padding: 6px 12px; font-size: 14px; border-radius: 10px; }
.btn.block { width: 100%; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 14px; font-weight: 600; }
.field small { color: var(--muted); font-size: 12.5px; }
input, select, textarea {
  width: 100%; min-height: 44px; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
}
textarea { min-height: 80px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 40%, transparent); outline-offset: 1px; }
input[type="datetime-local"], input[type="date"] { direction: ltr; text-align: right; }
.form-grid { display: grid; gap: 12px; }
@media (min-width: 640px) { .form-grid.two { grid-template-columns: 1fr 1fr; } }

/* ---------- login ---------- */
.login-wrap { min-height: calc(100vh - 40px); display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 400px; }
.login-card .brand { justify-content: center; font-size: 30px; gap: 12px; margin-bottom: 4px; }
.login-card .brand img { width: 44px; height: 44px; }
.demo-accounts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }

/* ---------- employee clock ---------- */
.clock-card { text-align: center; padding: 24px 18px; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; font-weight: 600; font-size: 14px; }
.status-pill::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.status-pill.in { background: var(--in-soft); color: var(--in); }
.status-pill.out { background: var(--surface-2); color: var(--muted); }
.big-time { font-size: 44px; font-weight: 700; letter-spacing: .5px; margin: 10px 0 2px; font-variant-numeric: tabular-nums; }
.status-detail { color: var(--muted); min-height: 24px; }
.clock-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.clock-btn { min-height: 76px; border-radius: 18px; font-size: 18px; font-weight: 700; border: 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.clock-btn small { font-weight: 500; font-size: 12.5px; opacity: .85; }
.clock-btn.in { background: var(--in); color: #fff; }
.clock-btn.out { background: var(--out); color: #fff; }
.clock-btn:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.simulate { margin-top: 16px; padding: 12px; border: 1px dashed #d6a72a; border-radius: 12px; background: var(--warn-soft); text-align: right; }
.simulate .field > span { color: var(--warn); }
.notice { padding: 12px 14px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); font-size: 14px; }
.notice.info { background: var(--primary-soft); color: var(--primary); }
.notice.err { background: var(--out-soft); color: var(--out); }

.history { display: grid; gap: 10px; }
.hist-item { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 14px; }
.hist-date { font-weight: 600; }
.hist-lines { grid-column: 1 / -1; display: grid; gap: 4px; font-size: 14px; }
.hist-line { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 6px; }
.tag.in { background: var(--in-soft); color: var(--in); }
.tag.out { background: var(--out-soft); color: var(--out); }
.tag.open { background: var(--warn-soft); color: var(--warn); }
.tag.edited { background: var(--primary-soft); color: var(--primary); }
.tag.muted { background: var(--surface-2); color: var(--muted); }
.duration { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- admin ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 4px; margin: 0 -4px 6px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { white-space: nowrap; border: 1px solid transparent; background: transparent; padding: 8px 14px; border-radius: 10px; cursor: pointer; font-weight: 600; color: var(--muted); }
.tab[aria-selected="true"] { background: var(--surface); border-color: var(--line); color: var(--primary); box-shadow: var(--shadow); }
.stat { padding: 16px; }
.stat .num { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .lbl { color: var(--muted); font-size: 14px; }
.checklist { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; }
.checklist .ok { color: var(--in); font-weight: 700; }
.checklist .no { color: var(--out); font-weight: 700; }

.filters { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
@media (min-width: 900px) { .filters { grid-template-columns: repeat(5, 1fr) auto; align-items: end; } }

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: right; font-weight: 600; color: var(--muted); font-size: 13px; padding: 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data td.num { font-variant-numeric: tabular-nums; }
@media (max-width: 759px) {
  table.data.responsive thead { display: none; }
  table.data.responsive, table.data.responsive tbody, table.data.responsive tr, table.data.responsive td { display: block; width: 100%; }
  table.data.responsive tr { border: 1px solid var(--line); border-radius: 14px; padding: 6px 12px; margin-bottom: 10px; background: var(--surface); }
  table.data.responsive td { border: 0; padding: 6px 0; display: flex; justify-content: space-between; gap: 12px; text-align: left; }
  table.data.responsive td::before { content: attr(data-label); color: var(--muted); font-weight: 600; text-align: right; flex-shrink: 0; }
  table.data.responsive td.actions { justify-content: flex-start; }
  table.data.responsive td.actions::before { content: none; }
}

.ip-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.ip-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: 14px; }
.ip-chip.private { border-color: #d6a72a; background: var(--warn-soft); }
.ip-chip button { border: 0; background: transparent; cursor: pointer; color: var(--out); font-size: 18px; line-height: 1; padding: 0 4px; }

.audit-item { padding: 14px; }
.audit-diff { display: grid; gap: 4px; margin-top: 8px; font-size: 14px; }
.audit-diff .k { color: var(--muted); }
.audit-diff del { color: var(--out); text-decoration: line-through; }
.audit-diff ins { color: var(--in); text-decoration: none; font-weight: 600; }

.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.switch input { width: 48px; height: 28px; min-height: 0; appearance: none; background: var(--line); border-radius: 999px; position: relative; cursor: pointer; border: 0; padding: 0; flex-shrink: 0; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: right .15s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked { background: var(--in); }
.switch input:checked::after { right: 23px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }

/* ---------- modal & toast ---------- */
.modal { border: 0; border-radius: 20px; padding: 0; width: min(520px, calc(100vw - 24px)); background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal::backdrop { background: rgba(15,25,23,.45); }
.modal-body { padding: 20px; max-height: calc(100vh - 80px); overflow-y: auto; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-start; margin-top: 18px; flex-wrap: wrap; }
.confirm-icon { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; margin: 4px auto 12px; font-size: 32px; color: #fff; }
.confirm-icon.in { background: var(--in); }
.confirm-icon.out { background: var(--out); }
.confirm-rows { display: grid; gap: 8px; margin-top: 14px; padding: 14px; border-radius: 14px; background: var(--surface-2); }
.confirm-rows div { display: flex; justify-content: space-between; gap: 10px; }
.confirm-rows span { color: var(--muted); }
.toast { position: fixed; bottom: calc(18px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; z-index: 50; max-width: calc(100vw - 32px); box-shadow: var(--shadow); font-size: 15px; }
.toast.err { background: var(--out); color: #fff; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.loading { text-align: center; color: var(--muted); padding: 40px; }
@media (max-width: 759px) {
  .grid.stats { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .grid.stats .card + .card { margin-top: 0; }
  .grid.stats .stat { padding: 12px 10px; }
  .grid.stats .stat .num { font-size: 22px; }
  .grid.stats .stat .lbl { font-size: 12px; line-height: 1.35; }
}
.grid > .card + .card { margin-top: 0; }
/* ---------- installable app ---------- */
.install-slot { margin-top: 14px; }
.install-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--primary-soft); border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent); }
.install-card img { width: 40px; height: 40px; border-radius: 10px; }
@media (display-mode: standalone) {
  .topbar { padding-top: calc(14px + env(safe-area-inset-top)); }
}

/* ---------- branch chips (overview) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 600; cursor: pointer; }
.chip:hover { border-color: var(--primary); }
.chip.on { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.chip-n { min-width: 24px; padding: 0 7px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 13px; text-align: center; line-height: 22px; }
.chip.on .chip-n { background: rgba(255,255,255,.22); color: inherit; }

.btn.danger-text { color: var(--out); }

/* ---------- organisation branding ---------- */
.org-chip { display: flex; align-items: center; gap: 8px; padding-inline-start: 12px; margin-inline-start: 4px; border-inline-start: 1px solid var(--line); color: var(--muted); font-weight: 600; font-size: 14px; min-width: 0; }
.org-chip img { height: 30px; max-width: 90px; object-fit: contain; border-radius: 6px; background: #fff; padding: 2px; }
.org-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 560px) { .org-chip span { display: none; } }
.login-org { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.login-org img { max-height: 96px; max-width: 100%; object-fit: contain; background: #fff; border-radius: 12px; padding: 6px 10px; }
.login-org b { font-size: 18px; }
.logo-preview { margin-top: 10px; min-height: 60px; display: flex; align-items: center; }
.logo-preview img { max-height: 90px; max-width: 260px; object-fit: contain; background: #fff; border-radius: 10px; padding: 6px; border: 1px solid var(--line); }

/* leave requests & balances */
.tab-badge { display: inline-block; min-width: 20px; margin-inline-start: 6px; padding: 0 6px; border-radius: 999px; background: var(--out); color: #fff; font-size: 12px; line-height: 20px; text-align: center; vertical-align: middle; }
.bal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); gap: 8px; margin-top: 12px; }
.bal { background: var(--surface-2); border-radius: 14px; padding: 10px 12px; }
.bal-n { font-size: 26px; font-weight: 700; color: var(--primary); line-height: 1.1; }
.bal.empty .bal-n { color: var(--out); }
.req-list { display: grid; gap: 8px; margin-top: 14px; }
.req-item { border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.req-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-bottom: 14px; }
.req-card { border-inline-start: 4px solid var(--warn); }
.bal-cell { white-space: nowrap; }
.bal-cell b { font-size: 17px; }
.dot-pending { color: var(--warn); font-size: 22px; line-height: 0; margin-inline-start: 6px; vertical-align: middle; }
.bal-edit { display: grid; gap: 8px; }
.bal-edit-h, .bal-edit-r { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 10px; align-items: center; }
.bal-edit-h { font-size: 13px; color: var(--muted); }
.bal-edit-r input { width: 100%; }
@media (max-width: 520px) { .bal-edit-h, .bal-edit-r { grid-template-columns: 1fr 1fr 1fr; font-size: 14px; } }
label.check { display: flex; align-items: center; gap: 8px; margin: 12px 0 4px; font-weight: 600; cursor: pointer; }
label.check input { width: auto; min-height: 0; }
