@font-face { font-family: AppArabic; src: url(/fonts/Amiri-Regular.woff) format('woff'); font-weight: 400; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: AppArabic; src: url(/fonts/Amiri-Bold.woff) format('woff'); font-weight: 700; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }

:root {
  --brand: #0f4c5c; --brand-2: #16697a; --brand-soft: #e6f2f1;
  --in: #12805c; --in-dark: #0d6648; --out: #c2410c; --out-dark: #9a3412;
  --text: #1b1f23; --muted: #5b6670; --line: #d8dee4; --bg: #f3f5f7; --card: #fff;
  --warn-bg: #fff4d6; --warn: #8a5a00; --err-bg: #fdecea; --err: #a4231a; --ok-bg: #e7f6ee; --ok: #0d6648;
  --radius: 14px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Arabic", Tahoma, AppArabic, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--bg); font-size: 16px; line-height: 1.5; min-height: 100vh; }
[dir=rtl] body { font-size: 17px; }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: 1.35rem; margin: 0 0 .75rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: .95rem; margin: 1.1rem 0 .5rem; color: var(--brand); }
.boot { padding: 3rem 1rem; text-align: center; color: var(--muted); }
.muted { color: var(--muted); } .small { font-size: .875rem; } .nowrap { white-space: nowrap; }
[hidden] { display: none !important; }

/* header & nav */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .6rem max(1rem, env(safe-area-inset-left)); padding-top: max(.6rem, env(safe-area-inset-top)); background: var(--brand); color: #fff; }
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 700; font-size: 1.05rem; min-width: 0; }
.brand img { border-radius: 8px; flex: none; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head-actions { display: flex; gap: .4rem; flex: none; }
.top .btn.ghost { color: #fff; border-color: rgba(255,255,255,.45); background: transparent; }
.top .btn.ghost:hover { background: rgba(255,255,255,.12); }
.tabs { display: flex; gap: .25rem; overflow-x: auto; background: #fff; border-bottom: 1px solid var(--line); padding: 0 .5rem; scrollbar-width: none; }
.tabs a { padding: .8rem .9rem; color: var(--muted); text-decoration: none; white-space: nowrap; border-bottom: 3px solid transparent; font-weight: 600; }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }
.container { max-width: 1120px; margin: 0 auto; padding: 1rem; padding-bottom: 2rem; }
.foot { text-align: center; padding: 0 1rem 2rem; }

/* cards */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem; margin-bottom: 1rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: .5rem; }
.card-head h1 { margin: 0; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 44px; padding: .55rem 1rem; border-radius: 10px;
  border: 1px solid transparent; font-weight: 600; cursor: pointer; text-decoration: none; transition: background .15s; }
.btn.small { min-height: 36px; padding: .35rem .75rem; font-size: .9rem; }
.btn.block { width: 100%; }
.btn.primary { background: var(--brand); color: #fff; } .btn.primary:hover { background: var(--brand-2); }
.btn.ghost { background: #fff; border-color: var(--line); color: var(--text); } .btn.ghost:hover { background: #f6f8fa; }
.btn.danger { background: var(--err); color: #fff; } .btn.danger.ghost { background: #fff; color: var(--err); border-color: #f1b8b2; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.busy { cursor: progress; }
.link { background: none; border: 0; color: var(--brand-2); text-decoration: underline; cursor: pointer; padding: .25rem; }
.icon-btn { background: none; border: 0; font-size: 1.1rem; cursor: pointer; padding: .35rem .5rem; border-radius: 8px; color: var(--muted); }
.icon-btn:hover { background: #f0f2f4; }

/* forms */
.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .85rem; min-width: 0; }
.field label { font-weight: 600; font-size: .92rem; }
.field .opt { font-weight: 400; color: var(--muted); }
.hint { font-size: .82rem; color: var(--muted); }
input, select, textarea { width: 100%; min-height: 46px; padding: .55rem .75rem; border: 1px solid #c4ccd4; border-radius: 10px; background: #fff; }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, summary:focus-visible { outline: 3px solid rgba(22,105,122,.35); outline-offset: 1px; border-color: var(--brand-2); }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; min-height: 0; margin: 0; accent-color: var(--brand); flex: none; }
.check { display: flex; align-items: center; gap: .55rem; margin: .25rem 0 .85rem; cursor: pointer; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .75rem; }
.filters { display: grid; gap: 0 .75rem; grid-template-columns: 1fr; align-items: end; }
.filters .period { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 .75rem; }
.period { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 .75rem; }
@media (min-width: 860px) { .filters { grid-template-columns: minmax(200px, 1.2fr) 3fr minmax(150px, 1fr); } }
@media (max-width: 520px) { .period, .filters .period { grid-template-columns: 1fr 1fr; } .period .field:first-child { grid-column: 1 / -1; } }
.export-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* alerts, tags */
.alert { padding: .75rem .9rem; border-radius: 10px; margin: .5rem 0; font-weight: 500; }
.alert.error { background: var(--err-bg); color: var(--err); }
.alert.warn { background: var(--warn-bg); color: var(--warn); }
.alert.ok, .alert.success { background: var(--ok-bg); color: var(--ok); }
.alert.success { font-size: 1.08rem; font-weight: 700; border: 1px solid #b7e2c9; }
.tag { display: inline-block; font-size: .78rem; font-weight: 700; padding: .12rem .5rem; border-radius: 999px; margin: .1rem 0; margin-inline-end: .25rem; white-space: nowrap; }
.tag.inc { background: var(--warn-bg); color: var(--warn); border: 1px solid #f1d58a; }
.tag.edited { background: #eef2ff; color: #3730a3; } .tag.added { background: #f3e8ff; color: #6b21a8; }
.tag.cancelled { background: #f1f3f5; color: #6b7280; text-decoration: line-through; }
.tag.ok { background: var(--ok-bg); color: var(--ok); } .tag.in { background: #e0f2fe; color: #075985; }

/* auth */
.auth { display: flex; justify-content: center; padding-top: 1.5rem; }
.auth-card { width: 100%; max-width: 440px; padding: 1.5rem; }

/* employee home */
.home { text-align: center; padding: 1.5rem 1.1rem; }
.hello { font-size: 1.15rem; font-weight: 700; }
.clock { font-size: 2.6rem; font-weight: 800; letter-spacing: .5px; margin-top: .5rem; color: var(--brand); font-variant-numeric: tabular-nums; }
[dir=rtl] .clock { direction: rtl; }
.clock-date { color: var(--muted); margin-bottom: .75rem; font-variant-numeric: tabular-nums; }
.status { display: inline-flex; align-items: center; gap: .5rem; padding: .45rem 1rem; border-radius: 999px; font-weight: 700; }
.status .dot { width: 10px; height: 10px; border-radius: 50%; }
.status.is-in { background: var(--ok-bg); color: var(--ok); } .status.is-in .dot { background: var(--in); box-shadow: 0 0 0 4px rgba(18,128,92,.18); }
.status.is-out { background: #f1f3f5; color: var(--muted); } .status.is-out .dot { background: #9aa4ad; }
.elapsed { margin-top: .5rem; color: var(--muted); font-weight: 600; }
.home-msg { margin: .75rem auto 0; max-width: 520px; }
.big-btns { display: grid; gap: .9rem; margin: 1.2rem auto .5rem; max-width: 520px; }
@media (min-width: 640px) { .big-btns { grid-template-columns: 1fr 1fr; } }
.big-btn { min-height: 88px; border: 0; border-radius: 18px; font-size: 1.35rem; font-weight: 800; color: #fff; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,.12); transition: transform .08s, background .15s; }
.big-btn:active:not(:disabled) { transform: scale(.98); }
.big-btn.in { background: var(--in); } .big-btn.in:hover:not(:disabled) { background: var(--in-dark); }
.big-btn.out { background: var(--out); } .big-btn.out:hover:not(:disabled) { background: var(--out-dark); }
.big-btn:disabled { background: #c9d0d6; color: #fff; box-shadow: none; cursor: not-allowed; }
.big-btn.busy { background: var(--brand-2) !important; opacity: 1; }
.disclaimer { font-size: .85rem; color: var(--muted); text-align: center; max-width: 620px; margin: 0 auto; padding: 0 .5rem; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin-bottom: 1rem; }
.stat { background: var(--brand-soft); border-radius: 12px; padding: .75rem; text-align: center; }
.stat.warn { background: var(--warn-bg); }
.stat-v { font-size: 1.5rem; font-weight: 800; color: var(--brand); font-variant-numeric: tabular-nums; }
.stat.warn .stat-v { color: var(--warn); }
.stat-l { font-size: .85rem; color: var(--muted); }

/* tables (stack into cards on phones) */
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th { text-align: start; font-size: .82rem; color: var(--muted); font-weight: 700; padding: .55rem .6rem; border-bottom: 2px solid var(--line); background: #fafbfc; }
.table td { padding: .6rem; border-bottom: 1px solid #eceff2; vertical-align: top; }
.table tr.row-inc td { background: #fffaf0; }
.table tr.row-cancel td { color: #8a939b; }
.empty { text-align: center; color: var(--muted); padding: 1.5rem 0; }
@media (max-width: 760px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { border: 1px solid var(--line); border-radius: 12px; margin-bottom: .7rem; padding: .35rem .2rem; background: #fff; }
  .table tr.row-inc { border-color: #f1d58a; background: #fffaf0; }
  .table td { border: 0; padding: .3rem .7rem; display: flex; gap: .75rem; justify-content: space-between; align-items: baseline; }
  .table td::before { content: attr(data-label); color: var(--muted); font-size: .82rem; font-weight: 600; flex: none; }
  .table td[data-label=""]::before { content: none; }
  .table td > *:not(:first-child) { text-align: end; }
}

/* employee picker */
.picker { position: relative; }
.picker summary { list-style: none; min-height: 46px; padding: .55rem .75rem; border: 1px solid #c4ccd4; border-radius: 10px; background: #fff; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker summary::-webkit-details-marker { display: none; }
.picker summary::after { content: '▾'; float: inline-end; color: var(--muted); }
.picker-pop { position: absolute; z-index: 20; inset-inline-start: 0; top: calc(100% + 4px); width: max(100%, 280px); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 28px rgba(0,0,0,.14); padding: .5rem; }
.picker-list { max-height: 280px; overflow: auto; margin-top: .4rem; }
.pick { display: flex; align-items: center; gap: .55rem; padding: .45rem .4rem; border-radius: 8px; cursor: pointer; }
.pick:hover { background: #f4f6f8; } .pick.all { font-weight: 700; border-bottom: 1px solid #eceff2; border-radius: 0; }
.pick.inactive { color: var(--muted); } .pick small { color: var(--muted); }

/* dialogs */
.overlay { position: fixed; inset: 0; background: rgba(15,23,32,.45); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 4vh .75rem; overflow-y: auto; }
.dialog { background: #fff; border-radius: 16px; width: 100%; max-width: 520px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.dialog.wide { max-width: 680px; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.1rem .4rem; }
.dialog-head h2 { margin: 0; }
.dialog-body { padding: .4rem 1.1rem .6rem; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; padding: .75rem 1.1rem 1.1rem; border-top: 1px solid #eceff2; }
.temp-pw { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.6rem; font-weight: 700; letter-spacing: 2px; text-align: center; background: var(--brand-soft); border-radius: 12px; padding: 1rem; margin: .5rem 0; user-select: all; }
.preview { margin: .25rem 0 .75rem; }
.ro { margin-bottom: .75rem; } .ro-l { font-size: .82rem; color: var(--muted); font-weight: 600; } .ro-v { white-space: pre-wrap; }
.ro-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.changes .old { color: var(--err); text-decoration: line-through; } .changes .new { color: var(--ok); font-weight: 600; }
.chg { font-size: .88rem; }
dl.install dt { font-weight: 700; margin-top: .6rem; } dl.install dd { margin: 0; color: var(--muted); }

/* toast */
#toast { position: fixed; inset-inline: 0; bottom: max(1rem, env(safe-area-inset-bottom)); margin: 0 auto; width: fit-content; max-width: calc(100% - 2rem);
  background: #1f2933; color: #fff; padding: .75rem 1.1rem; border-radius: 12px; z-index: 60; opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s; font-weight: 600; }
#toast.show { opacity: 1; transform: none; } #toast.error { background: var(--err); }

@media (max-width: 420px) { .row2, .ro-grid { grid-template-columns: 1fr; } .clock { font-size: 2.2rem; } .brand span { max-width: 150px; } }
@media print { .top, .tabs, .foot, .btn { display: none !important; } .card { box-shadow: none; } }
