/* UNIT ONE — واجهة فاخرة وهادية · فاتح وداكن تلقائي */
:root {
  --bg: #F7F1E8; --surface: #FFFDF9; --surface2: #F3ECE2; --ink: #2B1A1B; --mut: #86746D; --line: #E7DCD0;
  --b: #3C1C1F; --b-ink: #FBF4EA; --b-soft: rgba(60, 28, 31, .07); --y: #C1874E; --y-soft: rgba(217, 164, 110, .18);
  --gold: #D9A46E; --brand: #3C1C1F; --brand-ink: #F6E9DA;
  --ok: #2f7d55; --ok-soft: rgba(47, 125, 85, .1); --bad: #b42318; --bad-soft: rgba(180, 35, 24, .08);
  --shadow: 0 1px 2px rgba(60, 28, 31, .04), 0 6px 18px rgba(60, 28, 31, .05);
  --r: 16px; --side: 268px;
  --font: "IBM Plex Sans Arabic", -apple-system, "SF Arabic", "Segoe UI", Tahoma, "Noto Sans Arabic", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #160D0E; --surface: #211415; --surface2: #2A1A1C; --ink: #F5ECE2; --mut: #B4A196; --line: #3A2628;
    --b: #E0AC76; --b-ink: #2A1416; --b-soft: rgba(224, 172, 118, .13); --y: #E0AC76; --y-soft: rgba(224, 172, 118, .14);
    --brand: #241315;
    --ok: #4cb582; --ok-soft: rgba(76, 181, 130, .14); --bad: #f0705f; --bad-soft: rgba(240, 112, 95, .12);
    --shadow: 0 1px 2px rgba(0, 0, 0, .35);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 15.5px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; }
a { color: var(--b); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0 0 12px; color: var(--ink); }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; vertical-align: middle; }

/* ---------- الهيكل ---------- */
main { max-width: 1320px; margin: 0 auto; padding: 16px 14px 96px; }
.side { display: none; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line); }
.top .logo { display: flex; align-items: center; }
.top .ttl { flex: 1; min-width: 0; }
.top h1 { font-size: 17px; margin: 0; line-height: 1.3; }
.top .ttl span { font-size: 12px; color: var(--mut); }
.logo img { height: 30px; display: block; }
.logo .dk { display: none; }
@media (prefers-color-scheme: dark) { .logo .lt { display: none; } .logo .dk { display: block; } }
.wordmark { font-weight: 300; letter-spacing: .22em; font-size: 15px; color: var(--ink); direction: ltr; white-space: nowrap; }
.wordmark b { font-weight: 700; color: var(--b); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--b-soft); color: var(--b); display: grid; place-items: center; font-weight: 600; flex: 0 0 auto; }

.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: flex; background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 2px 8px; color: var(--mut); font-size: 11.5px; font-weight: 500; }
.tabs a .ic { width: 23px; height: 23px; }
.tabs a.on { color: var(--b); }
.tabs a:hover { text-decoration: none; }

@media (min-width: 1024px) {
  body.has-nav { padding-right: var(--side); }
  .side { display: flex; flex-direction: column; position: fixed; top: 0; right: 0; bottom: 0; width: var(--side); z-index: 30;
    background: var(--brand); color: var(--brand-ink); overflow: hidden; }
  .side::after { content: ""; position: absolute; left: -40px; right: -80px; bottom: 58px; height: 110px; pointer-events: none;
    background: url(pattern.png) no-repeat center bottom / 560px auto; opacity: .16; }
  .side > * { position: relative; z-index: 1; }
  .side .logo { display: block; padding: 30px 28px 22px; }
  .side .logo img { height: 46px; }
  .side .wordmark { font-size: 18px; }
  .side nav { flex: 1; overflow-y: auto; padding: 4px 14px 16px; }
  .side .sec { font-size: 11.5px; color: rgba(246, 233, 218, .5); padding: 18px 12px 6px; font-weight: 500; letter-spacing: .02em; }
  .side nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: rgba(246, 233, 218, .86); font-size: 14.5px; margin: 1px 0; }
  .side nav a .ic { color: rgba(246, 233, 218, .55); }
  .side nav a:hover { background: rgba(255, 255, 255, .06); text-decoration: none; }
  .side nav a.on { background: rgba(217, 164, 110, .16); color: var(--gold); font-weight: 600; }
  .side nav a.on .ic { color: var(--gold); }
  .side .avatar { background: rgba(217, 164, 110, .18); color: var(--gold); }
  .side .me { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-top: 1px solid rgba(246, 233, 218, .1); background: rgba(0, 0, 0, .12); }
  .side .me div:nth-child(2) { flex: 1; min-width: 0; line-height: 1.3; }
  .side .me b { display: block; font-size: 14px; font-weight: 600; }
  .side .me small { color: rgba(246, 233, 218, .55); font-size: 12px; }
  .side .me form { margin: 0; }
  .side .me button { background: none; border: 0; color: rgba(246, 233, 218, .6); cursor: pointer; padding: 6px; border-radius: 8px; }
  .side .me button:hover { background: rgba(255, 255, 255, .08); color: var(--gold); }
  .top { position: static; background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; border: 0; max-width: 1320px; margin: 0 auto; padding: 30px 32px 4px; }
  .top .logo, .top .who { display: none; }
  .top h1 { font-size: 26px; }
  .top .ttl span { font-size: 13px; }
  .tabs { display: none; }
  main { padding: 18px 32px 40px; }
}

/* ---------- البطاقات والعناصر ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.cols { display: grid; gap: 14px; grid-template-columns: 1fr; }
.cols > .card { margin-bottom: 0; }
@media (min-width: 1100px) { .cols { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols.three { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.cols + .card, .cols + .cols, .card + .cols, .kpis + .cols { margin-top: 14px; }
.center { text-align: center; }
.muted { color: var(--mut); }
.small { font-size: 13px; }
.mb { margin-bottom: 8px; }
.mt { margin-top: 12px; }
.inline { display: inline; }
label { display: block; font-size: 13px; color: var(--mut); margin-bottom: 10px; font-weight: 500; }
input, select, textarea { display: block; width: 100%; margin-top: 5px; font: inherit; font-size: 15px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--surface); color: var(--ink); transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--b); box-shadow: 0 0 0 3px var(--b-soft); }
input[type=checkbox] { width: auto; display: inline; }
.two { display: flex; gap: 10px; align-items: flex-end; }
.two > * { flex: 1; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.grid4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset:disabled input, fieldset:disabled select, fieldset:disabled textarea { background: var(--surface2); color: var(--ink); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; background: var(--b); color: var(--b-ink); border: 1px solid var(--b);
  border-radius: 11px; padding: 11px 16px; font: inherit; font-weight: 600; font-size: 15px; cursor: pointer; transition: filter .15s, transform .05s; }
.btn:hover { filter: brightness(1.07); text-decoration: none; }
.btn:active { transform: scale(.99); }
.btn.small { padding: 8px 12px; font-size: 14px; }
.btn.ghost { background: transparent; color: var(--b); }
.btn.ghost:hover { background: var(--b-soft); filter: none; }
.btn.big { padding: 15px; font-size: 17px; }
.btn.huge { padding: 26px 10px; font-size: 22px; border-radius: 20px; margin: 16px 0 6px; background: var(--ok); border-color: var(--ok);
  box-shadow: 0 10px 30px -12px var(--ok); }
.btn.huge.out { background: var(--b); border-color: var(--b); box-shadow: 0 10px 30px -12px var(--b); }
.btn.busy { opacity: .6; pointer-events: none; }
button.btn:disabled { opacity: .45; cursor: not-allowed; }
.danger { color: var(--bad) !important; border-color: var(--bad) !important; }
.linkbtn { background: none; border: 0; color: var(--mut); font: inherit; font-size: 14px; padding: 8px; cursor: pointer; }
.linkbtn:hover { color: var(--b); }

.flash { display: flex; align-items: center; gap: 10px; background: var(--ok-soft); color: var(--ok); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; font-weight: 500; }
.flash.bad { background: var(--bad-soft); color: var(--bad); }
.flash[hidden] { display: none; }
[hidden] { display: none !important; }

.row { display: flex; justify-content: space-between; align-items: center; padding: 12px 2px; border-bottom: 1px solid var(--line); gap: 10px; }
.row:last-child { border-bottom: 0; }
.row.link { color: var(--ink); }
.row.link:hover { text-decoration: none; background: var(--surface2); }
.row.today { font-weight: 600; color: var(--b); }
.pill { display: inline-flex; align-items: center; font-size: 12px; padding: 3px 10px; border-radius: 99px; background: var(--surface2); color: var(--mut); font-weight: 600; border: 1px solid var(--line); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
td.bad, .bad { color: var(--bad); font-weight: 600; }
.okc { color: var(--ok); font-weight: 600; }

.seg { display: flex; gap: 6px; margin: 4px 0 14px; overflow-x: auto; padding: 4px; background: var(--surface2); border-radius: 12px; border: 1px solid var(--line); }
.seg a { flex: 1; white-space: nowrap; text-align: center; padding: 8px 12px; border-radius: 9px; color: var(--mut); font-size: 14px; font-weight: 500; }
.seg a.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg a:hover { text-decoration: none; color: var(--ink); }
.weeknav { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.weeknav h2 { margin: 0; }

/* ---------- المؤشرات ---------- */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
@media (min-width: 900px) { .kpis { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); } }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--shadow); }
.kpi span { display: block; font-size: 13px; color: var(--mut); font-weight: 500; }
.kpi b { display: block; font-size: 28px; font-weight: 600; margin: 6px 0 2px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi small { font-size: 12.5px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 10px; margin-top: 12px; }
.stat { background: var(--surface2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; text-align: center; color: var(--ink); }
.stat:hover { text-decoration: none; border-color: var(--b); }
.stat b { display: block; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--mut); }

/* ---------- الرئيسية للموظف ---------- */
.shift { font-size: 20px; margin: 8px 0; }
.status { display: inline-block; padding: 6px 14px; border-radius: 99px; background: var(--surface2); font-size: 14px; border: 1px solid var(--line); }
.status.on { background: var(--ok-soft); color: var(--ok); font-weight: 600; border-color: transparent; }
.goal { margin: 12px 0; }
.goal-top { display: flex; justify-content: space-between; margin-bottom: 6px; }
.bar { height: 10px; background: var(--surface2); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.bar i { display: block; height: 100%; background: var(--y); border-radius: 99px; }
.bar i.full { background: var(--ok); }
.warn { border: 1px solid var(--y); background: var(--y-soft); }

/* ---------- القوائم ---------- */
.check { margin: 0; }
.check button { display: flex; gap: 14px; width: 100%; align-items: center; text-align: right; background: none; border: 0; border-bottom: 1px solid var(--line);
  padding: 14px 2px; font: inherit; color: var(--ink); cursor: pointer; }
.check .box { flex: 0 0 26px; height: 26px; border: 1.6px solid var(--line); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; background: var(--surface); }
.check.done .box { background: var(--ok); border-color: var(--ok); }
.check.done .txt { color: var(--mut); text-decoration: line-through; text-decoration-color: var(--line); }
.check .txt small { display: block; font-size: 12px; color: var(--ok); margin-top: 2px; text-decoration: none; }

/* ---------- الجداول ---------- */
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -2px 10px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
table.list th, table.list td { padding: 11px 10px; border-bottom: 1px solid var(--line); text-align: right; vertical-align: middle; }
table.list th { color: var(--mut); font-weight: 500; font-size: 12.5px; background: var(--surface2); position: sticky; top: 0; }
table.list tr:last-child td { border-bottom: 0; }
table.list tbody tr:hover td, table.list tr:hover td { background: color-mix(in srgb, var(--surface2) 60%, transparent); }
table.num td, table.num th { white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.click { cursor: pointer; }
tr.sum td { font-weight: 700; border-top: 2px solid var(--ink); background: var(--surface2); }
tr.sub td { font-weight: 600; background: var(--surface2); }
tr.sec td { color: var(--b); font-weight: 600; padding-top: 16px; background: transparent !important; }
table.grid th, table.grid td { padding: 4px 3px; text-align: center; }
table.grid th { font-size: 12px; color: var(--mut); white-space: nowrap; font-weight: 500; }
table.grid th.name { text-align: right; color: var(--ink); font-size: 14px; min-width: 100px; }
table.grid select { padding: 8px 2px; min-width: 70px; font-size: 13px; text-align: center; margin: 0; }
.sh-0 { background: var(--y-soft); } .sh-1 { background: var(--b-soft); } .sh-2 { background: var(--surface2); color: var(--mut); }
tr.cover td { font-weight: 600; } tr.cover td.zero { background: var(--bad-soft); color: var(--bad); }
table.items input, table.items select { margin: 0; padding: 7px 8px; font-size: 14px; min-width: 72px; }
table.items td:first-child input { min-width: 160px; }
.thumb img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; vertical-align: middle; margin-left: 6px; }

/* ---------- الرسوم ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart .c-ink { fill: var(--ink); } .chart .c-mut { fill: var(--mut); } .chart .c-grid { stroke: var(--line); } .chart .c-axis { stroke: var(--mut); }
.insights { margin: 0; padding-right: 18px; line-height: 2; }

/* ---------- النماذج والفلاتر ---------- */
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; align-items: end; margin-bottom: 10px; }
.filters label { margin: 0; }
.quick { display: flex; gap: 16px; font-size: 14px; flex-wrap: wrap; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.thumbs img { width: 92px; height: 92px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); }
.thumbs.big img { width: 100%; max-width: 440px; height: auto; max-height: 560px; object-fit: contain; background: var(--surface2); }
.filebtn { cursor: pointer; margin: 6px 0 10px; }
.tips { padding-right: 18px; }
details.person { border-bottom: 1px solid var(--line); padding: 12px 0; }
details.person summary { display: flex; justify-content: space-between; gap: 10px; cursor: pointer; list-style: none; font-weight: 600; }
details.person summary::-webkit-details-marker { display: none; }
details.person form { margin-top: 10px; }
details.person select, details.person input { margin-top: 4px; }
details.person.off { opacity: .5; }
.h2like { font-size: 16px; color: var(--b); font-weight: 600; cursor: pointer; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--surface2); border: 1px solid var(--line); border-radius: 99px; padding: 5px 12px; font-size: 13px; margin: 0; }
.chip button { background: none; border: 0; color: var(--mut); font-size: 16px; cursor: pointer; padding: 0 2px; }

/* ---------- الدخول ---------- */
body.no-nav { background: var(--brand) url(pattern.png) no-repeat center bottom / min(1100px, 160vw) auto; min-height: 100vh; }
body.no-nav .ver { color: rgba(246, 233, 218, .6); }
.login { max-width: 400px; margin: 9vh auto 0; text-align: center; padding: 0 6px; }
.login .mark { margin-bottom: 26px; display: flex; justify-content: center; }
.login .mark img { height: 78px; }
.login > p.muted { color: rgba(246, 233, 218, .7); }
.login .mark .wordmark { font-size: 26px; }
.login .card { text-align: right; padding: 24px; }
.login h1 { font-size: 20px; margin: 4px 0 2px; }

/* ---------- المزيد ---------- */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 700px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { display: flex; flex-direction: column; gap: 6px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); color: var(--ink); box-shadow: var(--shadow); }
.tile .ic { width: 26px; height: 26px; color: var(--b); }
.tile span { font-weight: 600; }
.tile small { color: var(--mut); font-size: 12px; }
.tile:hover { text-decoration: none; border-color: var(--b); }
.menu h2 { margin-bottom: 4px; }

.ver { text-align: center; color: var(--mut); opacity: .6; font-size: 11.5px; padding: 18px 8px 4px; }
.print-head { display: none; }
@media print {
  .top, .tabs, .side, .ver, .noprint, .flash, form.filters { display: none !important; }
  body, body.has-nav { background: #fff; color: #000; padding: 0; font-size: 12px; }
  main { max-width: none; padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
  .scroll { overflow: visible; }
  .print-head { display: block; margin-bottom: 6px; }
  table.num td, table.num th { white-space: normal; padding: 4px; }
}
/* v3.1 */
.forcebox { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; margin: 6px 0 12px; }
.forcebox input { width: 18px; height: 18px; margin: 0; accent-color: var(--b); }
.seg a .ic { width: 17px; height: 17px; margin-left: 4px; }
h2 .ic { width: 19px; height: 19px; color: var(--b); margin-left: 4px; vertical-align: -3px; }
.btn .ic { width: 18px; height: 18px; }
.linkbtn .ic { width: 16px; height: 16px; }
a.linkbtn { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; }
table.grid select.ov { font-weight: 700; border-color: var(--b); }
table.grid select.off { color: var(--mut); background: var(--surface2); }
table.grid select.none { color: var(--mut); }
table.grid select.altc, th.altc { background: var(--y-soft); }
tr.altrow th, tr.altrow td { background: var(--y-soft); }
.altbox { display: flex; justify-content: center; margin: 0; }
.altbox input { width: 20px; height: 20px; margin: 0; accent-color: var(--b); }
.nowrap { white-space: nowrap; }
table.list td input, table.list td select { margin: 0; padding: 7px 8px; }
