/* نبض المصنع — التصميم */
:root {
  --bg: #F3F4F6; --card: #FFFFFF; --card2: #F8F9FA;
  --ink: #111827; --ink2: #4B5563; --ink3: #8B93A1;
  --line: #E5E7EB; --line-soft: #F0F1F3;
  --acc: #E8590C; --acc-ink: #FFFFFF; --acc-soft: #FFF0E6; --acc-text: #C2410C;
  --ok: #2F9E44; --ok-soft: #E9F7EC; --ok-text: #237032;
  --warn: #F08C00; --warn-soft: #FFF4E0; --warn-text: #A85600;
  --bad: #E03131; --bad-soft: #FFEDED; --bad-text: #B42318;
  --info: #1C7ED6; --info-soft: #E7F1FC; --info-text: #1864AB;
  --idle: #ADB5BD; --idle-soft: #EEF0F2;
  --shade: rgba(17, 24, 39, .035);
  --heat1: #69C77B; --heat2: #F5A524; --heat3: #E5484D;
  --r: 16px; --r-sm: 10px;
  --sh: 0 1px 2px rgba(17, 24, 39, .05), 0 2px 10px rgba(17, 24, 39, .04);
  --font: system-ui, -apple-system, "SF Arabic", "Segoe UI", "Noto Sans Arabic", Tahoma, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1014; --card: #171A20; --card2: #1D2128;
    --ink: #ECEEF2; --ink2: #A9B0BC; --ink3: #7A8290;
    --line: #2A2F38; --line-soft: #21252C;
    --acc-soft: #3A2212; --acc-text: #FF9A5C;
    --ok-soft: #13301B; --ok-text: #69DB7C;
    --warn-soft: #3A2A0E; --warn-text: #FFC078;
    --bad-soft: #3B1515; --bad-text: #FF8787;
    --info-soft: #102A43; --info-text: #74C0FC;
    --idle-soft: #262A31; --shade: rgba(255, 255, 255, .03);
    --sh: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1014; --card: #171A20; --card2: #1D2128;
  --ink: #ECEEF2; --ink2: #A9B0BC; --ink3: #7A8290;
  --line: #2A2F38; --line-soft: #21252C;
  --acc-soft: #3A2212; --acc-text: #FF9A5C;
  --ok-soft: #13301B; --ok-text: #69DB7C;
  --warn-soft: #3A2A0E; --warn-text: #FFC078;
  --bad-soft: #3B1515; --bad-text: #FF8787;
  --info-soft: #102A43; --info-text: #74C0FC;
  --idle-soft: #262A31; --shade: rgba(255, 255, 255, .03);
  --sh: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--font); -webkit-tap-highlight-color: transparent; overflow-x: hidden; }
body.locked { overflow: hidden; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 22px; line-height: 1.3; font-weight: 800; }
h2 { font-size: 17px; font-weight: 800; }
h3 { font-size: 15.5px; font-weight: 700; }
a { color: inherit; }
button { font: inherit; color: inherit; }
.muted { color: var(--ink2); }
.faint { color: var(--ink3); font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.ic { width: 20px; height: 20px; flex: none; }
.ic.sm { width: 16px; height: 16px; }
[dir="rtl"] .flip { transform: scaleX(-1); }
.hide { display: none !important; }

/* ---------- top bar & nav ---------- */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  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-soft); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand b { font-size: 16px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-act { display: flex; align-items: center; gap: 6px; }
main { max-width: 980px; margin: 0 auto; padding: 16px 16px 32px; }
main.has-nav { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.nav { position: fixed; bottom: 0; inset-inline: 0; z-index: 20; display: flex; justify-content: center;
  background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.nav a { flex: 1; max-width: 140px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 0 7px;
  color: var(--ink3); text-decoration: none; font-size: 11.5px; font-weight: 700; }
.nav a .ic { width: 24px; height: 24px; }
.nav a.on { color: var(--acc); }

/* ---------- buttons ---------- */
.btn { appearance: none; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-weight: 700; font-size: 15px;
  min-height: 44px; padding: 0 16px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: transform .08s, background .15s; }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn.primary { background: var(--acc); border-color: var(--acc); color: var(--acc-ink); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.bad { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.bad-ghost { color: var(--bad-text); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); background: var(--bad-soft); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; }
.btn.big { min-height: 58px; font-size: 18px; border-radius: 16px; flex: 1; }
.btn.block { width: 100%; }
.btn.wa { background: #1B9E4B; border-color: #1B9E4B; color: #fff; }
.btn.wa.ghostwa { background: transparent; color: #17803D; border-color: color-mix(in srgb, #1B9E4B 45%, var(--line)); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.wa.ghostwa { color: #5EE08A; } }
:root[data-theme="dark"] .btn.wa.ghostwa { color: #5EE08A; }
.icon-btn { appearance: none; border: 0; background: transparent; width: 40px; height: 40px; border-radius: 12px; display: inline-flex;
  align-items: center; justify-content: center; color: var(--ink2); cursor: pointer; }
.icon-btn:active { background: var(--line-soft); }
.link-btn { appearance: none; background: none; border: 0; padding: 0; color: var(--acc-text); font-weight: 700; cursor: pointer; font-size: 14px; }

/* ---------- generic blocks ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh); padding: 16px; }
.stack { display: grid; gap: 12px; }
.sec { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 26px 0 10px; }
.sec h2 { display: flex; align-items: center; gap: 8px; }
.sec .count { font-size: 12px; font-weight: 800; background: var(--line-soft); color: var(--ink2); border-radius: 999px; padding: 1px 9px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head > .row { flex-wrap: wrap; gap: 6px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty { text-align: center; padding: 34px 16px; color: var(--ink2); }
.empty .ic { width: 40px; height: 40px; color: var(--ink3); margin-bottom: 8px; }
.empty h3 { color: var(--ink); margin-bottom: 4px; }
.loading, .boot-splash { display: flex; justify-content: center; padding: 60px 0; }
.spin { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--acc); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 640px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; box-shadow: var(--sh); }
.kpi span { display: block; font-size: 12.5px; color: var(--ink2); font-weight: 600; }
.kpi b { display: block; font-size: 26px; font-weight: 800; line-height: 1.25; font-variant-numeric: tabular-nums; }
.kpi small { font-size: 12px; color: var(--ink3); }
.kpi.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.kpi.bad b, .kpi.bad span { color: var(--bad-text); }
.kpi.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.kpi.warn b, .kpi.warn span { color: var(--warn-text); }
.kpi.ok b { color: var(--ok-text); }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px;
  background: var(--idle-soft); color: var(--ink2); white-space: nowrap; }
.badge.st-doing { background: var(--warn-soft); color: var(--warn-text); }
.badge.st-done { background: var(--ok-soft); color: var(--ok-text); }
.badge.st-blocked, .badge.bad { background: var(--bad-soft); color: var(--bad-text); }
.badge.info { background: var(--info-soft); color: var(--info-text); }
.badge.acc { background: var(--acc-soft); color: var(--acc-text); }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  background: color-mix(in srgb, var(--c) 14%, var(--card)); color: color-mix(in srgb, var(--c) 80%, var(--ink)); white-space: nowrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--idle)); flex: none; display: inline-block; }
.sdot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--idle); }
.sdot.st-doing { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.sdot.st-done { background: var(--ok); }
.sdot.st-blocked { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }

.bar { height: 8px; border-radius: 99px; background: var(--line-soft); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--acc); border-radius: 99px; }
.bar.ok > i { background: var(--ok); }
.bar.bad > i { background: var(--bad); }
.bar.thin { height: 5px; }

.alert { display: flex; gap: 8px; align-items: flex-start; background: var(--bad-soft); color: var(--bad-text); border-radius: 12px; padding: 10px 12px; font-weight: 600; font-size: 14px; }
.alert.warn { background: var(--warn-soft); color: var(--warn-text); }
.alert.info { background: var(--info-soft); color: var(--info-text); }

.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.fchip { appearance: none; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 7px 14px; font-weight: 700; font-size: 13.5px; cursor: pointer; white-space: nowrap; color: var(--ink2); }
.fchip.on { background: var(--ink); color: var(--card); border-color: var(--ink); }

/* ---------- lists ---------- */
.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh); overflow: hidden; }
.li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); text-decoration: none; color: inherit; cursor: pointer; }
.li:last-child { border-bottom: 0; }
.li:active { background: var(--line-soft); }
.li .main { flex: 1; min-width: 0; }
.li .t { font-weight: 700; }
.li .s { font-size: 13px; color: var(--ink2); }
.li .end { text-align: end; font-size: 13px; color: var(--ink2); flex: none; }
.li.static { cursor: default; }
.avatar { width: 38px; height: 38px; border-radius: 12px; flex: none; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px;
  background: color-mix(in srgb, var(--c, var(--idle)) 16%, var(--card)); color: color-mix(in srgb, var(--c, var(--ink2)) 85%, var(--ink)); }

/* ---------- login ---------- */
.login { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px 16px; }
.login-card { width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 22px; box-shadow: var(--sh); }
.login-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.login-head h1 { flex: 1; font-size: 20px; }
.demo { width: 100%; max-width: 400px; }
.demo h3 { margin-bottom: 4px; }
.demo .faint { margin-bottom: 10px; }

/* ---------- forms & sheet ---------- */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 13px; color: var(--ink2); font-weight: 700; }
.field small { font-size: 12px; color: var(--ink3); }
input, select, textarea { font: inherit; font-size: 16px; color: var(--ink); background: var(--card2); border: 1px solid var(--line);
  border-radius: 12px; min-height: 48px; padding: 10px 12px; width: 100%; }
textarea { min-height: 80px; resize: vertical; }
input[type="color"] { padding: 4px; height: 48px; }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; min-height: 0; accent-color: var(--acc); flex: none; margin: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--acc); outline-offset: -1px; border-color: transparent; background: var(--card); }
input:disabled { opacity: .5; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 10px; }
.grid2 > * { min-width: 0; }
input[type="date"], input[type="time"] { direction: ltr; min-width: 0; -webkit-appearance: none; appearance: none; }
[dir="rtl"] input[type="date"], [dir="rtl"] input[type="time"] { text-align: right; }
input::-webkit-date-and-time-value { text-align: inherit; }
.err { color: var(--bad-text); font-weight: 700; font-size: 14px; min-height: 0; }
.err:not(:empty) { margin-bottom: 10px; }
.hint { font-size: 12.5px; color: var(--ink3); display: flex; align-items: center; gap: 6px; margin: -6px 0 14px; }
.form-btns { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.form h2 { margin-bottom: 16px; }
.check { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card2); cursor: pointer; font-weight: 600; }
.check:has(input:checked) { border-color: var(--acc); background: var(--acc-soft); }
.choices { display: grid; gap: 8px; margin-bottom: 14px; }
.choices.cols { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.choice { display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--card2); font-weight: 700; font-size: 16px; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--acc); background: var(--acc-soft); color: var(--acc-text); }
.people { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.person { position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border: 1.5px solid var(--line); border-radius: 999px; background: var(--card2); cursor: pointer; font-weight: 600; font-size: 14px; }
.person input { position: absolute; opacity: 0; pointer-events: none; }
.person:has(input:checked) { border-color: var(--acc); background: var(--acc-soft); color: var(--acc-text); }
.person:has(input:focus-visible) { outline: 2px solid var(--acc); }
.stage-pick { display: grid; grid-template-columns: auto 1fr 92px; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.stage-pick input[type="number"] { min-height: 40px; padding: 6px 10px; text-align: center; }
.radio-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.radio-row label { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 14px; background: var(--card2); }
.radio-row label:has(input:checked) { border-color: var(--acc); background: var(--acc-soft); color: var(--acc-text); }

#sheet { position: fixed; inset: 0; z-index: 50; display: none; }
#sheet.open { display: block; }
.sheet-bg { position: absolute; inset: 0; background: rgba(10, 12, 16, .45); animation: fade .15s; }
.sheet { position: absolute; inset-inline: 0; bottom: 0; max-height: 92vh; overflow-y: auto; overscroll-behavior: contain; background: var(--card);
  border-radius: 22px 22px 0 0; padding: 6px 18px calc(18px + env(safe-area-inset-bottom)); animation: up .22s cubic-bezier(.2, .8, .2, 1); }
.sheet::before { content: ""; display: block; width: 42px; height: 5px; border-radius: 5px; background: var(--line); margin: 6px auto 14px; }
@media (min-width: 720px) {
  .sheet { inset-inline: auto; left: 50%; top: 50%; bottom: auto; transform: translate(-50%, -50%); width: 560px; border-radius: 22px; max-height: 88vh; padding-top: 18px; animation: fade .15s; }
  .sheet::before { display: none; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: .4; } }
.confirm p { font-size: 18px; font-weight: 700; margin: 6px 0 18px; }

#toast { position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); bottom: calc(96px + env(safe-area-inset-bottom)); display: grid; gap: 8px; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--ink); color: var(--card); padding: 11px 16px; border-radius: 14px; font-weight: 700; font-size: 14.5px; box-shadow: 0 6px 24px rgba(0,0,0,.18); animation: up .2s; text-align: center; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }
.offline { position: fixed; top: env(safe-area-inset-top); inset-inline: 0; z-index: 40; background: var(--warn); color: #fff; text-align: center; font-size: 13px; font-weight: 700; padding: 4px; }

.push-card { display: flex; align-items: flex-start; gap: 12px; background: var(--acc-soft); border: 1px solid color-mix(in srgb, var(--acc) 30%, transparent);
  border-radius: var(--r); padding: 14px; margin: 6px 0 14px; }
.push-card > .ic { width: 26px; height: 26px; color: var(--acc-text); margin-top: 2px; }
.push-card b { color: var(--acc-text); }
.push-card p { font-size: 14px; color: var(--ink2); margin-top: 2px; }
.push-card .icon-btn { width: 32px; height: 32px; margin: -6px; }

/* ---------- templates & guide ---------- */
.tpl-prev { background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: -4px 0 14px; display: grid; gap: 6px; font-size: 14px; }
.tpl-total { border-top: 1px dashed var(--line); padding-top: 8px; margin-top: 2px; }
.guide { background: var(--card); border: 1.5px solid color-mix(in srgb, var(--acc) 40%, var(--line)); border-radius: var(--r); padding: 14px 16px; margin: 6px 0 14px; box-shadow: var(--sh); }
.guide ol { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.guide li { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.guide li a { color: var(--acc-text); text-decoration: none; }
.guide li .n { width: 24px; height: 24px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 800;
  background: var(--acc-soft); color: var(--acc-text); }
.guide li.done { color: var(--ink3); }
.guide li.done .n { background: var(--ok-soft); color: var(--ok-text); }

/* ---------- photos ---------- */
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumb { position: relative; width: 78px; height: 78px; border-radius: 12px; overflow: hidden; background: var(--line-soft); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; padding: 0; flex: none; cursor: pointer; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.add { flex-direction: column; gap: 2px; color: var(--acc-text); font-size: 12px; font-weight: 700; border: 1.5px dashed color-mix(in srgb, var(--acc) 55%, transparent); background: var(--acc-soft); }
.thumb.add .ic { width: 24px; height: 24px; }
.thumb.add input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; min-height: 0; }
.thumb-x { position: absolute; top: 4px; inset-inline-end: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
  background: rgba(0, 0, 0, .6); color: #fff; display: flex; align-items: center; justify-content: center; }
.thumbs.sm { margin-top: 8px; }
.thumbs.sm .thumb { width: 52px; height: 52px; border-radius: 9px; }
.thumb.mini { width: 40px; height: 40px; border-radius: 8px; }
#lightbox { position: fixed; inset: 0; z-index: 80; background: rgba(0, 0, 0, .92); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom)); }
#lightbox img { max-width: 100%; max-height: calc(100vh - 120px); border-radius: 10px; object-fit: contain; }

/* ---------- worker ---------- */
.hello { margin: 4px 0 6px; }
.hello h1 { font-size: 26px; }
.wcard { background: var(--card); border: 1.5px solid var(--line); border-radius: 20px; padding: 16px; box-shadow: var(--sh); margin-bottom: 12px; }
.wcard.st-doing { border-color: color-mix(in srgb, var(--warn) 65%, var(--line)); }
.wcard.st-blocked { border-color: color-mix(in srgb, var(--bad) 60%, var(--line)); }
.wcard-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.wcard h3 { font-size: 20px; line-height: 1.35; margin-bottom: 2px; }
.wcard .meta { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink2); margin-top: 6px; text-decoration: none; }
.wcard .meta.link { color: var(--info-text); font-weight: 600; }
.wcard .alert { margin-top: 12px; }
.wbtns { display: flex; gap: 10px; margin-top: 14px; }
.wbtns .btn.big:last-child:not(:first-child) { flex: 0 0 34%; }
.wdone { display: flex; align-items: center; gap: 10px; padding: 12px 14px; color: var(--ok-text); font-weight: 700; }

/* ---------- today ---------- */
.prob { background: var(--card); border: 1.5px solid color-mix(in srgb, var(--bad) 45%, var(--line)); border-radius: var(--r); padding: 14px; box-shadow: var(--sh); }
.prob h3 { margin: 6px 0 2px; }
.prob .why { display: flex; gap: 8px; align-items: flex-start; color: var(--bad-text); font-weight: 700; margin-top: 8px; }
.prob .row { margin-top: 12px; }
.feed .li { align-items: flex-start; }
.feed .time { width: 62px; flex: none; font-size: 13px; color: var(--ink3); font-weight: 700; padding-top: 1px; font-variant-numeric: tabular-nums; }
.day-nav { display: flex; align-items: center; gap: 4px; }
.day-nav b { min-width: 92px; text-align: center; font-size: 14px; }

/* ---------- projects ---------- */
.pgrid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
.pcard { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px; box-shadow: var(--sh); text-decoration: none; color: inherit; }
.pcard:active { transform: scale(.99); }
.pcard-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.pcard .sub { font-size: 13.5px; color: var(--ink2); margin: 2px 0 12px; }
.pcard .due { font-size: 13px; font-weight: 700; color: var(--ink2); }
.pcard .due.bad { color: var(--bad-text); }
.pcard .due.warn { color: var(--warn-text); }
.pcard .fin { display: flex; gap: 14px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 13px; color: var(--ink2); flex-wrap: wrap; }
.pcard .fin b { color: var(--ink); font-variant-numeric: tabular-nums; }
.strip { display: flex; gap: 3px; margin-top: 12px; }
.strip span { height: 26px; border-radius: 7px; min-width: 18px; display: flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 700;
  background: color-mix(in srgb, var(--c) 16%, var(--card)); color: color-mix(in srgb, var(--c) 85%, var(--ink)); overflow: hidden; white-space: nowrap; padding: 0 6px; position: relative; }
.strip span.st-done { background: var(--c); color: #fff; }
.strip span.st-doing { background: color-mix(in srgb, var(--c) 55%, var(--card)); color: #fff; }
.strip span.st-blocked { box-shadow: inset 0 0 0 2px var(--bad); }
.strip span.late { box-shadow: inset 0 0 0 2px var(--bad); }

.phead .back { display: inline-flex; align-items: center; gap: 4px; color: var(--ink2); text-decoration: none; font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.phead h1 { flex: 1; }
.phead .sub { color: var(--ink2); margin: 2px 0 14px; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 14px; }
.phead .sub a { color: var(--info-text); text-decoration: none; font-weight: 600; }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
@media (max-width: 560px) { .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.fact { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.fact span { display: block; font-size: 12px; color: var(--ink2); font-weight: 700; }
.fact b { display: block; font-size: 16px; font-weight: 800; }
.fact small { display: block; font-size: 12px; font-weight: 700; color: var(--ink3); }
.fact small.bad { color: var(--bad-text); }
.fact small.ok { color: var(--ok-text); }
.fact small.warn { color: var(--warn-text); }
.tabs { display: flex; gap: 4px; background: var(--line-soft); padding: 4px; border-radius: 14px; margin: 16px 0 14px; overflow-x: auto; scrollbar-width: none; }
.tabs a { flex: 1 1 auto; text-align: center; padding: 9px 8px; border-radius: 10px; text-decoration: none; font-weight: 700; font-size: 14px; color: var(--ink2); white-space: nowrap; }
.tabs a.on { background: var(--card); color: var(--ink); box-shadow: var(--sh); }

.stage { background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--sh); margin-bottom: 14px; overflow: hidden; }
.stage-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 10px; border-top: 4px solid var(--c); }
.stage-head h3 { font-size: 17px; }
.stage-head .grow .faint { margin-top: 1px; }
.stage .bar { margin: 0 14px 10px; }
.stage .bar > i { background: var(--c); }
.stage .li { padding: 12px 14px; }
.stage-foot { padding: 8px 14px 12px; }
.money-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.money-row:last-child { border-bottom: 0; }
.money-row .bar { flex: 1; }
.money-row b { min-width: 92px; text-align: end; font-variant-numeric: tabular-nums; }
.money-row span { min-width: 64px; font-weight: 700; font-size: 14px; }
.lock { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink3); font-weight: 600; }

/* ---------- timeline (gantt) ---------- */
.tl { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh); -webkit-overflow-scrolling: touch; }
.tl-in { position: relative; width: calc(var(--lab) + var(--w)); min-width: 100%; isolation: isolate; }
.tl-row { position: relative; display: flex; min-height: 34px; border-bottom: 1px solid var(--line-soft); }
.tl-row:last-of-type { border-bottom: 0; }
.tl-row[data-act] { cursor: pointer; }
.tl-row[data-act]:hover .tl-lab { background: var(--card2); }
.tl-lab { position: sticky; inset-inline-start: 0; z-index: 3; flex: none; width: var(--lab); background: var(--card); padding: 6px 10px;
  display: flex; flex-direction: column; justify-content: center; font-size: 13px; line-height: 1.3; border-inline-end: 1px solid var(--line); min-width: 0; }
.tl-lab > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-lab small { color: var(--ink3); font-size: 11.5px; }
.tl-lab .row { gap: 6px; }
.tl-track { position: relative; flex: none; width: var(--w); }
.tl-head { min-height: 42px; background: var(--card2); }
.tl-head .tl-lab { background: var(--card2); }
.tl-tick { position: absolute; top: 0; bottom: 0; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 5px; font-size: 11px; color: var(--ink3); font-weight: 600; font-variant-numeric: tabular-nums; }
.tl-tick.major { color: var(--ink); font-weight: 800; }
.tl-tick em { position: absolute; top: 4px; inset-inline-start: 3px; font-style: normal; font-weight: 800; color: var(--ink2); white-space: nowrap; font-size: 11.5px; }
.tl-tick.sep { border-inline-start: 1px solid var(--line); }
.tl-bar { position: absolute; top: 7px; bottom: 7px; border-radius: 7px; overflow: hidden; display: flex; align-items: center;
  background: color-mix(in srgb, var(--c, var(--idle)) 20%, var(--card)); border: 1px solid color-mix(in srgb, var(--c, var(--idle)) 50%, transparent); }
.tl-bar > i { position: absolute; top: 0; bottom: 0; inset-inline-start: 0; background: var(--c); opacity: .85; }
.tl-bar > span { position: relative; padding-inline: 7px; font-size: 11.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: color-mix(in srgb, var(--c, var(--ink2)) 70%, var(--ink)); }
.tl-row.grp { min-height: 40px; background: var(--card2); }
.tl-row.grp .tl-lab { background: var(--card2); font-weight: 800; }
.tl-row.grp .tl-bar { top: 8px; bottom: 8px; }
.tl-row.sub .tl-lab { padding-inline-start: 22px; }
.tl-bar.w { --c: var(--idle); }
.tl-bar.w.st-doing { --c: var(--warn); }
.tl-bar.w.st-done { --c: var(--ok); }
.tl-bar.w.st-blocked { --c: var(--bad); }
.tl-bar.w.st-done, .tl-bar.w.st-doing, .tl-bar.w.st-blocked, .tl-bar.solid { background: var(--c); border-color: var(--c); }
.tl-bar.w.st-done > span, .tl-bar.w.st-doing > span, .tl-bar.w.st-blocked > span, .tl-bar.solid > span { color: #fff; }
.tl-bar.w.st-doing { background: repeating-linear-gradient(-45deg, var(--warn) 0 8px, color-mix(in srgb, var(--warn) 80%, #fff) 8px 16px); }
.tl-bar.late { outline: 2px solid var(--bad); outline-offset: -2px; }
.tl-bar.ghost { opacity: .55; }
.tl-bar.flag { top: 4px; bottom: 4px; width: 4px !important; border-radius: 2px; background: var(--bad); border: 0; }
.tl-bar.live::after { content: ""; position: absolute; inset-block: 0; inset-inline-end: 0; width: 3px; background: #fff; opacity: .9; animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.tl-bg, .tl-lines { position: absolute; top: 0; bottom: 0; inset-inline-start: var(--lab); width: var(--w); pointer-events: none; }
.tl-lines { z-index: 2; }
.tl-shade { position: absolute; top: 0; bottom: 0; background: var(--shade); }
.tl-line { position: absolute; top: 0; bottom: 0; width: 0; border-inline-start: 2px solid var(--info); }
.tl-line b { position: absolute; top: 3px; inset-inline-start: -1px; transform: translateX(var(--tx, -50%)); font-size: 10.5px; background: var(--info); color: #fff; padding: 1px 6px; border-radius: 6px; white-space: nowrap; font-weight: 800; }
[dir="rtl"] .tl-line b { --tx: 50%; }
.tl-line.due { border-inline-start: 2px dashed var(--bad); }
.tl-line.due b { background: var(--bad); top: auto; bottom: 3px; }
.tl.stacked .tl-row { flex-direction: column; min-height: 0; }
.tl.stacked .tl-lab { width: max-content; max-width: calc(100vw - 52px); border: 0; background: transparent; flex-direction: row; align-items: baseline; gap: 8px; padding: 7px 10px 0; }
.tl.stacked .tl-head .tl-lab { display: none; }
.tl.stacked .tl-row.grp .tl-lab { background: transparent; }
.tl.stacked .tl-row.sub .tl-lab { padding-inline-start: 20px; }
.tl.stacked .tl-track { height: 30px; }
.tl.stacked .tl-head .tl-track { height: 40px; }
.tl.stacked .tl-bar { top: 5px; bottom: 5px; }
.tl.stacked .tl-row[data-act]:hover .tl-lab { background: transparent; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 10px 2px 0; font-size: 12.5px; color: var(--ink2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 16px; height: 10px; border-radius: 3px; display: inline-block; background: var(--c); }
.legend i.line { width: 2px; height: 14px; border-radius: 0; }
.legend i.dash { width: 0; height: 14px; border-inline-start: 2px dashed var(--bad); background: none; }
.tl-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }

/* ---------- desktop niceties ---------- */
@media (min-width: 900px) {
  body { font-size: 15.5px; }
  .sheet { width: 600px; }
}

/* ---------- monthly report ---------- */
.rep-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.rep-table th { text-align: start; font-size: 12px; color: var(--ink2); font-weight: 700; padding: 10px 12px; background: var(--card2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.rep-table td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; font-variant-numeric: tabular-nums; }
.rep-table tr:last-child td { border-bottom: 0; }
.ok-t { color: var(--ok-text); font-weight: 700; }
.warn-t { color: var(--warn-text); font-weight: 700; }
.bad-t { color: var(--bad-text); font-weight: 700; }
.print-only { display: none; }
@media print {
  :root { --bg: #fff; --card: #fff; --card2: #F6F7F9; --ink: #111827; --ink2: #4B5563; --ink3: #6B7280; --line: #D9DCE1; --line-soft: #ECEEF1;
    --ok-soft: #E9F7EC; --ok-text: #237032; --warn-soft: #FFF4E0; --warn-text: #A85600; --bad-soft: #FFEDED; --bad-text: #B42318; --acc-soft: #FFF0E6; --acc-text: #C2410C;
    --idle-soft: #EEF0F2; --info-soft: #E7F1FC; --info-text: #1864AB; --shade: rgba(0,0,0,.04); --sh: none; color-scheme: light; }
  @page { size: A4; margin: 12mm; }
  body { background: #fff; font-size: 12px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .top, .nav, #toast, #sheet, .no-print, .offline, .push-card, .guide { display: none !important; }
  .print-only { display: block; }
  main, main.has-nav { max-width: none; padding: 0; }
  .card, .kpi, .list, .tl, .rep-table tr { break-inside: avoid; }
  .sec { break-after: avoid; margin-top: 18px; }
  .tl { overflow: visible; }
  a { text-decoration: none; }
}
@media (max-width: 480px) {
  .rep-table th, .rep-table td { padding: 8px 8px; font-size: 12.5px; }
}

/* ---------- offline ---------- */
.net { background: var(--warn-soft); color: var(--warn-text); padding: 8px 16px; font-size: 13.5px; font-weight: 700; text-align: center; border-bottom: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); }
.net.sending { background: var(--info-soft); color: var(--info-text); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.thumb.local::after { content: "⏳"; position: absolute; bottom: 3px; inset-inline-start: 4px; font-size: 13px; }

/* ---------- worker load ---------- */
.tl-bar.heat { top: 6px; bottom: 6px; border: 0; border-radius: 5px; justify-content: center; }
.tl-bar.heat > span { color: #fff; padding: 0; font-size: 11px; font-weight: 800; }
.tl-bar.heat.h1 { background: var(--heat1); }
.tl-bar.heat.h2 { background: var(--heat2); }
.tl-bar.heat.h3 { background: var(--heat3); }
.overlap { background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); border-radius: var(--r); padding: 12px 14px; }
.overlap.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.overlap b { color: var(--warn-text); display: inline-flex; align-items: center; gap: 6px; }
.overlap.bad b { color: var(--bad-text); }
.overlap ul { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 14px; }

/* ---------- hourly shifts ---------- */
.slot-time { width: 48px; flex: none; font-size: 12.5px; font-weight: 800; color: var(--ink2); line-height: 1.35; text-align: center; font-variant-numeric: tabular-nums; }
.slot-card { background: var(--card); border: 1.5px solid color-mix(in srgb, var(--c) 45%, var(--line)); border-inline-start: 6px solid var(--c); border-radius: 16px; padding: 12px 14px; box-shadow: var(--sh); }
.slot-card.done { opacity: .75; }
.slot-card .t { font-weight: 700; font-size: 16px; margin-top: 4px; }
.slot-hrs { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.slot-qty { font-weight: 800; color: var(--acc-text); }
.tl-bar.ghostsolid { opacity: .6; }

.sec { flex-wrap: wrap; }

/* ---------- supply ---------- */
.rq-filter { display: grid; gap: 8px; margin-bottom: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.grid3 select { min-height: 42px; font-size: 14px; padding: 6px 8px; }
@media (max-width: 480px) { .grid3 { grid-template-columns: 1fr 1fr; } .grid3 select:last-child { grid-column: span 2; } }
.rq-item { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.rq-item input { min-height: 44px; padding: 8px 10px; }
.rq-item input:first-child { flex: 1; min-width: 0; }
.supply-alert { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; background: var(--card); border: 1.5px solid color-mix(in srgb, var(--warn) 45%, var(--line));
  border-radius: var(--r); padding: 12px 14px; margin-top: 14px; box-shadow: var(--sh); }
.supply-alert > .ic { width: 26px; height: 26px; color: var(--warn-text); }
.thumb.busy { opacity: .5; }

/* ---------- tour & view-as ---------- */
.tour-dots { display: flex; gap: 5px; margin-bottom: 14px; }
.tour-dots a { flex: 1; height: 5px; border-radius: 3px; background: var(--line); }
.tour-dots a.past { background: color-mix(in srgb, var(--acc) 45%, var(--line)); }
.tour-dots a.on { background: var(--acc); }
.tour-card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 20px; box-shadow: var(--sh); }
.tour-card h2 { font-size: 22px; margin: 10px 0 6px; }
.tour-card > p { color: var(--ink2); font-size: 16px; line-height: 1.7; }
.tour-ic { width: 52px; height: 52px; border-radius: 16px; background: var(--acc-soft); color: var(--acc-text); display: flex; align-items: center; justify-content: center; }
.tour-ic .ic { width: 28px; height: 28px; }
.tour-live { margin-top: 14px; background: var(--card2); border: 1px dashed var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 6px; }
.tour-pv { font-weight: 700; }
.viewas-bar { background: var(--info-soft); color: var(--info-text); border-radius: var(--r); padding: 12px 14px; margin-bottom: 14px; display: grid; gap: 8px; }
.viewas-bar p { font-size: 13.5px; }
.phone-frame { max-width: 420px; margin: 0 auto; border: 8px solid var(--ink); border-radius: 34px; padding: 14px 12px 18px; background: var(--bg); }
.wguide { background: var(--info-soft); border-radius: var(--r); padding: 12px 14px; margin: 6px 0 14px; color: var(--ink); }
.wguide > .row > .ic { width: 28px; height: 28px; color: var(--info-text); flex: none; }
.wguide p { color: var(--ink2); font-size: 14.5px; margin-top: 2px; }

/* ---------- live & hours ---------- */
.live-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); animation: blink 1.4s infinite; vertical-align: middle; }
.live-btn { border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); color: var(--bad-text); }
.clock-now { font-size: 18px; color: var(--ink2); }
.live-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.live-card { background: var(--card); border: 1.5px solid var(--line); border-radius: 16px; padding: 12px 14px; box-shadow: var(--sh); }
.live-card.st-working { border-color: color-mix(in srgb, var(--ok) 50%, var(--line)); }
.live-card.st-blocked { border-color: color-mix(in srgb, var(--bad) 50%, var(--line)); }
.live-card.st-waiting { border-color: color-mix(in srgb, var(--warn) 50%, var(--line)); }
.live-card.st-idle { opacity: .8; }
.live-card .t { font-weight: 800; font-size: 15.5px; }
.lv-work { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.lv-work .s { font-size: 13px; color: var(--ink2); }
.lv-since { margin-top: 4px; font-size: 14px; color: var(--ok-text); display: flex; align-items: center; gap: 6px; }
.lv-slot { margin-top: 8px; background: var(--card2); border-radius: 10px; padding: 8px 10px; }
.lv-slot .s { font-size: 13px; color: var(--ink2); }
.lv-foot { margin-top: 8px; font-size: 13px; color: var(--ink2); gap: 6px; }
.plink { color: var(--info-text); text-decoration: none; font-weight: 600; }
.tl-row.hrow .tl-track { height: 46px; }
.tl.stacked .tl-row.hrow .tl-track { height: 46px; }
.tl-bar.plan { top: 4px; bottom: 52%; background: color-mix(in srgb, var(--c, var(--acc)) 10%, transparent); border: 1.5px dashed var(--c, var(--acc)); }
.tl-bar.plan > span { font-size: 10.5px; color: color-mix(in srgb, var(--c, var(--acc)) 75%, var(--ink)); }
.tl-bar.real { top: 52%; bottom: 4px; }
.legend i.planl { background: transparent; border: 1.5px dashed var(--c); }

/* ---------- monthly calendar ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-wd { text-align: center; font-size: 12px; font-weight: 700; color: var(--ink3); padding: 4px 0; }
.cal-wd.fri { color: var(--bad-text); }
.cal-cell { all: unset; box-sizing: border-box; cursor: pointer; min-height: 74px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 4px 5px; display: flex; flex-direction: column; gap: 2px; overflow: hidden; min-width: 0; }
.cal-cell.empty { background: transparent; border: 0; cursor: default; }
.cal-cell.fri { background: var(--card2); }
.cal-cell.today .cal-n { background: var(--acc); color: #fff; border-radius: 99px; padding: 0 6px; }
.cal-cell.on { border-color: var(--acc); box-shadow: 0 0 0 2px color-mix(in srgb, var(--acc) 35%, transparent); }
.cal-cell:focus-visible { outline: 2px solid var(--acc); }
.cal-n { font-weight: 800; font-size: 13px; align-self: flex-start; }
.cal-txt { font-size: 10.5px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--info-text); background: var(--info-soft); border-radius: 4px; padding: 1px 3px; }
.cal-txt.due { color: var(--bad-text); background: var(--bad-soft); }
.cal-txt .ic.sm { width: 10px; height: 10px; }
.cal-dots { display: flex; flex-wrap: wrap; gap: 2px; margin-top: auto; }
.cal-dots i { font-style: normal; font-size: 10px; font-weight: 800; min-width: 15px; text-align: center; color: #fff; background: var(--c); border-radius: 99px; padding: 0 3px; line-height: 15px; }
.cal-h { margin: 14px 0 6px; font-weight: 800; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.cal-h::before { content: ''; width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
@media (min-width: 700px) { .cal-cell { min-height: 96px; padding: 6px 7px; } .cal-txt { font-size: 12px; } }

/* ---------- attendance ---------- */
.att-in { all: unset; box-sizing: border-box; cursor: pointer; width: 100%; display: flex; align-items: center; gap: 14px; padding: 18px; margin: 4px 0 14px; border-radius: 18px;
  background: var(--ok); color: #fff; box-shadow: var(--sh); }
.att-in .ic { width: 30px; height: 30px; }
.att-in span { display: flex; flex-direction: column; gap: 2px; }
.att-in b { font-size: 22px; font-weight: 900; }
.att-in small { font-size: 13px; opacity: .9; }
.att-in:disabled { opacity: .6; cursor: default; }
.att-in:focus-visible { outline: 3px solid var(--ink); }
.att-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin: 4px 0 14px; border-radius: 16px; background: var(--card); border: 1.5px solid var(--line); }
.att-card.in { border-color: color-mix(in srgb, var(--ok) 55%, var(--line)); background: color-mix(in srgb, var(--ok) 7%, var(--card)); }
.att-card .s { font-size: 13px; color: var(--ink2); margin-top: 2px; }
.att-card .att-out { background: var(--card2); border-color: var(--line); min-height: 48px; }
.att-strip { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 12px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); color: inherit; text-decoration: none; }
.warn-card { background: var(--warn-soft, var(--card2)); }
.warn-t { color: var(--warn-text, var(--warn)); font-weight: 700; }
.ok-t { color: var(--ok-text); font-weight: 700; }

/* ================= desktop dashboard (قالب لوحة فهد) ================= */
.grow { flex: 1; min-width: 0; }
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }
.side { display: none; }
@media (min-width: 1024px) {
  body.has-side { padding-inline-start: 256px; }
  .side { display: flex; flex-direction: column; gap: 12px; position: fixed; inset-block: 0; inset-inline-start: 0; width: 256px; z-index: 30;
    padding: 16px 12px; background: var(--card); border-inline-end: 1px solid var(--line); overflow-y: auto; }
  body.has-side .top .brand { visibility: hidden; }
  body.has-side .top [data-act="lang"], body.has-side .top [data-act="logout"], body.has-side .top [data-act="cmd"] { display: none; }
  body.has-side .top { padding-block: 8px; min-height: 0; }
  body.has-side .nav { display: none; }
  body.has-side main { max-width: 1320px; padding: 22px clamp(16px, 3vw, 36px) 40px; }
  body.has-side main.has-nav { padding-bottom: 40px; }
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 6px; }
.side-brand b { display: block; font-size: 15px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-brand small { color: var(--ink3); font-size: 12px; }
.side-search { all: unset; box-sizing: border-box; cursor: pointer; display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 10px; color: var(--ink3); font-size: 14px; background: var(--card2); }
.side-search span { flex: 1; }
.side-search kbd, .cmd-in kbd { font: 11px/1 var(--font); border: 1px solid var(--line); border-radius: 6px; padding: 3px 5px; color: var(--ink3); }
.side-search:hover { background: var(--line-soft); }
.side-search:focus-visible, .side-nav a:focus-visible { outline: 2px solid var(--acc); outline-offset: 1px; }
.side-nav { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.side-gt { font-size: 11.5px; font-weight: 700; color: var(--ink3); padding: 0 10px 4px; letter-spacing: .02em; }
.side-nav a { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 0 10px; border-radius: 10px; color: var(--ink2); text-decoration: none; font-weight: 600; font-size: 14.5px; }
.side-nav a:hover { background: var(--line-soft); color: var(--ink); }
.side-nav a.on { background: var(--acc-soft); color: var(--acc-text); }
.sbadge { font-style: normal; font-size: 11.5px; font-weight: 800; min-width: 20px; text-align: center; padding: 1px 6px; border-radius: 99px; background: var(--bad); color: #fff; font-variant-numeric: tabular-nums; }
.sbadge.soft { background: var(--info-soft); color: var(--info-text); }
.side-foot { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 4px 6px; }
.side-user b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user small { color: var(--ink3); font-size: 12px; }

/* ⌘K */
#cmd { position: fixed; inset: 0; z-index: 80; }
.cmd-bg { position: absolute; inset: 0; background: rgba(14, 15, 19, .45); }
.cmd { position: relative; margin: 10vh auto 0; width: min(620px, calc(100% - 24px)); background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25); overflow: hidden; display: flex; flex-direction: column; max-height: 70vh; }
.cmd-in { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); color: var(--ink3); }
.cmd-in input { flex: 1; border: 0; outline: 0; background: transparent; font: 16px var(--font); color: var(--ink); min-height: 32px; }
.cmd-list { overflow-y: auto; padding: 6px; }
.cmd-g { font-size: 11.5px; font-weight: 700; color: var(--ink3); padding: 10px 10px 4px; }
.cmd-it { all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 10px; border-radius: 10px; cursor: pointer; font-size: 14.5px; }
.cmd-it small { color: var(--ink3); font-size: 12px; }
.cmd-it.on, .cmd-it:hover { background: var(--acc-soft); color: var(--acc-text); }
.cmd-empty { padding: 24px; text-align: center; color: var(--ink3); }

/* home */
.dk-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.dk-greet { font-size: 20px; }
.seg { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { all: unset; cursor: pointer; padding: 6px 14px; border-radius: 8px; font-size: 13.5px; font-weight: 700; color: var(--ink2); }
.seg button.on { background: var(--acc); color: var(--acc-ink); }
.seg button:focus-visible { outline: 2px solid var(--acc); }
.inbox { margin-bottom: 14px; }
.inbox h2 { font-size: 14px; color: var(--ink2); margin-bottom: 8px; }
.inbox-row { display: flex; flex-wrap: wrap; gap: 8px; }
.ichip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 99px; text-decoration: none; font-size: 13.5px; font-weight: 600;
  background: var(--card); border: 1px solid var(--line); color: var(--ink); }
.ichip b { font-size: 14px; }
.ichip.bad { border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); color: var(--bad-text); background: var(--bad-soft); }
.ichip.warn { border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); color: var(--warn-text); background: var(--warn-soft); }
.ichip.info { border-color: color-mix(in srgb, var(--info) 40%, var(--line)); color: var(--info-text); background: var(--info-soft); }
.ichip.ok { color: var(--ok-text); background: var(--ok-soft); border-color: transparent; }
.kgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kcard { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; box-shadow: var(--sh); container-type: inline-size; }
.kcard .kl { font-size: 13px; color: var(--ink2); font-weight: 700; }
.kcard .kv { display: block; font-size: 28px; font-weight: 800; margin: 6px 0 2px; }
.kcard .kv small { font-size: 13px; color: var(--ink3); font-weight: 600; }
.kcard .kf { font-size: 12.5px; color: var(--ink3); margin-top: 4px; }
.delta { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 800; padding: 2px 7px; border-radius: 99px; }
.delta.ok { background: var(--ok-soft); color: var(--ok-text); }
.delta.bad { background: var(--bad-soft); color: var(--bad-text); }
.delta.info { background: var(--info-soft); color: var(--info-text); }
.spark { width: 100%; height: 28px; display: block; }
.dk-two { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 12px; margin-bottom: 16px; }
@media (max-width: 1180px) { .dk-two { grid-template-columns: 1fr; } }
.area { width: 100%; height: auto; display: block; }
.area .grid { stroke: var(--line); stroke-width: 1; }
.area .ax { fill: var(--ink3); font-size: 11px; font-family: var(--font); }
.area .fill { fill: color-mix(in srgb, var(--acc) 14%, transparent); }
.area .cur { fill: none; stroke: var(--acc); stroke-width: 2.5; stroke-linejoin: round; }
.area .prev { fill: none; stroke: var(--ink3); stroke-width: 1.5; stroke-dasharray: 5 5; }
.area .pt { fill: var(--card); stroke: var(--acc); stroke-width: 2; }
.feed { display: flex; flex-direction: column; }
.fi { display: flex; gap: 10px; align-items: flex-start; padding: 8px 2px; border-bottom: 1px dashed var(--line); text-decoration: none; color: inherit; font-size: 13.5px; }
.fi:last-child { border-bottom: 0; }
.fi small { display: block; color: var(--ink3); font-size: 12px; }
.fdot { width: 8px; height: 8px; border-radius: 50%; background: var(--acc); margin-top: 7px; flex: none; }
.fdot.ok { background: var(--ok); } .fdot.bad { background: var(--bad); } .fdot.info { background: var(--info); }

/* tables */
.dt { background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--sh); overflow: hidden; }
.dt-views { display: flex; gap: 2px; padding: 8px 10px 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.dt-views button { all: unset; cursor: pointer; padding: 8px 12px; font-size: 14px; font-weight: 700; color: var(--ink2); border-bottom: 2px solid transparent; white-space: nowrap; }
.dt-views button span { font-size: 12px; color: var(--ink3); background: var(--line-soft); border-radius: 99px; padding: 1px 7px; margin-inline-start: 4px; }
.dt-views button.on { color: var(--acc-text); border-bottom-color: var(--acc); }
.dt-views button:focus-visible { outline: 2px solid var(--acc); }
.dt-tools { display: flex; align-items: center; gap: 8px; padding: 10px 12px; }
.dt-search { flex: 1; max-width: 360px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; color: var(--ink3); background: var(--card2); }
.dt-search input { flex: 1; border: 0; outline: 0; background: transparent; min-height: 36px; font: 14px var(--font); color: var(--ink); }
.dt-wrap { overflow-x: auto; }
.dtable { width: 100%; border-collapse: collapse; font-size: 14px; }
.dtable th { text-align: start; font-size: 12.5px; color: var(--ink3); font-weight: 700; background: var(--card2); padding: 9px 12px; border-block: 1px solid var(--line); white-space: nowrap; }
.dtable th button { all: unset; cursor: pointer; }
.dtable th button:focus-visible { outline: 2px solid var(--acc); }
.dtable td { padding: 11px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.dtable.dense td { padding: 6px 12px; }
.dtable th.n, .dtable td.n { text-align: end; }
.dtable tbody tr[data-act] { cursor: pointer; }
.dtable tbody tr:hover { background: var(--line-soft); }
.dtable tbody tr:focus-visible { outline: 2px solid var(--acc); outline-offset: -2px; }
.dtable tr.sel { background: var(--acc-soft); }
.dtable .ck { width: 36px; }
.dt-empty { text-align: center; color: var(--ink3); padding: 28px !important; }
.dt-pager { display: flex; align-items: center; justify-content: flex-end; gap: 6px; padding: 8px 12px; }
.bulk { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--ink); color: var(--bg); }
.bulk .btn { background: transparent; color: var(--bg); border-color: rgba(255, 255, 255, .3); }
.bad-t { color: var(--bad-text); }

.nt-row { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.nt-row:last-of-type { border-bottom: 0; }
.nt-row span { display: flex; flex-direction: column; }
.nt-row small { color: var(--ink3); font-size: 12.5px; }
.nt-row input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--acc); }

/* subscription (platform) */
.sub-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; margin-bottom: 12px; text-decoration: none; font-weight: 700; font-size: 14px; border: 1px solid var(--line); }
.sub-bar.info { background: var(--info-soft); color: var(--info-text); }
.sub-bar.warn { background: var(--warn-soft); color: var(--warn-text); }
.sub-bar.bad { background: var(--bad-soft); color: var(--bad-text); }
.kv2 { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; margin: 0; }
.kv2 dt { color: var(--ink3); }
.kv2 dd { margin: 0; }
.pay-info { margin-top: 12px; padding: 10px 12px; background: var(--card2); border-radius: 10px; }

.sub-plans { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 12px; margin-bottom: 12px; }
.sub-plan { display: flex; flex-direction: column; gap: 6px; }
.sub-plan.cur { border-color: color-mix(in srgb, var(--acc) 55%, var(--line)); }
.sub-plan .btn { margin-top: auto; justify-content: center; }
.sub-price b { font-size: 26px; }
.sub-price small { color: var(--ink3); }

/* notifications bell & inbox */
.icon-btn.bell { position: relative; }
.bell-n { position: absolute; top: 2px; inset-inline-end: 2px; font-style: normal; font-size: 10.5px; font-weight: 800; min-width: 17px; height: 17px; line-height: 17px; text-align: center; border-radius: 99px; background: var(--bad); color: #fff; padding: 0 4px; }
@media (min-width: 1024px) { body.has-side .top .bell { display: inline-flex; } }
.li.inb.unread { background: var(--acc-soft); }
.li.inb .s { white-space: normal; }
.udot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--acc); margin-top: 6px; }
.ch-list { display: grid; gap: 2px; }
.ch-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ch-row:last-child { border-bottom: 0; }
.ch-name { display: grid; gap: 2px; min-width: 150px; flex: 1; }
.ch-name .faint { font-size: 12.5px; }
.ch-tg { display: flex; gap: 6px; flex-wrap: wrap; }
.ch-chip { display: inline-flex; align-items: center; gap: 5px; padding: 6px 10px; border-radius: 99px; border: 1px solid var(--line); font-size: 13px; cursor: pointer; color: var(--muted); user-select: none; }
.ch-chip input { position: absolute; opacity: 0; pointer-events: none; }
.ch-chip:has(input:checked) { background: var(--acc-soft); border-color: var(--acc); color: var(--acc); font-weight: 700; }
.ch-chip:has(input:focus-visible) { outline: 2px solid var(--acc); outline-offset: 2px; }

/* الجوال الصغير: اللغة والخروج موجودين في «حسابي» — نخفف الشريط العلوي عشان يبان اسم المصنع */
@media (max-width: 420px) { .top .top-act > [data-act="lang"], .top .top-act > [data-act="logout"] { display: none; } }

/* الدعم الفني */
.sp-reply { margin-top: 6px; padding: 8px 10px; border-radius: 10px; background: var(--acc-soft); font-size: 14px; }
.sp-access { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); display: grid; gap: 6px; }

/* الآلات و QR */
.mc-status { display: grid; gap: 8px; margin-bottom: 12px; }
.mc-status.down { border-color: var(--bad); background: var(--bad-soft); }
.mc-status.up b { color: var(--ok-text); } .mc-status.down b { color: var(--bad-text); }
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 10px; }
.qr-card { border: 1px dashed var(--line); border-radius: 12px; padding: 10px; text-align: center; display: grid; gap: 4px; background: #fff; color: #111; }
.qr-card svg { width: 100%; height: auto; }
tr.warn-row td { background: var(--warn-soft); }

/* خانات القالب الموصوفة على صفحة المشروع */
.xf { display: inline-flex; gap: 4px; align-items: baseline; background: var(--card2); border: 1px solid var(--line); border-radius: 8px; padding: 2px 8px; font-size: 13px; }
.xf small { color: var(--ink3); }
