/* Bagheri iOS workspace layer. This file is injected into the persistent
   same-origin legacy document; it styles presentation only. */
@font-face {
  font-family: "Vazirmatn";
  src: url("./fonts/Vazirmatn[wght].woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}
:root {
  --olive-dark: #286344;
  --gold: #d77a39;
  --accent-dark: #b85c2b;
  --accent-soft: #f8eee5;
  --vg-color-primary: #286344;
  --vg-color-primary-soft: #e5f0e8;
  --vg-color-success: #347c56;
  --vg-color-warning: #a7642e;
  --vg-color-icon: #284438;
  --vg-color-bg: #eef2ed;
  --vg-color-bg-system: #f7f8f5;
  --vg-color-surface: #fffefa;
  --vg-color-surface-soft: #f5f7f3;
  --vg-color-text: #24362d;
  --vg-color-text-secondary: #4e6055;
  --vg-color-text-muted: #748177;
  --vg-color-border: rgba(42, 81, 59, .12);
  --vg-color-divider: rgba(42, 81, 59, .09);
  --ios-glass: rgba(255, 254, 250, .78);
  --ios-glass-border: rgba(42, 81, 59, .15);
  font-family: "Vazirmatn", Tahoma, sans-serif !important;
}
html, body { font-family: "Vazirmatn", Tahoma, sans-serif !important; }
body { background: var(--vg-color-bg) !important; color: var(--vg-color-text) !important; }
/* The React shell owns the navigation and page identity. Keep #main and every
   source-app overlay/control intact so the original workflows remain usable. */
body > header,
body > #nav,
body > .bottom-nav,
body > #more-sheet-root,
body > #fab,
body > .hdr-add,
body > button.app-back { display: none !important; }
main, #main {
  max-width: 820px !important;
  padding: 16px 16px calc(112px + env(safe-area-inset-bottom, 0px)) !important;
}
.card, .dash-health-row, .dash-monthly-target, .dash-qa-btn,
.dash-activity-section, .dash-watch-compact, .cust-summary,
.cust-recommended-action, .more-group-card, .report-summary-card {
  border-color: var(--vg-color-border) !important;
  box-shadow: 0 2px 10px rgba(34, 63, 46, .045) !important;
}
.btn:not(.secondary):not(.danger) {
  background: #286344 !important;
  border-color: #286344 !important;
}
.btn:focus-visible, a:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, button:focus-visible {
  outline: 3px solid rgba(215, 122, 57, .52) !important;
  outline-offset: 2px;
}
input, select, textarea, button, a { font-family: inherit; }
html[data-theme="dark"] {
  --vg-color-primary: #79b38a;
  --vg-color-primary-soft: rgba(89, 147, 104, .2);
  --vg-color-success: #79bc91;
  --vg-color-warning: #e6a06b;
  --vg-color-icon: #d8e7dc;
  --vg-color-bg: #111a15;
  --vg-color-bg-system: #0b110d;
  --vg-color-surface: #1a251e;
  --vg-color-surface-soft: #202d24;
  --vg-color-text: #e5eee7;
  --vg-color-text-secondary: #c1d0c5;
  --vg-color-text-muted: #9aab9f;
  --vg-color-border: rgba(213, 233, 218, .13);
  --vg-color-divider: rgba(213, 233, 218, .09);
  --ios-glass: rgba(29, 43, 34, .82);
  --ios-glass-border: rgba(213, 233, 218, .14);
  --olive-dark: #79b38a;
  --accent-dark: #e6a06b;
  --accent-soft: rgba(230, 160, 107, .14);
}
@media (min-width: 768px) {
  main, #main { padding: 24px 22px 54px !important; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* -------------------------------------------------------------------------
   Full shared page system
   The legacy application keeps its original view markup and calculations.
   These rules provide a unified visual layer for every route, including
   modules that do not share one exact component template.
   ------------------------------------------------------------------------- */
:root {
  --crm-canvas: #eef2ed;
  --crm-surface: #fffefa;
  --crm-surface-raised: #ffffff;
  --crm-surface-subtle: #f5f7f3;
  --crm-ink: #24362d;
  --crm-ink-soft: #52635a;
  --crm-muted: #748177;
  --crm-line: rgba(42, 81, 59, .12);
  --crm-separator: rgba(42, 81, 59, .09);
  --crm-green: #286344;
  --crm-green-soft: #e5f0e8;
  --crm-orange: #c9783c;
  --crm-orange-soft: #f8eee5;
  --crm-red: #bd4d48;
  --crm-red-soft: #f8e9e7;
  --crm-shadow: 0 2px 10px rgba(34, 63, 46, .045);
  --crm-shadow-raised: 0 10px 28px rgba(34, 63, 46, .10);
  --vg-radius-soft: 16px;
  --vg-radius-raised: 19px;
  --vg-radius-control: 12px;
  --vg-control-height: 46px;
  --vg-space-group: 14px;
  --vg-space-section: 22px;
  --vg-type-page: 1.12rem;
  --vg-type-section: .96rem;
  --vg-type-primary: 1.02rem;
  --vg-type-secondary: .88rem;
  --vg-type-label: .74rem;
  --vg-type-meta: .69rem;
  --vg-type-action: .84rem;
  --vg-weight-regular: 400;
  --vg-weight-medium: 500;
  --vg-weight-label: 550;
  --vg-weight-title: 700;
  --vg-weight-value: 750;
  --vg-weight-emphasis: 800;
  --vg-color-danger: var(--crm-red);
  --vg-color-danger-soft: var(--crm-red-soft);
  --vg-color-neutral: #6e7d72;
  --vg-color-neutral-soft: #edf0eb;
}
html, body {
  background: var(--crm-canvas) !important;
  color: var(--crm-ink) !important;
}
body {
  font-size: 15px !important;
  line-height: 1.62 !important;
  letter-spacing: 0 !important;
}
main, #main {
  width: 100%;
  color: var(--crm-ink);
}
main > * + * { margin-block-start: 11px; }
main h2.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0 14px !important;
  color: var(--crm-ink) !important;
  font-size: clamp(1.08rem, 4vw, 1.24rem) !important;
  font-weight: 800 !important;
  line-height: 1.4 !important;
  letter-spacing: -.025em !important;
}
main h2.section-title::after {
  align-self: center;
  margin-inline-start: 2px;
  border-block-end: 1px solid var(--crm-line);
  opacity: .8;
}
main h3, main h4, .sheet h3, .sheet-title {
  color: var(--crm-ink) !important;
  font-weight: 750 !important;
}
main h3.sub-title, main .mgmt-section-title {
  margin-block: 18px 9px;
  font-size: .9rem;
  line-height: 1.45;
}
main p, main .tx-hint, main .report-note {
  color: var(--crm-muted);
  line-height: 1.8;
}
main .tx-hint { font-size: .77rem; }

/* Work surfaces and section groupings */
.card, .report-summary-card, .gc-panel, .prospect-result-card,
.cust-summary, .cust-recommended-action, .settings-section,
.report-summary, .report-summary-card, .dash-activity-section,
.dash-activity-group, .dash-watch-compact, .dash-monthly-target,
.dash-qa-btn, .dash-health-row, .biz-status-secondary,
.watch-followup-card, .watch-detail-card, .supplier-summary,
.customer-identity-card, .customer-trend-card, .prospect-result-card,
.evaluation-card, .eval-card, .stock-panel, .inv-payment-panel {
  background-color: var(--crm-surface) !important;
  border-color: var(--crm-line) !important;
  border-radius: var(--vg-radius-soft) !important;
  box-shadow: var(--crm-shadow) !important;
}
.cards {
  align-items: stretch;
  gap: 9px !important;
  margin-block: 12px 16px;
}
.cards > .card {
  min-width: 0;
  padding: 13px !important;
}
.card .label, .label, .field label, .tx-toolbar-label {
  color: var(--crm-muted) !important;
  font-size: .7rem;
  font-weight: 550;
  line-height: 1.5;
}
.card .value, .value {
  color: var(--crm-ink);
  font-size: 1rem;
  font-weight: 750;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.dashboard-eyebrow {
  color: var(--crm-muted) !important;
  font-size: .72rem;
  font-weight: 550;
  letter-spacing: .01em;
}
.dashboard-block { margin-block-end: 20px; }
.dashboard-block-head { min-height: 32px; margin-block-end: 7px; }
.dash-section-label { color: var(--crm-ink) !important; font-size: .88rem; font-weight: 750 !important; }
.dash-section-ico { color: var(--crm-green) !important; }
.dash-section-label::after { display: none !important; }
.section-action, .more-row-icon, .bp-topic-chev { color: var(--crm-green) !important; }
.dash-health-row {
  min-height: 80px;
  padding: 12px 11px !important;
}
.dash-health-label { color: var(--crm-muted) !important; font-size: .66rem !important; }
.dash-health-value { color: var(--crm-ink) !important; font-size: clamp(.79rem, 3.2vw, .98rem) !important; }
.dash-health-value.debt, .accent-rust, .accent-red { color: var(--crm-red) !important; }
.dash-monthly-target { border-inline-start: 3px solid var(--crm-orange) !important; }
.dmt-title, .dmt-pct { color: var(--crm-green) !important; }
.dmt-bar { background: var(--crm-green-soft) !important; }
.dmt-bar > span { background: var(--crm-orange) !important; }
.dash-qa-btn { min-height: 72px; color: var(--crm-ink) !important; }
.dash-qa-ico { color: var(--crm-green) !important; }
.bp-dashboard-alert, .bp-dashboard-snapshot {
  border-color: var(--crm-line) !important;
  border-radius: var(--vg-radius-soft) !important;
}
.bp-dashboard-alert-head { color: var(--crm-ink) !important; }
.bp-dashboard-alert-dot { background: var(--crm-orange) !important; }
.bp-dashboard-snapshot-item strong { color: var(--crm-ink) !important; font-variant-numeric: tabular-nums; }
.bp-dashboard-watch-card { border-color: var(--crm-separator) !important; }
.bp-dashboard-watch-severity { color: var(--crm-orange) !important; }

/* Dense lists: one calm shared surface with inset RTL hairlines */
.tx-list, #customer-list, #invoice-list, #product-list, #payment-list,
#check-list, #visit-list, #prospect-list, .customer-tx-list,
.dash-activity, .dash-activity-group, .bp-dashboard-watch-list,
.watch-list, .watch-occ-list, .supplier-purchase-list {
  color: var(--crm-ink);
}
.tx-list:has(> .ledger-row), #customer-list:has(> .customer-list-row),
.dash-activity-group, .bp-dashboard-watch-list,
.more-group-card, .cd-records-nav, .customer-tx-list,
.rtp-list, .visit-list, .report-table-wrap {
  overflow: hidden;
  background: var(--crm-surface);
  border: 1px solid var(--crm-line);
  border-radius: 16px;
  box-shadow: var(--crm-shadow);
}
.ledger-row, .tx-row, .customer-list-row {
  min-height: 58px;
  padding: 11px 13px !important;
  border: 0 !important;
  color: var(--crm-ink) !important;
}
.ledger-row + .ledger-row::before, .tx-row + .tx-row::before,
.customer-list-row + .customer-list-row::before {
  inset-inline: 14px 12px !important;
  background: var(--crm-separator) !important;
}
.ledger-row .name, .tx-row-title, .customer-row-name,
.more-row-title, .bp-row-title {
  color: var(--crm-ink) !important;
  font-weight: 700 !important;
}
.ledger-row .sub, .tx-row-meta, .sub, .customer-row-meta,
.report-note, .bp-row-note {
  color: var(--crm-muted) !important;
}
.ledger-row .amount, .tx-row-total, .tx-row-amount,
.customer-row-balance-value, .invoice-row-total .tx-row-total {
  color: var(--crm-ink) !important;
  font-size: .88rem;
  font-weight: 750 !important;
  font-variant-numeric: tabular-nums;
}
.customer-row-status, .badge {
  border-radius: 999px !important;
  font-size: .65rem !important;
  font-weight: 650 !important;
  line-height: 1.45 !important;
}
.badge.tone-success, .badge.cleared, .accent-olive {
  color: #34744f !important;
}
.badge.tone-warning, .badge.pending, .accent-amber {
  color: #9a5d2f !important;
}
.badge.tone-danger, .badge.low, .watch-severity-high {
  color: var(--crm-red) !important;
}
.badge.tone-muted, .badge.tone-neutral {
  color: var(--crm-muted) !important;
}
.customer-row-balance { align-items: flex-start !important; }
a.ledger-row:active, a.tx-row:active, .more-row:active {
  background: var(--crm-surface-subtle) !important;
}
.ledger-row::after { opacity: .38; }
.empty {
  color: var(--crm-muted) !important;
  line-height: 1.8;
}
.empty::before { color: var(--crm-green); opacity: .24; }
.empty[role="alert"] { color: #a04d37 !important; }

/* Customer, supplier and prospect identity/detail pages */
.customer-identity-card, .supplier-identity-card,
.customer-detail-view .tx-identity, .prospect-result-card {
  padding: 16px !important;
  border-inline-start: 3px solid var(--crm-green) !important;
}
.customer-identity-name, .tx-identity-title, .customer-detail-title,
.supplier-title, .prospect-title {
  color: var(--crm-ink) !important;
  font-size: 1.08rem;
  font-weight: 800 !important;
}
.customer-identity-meta, .tx-identity-meta, .cust-summary-story,
.customer-last-visit-body, .bp-topic-text, .bp-row-text {
  color: var(--crm-ink-soft) !important;
  line-height: 1.8 !important;
}
.cust-summary, .cust-recommended-action {
  padding: 13px 14px !important;
  border-inline-start: 3px solid var(--crm-orange) !important;
}
.cust-recommended-action { background: var(--crm-green-soft) !important; }
.cust-recommended-action-label { color: var(--crm-muted) !important; }
.customer-behavior-summary { color: var(--crm-ink) !important; }
#main.customer-detail-view details {
  background: var(--crm-surface) !important;
  border: 1px solid var(--crm-line) !important;
  border-radius: 15px !important;
  box-shadow: var(--crm-shadow) !important;
}
#main.customer-detail-view details > summary.customer-behavior-summary {
  color: var(--crm-ink) !important;
  font-size: .91rem !important;
  font-weight: 700 !important;
}
.bp-focus, .watch-confirmed-card, .watch-lifecycle-card {
  background: var(--crm-surface) !important;
  border-color: var(--crm-line) !important;
  box-shadow: var(--crm-shadow) !important;
}
.bp-focus-head { color: var(--crm-muted) !important; }
.bp-topic + .bp-topic { border-color: var(--crm-separator) !important; }
.watch-level-critical, .watch-level-high { color: var(--crm-red) !important; }
.watch-level-medium { color: var(--crm-orange) !important; }
.customer-row-spark, .customer-trend-line { color: var(--crm-green) !important; stroke: var(--crm-green) !important; }
.customer-trend-area { fill: var(--crm-green) !important; }
.customer-trend-dot { background: var(--crm-green) !important; }
.cd-push-row, .cd-records-nav > a.cd-push-row {
  color: var(--crm-ink) !important;
  border-color: var(--crm-separator) !important;
}

/* Reports, analytics and charts */
.report-summary, .report-summary-card {
  background: var(--crm-surface) !important;
  border: 1px solid var(--crm-line) !important;
  border-radius: 16px !important;
}
.report-summary-value, .report-summary-value.profit { color: var(--crm-green) !important; }
.report-summary-value.debt, .report-summary-meta.down { color: var(--crm-red) !important; }
.report-section {
  margin-block: 19px !important;
  padding: 15px 14px !important;
  background: var(--crm-surface);
  border: 1px solid var(--crm-line);
  border-radius: 17px;
  box-shadow: var(--crm-shadow);
}
.report-section h3, .report-section h4 {
  margin: 0 0 10px !important;
  color: var(--crm-ink) !important;
  font-size: .91rem !important;
}
.report-accordion, .report-accordion-header {
  color: var(--crm-ink) !important;
  border-color: var(--crm-separator) !important;
}
.report-accordion-chevron::before { border-color: var(--crm-muted) !important; }
.report-profit-secondary .value { color: var(--crm-ink-soft) !important; }
.report-note { font-size: .72rem !important; }
main svg[role="img"], .report-chart, .chart-container, .chart-wrap {
  max-width: 100%;
}
main svg text, .report-chart text, .chart-container text {
  font-family: "Vazirmatn", Tahoma, sans-serif !important;
  fill: var(--crm-muted);
}
.report-chart .grid, .chart-grid, .recharts-cartesian-grid line {
  stroke: var(--crm-separator) !important;
}
.report-chart .series, .recharts-line path, .recharts-area path {
  stroke: var(--crm-green);
}
.report-legend, .chart-legend { color: var(--crm-ink-soft); font-size: .72rem; }

/* Financial tables and invoice workbench */
main table, .financial-table, .report-table {
  width: 100%;
  color: var(--crm-ink);
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  background: var(--crm-surface);
  border: 1px solid var(--crm-line);
  border-radius: 14px;
  font-size: .76rem;
}
main th, main td, .financial-table th, .financial-table td {
  padding: 9px 10px;
  text-align: start;
  border-block-end: 1px solid var(--crm-separator);
}
main th, .financial-table th {
  color: var(--crm-muted);
  background: var(--crm-surface-subtle);
  font-weight: 650;
}
main tr:last-child > td { border-block-end: 0; }
.inv-header {
  color: var(--crm-ink) !important;
  background: var(--crm-surface) !important;
  border-color: var(--crm-line) !important;
  box-shadow: var(--crm-shadow) !important;
}
.inv-header-title-main, .inv-customer-name, .inv-payment-total,
.inv-line-collapsed .inv-line-amount, .inv-summary-section #calc-summary .ledger-row .amount {
  color: var(--crm-ink) !important;
}
.inv-line-view-active, .inv-line-market-details, .inv-line-avg-cost {
  background: var(--crm-surface-subtle) !important;
}
.inv-line + .inv-line::before, .inv-summary-section .ledger-row + .ledger-row::before {
  background: var(--crm-separator) !important;
}
.inv-summary-section, .inv-items-card, .inv-payment-panel {
  border-color: var(--crm-line) !important;
  border-radius: 16px !important;
}
.inv-payment-action.is-active, .inv-discount-type-btn.is-active {
  color: var(--crm-green) !important;
  background: var(--crm-green-soft) !important;
}
.inv-line-del, .btn.danger { background: var(--crm-red) !important; border-color: var(--crm-red) !important; }
.inv-profit-summary { color: var(--crm-ink-soft) !important; }
.tx-details { color: var(--crm-ink); background: var(--crm-surface-subtle) !important; }

/* Forms, filters, search and selection controls */
.field { margin-block-end: 12px !important; }
.field label {
  display: block;
  margin-block-end: 5px !important;
  color: var(--crm-muted) !important;
}
.field input:not([type="checkbox"]):not([type="radio"]),
.field select, .field textarea,
input[type="search"], input[placeholder*="جستجو"],
.tx-toolbar-select, .inv-mini-input, .inv-payment-panel > input,
.inv-payment-check-due input, .inv-discount-block input, .prod-drop-search {
  min-height: 45px;
  padding: 10px 13px !important;
  color: var(--crm-ink) !important;
  background-color: var(--crm-surface) !important;
  border: 1px solid var(--crm-line) !important;
  border-radius: 12px !important;
  box-shadow: inset 0 1px 1px rgba(34, 63, 46, .025) !important;
  font-family: "Vazirmatn", Tahoma, sans-serif !important;
  font-size: 16px !important;
  line-height: 1.55;
}
.field textarea { min-height: 92px !important; border-radius: 13px !important; }
.field input:focus, .field select:focus, .field textarea:focus,
input[type="search"]:focus, input[placeholder*="جستجو"]:focus,
.tx-toolbar-select:focus {
  border-color: rgba(40, 99, 68, .58) !important;
  box-shadow: 0 0 0 3px rgba(40, 99, 68, .12) !important;
  outline: 0 !important;
}
input::placeholder, textarea::placeholder { color: #89958c !important; opacity: 1; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--crm-green) !important; }
.tx-toolbar { flex-wrap: wrap; gap: 8px !important; }
.tx-toolbar-select { max-width: 100%; }
.chip-row { gap: 7px !important; }
.chip, .chip-opt {
  min-height: 38px !important;
  padding: 7px 12px !important;
  color: var(--crm-ink-soft) !important;
  background: var(--crm-surface) !important;
  border: 1px solid var(--crm-line) !important;
  border-radius: 999px !important;
  font-size: .75rem !important;
  font-weight: 600 !important;
}
.chip.active, .chip-opt.selected {
  color: #fff !important;
  background: var(--crm-green) !important;
  border-color: var(--crm-green) !important;
}
.customer-filter-indicator, .filter-indicator, .bp-customer-secondary-filters {
  color: var(--crm-muted);
}
.btn-row { gap: 8px !important; }
.btn, .btn.small, .btn.secondary, .btn.danger {
  min-height: 44px;
  padding: 9px 14px;
  border-radius: 12px !important;
  font-family: "Vazirmatn", Tahoma, sans-serif !important;
  font-weight: 700 !important;
  box-shadow: none;
}
.btn:not(.secondary):not(.danger) {
  color: #fff !important;
  background: var(--crm-green) !important;
  border-color: var(--crm-green) !important;
}
.btn.secondary {
  color: var(--crm-ink-soft) !important;
  background: var(--crm-surface) !important;
  border-color: var(--crm-line) !important;
}
.btn.small { min-height: 40px; padding: 7px 11px; font-size: .75rem !important; }
.btn:disabled { opacity: .48; }

/* Sheets, dialogs, pickers and toast feedback */
.overlay, .more-overlay, .inv-payment-backdrop {
  background: rgba(21, 37, 28, .42) !important;
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.overlay .sheet, .sheet, .inv-payment-panel {
  width: min(100%, 760px);
  color: var(--crm-ink) !important;
  background: var(--crm-surface) !important;
  border: 1px solid var(--crm-line) !important;
  border-radius: 21px 21px 0 0 !important;
  box-shadow: var(--crm-shadow-raised) !important;
}
.sheet h3, .sheet-title { margin-block: 5px 15px; font-size: 1rem !important; }
.sheet-handle, .more-sheet-handle { background: rgba(65, 87, 71, .2) !important; }
.close-x, .icon-btn, .icon-button {
  color: var(--crm-ink-soft) !important;
  background: var(--crm-surface-subtle) !important;
  border-color: var(--crm-line) !important;
}
.toast {
  color: #fff !important;
  background: var(--crm-green) !important;
  box-shadow: var(--crm-shadow-raised);
}
.toast.error { background: var(--crm-red) !important; }
.more-page { gap: 21px !important; }
.more-group-title { color: var(--crm-muted) !important; font-weight: 650 !important; }
.more-group-card { border-color: var(--crm-line) !important; }
.more-row { min-height: 55px; color: var(--crm-ink) !important; }
.more-row-icon { color: var(--crm-green) !important; }
.more-row + .more-row::before { background: var(--crm-separator) !important; }

/* Secondary modules: stock, suppliers, visits, prospects, checks, watches,
   evaluation, locations, game and settings */
.mgmt-section, .settings-section { margin-block-end: 18px; }
.mgmt-section-title { color: var(--crm-ink) !important; }
.settings-warn, .settings-restore-note, .eval-incomplete-note {
  color: #81562f !important;
  background: var(--crm-orange-soft) !important;
  border-color: rgba(201, 120, 60, .2) !important;
  border-radius: 13px !important;
}
.settings-tech-row, .auto-backup-row, .tech-label { color: var(--crm-ink) !important; }
.auto-backup-row { border-color: var(--crm-separator) !important; }
.gc-panel, .gc-mission, .more-group-card, .report-summary-card,
.prospect-result-card, .watch-detail-card, .watch-followup-card {
  border: 1px solid var(--crm-line) !important;
}
.gc-title, .gc-section-title, .gc-mission-title, .watch-detail-title {
  color: var(--crm-ink) !important;
}
.gc-title-line, .gc-line { background: var(--crm-separator) !important; border-color: var(--crm-separator) !important; }
.gc-seg { background: var(--crm-surface-subtle) !important; }
.gc-seg-btn.is-active { color: var(--crm-green) !important; background: var(--crm-surface) !important; }
.gc-mission.is-complete .gc-mission-icon, .gc-line-val.is-ok, .gc-pill.is-on {
  color: var(--crm-green) !important;
}
.watch-detail-reason .watch-detail-value { color: var(--crm-orange) !important; }
.watch-severity-high, .action-urgency-critical { color: var(--crm-red) !important; }
.action-urgency-high { color: var(--crm-orange) !important; }
.action-urgency-medium { color: var(--crm-green) !important; }
.prospect-daily-target, .prospect-result-card, .evaluation-card, .eval-card {
  border-color: var(--crm-line) !important;
}
.rank-pill-incomplete { color: var(--crm-muted) !important; background: var(--crm-surface-subtle) !important; }
.bp-alert-row, .bp-dashboard-watch-card, .watch-followup-row {
  border-color: var(--crm-separator) !important;
}
.check-status, .payment-status, .visit-status { font-weight: 650; }

/* Consistent dark palette for all legacy pages and their native controls */
html[data-theme="dark"] {
  --crm-canvas: #111a15;
  --crm-surface: #1a251e;
  --crm-surface-raised: #202d24;
  --crm-surface-subtle: #202d24;
  --crm-ink: #e5eee7;
  --crm-ink-soft: #c1d0c5;
  --crm-muted: #9aab9f;
  --crm-line: rgba(213, 233, 218, .13);
  --crm-separator: rgba(213, 233, 218, .09);
  --crm-green: #79b38a;
  --crm-green-soft: rgba(89, 147, 104, .2);
  --crm-orange: #e6a06b;
  --crm-orange-soft: rgba(230, 160, 107, .14);
  --crm-red: #f17d76;
  --crm-red-soft: rgba(241, 125, 118, .15);
  --crm-shadow: none;
  --crm-shadow-raised: 0 12px 34px rgba(0, 0, 0, .34);
  --vg-color-primary: var(--crm-green);
  --vg-color-primary-soft: var(--crm-green-soft);
  --vg-color-success: #79bc91;
  --vg-color-warning: var(--crm-orange);
  --vg-color-danger: var(--crm-red);
  --vg-color-danger-soft: var(--crm-red-soft);
  --vg-color-neutral-soft: #29332c;
  --olive-dark: var(--crm-green);
  --gold: var(--crm-orange);
  --accent-dark: var(--crm-orange);
  --accent-soft: var(--crm-orange-soft);
  --ink: var(--crm-ink);
  --ink-soft: var(--crm-muted);
  --card: var(--crm-surface);
  --line: var(--crm-line);
}
html[data-theme="dark"] body { background: var(--crm-canvas) !important; color: var(--crm-ink) !important; }
html[data-theme="dark"] .card,
html[data-theme="dark"] .report-summary-card,
html[data-theme="dark"] .gc-panel,
html[data-theme="dark"] .prospect-result-card,
html[data-theme="dark"] .cust-summary,
html[data-theme="dark"] .cust-recommended-action,
html[data-theme="dark"] .settings-section,
html[data-theme="dark"] .report-summary,
html[data-theme="dark"] .dash-activity-section,
html[data-theme="dark"] .dash-activity-group,
html[data-theme="dark"] .dash-watch-compact,
html[data-theme="dark"] .dash-monthly-target,
html[data-theme="dark"] .dash-qa-btn,
html[data-theme="dark"] .dash-health-row,
html[data-theme="dark"] .biz-status-secondary,
html[data-theme="dark"] .customer-identity-card,
html[data-theme="dark"] .customer-trend-card,
html[data-theme="dark"] .report-section,
html[data-theme="dark"] .tx-list:has(> .ledger-row),
html[data-theme="dark"] #customer-list:has(> .customer-list-row),
html[data-theme="dark"] .bp-dashboard-watch-list,
html[data-theme="dark"] .more-group-card,
html[data-theme="dark"] .cd-records-nav,
html[data-theme="dark"] .customer-tx-list,
html[data-theme="dark"] .rtp-list,
html[data-theme="dark"] main table {
  color: var(--crm-ink) !important;
  background-color: var(--crm-surface) !important;
  border-color: var(--crm-line) !important;
  box-shadow: none !important;
}
html[data-theme="dark"] .ledger-row,
html[data-theme="dark"] .tx-row,
html[data-theme="dark"] .customer-list-row,
html[data-theme="dark"] .more-row,
html[data-theme="dark"] .ledger-row .name,
html[data-theme="dark"] .tx-row-title,
html[data-theme="dark"] .customer-row-name,
html[data-theme="dark"] .value,
html[data-theme="dark"] .card .value {
  color: var(--crm-ink) !important;
}
html[data-theme="dark"] .field input:not([type="checkbox"]):not([type="radio"]),
html[data-theme="dark"] .field select,
html[data-theme="dark"] .field textarea,
html[data-theme="dark"] input[type="search"],
html[data-theme="dark"] input[placeholder*="جستجو"],
html[data-theme="dark"] .tx-toolbar-select,
html[data-theme="dark"] .inv-mini-input,
html[data-theme="dark"] .inv-payment-panel > input,
html[data-theme="dark"] .inv-payment-check-due input,
html[data-theme="dark"] .inv-discount-block input,
html[data-theme="dark"] .prod-drop-search,
html[data-theme="dark"] main table,
html[data-theme="dark"] main th {
  color: var(--crm-ink) !important;
  background-color: var(--crm-surface-subtle) !important;
  border-color: var(--crm-line) !important;
}
html[data-theme="dark"] .btn.secondary, html[data-theme="dark"] .chip,
html[data-theme="dark"] .chip-opt, html[data-theme="dark"] .close-x,
html[data-theme="dark"] .icon-btn, html[data-theme="dark"] .icon-button {
  color: var(--crm-ink-soft) !important;
  background: var(--crm-surface-subtle) !important;
  border-color: var(--crm-line) !important;
}
html[data-theme="dark"] .btn:not(.secondary):not(.danger),
html[data-theme="dark"] .chip.active, html[data-theme="dark"] .chip-opt.selected {
  color: #102016 !important;
  background: var(--crm-green) !important;
  border-color: var(--crm-green) !important;
}
html[data-theme="dark"] .report-section h3,
html[data-theme="dark"] .report-section h4,
html[data-theme="dark"] .dash-section-label,
html[data-theme="dark"] .dash-health-value,
html[data-theme="dark"] .inv-header-title-main,
html[data-theme="dark"] .inv-customer-name,
html[data-theme="dark"] .inv-payment-total,
html[data-theme="dark"] .tx-identity-title,
html[data-theme="dark"] .customer-identity-name,
html[data-theme="dark"] .customer-detail-title {
  color: var(--crm-ink) !important;
}
html[data-theme="dark"] .bp-topic-text,
html[data-theme="dark"] .bp-row-text,
html[data-theme="dark"] .customer-identity-meta,
html[data-theme="dark"] .tx-identity-meta,
html[data-theme="dark"] .cust-summary-story {
  color: var(--crm-ink-soft) !important;
}
html[data-theme="dark"] .settings-warn,
html[data-theme="dark"] .settings-restore-note,
html[data-theme="dark"] .eval-incomplete-note {
  color: #edc09b !important;
  background: var(--crm-orange-soft) !important;
}
html[data-theme="dark"] .overlay, html[data-theme="dark"] .more-overlay,
html[data-theme="dark"] .inv-payment-backdrop {
  background: rgba(0, 0, 0, .56) !important;
}
@media (max-width: 420px) {
  .report-section { padding: 12px !important; }
  .cards { gap: 7px !important; }
  .cards > .card { padding: 11px !important; }
  .tx-list:has(> .ledger-row), #customer-list:has(> .customer-list-row) { border-radius: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .btn, .chip, .chip-opt, .ledger-row, .more-row { transition: none !important; }
}

/* Keep the daily sales snapshot useful without three unrelated saturated tiles. */
html body #main .dashboard-shell .bp-dashboard-snapshot-grid {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 0 !important;
  overflow: hidden;
  padding: 3px 0;
  background: var(--crm-surface) !important;
  border: 1px solid var(--crm-line) !important;
  border-radius: 17px !important;
  box-shadow: var(--crm-shadow) !important;
}
html body #main .dashboard-shell .bp-dashboard-snapshot-item,
html body #main .dashboard-shell .bp-dashboard-snapshot-item:nth-child(2),
html body #main .dashboard-shell .bp-dashboard-snapshot-item:nth-child(3) {
  min-width: 0;
  padding: 12px 7px;
  color: var(--crm-ink) !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  filter: none !important;
}
html body #main .dashboard-shell .bp-dashboard-snapshot-item + .bp-dashboard-snapshot-item {
  border-inline-start: 1px solid var(--crm-separator) !important;
}
html body #main .dashboard-shell .bp-dashboard-snapshot-item span,
html body #main .dashboard-shell .bp-dashboard-snapshot-item strong,
html body #main .dashboard-shell .bp-dashboard-snapshot-item small {
  color: var(--crm-ink) !important;
}
html body #main .dashboard-shell .bp-dashboard-snapshot-item span,
html body #main .dashboard-shell .bp-dashboard-snapshot-item small {
  opacity: 1 !important;
  color: var(--crm-muted) !important;
}
html body #main .dashboard-shell .bp-dashboard-snapshot-item::after {
  display: none !important;
}
