/* CRM — Leather&More */
:root {
  --deep: #1F140D; --forest: #3B2416; --pine: #5A3822; --emerald: #8B5A2B; --mint: #D9A66B; --lime: #E8C48F;
  --bg: #F6F2EC; --surface: #FFFFFF; --surface-2: #FBF8F4; --ink: #2A1D14; --muted: #6E5E52; --faint: #9A8B7F;
  --line: rgba(59, 36, 22, .10); --line-strong: rgba(59, 36, 22, .2);
  --danger: #C2412D; --danger-bg: #FCEDEA; --warn: #A87A0F; --warn-bg: #FBF3DC; --ok-bg: #F3EADF;
  --r-sm: 8px; --r: 12px; --r-lg: 16px;
  --shadow: 0 1px 2px rgba(31, 20, 13, .05), 0 4px 14px -6px rgba(31, 20, 13, .14);
  --shadow-lg: 0 12px 48px -12px rgba(31, 20, 13, .35);
  --f: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --f-display: 'Alexandria', 'IBM Plex Sans Arabic', sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15100C; --surface: #1E1611; --surface-2: #19130F; --ink: #F0E8E0; --muted: #B5A396; --faint: #85766A; --emerald: #C8915A; --pine: #6B4329;
    --line: rgba(255, 255, 255, .08); --line-strong: rgba(255, 255, 255, .16);
    --danger: #F08A76; --danger-bg: #3A1A14; --warn: #E6B94A; --warn-bg: #33290F; --ok-bg: #2E2117;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px -6px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--f); background: var(--bg); color: var(--ink); line-height: 1.6; -webkit-font-smoothing: antialiased; font-size: 15px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--emerald); outline-offset: 2px; border-radius: 6px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }

/* أزرار وحقول */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 10px;
  background: var(--forest); color: #fff; font-weight: 600; font-size: 14px; white-space: nowrap; transition: background .15s, transform .1s; }
.btn:hover { background: var(--pine); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 8px; color: var(--muted); }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.input, select.input, textarea.input { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); }
textarea.input { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
.input:focus { outline: none; border-color: var(--emerald); box-shadow: 0 0 0 3px color-mix(in srgb, var(--emerald) 18%, transparent); }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { margin-top: 5px; accent-color: var(--emerald); width: 16px; height: 16px; }

/* هيكل التطبيق */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; height: 60px; padding: 0 24px;
  background: var(--deep); color: #E7EFEB; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--f-display); font-weight: 600; font-size: 16px; white-space: nowrap; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--lime); color: var(--deep); display: grid; place-items: center; font-weight: 800; font-size: 11px; letter-spacing: -.02em; }
.brand small { font-family: var(--f); font-weight: 500; font-size: 12px; color: #9DB0A8; display: block; line-height: 1.2; }
.tabs { display: flex; gap: 4px; margin-inline-start: 12px; overflow-x: auto; scrollbar-width: none; }
.tab { height: 36px; padding: 0 14px; border-radius: 8px; color: #B9C9C2; font-weight: 500; font-size: 14px; white-space: nowrap; }
.tab:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.tab[aria-selected="true"] { color: var(--deep); background: var(--lime); font-weight: 600; }
.topbar .spacer { flex: 1; }
.user-chip { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--emerald); color: #fff; font-weight: 700; font-size: 13px; flex: none; }
.topbar .icon-btn { color: #B9C9C2; }
.topbar .icon-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.banner { background: var(--warn-bg); color: var(--warn); font-size: 13px; padding: 8px 24px; text-align: center; }

main.page { max-width: 1440px; margin: 0 auto; padding: 24px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--f-display); font-size: 22px; font-weight: 600; line-height: 1.3; }
.page-head p { color: var(--muted); font-size: 14px; }

/* بطاقات الإحصاء */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; text-align: start; transition: border-color .15s; }
button.stat:hover { border-color: var(--line-strong); }
.stat[aria-pressed="true"] { border-color: var(--emerald); box-shadow: inset 0 0 0 1px var(--emerald); }
.stat .label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat .value { font-family: var(--f-display); font-size: 28px; font-weight: 600; line-height: 1.3; font-variant-numeric: tabular-nums; }
.stat.danger .value { color: var(--danger); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

/* شريط الأدوات */
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .search { position: relative; flex: 1; min-width: 200px; max-width: 360px; }
.toolbar .search svg { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.toolbar .search .input { padding-inline-start: 36px; }
.toolbar select.input { width: auto; min-width: 140px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 10px; padding: 3px; background: var(--surface); }
.seg button { height: 32px; padding: 0 12px; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.seg button[aria-pressed="true"] { background: var(--forest); color: #fff; }

/* Pipeline */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(272px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.col { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-lg); display: flex; flex-direction: column; max-height: calc(100vh - 260px); min-height: 160px; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; font-weight: 600; font-size: 14px; border-bottom: 1px solid var(--line); }
.col-head .count { margin-inline-start: auto; font-size: 12px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; font-variant-numeric: tabular-nums; }
.col-body { padding: 10px; display: grid; gap: 8px; overflow-y: auto; align-content: start; }
.col.drop { border-color: var(--emerald); background: color-mix(in srgb, var(--emerald) 6%, var(--surface-2)); }
.col-empty { color: var(--faint); font-size: 13px; text-align: center; padding: 18px 8px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; text-align: start; width: 100%;
  box-shadow: 0 1px 1px rgba(6, 36, 25, .03); transition: border-color .15s, box-shadow .15s; display: grid; gap: 6px; cursor: pointer; }
.card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.card[draggable="true"] { cursor: grab; }
.card.dragging { opacity: .4; }
.card-top { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.order-no { font-weight: 600; color: var(--emerald); font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.card-title { font-weight: 600; font-size: 14px; line-height: 1.45; }
.card-client { font-size: 13px; color: var(--muted); }
.card-foot { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-top: 2px; }
.card-foot .people { margin-inline-start: auto; display: flex; }
.card-foot .people .avatar { width: 24px; height: 24px; font-size: 11px; border: 2px solid var(--surface); margin-inline-start: -6px; }
.due { display: inline-flex; align-items: center; gap: 4px; }
.due.late { color: var(--danger); font-weight: 600; }
.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--emerald); border-color: transparent; }
.badge.late { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }

/* الجداول */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: start; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--surface-2); }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }

/* لوحات وأقسام */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; }
.panel h2 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.panel > p { color: var(--muted); font-size: 14px; margin-bottom: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 40px; gap: 10px; align-items: center; font-size: 14px; padding: 6px 0; }
.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.bar > i { display: block; height: 100%; border-radius: 99px; }

/* اللوحة الجانبية لتفاصيل الطلب */
.scrim { position: fixed; inset: 0; background: rgba(6, 20, 15, .45); z-index: 40; opacity: 0; transition: opacity .2s; }
.scrim.open { opacity: 1; }
.drawer { position: fixed; top: 0; bottom: 0; inset-inline-end: 0; width: min(560px, 100%); background: var(--surface); z-index: 41;
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; transform: translateX(-100%); transition: transform .25s cubic-bezier(.22, 1, .36, 1); }
[dir="rtl"] .drawer { transform: translateX(-100%); inset-inline-end: auto; left: 0; }
.drawer.open { transform: none; }
.drawer-head { padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: flex-start; }
.drawer-head h2 { font-size: 18px; font-weight: 600; line-height: 1.4; }
.drawer-head .meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.drawer-body { padding: 20px; overflow-y: auto; display: grid; gap: 20px; align-content: start; flex: 1; }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.kv div { display: grid; gap: 2px; }
.kv dt { font-size: 12px; color: var(--muted); }
.kv dd { font-size: 14px; font-weight: 500; }
.section-title { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.desc { white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; font-size: 14px; line-height: 1.8; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px 0 4px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; }
.chip .avatar { width: 22px; height: 22px; font-size: 10px; }
.chip small { color: var(--faint); font-size: 11px; }
.timeline { display: grid; gap: 12px; }
.tl { display: grid; grid-template-columns: 28px 1fr; gap: 10px; font-size: 14px; }
.tl .avatar { width: 28px; height: 28px; font-size: 11px; }
.tl.sys .avatar { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.tl .who { font-size: 12px; color: var(--muted); }
.tl .who b { color: var(--ink); font-weight: 600; }
.tl.sys .body { color: var(--muted); }
.note-form { display: grid; gap: 8px; }
.note-form .row { display: flex; justify-content: flex-end; }
.assign-list { display: grid; gap: 4px; max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--r); padding: 6px; }
.assign-list label { display: flex; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.assign-list label:hover { background: var(--surface-2); }

/* نافذة */
dialog { border: 0; border-radius: var(--r-lg); padding: 0; width: min(460px, calc(100% - 32px)); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); margin: auto; }
dialog::backdrop { background: rgba(6, 20, 15, .45); }
dialog form { padding: 22px; display: grid; gap: 14px; }
dialog h3 { font-size: 17px; font-weight: 600; }
dialog .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }

/* تنبيه */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); background: var(--deep); color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 14px; z-index: 60; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; box-shadow: var(--shadow-lg); max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }
.err { color: var(--danger); font-size: 13px; min-height: 1em; }

/* صفحات الدخول */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 600px at 80% -10%, #12805C55, transparent 60%), var(--deep); }
.auth-card { width: min(420px, 100%); background: var(--surface); border-radius: 20px; padding: 32px 28px; box-shadow: var(--shadow-lg); display: grid; gap: 18px; }
.auth-card h1 { font-family: var(--f-display); font-size: 22px; font-weight: 600; }
.auth-card .sub { color: var(--muted); font-size: 14px; margin-top: -10px; }
.auth-card .btn { height: 46px; width: 100%; font-size: 15px; }
.auth-switch { text-align: center; font-size: 13px; color: var(--muted); }
.auth-switch a { color: var(--emerald); font-weight: 600; text-decoration: none; }
.portals { width: min(760px, 100%); display: grid; gap: 24px; }
.portals header { text-align: center; color: #E7EFEB; }
.portals header h1 { font-family: var(--f-display); font-size: 28px; font-weight: 600; }
.portals header p { color: #9DB0A8; }
.portal-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.portal { background: var(--surface); border-radius: 20px; padding: 26px; display: grid; gap: 10px; text-decoration: none; transition: transform .15s, box-shadow .15s; box-shadow: var(--shadow); }
.portal:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.portal .ic { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: var(--ok-bg); color: var(--emerald); }
.portal.admin .ic { background: var(--lime); color: var(--deep); }
.portal h2 { font-size: 18px; font-weight: 600; }
.portal p { color: var(--muted); font-size: 14px; }
.portal span.go { color: var(--emerald); font-weight: 600; font-size: 14px; }

@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  main.page { padding: 16px; }
  .topbar { padding: 0 12px; gap: 8px; flex-wrap: wrap; height: auto; min-height: 56px; padding-block: 8px; }
  .tabs { order: 3; width: 100%; margin: 0; }
  .user-chip .name { display: none; }
  .brand small { display: none; }
  .portal-grid { grid-template-columns: 1fr; }
  .board { grid-auto-columns: 86%; }
  .kv { grid-template-columns: 1fr 1fr; }
  .bar-row { grid-template-columns: 96px 1fr 32px; }
  .toolbar .search { max-width: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* العمل والمؤقت */
.work-chip { display: inline-flex; align-items: center; gap: 6px; align-self: start; justify-self: start; width: max-content; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.work-chip.running { background: color-mix(in srgb, var(--emerald) 14%, var(--surface)); color: var(--emerald); }
.work-chip.done { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); font-weight: 500; }
.col-head .work-chip { height: 20px; padding: 0 7px; font-size: 11px; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.live-timer { font-variant-numeric: tabular-nums; }
.card.working { border-color: color-mix(in srgb, var(--emerald) 45%, var(--line)); }
.work-box { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 14px 16px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface-2); }
.work-box.running { border-color: color-mix(in srgb, var(--emerald) 40%, var(--line)); background: color-mix(in srgb, var(--emerald) 7%, var(--surface)); }
.work-label { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.work-box.running .work-label { color: var(--emerald); }
.work-clock { display: block; font-family: var(--f-display); font-size: 30px; font-weight: 600; line-height: 1.3; direction: ltr; text-align: right; unicode-bidi: isolate; }
.work-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.btn-start { background: var(--emerald); height: 44px; padding: 0 20px; font-size: 15px; }
.btn-start:hover { background: var(--pine); }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }

/* شاشة الورشة: اختيار الموظف */
.worker-dialog { width: min(520px, calc(100% - 32px)); }
.worker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.worker-btn { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); font-weight: 600; font-size: 15px; text-align: start; }
.worker-btn:hover:not(:disabled) { border-color: var(--emerald); }
.worker-btn[aria-pressed="true"] { border-color: var(--emerald); box-shadow: inset 0 0 0 1px var(--emerald); background: color-mix(in srgb, var(--emerald) 8%, var(--surface)); }
.worker-btn:disabled { cursor: default; opacity: 1; }
.worker-btn .avatar { width: 34px; height: 34px; flex: none; }
.pin-input { font-size: 22px; letter-spacing: .4em; text-align: center; height: 52px; }
.page.workshop .card-title { font-size: 15px; }
.work-clock.dur { direction: rtl; text-align: start; font-size: 24px; }

/* شاشة الورشة: شريط أسماء الموظفين */
.worker-chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; margin-bottom: 8px; scrollbar-width: thin; }
.worker-chip { flex: none; display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px 0 10px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); font-weight: 600; font-size: 14px; white-space: nowrap; }
.worker-chip:first-child { padding-inline: 18px; }
.worker-chip .avatar { width: 28px; height: 28px; font-size: 11px; }
.worker-chip[aria-pressed="true"] { border-color: var(--emerald); background: color-mix(in srgb, var(--emerald) 12%, var(--surface)); box-shadow: inset 0 0 0 1px var(--emerald); }
.chip-count { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }
.chip-count.working { background: color-mix(in srgb, var(--emerald) 18%, var(--surface)); color: var(--emerald); border-color: transparent; }

/* العمل على أجزاء */
.work-chip.partial { background: var(--warn-bg); color: var(--warn); font-weight: 500; white-space: normal; height: auto; min-height: 24px; padding-block: 2px; }
.work-chip.waiting { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); font-weight: 500; }
.card.mine-done { opacity: .62; }
.card-foot .people .avatar.done { outline: 2px solid var(--emerald); outline-offset: -2px; }
.card-foot .people .avatar.now { box-shadow: 0 0 0 2px var(--emerald); }
.work-box { flex-direction: column; align-items: stretch; }
.work-head { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.work-steps { list-style: none; display: grid; gap: 6px; border-top: 1px solid var(--line); padding-top: 10px; }
.work-steps li { display: flex; align-items: center; gap: 10px; font-size: 14px; min-height: 36px; }
.work-steps li .who { font-weight: 600; flex: 1; }
.work-steps li .what { color: var(--muted); font-variant-numeric: tabular-nums; }
.work-steps li.now .what { color: var(--emerald); font-weight: 600; }
.work-steps li.done .what { color: var(--emerald); }
.work-steps li .avatar { width: 28px; height: 28px; font-size: 11px; }
.work-steps li .who { display: flex; flex-direction: column; line-height: 1.35; }
.work-steps li .who small { font-weight: 400; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.work-steps li .step-no { width: 20px; height: 20px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); flex: none; }
.work-steps li.done .step-no { background: var(--ok-bg); color: var(--emerald); border-color: transparent; }
.work-steps li.now .step-no { background: var(--emerald); color: #fff; border-color: transparent; }
.work-steps li.todo { opacity: .7; }

/* اللغة الإنجليزية: اتجاه من اليسار */
[dir="ltr"] .drawer { left: auto; right: 0; transform: translateX(100%); }
[dir="ltr"] .drawer.open { transform: none; }
[dir="ltr"] .work-clock { text-align: left; }
.tr-pending body { visibility: hidden; }
.lang-btn { height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line-strong); font-size: 13px; font-weight: 600; color: var(--ink); background: var(--surface); white-space: nowrap; }
.lang-btn:hover { background: var(--surface-2); }
.lang-float { position: fixed; top: 14px; inset-inline-end: 14px; z-index: 5; }
.auth .lang-btn { background: color-mix(in srgb, var(--surface) 92%, transparent); }

/* ---------- القطع والمهام ---------- */
.card-doing { font-size: 12.5px; color: var(--ink); background: var(--ok-bg); border-radius: 8px; padding: 4px 8px; margin-top: 6px; line-height: 1.5; overflow-wrap: anywhere; }
.chip-doing { display: block; font-size: 11px; color: var(--muted); max-width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-pick { display: grid; gap: 10px; margin: 12px 0; max-height: 46vh; overflow-y: auto; }
.task-item { border: 1px solid var(--line-strong); border-radius: 10px; padding: 8px 12px 10px; margin: 0; min-width: 0; }
.task-item legend { font-weight: 700; font-size: 14px; padding: 0 4px; }
.task-text { display: block; font-size: 12px; color: var(--faint); margin: 2px 0 6px; overflow-wrap: anywhere; text-align: start; }
.task-chks { display: flex; flex-wrap: wrap; gap: 6px; }
.task-chk { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong); border-radius: 999px; padding: 6px 12px; min-height: 36px; cursor: pointer; font-size: 14px; }
.task-chk:has(input:checked) { background: var(--ok-bg); border-color: var(--emerald); font-weight: 600; }
.task-chk input { width: 18px; height: 18px; accent-color: var(--emerald); }
.task-extra { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; }
.task-extra.hidden { display: none; }
@media (max-width: 480px) { .task-extra { grid-template-columns: 1fr; } }
.items-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.items-list > li { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.item-head { font-size: 14px; margin-bottom: 6px; }
.task-state { display: inline-flex; align-items: center; font-size: 12.5px; border-radius: 999px; padding: 3px 10px; border: 1px solid var(--line-strong); }
.task-state.running { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.task-state.done { background: var(--ok-bg); color: var(--emerald); border-color: transparent; }
.task-state small { color: var(--muted); margin-inline-start: 2px; }
.items-edit { display: grid; gap: 10px; }
.item-edit { border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px; display: grid; gap: 8px; }
.item-edit-top { display: grid; grid-template-columns: 70px 1fr 1.4fr 36px; gap: 6px; align-items: center; }
@media (max-width: 480px) { .item-edit-top { grid-template-columns: 64px 1fr 36px; } .item-edit-top select:nth-of-type(2) { grid-column: 1 / -1; grid-row: 2; } }
table.report td, table.report th { white-space: nowrap; }
table.report td:last-child { white-space: normal; }
.bar-cell { position: relative; min-width: 140px; }
.bar-cell .bar { display: inline-block; height: 10px; border-radius: 999px; background: var(--emerald); opacity: .8; vertical-align: middle; margin-inline-end: 8px; min-width: 2px; max-width: calc(100% - 48px); }
.panel table .input:not([type="number"]) { min-width: 120px; }

/* ---------- الدفع ---------- */
.pay-chip { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.pay-paid { background: var(--ok-bg); color: var(--emerald); }
.pay-partial { background: var(--warn-bg); color: var(--warn); }
.pay-unpaid { background: var(--danger-bg); color: var(--danger); }
.pay-none { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.card-top { flex-wrap: wrap; row-gap: 4px; }
