@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@400;500;600&display=swap');

:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1c1f23;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #0f4c5c;
  --brand-2: #e36414;
  --ok: #157f3b; --ok-bg: #e5f5ea;
  --warn: #9a5b00; --warn-bg: #fdf1dc;
  --err: #b42318; --err-bg: #fde8e7;
  --info: #1d4ed8; --info-bg: #e5edfd;
  --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
a { color: var(--brand); }
.shell { display: flex; min-height: 100vh; }
.side { width: 220px; background: var(--brand); color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { font-weight: 600; font-size: 20px; padding: 20px; }
.brand span { color: var(--brand-2); }
.brand.big { font-size: 28px; color: var(--brand); text-align: center; padding: 0 0 16px; }
.side nav { flex: 1; overflow-y: auto; }
.side nav a { display: flex; justify-content: space-between; align-items: center; color: #dfe9ec; text-decoration: none; padding: 10px 20px; }
.side nav a:hover { background: rgba(255,255,255,.08); }
.side nav a.on { background: rgba(255,255,255,.15); color: #fff; font-weight: 500; }
.count { background: var(--brand-2); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 8px; }
.me { padding: 16px 20px; font-size: 12px; color: #b9cdd2; border-top: 1px solid rgba(255,255,255,.1); }
.me a { color: #fff; }
.main { flex: 1; padding: 20px 28px; min-width: 0; }
.top { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.top h1 { font-size: 22px; font-weight: 600; margin: 0; }
.menu-btn { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; font-size: 18px; padding: 4px 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 16px; overflow-x: auto; }
.card h2 { font-size: 16px; font-weight: 600; margin: 4px 0 12px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: right; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-weight: 500; color: var(--muted); font-size: 12px; white-space: nowrap; }
tr.dim td { opacity: .5; }
table.kv th { width: 180px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.stat b { font-size: 22px; font-weight: 600; }
.t-ok { color: var(--ok); } .t-warn { color: var(--warn); } .t-err { color: var(--err); } .t-info { color: var(--info); }
.muted { color: var(--muted); font-size: 12px; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; white-space: nowrap; background: #eef0f2; color: #4b5563; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.err { background: var(--err-bg); color: var(--err); }
.badge.info { background: var(--info-bg); color: var(--info); }
.punch { display: inline-block; margin: 2px; padding: 2px 8px; border-radius: 6px; font-size: 12px; text-decoration: none; border: 1px solid transparent; }
.punch.in { background: var(--ok-bg); color: var(--ok); }
.punch.out { background: #eef0f2; color: #374151; }
.punch.admin { border: 1px dashed currentColor; }
.punch.auto { background: #f3e8ff; color: #6b21a8; border: 1px solid #d8b4fe; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
input, select, textarea { font: inherit; padding: 7px 10px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; color: var(--text); max-width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid #9cc3cc; border-color: var(--brand); }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #374151; }
label small { color: var(--muted); font-size: 11px; }
label.check { flex-direction: row; align-items: center; gap: 8px; }
.filters label { flex-direction: row; align-items: center; gap: 6px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid h2 { margin: 8px 0 0; border-top: 1px solid var(--line); padding-top: 14px; }
.form-grid h2:first-of-type { border-top: 0; padding-top: 0; }
.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.inline-form label { flex-direction: row; align-items: center; gap: 6px; }
.btn { display: inline-block; font: inherit; font-size: 13px; padding: 7px 14px; border-radius: 8px; border: 1px solid #cfd4da; background: #fff; color: var(--text); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f3f4f6; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #0b3a46; }
.btn.danger { color: var(--err); border-color: #f1b8b3; }
.btn.sm { padding: 4px 10px; font-size: 12px; }
td.actions { white-space: nowrap; }
td.actions form { display: inline; }
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.alert.ok { background: var(--ok-bg); color: var(--ok); }
.alert.err { background: var(--err-bg); color: var(--err); }
.sched input[type=time] { width: 7.5rem; }
details summary { cursor: pointer; }
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.auth-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 28px; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; }
.auth-card h1 { font-size: 20px; margin: 0; }
.auth-card h2 { font-size: 14px; margin: 8px 0 0; color: var(--muted); }
@media (max-width: 860px) {
  .side { position: fixed; right: -240px; z-index: 10; transition: right .2s; }
  .side.open { right: 0; }
  .menu-btn { display: block; }
  .main { padding: 14px 16px; }
}

/* tabs inside a record */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 7px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--line); text-decoration: none; color: var(--text); font-size: 13px; }
.tabs a:hover { border-color: var(--brand); }
.tabs .count { margin-inline-start: 4px; }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }

/* documents */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin-bottom: 16px; }
.doc-card { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; display: flex; flex-direction: column; }
.doc-thumb { display: flex; align-items: center; justify-content: center; height: 130px; background: #f3f4f6; text-decoration: none; }
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.doc-icon { font-weight: 600; font-size: 20px; color: var(--err); }
.doc-icon.muted { font-size: 12px; font-weight: 400; color: var(--muted); }
.doc-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.doc-edit { border-top: 1px solid var(--line); padding: 6px 12px 10px; }
.doc-edit summary { font-size: 12px; color: var(--brand); padding: 4px 0; }
.doc-edit form { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.doc-edit input[type=file] { font-size: 12px; }
.row-btns { display: flex; gap: 6px; }
.doc-upload { border: 1px dashed #c7cdd4; border-radius: 12px; padding: 16px; background: #fafbfc; display: flex; flex-direction: column; gap: 12px; }
.doc-upload h3 { margin: 0; font-size: 15px; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip input { display: none; }
.chip span { display: inline-block; padding: 6px 12px; border-radius: 999px; border: 1px solid #d1d5db; background: #fff; cursor: pointer; font-size: 13px; }
.chip input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.drop { position: relative; display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 110px; border: 2px dashed #c7cdd4; border-radius: 12px; background: #fff; cursor: pointer; text-align: center; padding: 12px; }
.drop.over { border-color: var(--brand); background: #eef6f8; }
.drop.has-file { border-style: solid; border-color: var(--ok); }
.drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop-text { color: var(--muted); font-size: 13px; }
.drop.has-file .drop-text { color: var(--ok); font-weight: 500; }
.drop-preview { max-height: 90px; border-radius: 8px; }
.upload-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; justify-content: space-between; }
.upload-row label { flex-direction: row; align-items: center; gap: 8px; }

.danger-zone { border-color: #f1b8b3; }
.danger-zone h2 { color: var(--err); }

/* notification bell */
.top h1 { flex: 1; }
.bell { position: relative; }
.bell-btn { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 10px; font-size: 18px; width: 42px; height: 40px; cursor: pointer; }
.bell-badge { position: absolute; top: -6px; left: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--err); color: #fff; font-size: 11px; font-weight: 600; line-height: 20px; text-align: center; }
.bell-badge[hidden] { display: none; }
.bell-panel { position: absolute; left: 0; top: 48px; width: min(380px, calc(100vw - 32px)); max-height: 70vh; overflow-y: auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.12); z-index: 50; }
.bell-panel[hidden] { display: none; }
.bell-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--card); }
.bell-sum { display: block; padding: 10px 14px; background: var(--warn-bg); color: var(--warn); text-decoration: none; border-bottom: 1px solid var(--line); font-weight: 500; }
.bell-item { display: flex; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--text); }
.bell-item:hover { background: var(--bg); }
.bell-item.new { background: var(--info-bg); }
.bell-item .bi { font-size: 18px; line-height: 1.2; }
.bell-item .bt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bell-item .bt b { font-weight: 600; font-size: 13px; }
.bell-item .bt small { color: var(--muted); font-size: 12px; }
.bell-item .bt em { color: var(--muted); font-size: 11px; font-style: normal; }
.bell-empty { padding: 16px 14px; margin: 0; }
.bell-page { padding: 0; }
.bell-page .bell-item:last-child { border-bottom: 0; }

/* departments: member picker */
.member-list { max-height: 460px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.member { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.member:last-child { border-bottom: 0; }
.member:hover { background: var(--bg); }
.member input { margin-top: 3px; }
.form-grid .member-list label.member { display: flex; flex-direction: row; align-items: flex-start; gap: 10px; margin: 0; font-weight: 400; }
.form-grid .member-list label.member input { width: auto; flex: none; }

.sched td.ot input { background: #f5f3ff; border-color: #ddd6fe; }

/* reports: filters + review table */
.report-filters { align-items: center; }
.report-filters .presets { display: flex; gap: 6px; width: 100%; }
.emp-pick { position: relative; }
.emp-pick > summary { list-style: none; cursor: pointer; }
.emp-pick-box { position: absolute; z-index: 40; top: 42px; right: 0; width: 320px; max-height: 360px; overflow-y: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.12); }
.emp-pick-box input:not([type]) { width: 100%; margin-bottom: 6px; }
.emp-pick-box label { padding: 4px 2px; }
.review .table-wrap { overflow-x: auto; }
.review td input.n { width: 84px; padding: 4px 6px; }
.review td input.notes { width: 140px; padding: 4px 6px; }
.review td select.ed { padding: 3px 4px; margin-bottom: 4px; }
.review td select.ed.need { border-color: var(--warn); background: var(--warn-bg); }
.review td.net { font-weight: 600; white-space: nowrap; }
.review input:disabled { opacity: .4; }

/* employee balances */
.bal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.bal { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.bal span { color: var(--muted); font-size: 12px; }
.bal b { font-size: 18px; }
.bal small { color: var(--muted); font-size: 11px; }
.bal.main { grid-column: span 2; background: var(--ok-bg); border-color: #bfe3c9; }
.bal.unpaid, .bal.warn { background: var(--warn-bg); }
.bal.bad { background: var(--err-bg); }
.bal.auto { background: #f3e8ff; }

/* bulk document import */
tr.row-warn td { background: #fff8e1; }
.review select.emp-sel { max-width: 300px; }
.sched-members { margin-top: 4px; font-size: 13px; line-height: 1.7; }
.leave-now { margin: 0 0 12px; font-size: 15px; }
.leave-now .badge { font-size: 14px; padding: 4px 12px; }
.warn-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; margin-bottom: 8px; line-height: 1.9; }
.warn-pdf { width: 100%; height: 80vh; border: 1px solid #e5e7eb; border-radius: 10px; margin-top: 12px; background: #f8f9fa; }
