:root {
  --bg: #050706;
  --card: #0c120e;
  --border: #1a2a20;
  --green: #20e070;
  --green-dim: #146b3a;
  --text: #f5f8f6;
  --muted: #8d9891;
  --danger: #ff6b6b;
  --row: #0a100c;
  --input: #0f1612;
  --radius: 12px;
  --font: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); }
body { display: flex; flex-direction: column; min-height: 100vh; }
.top {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.brand { display: flex; gap: .75rem; align-items: center; }
.brand .mark {
  width: 40px; height: 40px; border-radius: 10px;
  object-fit: cover; display: block; flex-shrink: 0;
  background: #0a100c;
  border: 1px solid rgba(32, 224, 112, 0.35);
}
.brand strong { display: block; }
.brand small { color: var(--muted); }
.brand-pack {
  display: inline-flex; align-items: center; margin-top: .4rem;
  min-height: 2.5rem; padding: .35rem .9rem;
  font-size: .82rem; font-weight: 700; color: var(--bg);
  background: var(--green); border-radius: 999px;
  text-decoration: none; border: 1px solid var(--green);
}
.brand-pack:hover { background: #7dffb0; border-color: #7dffb0; color: var(--bg); }
.brand-pack:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.demo-seed-chip {
  display: inline-flex; align-items: center; margin-inline-start: .5rem; margin-top: .35rem;
  min-height: 1.6rem; padding: .1rem .55rem;
  font-size: .72rem; font-weight: 600; color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px; background: #0a100c;
  vertical-align: middle;
}
.demo-seed-chip[hidden] { display: none !important; }

.backup-nudge {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .65rem 1rem;
  padding: .7rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: #070a08;
}
.backup-nudge[hidden] { display: none !important; }
.backup-nudge-text {
  margin: 0;
  flex: 1 1 14rem;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.45;
}
.backup-nudge-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
}
.backup-nudge .primary {
  margin-top: 0;
  padding: .45rem .95rem;
  font-size: .88rem;
}
.backup-nudge .ghost {
  padding: .45rem .85rem;
  font-size: .88rem;
}
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* Language toggle (AR | EN) — header chrome */
.lang-toggle {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: #0a100c;
}
.lang-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .02em;
  min-height: 2.5rem;
  min-width: 2.75rem;
  padding: .35rem .7rem;
  cursor: pointer;
}
.lang-btn + .lang-btn {
  border-inline-start: 1px solid var(--border);
}
.lang-btn.active {
  background: var(--green);
  color: var(--bg);
}
.lang-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
  z-index: 1;
}
@media (max-width: 700px) {
  .lang-toggle .lang-btn {
    min-height: 44px;
    min-width: 44px;
    padding: .35rem .65rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
  }
}

.tabs {
  display: flex; gap: .35rem; padding: .75rem 1.25rem;
  border-bottom: 1px solid var(--border); background: #070a08;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.tab {
  background: transparent; border: 1px solid transparent; color: var(--muted);
  padding: .55rem 1rem; border-radius: 999px; cursor: pointer; white-space: nowrap; font: inherit;
  flex: 0 0 auto;
}
@media (max-width: 700px) {
  .tabs {
    padding: .55rem .75rem;
    gap: .25rem;
    flex-wrap: nowrap;
    overflow-x: auto;
  }
  .tabs .tab {
    min-height: 44px;
    padding: .4rem .72rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    font-size: .88rem;
  }
  .badge { font-size: .68rem; padding: .08rem .35rem; margin-inline-start: .2rem; }
}
.tab.active { color: var(--bg); background: var(--green); border-color: var(--green); font-weight: 600; }
main { flex: 1; padding: 1.25rem; max-width: 1400px; width: 100%; margin: 0 auto; }
.panel { display: none; }
.panel.active { display: block; }
.panel-head { display: flex; justify-content: space-between; align-items: end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.panel-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
h1 { margin: 0 0 .25rem; font-size: 1.45rem; }
.muted { color: var(--muted); margin: 0; }
.fx { display: flex; flex-direction: column; gap: .35rem; color: var(--muted); font-size: .9rem; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
table { width: 100%; border-collapse: collapse; min-width: 900px; }
th, td { padding: .55rem .5rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { background: #0f3d2e; color: #fff; font-size: .85rem; position: sticky; top: 0; }
tr:nth-child(even) td { background: var(--row); }
input, select, textarea {
  width: 100%; background: var(--input); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: .4rem .5rem; font: inherit;
}
textarea { min-height: 64px; resize: vertical; }
td.num input { text-align: left; font-variant-numeric: tabular-nums; direction: ltr; }
.calc { color: var(--green); font-weight: 600; font-variant-numeric: tabular-nums; direction: ltr; display: block; text-align: left; }
button { font: inherit; cursor: pointer; }
.primary {
  margin-top: 1rem; background: var(--green); color: #04110a; border: none;
  padding: .65rem 1.1rem; border-radius: 999px; font-weight: 700;
}
.ghost {
  background: transparent; color: var(--text); border: 1px solid var(--border);
  padding: .45rem .8rem; border-radius: 999px;
}
.ghost.danger { color: var(--danger); border-color: #5a2a2a; }
.icon-btn { background: transparent; border: none; color: var(--muted); padding: .25rem .4rem; }
.form-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .9rem;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem;
}
.form-grid label { display: flex; flex-direction: column; gap: .35rem; color: var(--muted); font-size: .9rem; }
.form-grid .full { grid-column: 1 / -1; }
.foot { padding: 1rem 1.25rem; color: var(--muted); border-top: 1px solid var(--border); font-size: .85rem; }

tr.overdue td { box-shadow: inset 3px 0 0 var(--danger); }
tr.overdue input[data-k="next"], tr.overdue select[data-k="status"] {
  border-color: #7a3030; color: #ffb4b4;
}
@media (max-width: 700px) {
  /* Pricing / CRM / week: stack rows as cards on narrow screens */
  #panel-pricing .table-wrap,
  #panel-crm .table-wrap,
  #panel-week .table-wrap {
    overflow: visible;
    border: none;
    background: transparent;
    border-radius: 0;
  }
  #panel-pricing table,
  #panel-crm table,
  #panel-week table {
    min-width: 0;
    width: 100%;
    display: block;
  }
  #panel-pricing thead,
  #panel-crm thead,
  #panel-week thead { display: none; }
  #panel-pricing tbody,
  #panel-crm tbody,
  #panel-week tbody {
    display: flex;
    flex-direction: column;
    gap: .75rem;
  }
  #panel-pricing tr,
  #panel-crm tr,
  #panel-week tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .55rem .65rem;
    padding: .85rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
  }
  #panel-pricing tr:nth-child(even) td,
  #panel-crm tr:nth-child(even) td,
  #panel-week tr:nth-child(even) td { background: transparent; }
  #panel-pricing td,
  #panel-crm td,
  #panel-week td {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    padding: 0;
    border: none;
    min-width: 0;
  }
  #panel-pricing td::before,
  #panel-crm td::before,
  #panel-week td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: .72rem;
    font-weight: 600;
  }
  #panel-pricing td:nth-child(1),
  #panel-pricing td:nth-child(10),
  #panel-pricing td:nth-child(11) {
    grid-column: 1 / -1;
  }
  #panel-crm td:nth-child(1),
  #panel-crm td:nth-child(8),
  #panel-crm td:nth-child(9) {
    grid-column: 1 / -1;
  }
  #panel-week td:nth-child(1),
  #panel-week td:nth-child(2),
  #panel-week td:nth-child(4) {
    grid-column: 1 / -1;
  }
  #panel-pricing td.calc-cell {
    background: #0a1610;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: .4rem .5rem;
  }
  #panel-pricing .row-actions,
  #panel-crm .row-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: .5rem;
    white-space: normal;
  }
  /* Primary action full-width; نسخ + ✕ on the next row (Roli mobile crowding after #28) */
  #panel-pricing .row-actions {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: .4rem .5rem;
    width: 100%;
  }
  #panel-pricing .row-actions [data-use] {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: center;
  }
  #panel-pricing .row-actions [data-dup],
  #panel-pricing .row-actions .icon-btn {
    justify-self: start;
  }
  #panel-pricing .row-actions .icon-btn {
    justify-self: end;
  }
  /* CRM: wrap واتساب/تواصلت; keep نسخ + ✕ on a compact trailing row */
  #panel-crm .row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem .5rem;
    width: 100%;
  }
  #panel-crm .row-actions [data-dup],
  #panel-crm .row-actions .icon-btn {
    margin-inline-start: 0;
  }
  #panel-crm tr.overdue {
    box-shadow: inset 3px 0 0 var(--danger);
  }
  #panel-crm tr.overdue td {
    box-shadow: none;
  }
  #panel-week tr.today {
    box-shadow: inset 3px 0 0 var(--green);
    background: #0d1a12;
  }
  #panel-week tr.today td {
    box-shadow: none;
    background: transparent;
  }
}

.badge {
  display: inline-block; margin-inline-start: .35rem; padding: .1rem .45rem;
  border-radius: 999px; background: #5a2a2a; color: #ffb4b4; font-size: .72rem; font-weight: 700;
}
/* Empty overdue badge must not reserve 44×44 flex space in the tab strip (clips «Work week»). */
#crm-overdue-badge[hidden] {
  display: none !important;
}
.row-actions { display: flex; gap: .25rem; align-items: center; white-space: nowrap; }
.ghost.tiny {
  padding: .25rem .55rem; font-size: .78rem; border-radius: 999px;
  color: var(--green); border-color: var(--green-dim);
}
.proposal-actions { display: flex; gap: .75rem; align-items: center; margin-top: .25rem; flex-wrap: wrap; }
.proposal-actions .primary { margin-top: 0; }
.toast {
  position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%);
  background: #146b3a; color: #f5f8f6; padding: .55rem .65rem .55rem 1.1rem; border-radius: 999px;
  border: 1px solid var(--green); box-shadow: 0 8px 24px rgba(0,0,0,.35);
  z-index: 50; font-size: .9rem; font-weight: 600;
  display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; max-width: min(92vw, 28rem);
}
/* Author display:flex overrides UA [hidden]; keep blank toast out of view. */
.toast[hidden] {
  display: none !important;
}
.toast-action {
  flex: 0 0 auto;
  background: #f5f8f6; color: #146b3a; border: 0;
  border-radius: 999px; padding: .35rem .75rem;
  font: inherit; font-size: .82rem; font-weight: 700; cursor: pointer;
}
.toast-action:hover { filter: brightness(1.05); }
.toast-action:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

tr.today td { box-shadow: inset 3px 0 0 var(--green); background: #0d1a12; }
.today-pill {
  display: inline-block; margin-inline-start: .35rem; padding: .05rem .4rem;
  border-radius: 999px; background: var(--green-dim); color: var(--green);
  font-size: .72rem; font-weight: 700; vertical-align: middle;
}
.proposal-actions .ghost { margin-top: 0; }

.date-hint { font-size: .75rem; color: var(--muted); margin-top: .2rem; }
.date-hint.late { color: #ff8a8a; }

.crm-filters {
  display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 .85rem;
}
.chip {
  background: transparent; color: var(--muted); border: 1px solid var(--border);
  padding: .35rem .75rem; border-radius: 999px; font: inherit; font-size: .85rem;
}
.chip.active {
  color: var(--bg); background: var(--green); border-color: var(--green); font-weight: 600;
}
.chip.chip-late.active {
  color: #1a0606; background: #ff8a8a; border-color: #ff8a8a;
}
.chip.chip-today.active {
  color: #04110a; background: #7dffb0; border-color: #7dffb0;
}
.chip.chip-none.active {
  border-color: #c9a227;
  background: #f7f0d8;
  color: #6b5510;
}
.crm-pipeline {
  margin-top: .35rem;
  font-size: .88rem;
  font-variant-numeric: tabular-nums;
}
.chip:not(.active):hover { border-color: var(--green-dim); color: var(--text); }
.chip-count {
  display: inline-block;
  min-width: 1.1em;
  margin-inline-start: .15rem;
  padding: 0 .35rem;
  border-radius: 999px;
  font-size: .72em;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
  background: rgba(255,255,255,.1);
  color: inherit;
  opacity: .92;
}
.chip.active .chip-count {
  background: rgba(0,0,0,.18);
}
.empty-hint {
  color: var(--muted); text-align: center; padding: 1.25rem 1rem;
  border: 1px dashed var(--border); border-radius: var(--radius); margin: 0 0 .85rem;
  background: var(--card);
}

.crm-search { display: block; margin: 0 0 .85rem; }
.crm-search-wrap { position: relative; display: block; }
.crm-search input {
  width: 100%;
  background: var(--input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding-block: .55rem;
  padding-inline: 1rem 2.4rem;
  font: inherit;
}
.crm-search input::placeholder { color: var(--muted); }
.crm-search-clear {
  position: absolute;
  inset-inline-end: .35rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.7rem; height: 1.7rem;
  border: 0; border-radius: 999px;
  background: transparent; color: var(--muted);
  font: inherit; font-size: .85rem; line-height: 1;
  cursor: pointer; padding: 0;
}
.crm-search-clear:hover { color: var(--text); background: rgba(255,255,255,.06); }
.crm-search-clear:focus-visible { outline: 2px solid var(--accent, #6ee7a8); outline-offset: 1px; }
#crm-overdue-badge { cursor: pointer; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* Pricing totals footer */
#pricing-tfoot td { background: #0a1810; font-weight: 600; }
#pricing-tfoot .calc { color: var(--green); }
#pricing-tfoot strong { color: var(--text); }
@media (max-width: 700px) {
  #panel-pricing tfoot {
    display: block;
    margin-top: .35rem;
  }
  #panel-pricing tfoot tr.pricing-totals-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .55rem .65rem;
    padding: .85rem;
    background: #0a1810;
    border: 1px solid var(--green-dim);
    border-radius: var(--radius);
  }
  #panel-pricing tfoot td {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    padding: 0;
    border: none;
    background: transparent;
  }
  #panel-pricing tfoot td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: .72rem;
    font-weight: 600;
  }
  #panel-pricing tfoot td:first-child {
    grid-column: 1 / -1;
  }
  #panel-pricing tfoot td:last-child {
    display: none;
  }
}

/* CRM visible pipeline value footer (parity with pricing totals) */
#crm-tfoot td { background: #0a1810; font-weight: 600; }
#crm-tfoot .calc { color: var(--green); }
#crm-tfoot strong { color: var(--text); }
@media (max-width: 700px) {
  #panel-crm tfoot {
    display: block;
    margin-top: .35rem;
  }
  #panel-crm tfoot tr.crm-totals-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .55rem .65rem;
    padding: .85rem;
    background: #0a1810;
    border: 1px solid var(--green-dim);
    border-radius: var(--radius);
  }
  #panel-crm tfoot td {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    padding: 0;
    border: none;
    background: transparent;
  }
  #panel-crm tfoot td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: .72rem;
    font-weight: 600;
  }
  #panel-crm tfoot td:first-child {
    grid-column: 1 / -1;
  }
  #panel-crm tfoot td[data-label=""] {
    display: none;
  }
}

.snooze-row {
  display: flex;
  gap: .28rem;
  margin-top: .28rem;
  flex-wrap: wrap;
}
.snooze-row .tiny {
  padding: .25rem .55rem;
  font-size: .72rem;
  line-height: 1.2;
  min-height: 2rem; /* mirror .week-row-actions .tiny */
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Desktop week row tinies — keep before ≤700px 44px sweep so cascade cannot zero mobile height (#104 pattern). */
.week-row-actions .tiny {
  min-height: 2rem;
}

/* Clickable CRM pipeline jump (parity with overdue tab badge) */
.pipeline-jump {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  color: var(--accent, #6ee7a8);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.pipeline-jump:hover { filter: brightness(1.08); }
.pipeline-jump:focus-visible {
  outline: 2px solid var(--accent, #6ee7a8);
  outline-offset: 2px;
  border-radius: 2px;
}

@media (max-width: 700px) {
  /* Mobile: ≥44px tap targets for snooze + CRM/pricing/week row tinies (نسخ نص / مسح / كرّر / واتساب / تواصلت / انقل للعرض) */
  .snooze-row .tiny,
  #panel-crm .row-actions .tiny,
  #panel-pricing .row-actions .tiny,
  #panel-week .week-row-actions .tiny {
    min-height: 44px;
    min-width: 44px; /* Testi #122 FAIL: +3/+7 / كرّر were ~34–37px wide */
    padding: .4rem .65rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
  }
  /* Pricing/CRM row delete ✕ — same 44px square hit target as sibling tinies (كرّر / نسخ نص) */
  #panel-pricing .row-actions .icon-btn,
  #panel-crm .row-actions .icon-btn {
    min-height: 44px;
    min-width: 44px;
    padding: .4rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
  }
  /* CRM filter chips (الكل / النهاردة / متأخر / بدون موعد / …) — same 44px touch standard */
  .crm-filters .chip {
    min-height: 44px;
    padding: .4rem .85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
  }
  /* CRM/week panel-actions ghosts (تواصلت للكل / +3 للكل / نسخ المتابعات / نسخ اليوم / …) */
  #panel-crm .panel-actions .ghost,
  #panel-week .panel-actions .ghost {
    min-height: 44px;
    padding: .4rem .85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
  }
  /* CRM «+ عميل» primary — same 44px as ghosts beside it / pricing «+ صف تسعير» */
  #panel-crm .panel-actions .primary {
    min-height: 44px;
    padding: .4rem .85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
  }
  /* Pricing footer + proposal actions (نسخ التسعير / انقل لعرض السعر / فتح واتساب / أضف للعملاء / …) — same 44px */
  #panel-pricing .pricing-actions .ghost,
  #panel-pricing .pricing-actions .primary,
  #panel-proposal .proposal-actions .ghost,
  #panel-proposal .proposal-actions .primary {
    min-height: 44px;
    padding: .4rem .85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
  }
  /* Header action ghosts (تصدير / استيراد / مسح البيانات) — same 44px */
  .top .actions .ghost {
    min-height: 44px;
    padding: .4rem .85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
  }
  /* Main nav tabs (التسعير / عرض السعر / العملاء / أسبوع الشغل) — same 44px; keep .tabs overflow-x */
  .tabs .tab {
    min-height: 44px;
    padding: .4rem .72rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
  }
  /* Toast undo / action (تراجع / انقل لعرض السعر / أضف للعملاء / …) — critical ~6s window */
  .toast-action {
    min-height: 44px;
    padding: .4rem .85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
  }
  /* Backup nudge (تصدير الآن / إخفاء) — same 44px; was .45rem padding (~32px) outside this query */
  .backup-nudge .primary,
  .backup-nudge .ghost {
    min-height: 44px;
    padding: .4rem .85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
  }
  /* Brand pack CTA («Own the $12 pack · الرزمة») — same 44px; was min-height 2.5rem (~40px) outside this query */
  .brand-pack {
    min-height: 44px;
    padding: .4rem .85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
  }
  /* CRM search clear ✕ — same 44px square; was width/height 1.7rem (~27px) outside this query */
  .crm-search-clear {
    min-height: 44px;
    min-width: 44px;
    padding: .4rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
  }
  /* CRM search input (#crm-search) — same 44px; was padding-block .55rem (~37px) outside this query.
     Clear ✕ already 44px; match field height. min-height + box-sizing; keep pill padding-inline for ✕. */
  .crm-search input,
  #crm-search {
    min-height: 44px;
    box-sizing: border-box;
  }
  /* CRM pipeline jump links (X متأخر / متابعة النهاردة / بدون موعد) — same 44px; was padding:0 ~.88rem outside this query */
  .pipeline-jump {
    min-height: 44px;
    padding: .4rem .85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
  }
  /* CRM overdue tab badge («N متأخر») — own click target (stopPropagation); was ~.72rem pad outside this query */
  #crm-overdue-badge {
    min-height: 44px;
    min-width: 44px;
    padding: .35rem .65rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    vertical-align: middle;
  }
  #crm-overdue-badge[hidden] {
    display: none !important;
    min-width: 0;
    min-height: 0;
    padding: 0;
    margin: 0;
  }
  /* Pricing / CRM / week table inputs & selects — same 44px; was padding .4rem .5rem (~32–36px) outside this query.
     Priority: CRM select[data-k=status] + input[data-k=next]. Scoped to tables so .crm-search keeps its clear-✕ padding.
     min-height + box-sizing only (no flex) so type=date native chrome stays usable. */
  #panel-pricing table input,
  #panel-pricing table select,
  #panel-crm table input,
  #panel-crm table select,
  #panel-week table input,
  #panel-week table select {
    min-height: 44px;
    padding: .55rem .65rem;
    box-sizing: border-box;
  }
  /* Pricing FX (#fx-rate) + proposal form fields — same 44px; left out of table-scoped #106.
     FX lives in .panel-head label.fx; proposal uses #proposal-form (not a table).
     min-height + box-sizing only (no flex) so type=date native chrome stays usable. */
  #panel-pricing #fx-rate,
  #panel-proposal #proposal-form input,
  #panel-proposal #proposal-form select,
  #panel-proposal #proposal-form textarea {
    min-height: 44px;
    padding: .55rem .65rem;
    box-sizing: border-box;
  }
}

.week-done-cell {
  vertical-align: middle;
  white-space: nowrap;
  width: 1%;
  min-width: 7.5rem;
}
#week-table th:nth-last-child(2),
#week-table td.week-done-cell {
  min-width: 7.5rem;
  white-space: nowrap;
}
.week-row-actions {
  width: 1%;
  white-space: nowrap;
  vertical-align: middle;
  display: inline-flex;
  gap: .35rem;
  align-items: center;
}
.done-toggle {
  display: inline-flex; align-items: center; gap: .35rem;
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  padding: .4rem .75rem; border-radius: 999px; cursor: pointer; font: inherit;
  white-space: nowrap;
  min-width: 6.75rem;
  justify-content: center;
}
.done-toggle:hover { border-color: var(--accent, #6ee7a8); color: var(--text, #e8f5ee); }
.done-toggle.on {
  background: color-mix(in srgb, var(--accent, #6ee7a8) 18%, transparent);
  border-color: var(--accent, #6ee7a8); color: var(--accent, #6ee7a8);
}
.done-toggle:focus-visible { outline: 2px solid var(--accent, #6ee7a8); outline-offset: 2px; }
.done-toggle-label { font-size: .88rem; white-space: nowrap; }
tr.week-done td[data-label="المهام"] input,
tr.week-done td[data-label="التسليمات"] input {
  text-decoration: line-through; opacity: .78;
}
@media (max-width: 700px) {
  .week-done-cell, #week-table th:nth-last-child(2) { min-width: 0; width: auto; }
  .done-toggle {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: .55rem .75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
  }
  #panel-week .week-row-actions {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: .35rem;
  }
  #panel-week .week-row-actions .tiny {
    width: 100%;
    min-height: 44px;
    min-width: 44px;
    padding: .4rem .65rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
  }
}

.pricing-actions { margin-top: .75rem; }

/* Desktop: CRM status labels must not clip (عرض سعر / عميل محتمل / تم الاتفاق) */
@media (min-width: 701px) {
  #crm-table th:nth-child(4),
  #crm-table td:nth-child(4) {
    min-width: 8.75rem;
    width: 8.75rem;
  }
  #crm-table select[data-k="status"] {
    min-width: 8.5rem;
    width: 100%;
  }
}

/* CRM: follow-ups due today (parity with week tr.today; overdue still wins) */
tr.due-today td { box-shadow: inset 3px 0 0 var(--green); background: #0d1a12; }
tr.due-today input[data-k="next"], tr.due-today select[data-k="status"] {
  border-color: rgba(110, 231, 168, .45);
}
@media (max-width: 700px) {
  #panel-crm tr.due-today {
    box-shadow: inset 3px 0 0 var(--green);
    background: #0d1a12;
  }
  #panel-crm tr.due-today td {
    box-shadow: none;
    background: transparent;
  }
}

.next-na { display: inline-block; padding: .35rem 0; color: var(--muted); }
td.next-closed { opacity: .85; }

/* Bilingual dir: number/calc columns stay LTR regardless of page dir */
html[dir="ltr"] td.num input,
html[dir="ltr"] .calc {
  text-align: left;
}
