/* Production Tracker demo. Logical properties throughout so RTL and LTR both work. */
:root {
  --ink: #12302e;
  --ink-2: #2c4a47;
  --muted: #5d7472;
  --bg: #edf3f2;
  --card: #ffffff;
  --line: #dce8e6;

  --brand: #0b7a75;
  --brand-700: #0b5d59;
  --brand-900: #073e3b;
  --brand-50: #e3f4f1;
  --brand-100: #c5e8e3;

  --amber: #f59e0b;
  --amber-700: #b45309;
  --amber-50: #fff4db;
  --coral: #e5484d;
  --coral-700: #b42328;
  --coral-50: #fdeced;
  --green: #15803d;
  --green-50: #e3f6e9;
  --orange: #ea580c;
  --orange-50: #ffeddf;
  --blue: #2563eb;
  --blue-50: #e6eefe;
  --gold: #ca8a04;
  --gold-50: #fef5d6;

  --r-sm: 10px;
  --r: 16px;
  --r-lg: 22px;
  --shadow: 0 1px 2px rgba(12, 52, 49, .06), 0 6px 20px rgba(12, 52, 49, .07);
  --shadow-lg: 0 10px 40px rgba(7, 40, 38, .22);
  --font: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
* { font-synthesis: none; }
i, em, cite, address, dfn, var { font-style: normal; }
html { -webkit-text-size-adjust: 100%; scroll-padding-block-start: 110px; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(1200px 380px at 50% -120px, #d4ece8 0%, rgba(212, 236, 232, 0) 70%),
    var(--bg);
  min-block-size: 100vh;
}
body.has-modal { overflow: hidden; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.5rem; font-weight: 700; line-height: 1.3; }
h2 { font-size: 1.15rem; font-weight: 700; line-height: 1.35; }
h3 { font-size: 1rem; font-weight: 600; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

.ico { inline-size: 1.15em; block-size: 1.15em; flex: none; vertical-align: -0.2em; }
[dir="rtl"] .ico-flip, [dir="rtl"] .di-arrow .ico, [dir="rtl"] .wc-go .ico { transform: scaleX(-1); }

:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

/* ---------------- Top bar ---------------- */
.topbar {
  background: linear-gradient(120deg, var(--brand-900) 0%, var(--brand-700) 55%, #0d7f78 100%);
  color: #fff;
  position: sticky;
  inset-block-start: 0;
  z-index: 20;
  box-shadow: 0 2px 14px rgba(7, 40, 38, .25);
}
.topbar-inner {
  max-inline-size: 1360px;
  margin-inline: auto;
  padding-block: 12px;
  padding-inline: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.brand { display: flex; align-items: center; gap: 12px; flex: none; }
.brand-mark svg { display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 1.1rem; font-weight: 700; }
.brand-text small { color: #b8e2dc; font-size: .8rem; }

.top-actions { display: flex; align-items: center; gap: 8px; flex: none; margin-inline-start: auto; }
.btn-top {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(255, 255, 255, .12);
  color: #fff;
  border-radius: 999px;
  padding-block: 8px;
  padding-inline: 14px;
  font-weight: 600;
  font-size: .9rem;
  white-space: nowrap;
}
.btn-top:hover { background: rgba(255, 255, 255, .2); }
.btn-top-ghost { background: transparent; }

/* ---------------- Layout ---------------- */
.app {
  max-inline-size: 1360px;
  margin-inline: auto;
  padding-block: 24px 64px;
  padding-inline: 24px;
}
.card {
  background: var(--card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  border: 1px solid rgba(220, 232, 230, .7);
  padding: 22px;
}
.card-head { display: flex; align-items: flex-start; gap: 14px; margin-block-end: 20px; }
.card-head-sm { margin-block-end: 16px; }
.card-head-sm h2 { display: flex; align-items: center; gap: 8px; }
.head-ico {
  display: grid;
  place-items: center;
  inline-size: 44px;
  block-size: 44px;
  border-radius: 14px;
  background: var(--brand-50);
  color: var(--brand);
  flex: none;
}
.head-ico .ico { inline-size: 22px; block-size: 22px; }
.card-head-sm .head-ico { inline-size: 38px; block-size: 38px; border-radius: 12px; }
.card-head-sm .head-ico .ico { inline-size: 19px; block-size: 19px; }
.head-ico-coral { background: var(--coral-50); color: var(--coral); }
.head-ico-green { background: var(--green-50); color: var(--green); }
.head-ico-amber { background: var(--amber-50); color: var(--amber-700); }
.head-ico-orange { background: var(--orange-50); color: var(--orange); }
.head-ico-blue { background: var(--blue-50); color: var(--blue); }
.card-head p { margin-block-start: 2px; font-size: .92rem; }

.count-badge {
  display: inline-grid;
  place-items: center;
  min-inline-size: 26px;
  block-size: 26px;
  padding-inline: 8px;
  border-radius: 999px;
  background: var(--coral-50);
  color: var(--coral-700);
  font-size: .85rem;
  font-weight: 700;
}
.count-green { background: var(--green-50); color: var(--green); }
.sub-title .count-badge { background: var(--brand-50); color: var(--brand-700); }

/* ---------------- Chips + avatars ---------------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding-block: 3px;
  padding-inline: 10px;
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.5;
}
.chip .ico { inline-size: 14px; block-size: 14px; }
.chip-sm { padding-block: 1px; padding-inline: 8px; font-size: .76rem; }
.chip-teal { background: var(--brand-50); color: var(--brand-700); }
.chip-orange { background: var(--orange-50); color: #b9440a; }
.chip-blue { background: var(--blue-50); color: #1d4fc4; }
.chip-open { background: var(--coral-50); color: var(--coral-700); }
.chip-closed { background: var(--green-50); color: var(--green); }
.chip-ro { background: rgba(255, 255, 255, .16); color: #fff; border: 1px solid rgba(255, 255, 255, .3); }

.avatar {
  display: inline-grid;
  place-items: center;
  inline-size: 40px;
  block-size: 40px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
  flex: none;
}
.avatar-sm { inline-size: 32px; block-size: 32px; font-size: .9rem; }
.avatar-lg { inline-size: 50px; block-size: 50px; font-size: 1.25rem; }
.avatar-xl { inline-size: 68px; block-size: 68px; font-size: 1.7rem; border: 3px solid rgba(255, 255, 255, .5); }
.tone-1 { background: #e8590c; }
.tone-2 { background: #0b7a75; }
.tone-3 { background: #2563eb; }
.tone-4 { background: #c2410c; }
.tone-5 { background: #0e9f6e; }
.tone-6 { background: #b45309; }
.tone-7 { background: #db2777; }
.tone-8 { background: #0369a1; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 14px;
  padding-block: 12px;
  padding-inline: 20px;
  font-weight: 700;
  min-block-size: 48px;
  transition: transform .08s, background .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(11, 122, 117, .3); }
.btn-primary:hover { background: var(--brand-700); }
.btn-accent { background: var(--amber); color: #3b2300; box-shadow: 0 4px 12px rgba(245, 158, 11, .3); }
.btn-accent:hover { background: #e48f05; }
.btn-danger { background: var(--coral); color: #fff; }
.btn-danger:hover { background: var(--coral-700); }
.btn-ghost { background: transparent; color: var(--ink-2); border: 1.5px solid var(--line); }
.btn-ghost:hover { background: #f4f8f7; }
.btn-on-dark { color: #fff; border-color: rgba(255, 255, 255, .35); }
.btn-on-dark:hover { background: rgba(255, 255, 255, .12); }
.btn-xl { min-block-size: 60px; font-size: 1.1rem; padding-inline: 28px; border-radius: 16px; }
.icon-btn {
  display: grid;
  place-items: center;
  inline-size: 44px;
  block-size: 44px;
  border-radius: 12px;
  border: 0;
  background: #f1f6f5;
  color: var(--ink-2);
  margin-inline-start: auto;
  flex: none;
}
.icon-btn:hover { background: #e3eceb; }

/* ---------------- Forms ---------------- */
.field { margin-block-end: 22px; }
.label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink-2);
  margin-block-end: 10px;
}
.label .ico { color: var(--brand); }
.unit-tag {
  background: var(--amber-50);
  color: var(--amber-700);
  border-radius: 999px;
  padding-inline: 10px;
  font-size: .82rem;
  font-weight: 700;
}
.input {
  inline-size: 100%;
  min-block-size: 56px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: #fbfdfd;
  padding-inline: 16px;
  font-size: 1.05rem;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(11, 122, 117, .14); background: #fff; }
.textarea { padding-block: 12px; min-block-size: 76px; resize: vertical; line-height: 1.5; }
.input-sm { min-block-size: 44px; font-size: .95rem; border-radius: 12px; padding-inline: 12px; }
.field-date .input { max-inline-size: 260px; }

/* auto-fill: a button never gets narrower than avatar + name need (fixes squeezed names at 1024-1180px). */
.worker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 10px; border-radius: 16px; }
.pick-worker {
  display: flex;
  align-items: center;
  gap: 10px;
  min-block-size: 64px;
  padding-block: 10px;
  padding-inline: 12px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: #fff;
  text-align: start;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.pick-worker:hover { border-color: var(--brand-100); background: #f7fbfa; }
.pick-worker.is-on { border-color: var(--brand); background: var(--brand-50); box-shadow: 0 0 0 3px rgba(11, 122, 117, .12); }
.pw-text { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-inline-size: 0; }
.pw-name { font-weight: 700; font-size: 1.05rem; line-height: 1.3; white-space: nowrap; }

.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; border-radius: 16px; }
.seg-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-block-size: 68px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: #fff;
  line-height: 1.3;
  transition: all .15s;
  border-block-start-width: 5px;
}
.seg-btn strong { font-size: 1.1rem; }
.seg-btn small { color: var(--muted); font-size: .85rem; }
.seg-teal { border-block-start-color: var(--brand); }
.seg-orange { border-block-start-color: var(--orange); }
.seg-blue { border-block-start-color: var(--blue); }
.seg-btn.is-on.seg-teal { background: var(--brand-50); border-color: var(--brand); }
.seg-btn.is-on.seg-orange { background: var(--orange-50); border-color: var(--orange); }
.seg-btn.is-on.seg-blue { background: var(--blue-50); border-color: var(--blue); }

.tiles { display: grid; gap: 10px; border-radius: 16px; }
.tiles-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-block-size: 92px;
  padding: 12px 8px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: #fff;
  text-align: center;
  transition: all .15s;
}
.tile:hover { border-color: var(--brand-100); }
.tile-ico { display: grid; place-items: center; inline-size: 36px; block-size: 36px; border-radius: 10px; background: #f1f6f5; color: var(--muted); }
.tile-name { font-weight: 700; line-height: 1.3; }
.tile-sub { font-size: .8rem; color: var(--muted); }
.tile.is-on { border-color: var(--amber); background: var(--amber-50); box-shadow: 0 0 0 3px rgba(245, 158, 11, .16); }
.tile.is-on .tile-ico { background: var(--amber); color: #fff; }
.tile.is-dim:not(.is-on) { opacity: .55; }

.stepper { display: flex; align-items: stretch; gap: 10px; max-inline-size: 420px; }
.step-btn {
  inline-size: 64px;
  min-block-size: 64px;
  border-radius: 16px;
  border: 2px solid var(--line);
  background: #f4f9f8;
  color: var(--brand-700);
  display: grid;
  place-items: center;
  flex: none;
}
.step-btn:hover { background: var(--brand-50); border-color: var(--brand-100); }
.step-btn .ico { inline-size: 24px; block-size: 24px; }
.qty-input {
  flex: 1;
  min-inline-size: 0;
  min-block-size: 64px;
  border: 2px solid var(--line);
  border-radius: 16px;
  text-align: center;
  font-size: 1.6rem;
  font-weight: 700;
  background: #fbfdfd;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}
.qty-input::-webkit-outer-spin-button, .qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(11, 122, 117, .14); background: #fff; }

.mode { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode-btn {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: #fff;
  text-align: start;
  min-block-size: 76px;
  transition: all .15s;
}
.mode-btn .ico { inline-size: 26px; block-size: 26px; color: var(--muted); margin-block-start: 2px; }
.mode-btn span { display: flex; flex-direction: column; line-height: 1.35; }
.mode-btn small { color: var(--muted); font-size: .85rem; }
.mode-btn.is-on { border-color: var(--brand); background: var(--brand-50); }
.mode-btn.is-on .ico { color: var(--brand); }

.return-block {
  border-radius: 18px;
  background: linear-gradient(180deg, #fff9ec 0%, #fffdf7 100%);
  border: 1.5px dashed #f3cf87;
  padding: 18px;
  margin-block-end: 22px;
}
.return-block .field:last-child { margin-block-end: 0; }
.hint { display: flex; align-items: center; gap: 6px; margin-block-start: 10px; color: var(--amber-700); font-weight: 600; font-size: .92rem; }

.field-error {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-block-start: 8px;
  color: var(--coral-700);
  font-weight: 600;
  font-size: .95rem;
}
.has-error .input, .has-error .qty-input, .has-error .step-btn,
.has-error .pick-worker, .has-error .seg-btn, .has-error .tile { border-color: #f2a5a8; }
.has-error .input, .has-error .qty-input { background: #fff7f7; }

.form-actions, .modal-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.form-actions .btn-xl { flex: 1; max-inline-size: 420px; }

/* ---------------- Keeper ---------------- */
.keeper-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(320px, 1fr); gap: 22px; align-items: start; }
.keeper-side { display: grid; gap: 22px; position: sticky; inset-block-start: 92px; }
.open-list, .done-list, .bd-list, .w-today-list, .kpi-list { list-style: none; margin: 0; padding: 0; }
.open-list { display: grid; gap: 10px; max-block-size: 520px; overflow-y: auto; padding-inline-end: 2px; }
.open-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  background: #fff8f7;
  border: 1px solid #f8d7d8;
  border-inline-start: 5px solid var(--coral);
}
.oi-main { display: flex; gap: 10px; align-items: flex-start; min-inline-size: 0; }
.oi-text { min-inline-size: 0; }
.oi-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.oi-qty { font-weight: 700; font-size: 1.05rem; }
.oi-qty .muted { font-weight: 500; font-size: .92rem; }
.oi-meta { display: flex; align-items: center; gap: 4px; font-size: .84rem; }
.oi-meta .ico { inline-size: 14px; block-size: 14px; }
.open-item .btn { min-block-size: 46px; padding-inline: 14px; font-size: .92rem; }

.done-list { display: grid; gap: 4px; }
.done-item { display: flex; align-items: center; gap: 10px; padding-block: 8px; border-block-end: 1px solid #eef3f2; }
.done-item:last-child { border-block-end: 0; }
.di-text { flex: 1; min-inline-size: 0; font-size: .93rem; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.di-arrow { color: var(--muted); display: inline-flex; }
.di-arrow .ico { inline-size: 14px; block-size: 14px; }
.di-out { color: var(--green); font-weight: 700; }
.di-time { font-size: .82rem; font-variant-numeric: tabular-nums; }
.empty-mini { display: flex; align-items: center; gap: 8px; color: var(--muted); padding: 12px; border-radius: 12px; background: #f5f9f8; }
.empty-mini .ico { color: var(--green); }

/* ---------------- Admin ---------------- */
.admin-head { display: flex; align-items: flex-end; justify-content: space-between; margin-block-end: 16px; }
.admin-head p { display: flex; align-items: center; gap: 6px; margin-block-start: 2px; }
.filters { padding: 14px 16px; margin-block-end: 18px; }
.filters-row { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; justify-content: space-between; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; background: #f1f6f5; padding: 5px; border-radius: 14px; }
.pill {
  border: 0;
  background: transparent;
  padding-block: 9px;
  padding-inline: 16px;
  border-radius: 10px;
  font-weight: 600;
  color: var(--ink-2);
  min-block-size: 42px;
}
.pill:hover { background: #e3eceb; }
.pill.is-on { background: var(--brand); color: #fff; box-shadow: 0 3px 10px rgba(11, 122, 117, .3); }
.selects, .custom-range { display: flex; gap: 10px; flex-wrap: wrap; }
.custom-range { margin-block-start: 12px; }
.mini-field { display: flex; flex-direction: column; gap: 4px; font-size: .82rem; font-weight: 600; color: var(--muted); min-inline-size: 170px; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-block-end: 22px; }
.kpi {
  border-radius: var(--r-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  border: 1px solid transparent;
  position: relative;
  overflow: hidden;
}
.kpi::after {
  content: "";
  position: absolute;
  inset-block-start: -40px;
  inset-inline-end: -40px;
  inline-size: 120px;
  block-size: 120px;
  border-radius: 50%;
  opacity: .5;
}
.kpi-top { display: flex; align-items: center; gap: 10px; margin-block-end: 10px; position: relative; z-index: 1; }
.kpi-top h3 { font-size: .95rem; }
.kpi-ico { display: grid; place-items: center; inline-size: 36px; block-size: 36px; border-radius: 11px; color: #fff; }
.kpi-value { font-size: 2.3rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; position: relative; z-index: 1; }
.kpi-value small { font-size: .95rem; font-weight: 600; color: var(--muted); }
.kpi-sub { font-size: .85rem; color: var(--muted); margin-block-start: 6px; display: flex; align-items: center; gap: 6px; position: relative; z-index: 1; }
.kpi-list { display: grid; gap: 4px; position: relative; z-index: 1; }
.kpi-list li { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: .9rem; }
.kpi-list strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.kpi-list small { color: var(--muted); font-weight: 600; font-size: .8rem; }
.kpi-teal { background: linear-gradient(160deg, #e2f4f1, #f6fcfb); border-color: #cbe9e4; }
.kpi-teal .kpi-ico { background: var(--brand); }
.kpi-teal::after { background: #c3e7e1; }
.kpi-amber { background: linear-gradient(160deg, #fff1d1, #fffaf0); border-color: #fbe3ac; }
.kpi-amber .kpi-ico { background: var(--amber); }
.kpi-amber::after { background: #fde4a6; }
.kpi-green { background: linear-gradient(160deg, #ddf4e5, #f5fcf7); border-color: #c4ead1; }
.kpi-green .kpi-ico { background: var(--green); }
.kpi-green::after { background: #c3ebd0; }
.kpi-gold { background: linear-gradient(160deg, #fdf1c7, #fffbec); border-color: #f5e09a; }
.kpi-gold .kpi-ico { background: var(--gold); }
.kpi-gold::after { background: #f8e6a3; }
.kpi-coral { background: linear-gradient(160deg, #fde3e4, #fff7f7); border-color: #f7c9cb; }
.kpi-coral .kpi-ico { background: var(--coral); }
.kpi-coral::after { background: #f8cdd0; }
.kpi-blue { background: linear-gradient(160deg, #e1ebfe, #f6f9ff); border-color: #ccdcfc; }
.kpi-blue .kpi-ico { background: var(--blue); }
.kpi-blue::after { background: #cfdefd; }
.meter { block-size: 8px; border-radius: 99px; background: rgba(0, 0, 0, .07); overflow: hidden; margin-block-start: 10px; position: relative; z-index: 1; }
.meter span { display: block; block-size: 100%; border-radius: 99px; background: currentColor; }
.kpi-green .meter { color: var(--green); }
.kpi-gold .meter { color: var(--gold); }
.kpi-coral .meter { color: var(--coral); }
.dot { inline-size: 8px; block-size: 8px; border-radius: 50%; display: inline-block; }
.dot-coral { background: var(--coral); }

.admin-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); gap: 22px; align-items: start; }
.admin-side { display: grid; gap: 22px; }
.worker-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.worker-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: start;
  background: #fbfdfd;
  border: 1.5px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.worker-card:hover { border-color: var(--brand-100); box-shadow: 0 8px 22px rgba(12, 52, 49, .1); transform: translateY(-2px); }
.wc-head { display: flex; align-items: center; gap: 12px; }
.wc-title { flex: 1; min-inline-size: 0; }
.wc-name { font-size: 1.15rem; display: block; }
.wc-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-block-start: 3px; }
.wc-ratio {
  font-weight: 700;
  font-size: .95rem;
  padding-block: 4px;
  padding-inline: 10px;
  border-radius: 10px;
  font-variant-numeric: tabular-nums;
}
.tone-good { background: var(--green-50); color: var(--green); }
.tone-warn { background: var(--gold-50); color: #8a5d00; }
.tone-bad { background: var(--coral-50); color: var(--coral-700); }
.tone-muted { background: #eef3f2; color: var(--muted); }
.tone-text { background: none; font-weight: 700; font-size: .9rem; }
.wc-sentence { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-weight: 600; font-size: 1rem; line-height: 1.5; }
.wc-sentence > span { display: inline-flex; align-items: center; gap: 6px; }
.seg-in { color: var(--brand-700); }
.seg-out { color: #9a5b00; }
.seg-wait { color: var(--coral-700); }
.seg-sep { color: #a8bbb9; }
.wc-foot { display: flex; align-items: center; justify-content: space-between; font-size: .85rem; border-block-start: 1px dashed var(--line); padding-block-start: 10px; }
.wc-go { color: var(--brand); display: inline-flex; }

.bd-list { display: grid; gap: 16px; }
.bd-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-block-end: 6px; }
.bd-name { display: flex; align-items: center; gap: 8px; font-size: .92rem; }
.bd-total { font-weight: 700; font-variant-numeric: tabular-nums; }
.bd-total small { color: var(--muted); font-weight: 600; }
.bar { block-size: 12px; border-radius: 99px; background: #eef3f2; overflow: hidden; }
.bar span { display: block; block-size: 100%; border-radius: 99px; min-inline-size: 4px; transition: inline-size .3s; }
.bar-teal span { background: linear-gradient(90deg, #0b7a75, #22a39b); }
.bar-orange span { background: linear-gradient(90deg, #ea580c, #fb8a3c); }
.bar-blue span { background: linear-gradient(90deg, #2563eb, #5b8def); }
.bar-gold span { background: linear-gradient(90deg, #d97706, #f5b100); }
.bd-meta { display: flex; justify-content: space-between; gap: 8px; margin-block-start: 6px; font-size: .84rem; color: var(--muted); flex-wrap: wrap; }
.bd-meta span { display: inline-flex; align-items: center; gap: 4px; }
.bd-meta .ico { inline-size: 14px; block-size: 14px; }
.swatch { inline-size: 12px; block-size: 12px; border-radius: 4px; display: inline-block; }
.sw-teal { background: var(--brand); }
.sw-gold { background: #e9a100; }
.sw-orange { background: var(--orange); }
.sw-blue { background: var(--blue); }

.empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 40px 16px;
  border-radius: 18px;
  background: #f5f9f8;
  text-align: center;
}
.empty-ico { inline-size: 40px; block-size: 40px; color: var(--brand-100); }
.empty-sm { padding: 24px 16px; }

/* ---------------- Charts + tables ---------------- */
.sub-title { margin-block: 20px 10px; display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
.chart-box { background: linear-gradient(180deg, #f7fbfa, #fff); border: 1px solid var(--line); border-radius: 16px; padding: 10px 6px 4px; }
.chart { display: block; inline-size: 100%; block-size: auto; }
.chart .grid { stroke: #e4eceb; stroke-width: 1; }
.chart .grid-base { stroke: #c9d8d6; }
.chart .axis { fill: #6f8583; font-size: 12px; font-family: var(--font); }
.chart .axis-sm { font-size: 10.5px; }
.chart .axis-today { fill: var(--brand-700); font-weight: 700; }
.chart .bar-rect { fill: #5fb7ae; }
.chart .bar-rect.is-today { fill: var(--amber); }
.chart .bar-off { fill: #e4eceb; }
.chart .bar-open { fill: var(--coral); stroke: #fff; stroke-width: 2; }
.chart .bar-val { fill: var(--ink-2); font-size: 11.5px; font-weight: 700; font-family: var(--font); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; }
.table { inline-size: 100%; border-collapse: collapse; font-size: .92rem; min-inline-size: 640px; }
.table th {
  text-align: start;
  background: #f3f8f7;
  color: var(--muted);
  font-weight: 700;
  font-size: .82rem;
  padding-block: 10px;
  padding-inline: 12px;
  white-space: nowrap;
}
.table td { padding-block: 10px; padding-inline: 12px; border-block-start: 1px solid #eef3f2; vertical-align: top; }
.table .num { font-weight: 700; font-variant-numeric: tabular-nums; }
.td-sub { font-size: .8rem; }
.td-note { max-inline-size: 220px; color: var(--ink-2); }
.row-open td { background: #fffafa; }

/* ---------------- Worker view ---------------- */
.picker-card { max-inline-size: 900px; margin-inline: auto; }
.worker-grid-lg { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.pick-worker-lg { flex-direction: column; justify-content: center; min-block-size: 130px; text-align: center; }
.pick-worker-lg .pw-name { flex: none; font-size: 1.15rem; }

.worker-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  color: #fff;
  border-radius: var(--r-lg);
  padding: 22px 24px;
  margin-block-end: 22px;
  background:
    radial-gradient(500px 200px at 85% 120%, rgba(245, 158, 11, .35), rgba(245, 158, 11, 0) 70%),
    linear-gradient(120deg, var(--brand-900), var(--brand) 100%);
  box-shadow: var(--shadow);
}
.wh-text { flex: 1; min-inline-size: 200px; }
.wh-text h1 { font-size: 1.7rem; }
.wh-text p { color: #cdebe6; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-block-start: 4px; }
.worker-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 22px; align-items: start; }
.w-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-block-end: 16px; }
.w-stat { border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.w-stat strong { font-size: 1.2rem; line-height: 1.3; font-variant-numeric: tabular-nums; }
.ws-label { font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.ws-ico { display: grid; place-items: center; inline-size: 32px; block-size: 32px; border-radius: 10px; color: #fff; margin-block-end: 4px; }
.ws-teal { background: var(--brand-50); }
.ws-teal .ws-ico { background: var(--brand); }
.ws-amber { background: var(--amber-50); }
.ws-amber .ws-ico { background: var(--amber); }
.ws-coral { background: var(--coral-50); }
.ws-coral .ws-ico { background: var(--coral); }
.w-today-list { display: grid; gap: 10px; }
.wt-item { border: 1.5px solid var(--line); border-radius: 16px; padding: 12px 14px; border-inline-start: 5px solid var(--green); }
.wt-item.is-open { border-inline-start-color: var(--coral); background: #fffafa; }
.wt-flow { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-weight: 700; }
.wt-in { color: var(--brand-700); display: inline-flex; align-items: center; gap: 6px; }
.wt-out { color: #9a5b00; }
.wt-wait { color: var(--coral-700); }
.wt-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-block-start: 6px; font-size: .85rem; }

/* ---------------- Modal ---------------- */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(7, 40, 38, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  animation: fade .15s ease-out;
}
.modal {
  background: #fff;
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  inline-size: 100%;
  max-inline-size: 620px;
  max-block-size: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  animation: pop .18s ease-out;
}
.modal-lg { max-inline-size: 920px; }
.modal-sm { max-inline-size: 460px; }
.modal-head { display: flex; align-items: flex-start; gap: 14px; padding: 20px 22px 14px; border-block-end: 1px solid #eef3f2; }
.modal-head p { margin-block-start: 2px; font-size: .92rem; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.modal-body { padding: 18px 22px 22px; overflow-y: auto; }
.modal-actions-pad { padding: 18px 22px 22px; }
.mini-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.mini-kpi { border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.mini-kpi span { font-size: .82rem; font-weight: 600; color: var(--ink-2); }
.mini-kpi strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.mk-teal { background: var(--brand-50); }
.mk-amber { background: var(--amber-50); }
.mk-green { background: var(--green-50); }
.mk-gold { background: var(--gold-50); }
.mk-coral { background: var(--coral-50); }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }

/* ---------------- Toast ---------------- */
.toast-root {
  position: fixed;
  inset-inline: 0;
  inset-block-end: 22px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  padding-inline: 16px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--brand-900);
  color: #fff;
  padding: 14px 18px;
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  font-weight: 600;
  max-inline-size: 560px;
  animation: rise .2s ease-out;
  transition: opacity .3s, transform .3s;
}
.toast .ico { color: #6ee7b7; inline-size: 22px; block-size: 22px; }
.toast.is-leaving { opacity: 0; transform: translateY(8px); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------------- Header user ---------------- */
.user-slot { display: flex; align-items: center; }
.user-chip { display: inline-flex; align-items: center; gap: 8px; padding-block: 4px; padding-inline: 4px 12px; border-radius: 999px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .16); }
.uc-text { display: flex; flex-direction: column; line-height: 1.2; align-items: flex-start; }
.uc-name { font-size: .92rem; white-space: nowrap; }
.chip-on-dark.chip-role { background: var(--amber); color: #3b2300; }

/* ---------------- Role chips ---------------- */
.chip-role-admin { background: #e6eefe; color: #1d4fc4; }
.chip-role-keeper { background: var(--amber-50); color: var(--amber-700); }
.chip-role-worker { background: var(--brand-50); color: var(--brand-700); }
.chip-you { background: var(--ink); color: #fff; }

/* ---------------- Login ---------------- */
.login-wrap { max-inline-size: 520px; margin-inline: auto; display: grid; gap: 18px; padding-block-start: 12px; }
.login-card { padding: 30px; border-block-start: 6px solid var(--brand); }
.login-brand { display: flex; align-items: center; gap: 14px; margin-block-end: 22px; }
.login-brand svg { flex: none; }
.login-brand div { display: flex; flex-direction: column; line-height: 1.25; }
.login-brand strong { font-size: 1.3rem; color: var(--brand-900); }
.login-brand small { color: var(--muted); }
.login-sub { margin-block: 4px 22px; }
.input-lg { min-block-size: 60px; font-size: 1.15rem; }
.ltr-input { direction: ltr; }
[dir="rtl"] .ltr-input { text-align: right; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-inline-end: 64px; }
.pw-eye { position: absolute; inset-block: 6px; inset-inline-end: 6px; inline-size: 50px; border: 0; border-radius: 10px; background: #eef5f4; color: var(--brand-700); display: grid; place-items: center; }
.pw-eye:hover { background: var(--brand-50); }
.pw-eye .ico { inline-size: 22px; block-size: 22px; }
.btn-block { inline-size: 100%; margin-block-start: 6px; }
.demo-card { padding: 0; overflow: hidden; }
.demo-head { display: flex; align-items: center; gap: 12px; inline-size: 100%; border: 0; background: transparent; padding: 18px 20px; text-align: start; }
.demo-head:hover { background: #f7fbfa; }
.dh-text { display: flex; flex-direction: column; flex: 1; min-inline-size: 0; line-height: 1.35; }
.dh-text small { font-size: .85rem; }
.dh-chev { color: var(--muted); display: inline-flex; transition: transform .15s; transform: rotate(90deg); }
.demo-card.is-open .dh-chev { transform: rotate(-90deg); }
.demo-list { list-style: none; margin: 0; padding: 0 12px 12px; display: grid; gap: 6px; }
.demo-acc { display: flex; align-items: center; gap: 10px; inline-size: 100%; border: 1.5px solid var(--line); background: #fbfdfd; border-radius: 14px; padding: 10px 12px; text-align: start; min-block-size: 60px; }
.demo-acc:hover { border-color: var(--brand-100); background: var(--brand-50); }
.da-main { display: flex; flex-direction: column; gap: 2px; flex: 1; min-inline-size: 0; }
.da-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.da-cred { display: flex; gap: 4px 12px; flex-wrap: wrap; font-size: .85rem; color: var(--muted); }
.da-phone { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink-2); }
.da-go { color: var(--brand); display: inline-flex; }
[dir="rtl"] .da-go .ico { transform: scaleX(-1); }

/* ---------------- Admin tabs + users ---------------- */
.tabs { display: flex; gap: 6px; margin-block-end: 18px; background: #fff; padding: 6px; border-radius: 16px; box-shadow: var(--shadow); inline-size: fit-content; max-inline-size: 100%; }
.tab { display: inline-flex; align-items: center; gap: 8px; border: 0; background: transparent; padding-block: 10px; padding-inline: 18px; border-radius: 12px; font-weight: 700; color: var(--ink-2); min-block-size: 46px; }
.tab:hover { background: #f1f6f5; }
.tab.is-on { background: var(--brand); color: #fff; box-shadow: 0 3px 10px rgba(11, 122, 117, .3); }
.users-card { margin-block-end: 22px; }
.users-head { align-items: center; flex-wrap: wrap; }
.users-head .uh-text { flex: 1; min-inline-size: 180px; }
.users-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.user-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 16px; background: #fbfdfd; }
.user-row.is-stopped { background: #fbf6f6; border-style: dashed; }
.user-row.is-stopped .avatar { filter: grayscale(.8); opacity: .7; }
.ur-who { display: flex; align-items: center; gap: 12px; min-inline-size: 0; }
.ur-main { min-inline-size: 0; }
.ur-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ur-name { font-size: 1.05rem; }
.ur-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-block-start: 3px; }
.ur-phone { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .88rem; font-weight: 600; }
.ur-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.ur-note { font-size: .82rem; max-inline-size: 150px; }
.btn-sm { min-block-size: 42px; padding-block: 8px; padding-inline: 12px; font-size: .88rem; border-radius: 12px; }
.btn-soft-danger { background: var(--coral-50); color: var(--coral-700); }
.btn-soft-danger:hover { background: #fbd9db; }
.btn-soft-ok { background: var(--green-50); color: var(--green); }
.btn-soft-ok:hover { background: #ccefd8; }
.seg-plain { border-block-start-width: 2px; }
.seg-btn.seg-plain.is-on { background: var(--brand-50); border-color: var(--brand); }
.danger-card .btn-danger { flex: none; }

/* ---------------- Responsive ---------------- */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-grid { grid-template-columns: minmax(0, 1fr); }
  .admin-side { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1020px) {
  .keeper-layout { grid-template-columns: minmax(0, 1fr); }
  .keeper-side { position: static; grid-template-columns: 1fr 1fr; }
  .worker-layout { grid-template-columns: minmax(0, 1fr); }
  .topbar-inner { flex-wrap: wrap; gap: 10px 16px; padding-inline: 16px; }
}
@media (max-width: 820px) {
  .app { padding-inline: 16px; padding-block-start: 18px; }
  .worker-grid-lg { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tiles-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .keeper-side { grid-template-columns: minmax(0, 1fr); }
  .admin-side { grid-template-columns: minmax(0, 1fr); }
  .filters-row { flex-direction: column; align-items: stretch; }
  .selects .mini-field { flex: 1; }
}
@media (max-width: 1020px) {
  .user-row { grid-template-columns: minmax(0, 1fr) auto; }
  .ur-actions { grid-column: 1 / -1; justify-content: flex-start; }
}
@media (max-width: 600px) {
  body { font-size: 15px; }
  .uc-text .chip { display: none; }
  .login-card { padding: 22px 18px; }
  .demo-card { padding: 0; }
  .tabs { inline-size: 100%; }
  .tab { flex: 1; justify-content: center; padding-inline: 10px; }
  .users-head .btn { inline-size: 100%; }
  h1 { font-size: 1.3rem; }
  .card { padding: 16px; border-radius: 18px; }
  .brand-text small { display: none; }
  .btn-top span { display: none; }
  .btn-top { padding-inline: 11px; min-block-size: 40px; }
  .worker-cards { grid-template-columns: 1fr; }
  .kpis { gap: 10px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 1.8rem; }
  .mode { grid-template-columns: 1fr; }
  .seg-btn strong { font-size: 1rem; }
  .pick-worker { min-block-size: 58px; padding-inline: 10px; gap: 8px; }
  .pick-worker .chip { display: none; }
  .pick-worker-lg .chip { display: inline-flex; }
  .w-stats, .mini-kpis { grid-template-columns: 1fr; }
  .w-stat { flex-direction: row; align-items: center; flex-wrap: wrap; }
  .w-stat .ws-ico { margin-block-end: 0; }
  .w-stat strong { margin-inline-start: auto; }
  .open-item { flex-direction: column; align-items: stretch; }
  .open-item .btn { inline-size: 100%; }
  .form-actions .btn-xl { max-inline-size: none; }
  .backdrop { padding: 10px; align-items: flex-end; }
  .modal { max-block-size: calc(100vh - 20px); border-radius: 22px; }
  .modal-head, .modal-body { padding-inline: 16px; }
  .pills { inline-size: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .pill { padding-inline: 8px; white-space: nowrap; }
  .mini-field { min-inline-size: 0; }
  .wh-text h1 { font-size: 1.4rem; }
}
@media (max-width: 400px) {
  .kpis { grid-template-columns: 1fr; }
}
