/* ==========================================================================
   سامانهٔ ERP — استایل پایه (راست‌به‌چپ، بدون نیاز به اینترنت)
   ========================================================================== */

@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/Vazirmatn-Variable.woff2") format("woff2-variations"),
       url("../fonts/Vazirmatn-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #e3e6ea;
  --text: #1d2430;
  --muted: #667085;
  --faint: #98a2b3;

  --side-bg: #17202e;
  --side-text: #c4cbd6;
  --side-muted: #6f7b8f;
  --side-hover: #222d3e;
  --side-active: #2b3a50;

  --accent: #0f766e;
  --accent-soft: #e6f4f2;
  --warn: #b45309;
  --warn-soft: #fdf3e5;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --ok: #067647;
  --ok-soft: #e7f6ee;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06);
  --side-width: 248px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: "Vazirmatn", Tahoma, "Segoe UI", sans-serif;
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
  font-feature-settings: "ss01";
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.4; margin: 0 0 .5rem; }
h1 { font-size: 1.45rem; font-weight: 700; }
h2 { font-size: 1.1rem; font-weight: 600; }
h3 { font-size: .98rem; font-weight: 600; }

.num, .ltr { direction: ltr; unicode-bidi: embed; display: inline-block; }

/* ---------- چیدمان ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--side-width);
  flex-shrink: 0;
  background: var(--side-bg);
  color: var(--side-text);
  padding: 18px 12px 28px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 10px 18px;
  color: #fff; font-weight: 700; font-size: 1.05rem;
}
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent);
  display: grid; place-items: center;
  font-size: .8rem; letter-spacing: .5px;
}

.nav-group { margin-top: 14px; }
.nav-group-title {
  font-size: .72rem; color: var(--side-muted);
  padding: 0 10px 4px; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 10px; border-radius: 7px;
  color: var(--side-text); font-size: .9rem;
}
a.nav-item:hover { background: var(--side-hover); text-decoration: none; color: #fff; }
.nav-item.is-current { background: var(--side-active); color: #fff; }
.nav-item.is-planned { color: var(--side-muted); cursor: default; }
.nav-badge {
  font-size: .66rem; padding: 0 7px; border-radius: 99px;
  border: 1px solid #344257; color: var(--side-muted); white-space: nowrap;
}
.nav-badge.building { border-color: #8a5a17; color: #e8b05e; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 28px; background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5;
}
.topbar-context { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.topbar-user { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .88rem; white-space: nowrap; }

.context-select {
  font: inherit; font-size: .86rem;
  padding: 4px 10px 4px 28px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
}

.content { padding: 26px 28px 48px; max-width: 1180px; width: 100%; }

.btn.menu-toggle { display: none; }

/* ---------- کارت‌ها ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.page-head p { margin: 0; color: var(--muted); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 22px;
}
.card + .card { margin-top: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-head p { margin: 0; color: var(--muted); font-size: .88rem; }

/* چک‌لیست راه‌اندازی */
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 0; border-top: 1px solid var(--border);
}
.checklist li:first-child { border-top: 0; }
.check-dot {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-size: .78rem; font-weight: 700;
  border: 2px solid var(--border); color: var(--faint);
}
.checklist li.done .check-dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.check-body { flex: 1; }
.check-body small { display: block; color: var(--muted); }
.checklist li.done .check-body strong { color: var(--muted); font-weight: 500; }

/* نقشهٔ ماژول‌ها */
.module-group + .module-group { margin-top: 18px; }
.module-group h3 { color: var(--muted); font-size: .82rem; font-weight: 600; margin-bottom: 8px; }
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.module {
  border: 1px solid var(--border); border-radius: 9px; padding: 12px 14px;
  background: var(--surface-2);
}
.module-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 600; }
.module p { margin: 4px 0 0; font-size: .82rem; color: var(--muted); line-height: 1.6; }
.module.active { background: var(--surface); border-color: #b7dcd7; }
.module.building { background: var(--warn-soft); border-color: #f1d3a6; }
.module ul { margin: 8px 0 0; padding: 0 16px 0 0; font-size: .82rem; color: var(--text); }

/* برچسب وضعیت */
.pill {
  font-size: .7rem; font-weight: 600; padding: 1px 8px; border-radius: 99px; white-space: nowrap;
  background: #eef0f3; color: var(--muted);
}
.pill.active { background: var(--ok-soft); color: var(--ok); }
.pill.building { background: #fbe3c2; color: var(--warn); }

/* دکمه‌ها */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: .86rem; font-weight: 600;
  padding: 6px 14px; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.btn:hover { text-decoration: none; background: var(--surface-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #0b625b; }
.btn-link { border: 0; background: none; padding: 0; color: var(--muted); font-weight: 500; }
.btn-link:hover { color: var(--danger); background: none; }

/* پیام‌ها */
.messages { list-style: none; margin: 0 0 18px; padding: 0; }
.messages li { padding: 10px 14px; border-radius: 8px; margin-bottom: 8px; background: var(--accent-soft); }
.messages li.error { background: var(--danger-soft); color: var(--danger); }
.messages li.warning { background: var(--warn-soft); color: var(--warn); }
.messages li.success { background: var(--ok-soft); color: var(--ok); }

/* ---------- جدول‌ها ---------- */
.card-flush { padding: 0; overflow: hidden; }
.toolbar { display: flex; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.search {
  flex: 1; max-width: 340px; font: inherit; font-size: .88rem;
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface);
}
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th {
  text-align: right; font-weight: 600; color: var(--muted); font-size: .78rem;
  padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr.is-muted td { color: var(--faint); }
.table td.actions { white-space: nowrap; text-align: left; }
.table td.actions a + a { margin-right: 14px; }
.table td.empty { text-align: center; color: var(--muted); padding: 32px; }
.table .pill + .pill { margin-right: 4px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); margin-left: 6px; }
.dot.ok { background: var(--ok); }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 12px; border-top: 1px solid var(--border); color: var(--muted); font-size: .86rem; }

/* ---------- فرم‌ها ---------- */
.back { font-size: .84rem; color: var(--muted); display: inline-block; margin-bottom: 4px; }
.form-card { max-width: 820px; }
.form-card.narrow { max-width: 460px; }
.form-card h2 { font-size: .95rem; margin: 22px 0 12px; padding-top: 18px; border-top: 1px solid var(--border); }
.form-card h2:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; }
.form-grid.single { grid-template-columns: 1fr; }
.form-field.wide { grid-column: 1 / -1; }
.form-field > label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 4px; }
.form-field .req { color: var(--danger); }
.form-field input[type=text], .form-field input[type=password], .form-field input[type=email],
.form-field input[type=number], .form-field input:not([type]), .form-field select, .form-field textarea {
  width: 100%; font: inherit; font-size: .9rem; padding: 7px 11px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text);
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  outline: 2px solid var(--accent-soft); border-color: var(--accent);
}
.form-field.has-error input, .form-field.has-error select { border-color: var(--danger); }
.form-field .help { display: block; color: var(--muted); font-size: .78rem; margin-top: 3px; }
.form-field .error { display: block; color: var(--danger); font-size: .8rem; margin-top: 3px; }
.form-field label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; margin-top: 26px; }
.form-field > div:not(.help) { display: flex; flex-wrap: wrap; gap: 8px; }
.form-field > div > div label {
  display: flex; align-items: center; gap: 8px; font-size: .9rem; font-weight: 500;
  padding: 7px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); cursor: pointer;
}
.form-field > div > div label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.hint { color: var(--muted); font-size: .8rem; margin: 8px 0 0; }
.form-actions { display: flex; gap: 8px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--border); }

/* ---------- خزانه ---------- */
.num { font-variant-numeric: tabular-nums; }
td.ltr { display: table-cell; text-align: right; }
.table td:has(.dot) { white-space: nowrap; }
td.num, th.num { display: table-cell; text-align: left; direction: ltr; white-space: nowrap; }
.num.in, td.in { color: var(--ok); }
.num.out, td.out { color: var(--text); }
.num.warn, .warn { color: var(--warn); }
.num.ok { color: var(--ok); }
.ltr { direction: ltr; unicode-bidi: isolate; }

.acc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.acc-card { display: block; color: var(--text); }
.acc-card:hover { text-decoration: none; border-color: #b7dcd7; }
.acc-card + .acc-card { margin-top: 0; }
.acc-card.is-muted { opacity: .6; }
.acc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.acc-head small { display: block; color: var(--muted); font-size: .8rem; }
.acc-figures { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0 0; }
.acc-figures dt { font-size: .74rem; color: var(--muted); }
.acc-figures dd { margin: 0; font-size: 1.05rem; font-weight: 600; }
.empty-state { text-align: center; padding: 40px 24px; }
.empty-state p { color: var(--muted); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: -8px 0 20px; overflow-x: auto; }
.tabs a { padding: 8px 14px; color: var(--muted); font-size: .88rem; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.stat-row .card + .card { margin-top: 0; }
.stat { padding: 14px 16px; }
.stat span { display: block; font-size: .76rem; color: var(--muted); }
.stat strong { font-size: 1.15rem; }
.stat-row.inline { margin: 8px 0 0; }
.stat-row.inline .stat { padding: 10px 0; }

.steps { margin: 0; padding: 0 20px 0 0; line-height: 2.1; }
.card-head.pad, .pad { padding: 14px 16px 0; }
.card-head h2 small { font-weight: 400; color: var(--muted); font-size: .8rem; margin-right: 6px; }
.form-card.wide { max-width: none; }
.form-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.chip { font-size: .82rem; padding: 3px 12px; border-radius: 99px; border: 1px solid var(--border); color: var(--muted); }
.chip.on { background: var(--accent-soft); border-color: #b7dcd7; color: var(--accent); }
.chip:hover { text-decoration: none; }
.table.compact td, .table.compact th { padding: 7px 12px; }
.table .sub { display: block; color: var(--muted); font-size: .76rem; }
.table .desc { display: block; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table tr.strike td { text-decoration: line-through; }
.table tr.is-header td { background: var(--accent-soft); font-weight: 600; }
.table tr.is-selected td { background: #eef8f6; }
.table-wrap.tall { max-height: 560px; overflow-y: auto; }
.table-wrap.tall thead th { position: sticky; top: 0; z-index: 1; }
.table-wrap.preview { border: 1px solid var(--border); border-radius: 8px; }
.table-wrap.preview td { white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; font-size: .8rem; }
.hint-list { color: var(--muted); font-size: .84rem; padding-right: 18px; margin: 12px 0 0; }
.error-list { color: var(--danger); font-size: .85rem; padding-right: 18px; }
.kv { margin: 0 0 12px; }
.kv div { display: flex; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.kv dt { color: var(--muted); min-width: 80px; }
.kv dd { margin: 0; }

.action-bar { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.action-bar .hint { margin: 0; }
.action-bar input { font: inherit; padding: 5px 10px; border: 1px solid var(--border); border-radius: 7px; margin-right: 6px; }
.recon-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; margin-bottom: 18px; }
.recon-grid .card + .card { margin-top: 0; }
.recon-grid td:first-child { width: 28px; }
.recon-grid tbody tr { cursor: pointer; }
.match-bar {
  position: sticky; bottom: 12px; z-index: 4; display: flex; align-items: center; gap: 22px;
  background: var(--side-bg); color: #fff; padding: 10px 18px; border-radius: 10px; margin-bottom: 18px;
  box-shadow: 0 6px 20px rgba(16,24,40,.18);
}
.match-bar .btn-primary { margin-right: auto; }
.match-bar .warn { color: #f5c27a; }
.match-bar .ok { color: #7fe0c4; }

.report { max-width: 1000px; }
.report-head { display: flex; justify-content: space-between; gap: 20px; border-bottom: 2px solid var(--text); padding-bottom: 12px; margin-bottom: 16px; }
.report-head p { margin: 0; color: var(--muted); }
.report-head dl { margin: 0; font-size: .85rem; }
.report-head dl div { display: flex; gap: 8px; }
.report-head dt { color: var(--muted); }
.report-head dd { margin: 0; }
.recon-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.recon-cols h3 { font-size: .9rem; margin-bottom: 8px; }
.rep { width: 100%; border-collapse: collapse; font-size: .85rem; }
.rep td { padding: 5px 4px; border-bottom: 1px solid var(--border); }
.rep td.num { text-align: left; direction: ltr; white-space: nowrap; }
.rep tr.total td { font-weight: 700; border-bottom: 2px solid var(--text); padding-top: 9px; }
.rep tr.sub td { color: var(--muted); font-size: .78rem; padding-top: 12px; border-bottom: 0; }
.rep tr.none td { color: var(--faint); font-size: .8rem; }
.verdict { margin-top: 20px; padding: 12px 16px; border-radius: 8px; font-weight: 500; }
.verdict.ok { background: var(--ok-soft); color: var(--ok); }
.verdict.warn { background: var(--warn-soft); color: var(--warn); }
.signatures { display: flex; justify-content: space-around; margin-top: 48px; color: var(--muted); font-size: .85rem; }
.signatures span { border-top: 1px solid var(--border); padding-top: 6px; min-width: 160px; text-align: center; }

@media print {
  .sidebar, .topbar, .no-print, .messages { display: none !important; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; }
  .card { box-shadow: none; border: 0; padding: 0; }
}

/* بارگذاری فایل */
.upload-choice { display: flex; gap: 8px; margin-bottom: 14px; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border: 2px dashed var(--border); border-radius: 12px; padding: 34px 16px; text-align: center;
  background: var(--surface-2); cursor: pointer; position: relative; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.has-file { border-style: solid; border-color: var(--accent); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dz-title { font-weight: 600; }
.dz-hint { color: var(--muted); font-size: .82rem; }
.head-actions { display: flex; align-items: center; gap: 12px; }
.head-actions .btn-link { color: var(--accent); }

/* ---------- صفحهٔ ورود ---------- */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card .brand { color: var(--text); padding: 0 0 16px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .86rem; font-weight: 600; margin-bottom: 4px; }
.field input {
  width: 100%; font: inherit; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
}
.field input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.form-error { background: var(--danger-soft); color: var(--danger); padding: 8px 12px; border-radius: 8px; margin-bottom: 14px; font-size: .88rem; }

/* ---------- موبایل ---------- */
@media (max-width: 860px) {
  .sidebar { position: fixed; right: 0; z-index: 20; transform: translateX(100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .btn.menu-toggle { display: inline-flex; }
  .topbar { padding: 10px 16px; }
  .content { padding: 18px 16px 40px; }
  .topbar-user .username { display: none; }
  .form-grid, .form-grid.cols-4 { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .recon-grid, .recon-cols { grid-template-columns: 1fr; }
  .match-bar { flex-wrap: wrap; gap: 10px; }
  .page-head { flex-wrap: wrap; }
}

/* ---------- لایسنس و تسهیلات ---------- */
.license-banner { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; background: var(--warn-soft); color: var(--warn); }
.license-banner.danger { background: var(--danger-soft); color: var(--danger); }
.license-banner a { margin-right: 10px; font-weight: 600; }
.pill.danger { background: var(--danger-soft); color: var(--danger); }
.table tr.is-overdue td { background: #fff6f5; }
.num.warn, strong.warn { color: var(--danger); }
.table tfoot td { padding: 9px 12px; }
.table input { font: inherit; font-size: .85rem; padding: 4px 8px; border: 1px solid var(--border); border-radius: 6px; max-width: 160px; }

/* ---------- صفحهٔ تطبیق ---------- */
.rc-hero { display: grid; grid-template-columns: 1fr auto; gap: 14px 24px; align-items: center; margin-bottom: 16px; }
.rc-progress-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; }
.rc-progress h2 { margin: 0; font-size: 1.05rem; }
.rc-progress p { margin: 2px 0 0; color: var(--muted); font-size: .85rem; }
.rc-percent { font-size: 1.6rem; color: var(--accent); line-height: 1; }
.rc-bar { height: 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); margin-top: 10px; overflow: hidden; }
.rc-bar span { display: block; height: 100%; background: linear-gradient(90deg, #14a397, var(--accent)); border-radius: 99px; transition: width .4s; }
.rc-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.rc-actions form { margin: 0; }
.rc-steps { grid-column: 1 / -1; margin: 0; padding: 12px 18px 0 0; border-top: 1px dashed var(--border);
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 22px; font-size: .82rem; color: var(--muted); }
.rc-steps b { color: var(--text); font-weight: 600; }
.rc-tag { display: inline-block; font-size: .68rem; font-weight: 700; padding: 0 7px; border-radius: 99px;
  background: #fff4d6; color: #8a5a00; border: 1px solid #f3d38a; }

.rc-panel { display: flex; flex-direction: column; }
.rc-panel-head { padding: 14px 16px 10px; border-bottom: 1px solid var(--border); display: grid; gap: 10px; }
.rc-title { display: flex; align-items: center; gap: 10px; }
.rc-title h2 { margin: 0; font-size: .98rem; }
.rc-title small { color: var(--muted); font-size: .78rem; }
.rc-icon { font-size: .7rem; font-weight: 700; padding: 6px 8px; border-radius: 8px; }
.rc-icon.bank { background: #e8f0fe; color: #1d4ed8; }
.rc-icon.book { background: var(--accent-soft); color: var(--accent); }
.rc-tools { display: flex; gap: 8px; align-items: center; }
.rc-search { flex: 1; min-width: 0; font: inherit; font-size: .84rem; padding: 6px 11px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface-2); }
.rc-search:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); background: var(--surface); }
.rc-chips { display: flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 2px; }
.rc-chips button { font: inherit; font-size: .76rem; border: 0; background: none; padding: 3px 10px; border-radius: 6px; color: var(--muted); cursor: pointer; }
.rc-chips button.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }

.rc-list { max-height: 560px; overflow-y: auto; }
.rc-row { display: grid; grid-template-columns: 20px 74px 1fr auto; gap: 4px 12px; align-items: center;
  padding: 10px 16px; border-bottom: 1px solid var(--border); cursor: pointer; position: relative; transition: background .12s; }
.rc-row:hover { background: var(--surface-2); }
.rc-row[hidden] { display: none; }
.rc-row input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.rc-date { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.rc-desc { min-width: 0; }
.rc-main { display: block; font-size: .87rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-meta { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: .74rem; color: var(--muted); }
.rc-amt { text-align: left; white-space: nowrap; }
.rc-amt b { display: block; font-size: .92rem; font-weight: 700; }
.rc-amt small { font-size: .7rem; color: var(--faint); }
.rc-amt.in b { color: var(--ok); }
.rc-record { font-size: .74rem; font-weight: 600; opacity: 0; transition: opacity .12s; }
.rc-tag[hidden], .match-bar[hidden], .match-bar [hidden] { display: none; }
.match-bar .btn:disabled { opacity: .45; cursor: not-allowed; }
.rc-row:hover .rc-record, .rc-row:focus-within .rc-record { opacity: 1; }
.rc-row.is-selected { background: #eaf6f4; box-shadow: inset -3px 0 0 var(--accent); }
.rc-row.is-suggested { background: #fffaf0; box-shadow: inset -3px 0 0 #e7b34a; }
.rc-empty { padding: 36px 16px; text-align: center; color: var(--muted); }
.rc-older { padding-bottom: 12px; }

.match-bar { gap: 18px; flex-wrap: wrap; }
.match-bar .mb-sel, .match-bar .mb-sum { display: flex; flex-direction: column; line-height: 1.3; }
.match-bar small { font-size: .7rem; color: #9fb0c6; }
.match-bar .mb-hint { font-size: .8rem; color: #c9d4e3; margin-right: auto; }
.match-bar .btn-primary { margin-right: 0; }
.match-bar .btn:not(.btn-primary) { background: transparent; color: #fff; border-color: #44546b; }
.match-bar .mb-clear { color: #9fb0c6; font-size: .8rem; }
.match-bar .mb-clear:hover { color: #fff; }

.rc-history summary { list-style: none; cursor: pointer; padding-top: 14px; padding-bottom: 12px; }
.rc-history summary::-webkit-details-marker { display: none; }
.rc-history summary h2 { margin: 0; display: inline; }
.rc-history summary h2::before { content: "▸ "; color: var(--muted); }
.rc-history[open] summary h2::before { content: "▾ "; }
.rc-history summary small { color: var(--muted); font-weight: 400; font-size: .8rem; }

@media (max-width: 900px) {
  .rc-hero { grid-template-columns: 1fr; }
  .rc-actions { justify-content: flex-start; }
  .rc-steps { grid-template-columns: 1fr; }
  .rc-row { grid-template-columns: 20px 1fr auto; }
  .rc-date { grid-column: 2; grid-row: 2; }
  .rc-record { opacity: 1; }
}

/* ==========================================================================
   تطبیق — نسخهٔ «جفت پیشنهادی»
   ========================================================================== */
:root {
  --rx-bank: #3346a8; --rx-bank-soft: #eef0fb;
  --rx-book: #0e6b5c; --rx-book-soft: #e7f3f0;
  --rx-sugg: #b7861a; --rx-sugg-soft: #fbf3df;
  --rx-open: #b4382b; --rx-open-soft: #fbecea;
  --rx-ink: #16212b;
}
.btn-lg { padding: 10px 22px; font-size: .95rem; border-radius: 9px; }

.rx-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 28px; margin: 4px 0 22px; }
.rx-status { flex: 1; max-width: 680px; }
.rx-status h2 { font-size: 1.5rem; font-weight: 800; color: var(--rx-ink); margin: 0 0 4px; letter-spacing: -.2px; }
.rx-status h2 .num { color: var(--rx-open); }
.rx-status p { margin: 0; color: var(--muted); font-size: .9rem; max-width: 60ch; }
.rx-meter { display: flex; gap: 3px; height: 10px; margin-top: 16px; }
.rx-meter span { min-width: 0; border-radius: 3px; }
.rx-meter span[style="flex-grow: 0"] { display: none; }
.m-done { background: var(--rx-book); }
.m-sugg { background: var(--rx-sugg); }
.m-open { background: var(--rx-open); opacity: .75; }
.rx-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 20px; padding: 0; margin: 10px 0 0; font-size: .8rem; color: var(--muted); }
.rx-legend li { display: flex; align-items: center; gap: 6px; }
.rx-legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.rx-legend b { color: var(--rx-ink); font-weight: 700; }
.rx-legend-books { margin-right: auto; }
.rx-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; flex-shrink: 0; }
.rx-actions form { margin: 0; }
.rx-uploads { display: flex; gap: 16px; font-size: .82rem; }
.rx-uploads a { color: var(--muted); border-bottom: 1px dashed var(--border); }
.rx-uploads a:hover { color: var(--accent); text-decoration: none; }

.rx-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.rx-tabs button { font: inherit; font-size: .9rem; background: none; border: 0; padding: 10px 14px; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; }
.rx-tabs button b { font-weight: 600; font-size: .75rem; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 99px; padding: 0 8px; margin-right: 4px; color: var(--muted); }
.rx-tabs button.on { color: var(--rx-ink); border-bottom-color: var(--rx-ink); font-weight: 700; }
.rx-tabs button.on b { background: var(--rx-ink); border-color: var(--rx-ink); color: #fff; }
.rx-tabs button:focus-visible, .rx-ok:focus-visible { outline: 2px solid var(--rx-bank); outline-offset: 2px; }

.rx-cols, .rx-pair { display: grid; grid-template-columns: minmax(0, 1fr) 168px minmax(0, 1fr); align-items: stretch; }
.rx-cols { font-size: .78rem; color: var(--muted); padding: 0 4px 8px; }
.rx-cols span:first-child { color: var(--rx-bank); font-weight: 600; }
.rx-cols span:last-child { color: var(--rx-book); font-weight: 600; }
.rx-pair { margin-bottom: 10px; }
.rx-card { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); padding: 14px 16px; }
.rx-card.bank { border-radius: 0 10px 10px 0; border-right: 3px solid var(--rx-bank); }
.rx-card.book { border-radius: 10px 0 0 10px; border-left: 3px solid var(--rx-book); }
.rx-lone .rx-card.bank { border-radius: 10px; }
.rx-when { font-size: .8rem; color: var(--muted); }
.rx-what { min-width: 0; }
.rx-what strong { display: block; font-weight: 600; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rx-what small { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: .74rem; color: var(--muted); }
.rx-amt { text-align: left; white-space: nowrap; }
.rx-amt b { display: block; font-size: 1.08rem; font-weight: 800; color: var(--rx-ink); letter-spacing: .2px; }
.rx-amt.in b { color: var(--rx-book); }
.rx-amt small { font-size: .7rem; color: var(--faint); }

/* درز: جایی که دو طرف به هم وصل می‌شوند */
.rx-seam { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: var(--rx-book-soft); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 8px 6px; text-align: center; }
.rx-seam::before { content: ""; position: absolute; top: 50%; left: 0; right: 0; border-top: 1px dashed #b9d3cc; z-index: 0; }
.rx-pair.has-fee .rx-seam { background: var(--rx-sugg-soft); }
.rx-pair.has-fee .rx-seam::before { border-top-color: #e6cf98; }
.rx-why, .rx-fee { position: relative; z-index: 1; font-size: .7rem; color: var(--muted); background: inherit; padding: 0 4px; line-height: 1.4; }
.rx-fee { color: #8a6312; }
.rx-ok { position: relative; z-index: 1; font: inherit; font-weight: 700; font-size: .85rem; color: #fff; background: var(--rx-book);
  border: 0; border-radius: 99px; padding: 6px 22px; cursor: pointer; box-shadow: 0 0 0 4px var(--rx-book-soft); }
.rx-pair.has-fee .rx-ok { background: var(--rx-sugg); box-shadow: 0 0 0 4px var(--rx-sugg-soft); }
.rx-ok:hover { filter: brightness(1.08); }
.rx-ok:active { transform: scale(.97); }
.rx-pair:hover .rx-card { border-color: #c9d2db; }

.rx-lone { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 14px; align-items: center; margin-bottom: 10px; }
.rx-next { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.rx-next .btn-link { color: var(--rx-bank); font-size: .82rem; }
.rx-note { color: var(--muted); font-size: .82rem; max-width: 70ch; margin-top: 14px; }
.rx-empty { text-align: center; padding: 48px 20px; background: var(--surface); border: 1px dashed var(--border); border-radius: 10px; }
.rx-empty h3 { margin: 0 0 4px; font-size: 1rem; }
.rx-empty p { margin: 0; color: var(--muted); font-size: .88rem; }
.rx-pane[hidden] { display: none; }

@media (max-width: 900px) {
  .rx-head { flex-direction: column; }
  .rx-actions { align-items: flex-start; }
  .rx-cols { display: none; }
  .rx-pair { grid-template-columns: 1fr; }
  .rx-card.bank, .rx-card.book { border-radius: 10px; border-left-width: 1px; border-right-width: 3px; }
  .rx-card.book { border-right-color: var(--rx-book); }
  .rx-seam { flex-direction: row; border: 0; background: none; padding: 8px 0; }
  .rx-seam::before { display: none; }
  .rx-lone { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .rx-ok:active { transform: none; } }

/* ---------- رنگ‌بندی تازهٔ تطبیق ---------- */
:root {
  --rx-bank: #4f46e5; --rx-bank-soft: #eef0ff; --rx-bank-mid: #c7cbff;
  --rx-book: #0d9488; --rx-book-soft: #e3f7f4; --rx-book-mid: #a7e3da;
  --rx-high: #059669; --rx-high-soft: #d9f6ea;
  --rx-med: #2563eb;  --rx-med-soft: #e0eaff;
  --rx-low: #d97706;  --rx-low-soft: #fff1d6;
  --rx-open: #e5484d; --rx-ink: #111a2e;
}
.rx-head { background:
    radial-gradient(120% 140% at 100% 0%, #eef0ff 0%, rgba(238,240,255,0) 55%),
    radial-gradient(120% 140% at 0% 100%, #e3f7f4 0%, rgba(227,247,244,0) 55%), #fff;
  border: 1px solid #e3e6f0; border-radius: 16px; padding: 22px 24px; box-shadow: 0 1px 2px rgba(17,26,46,.05); }
.rx-status h2 { font-size: 1.6rem; }
.rx-meter { height: 12px; gap: 4px; }
.rx-meter span { border-radius: 99px; }
.m-done { background: linear-gradient(90deg, #10b981, #0d9488); }
.m-sugg { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.m-open { background: linear-gradient(90deg, #fb7185, #e5484d); opacity: 1; }
.rx-legend i { border-radius: 99px; }
.btn-primary { background: linear-gradient(135deg, #0f9f8f, #0d7f73); border-color: #0d7f73; }
.btn-primary:hover { background: linear-gradient(135deg, #0d9083, #0b6e64); }
.rx-actions .btn-lg { box-shadow: 0 6px 16px -6px rgba(13,148,136,.55); }

.rx-tabs { border: 0; background: #e9ecf3; padding: 4px; border-radius: 12px; display: inline-flex; gap: 2px; margin-bottom: 18px; }
.rx-tabs button { border: 0; margin: 0; border-radius: 9px; padding: 8px 16px; }
.rx-tabs button.on { background: #fff; color: var(--rx-ink); box-shadow: 0 1px 3px rgba(17,26,46,.12); border: 0; }
.rx-tabs button.on b { background: var(--rx-bank); border-color: var(--rx-bank); }

.rx-bulk { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 14px; }
.rx-bulk p { margin: 0; font-size: .84rem; color: var(--muted); max-width: 62ch; }
.conf-dot { font-weight: 700; color: var(--rx-high); }
.btn-high { background: var(--rx-high); border-color: var(--rx-high); color: #fff; box-shadow: 0 6px 16px -8px rgba(5,150,105,.7); }
.btn-high:hover { background: #047857; }

.rx-cols span:first-child { color: var(--rx-bank); }
.rx-cols span:last-child { color: var(--rx-book); }
.rx-card { border-color: #e3e6f0; }
.rx-card.bank { border-right: 4px solid var(--rx-bank); background: linear-gradient(270deg, #fafaff, #fff 40%); }
.rx-card.book { border-left: 4px solid var(--rx-book); background: linear-gradient(90deg, #f6fdfb, #fff 40%); }
.rx-amt b { font-size: 1.12rem; }
.rx-amt.in b { color: #0f8a5f; }
.rx-amt.out b { color: var(--rx-ink); }

/* درز: از نیلیِ بانک به سبزآبیِ دفاتر */
.rx-seam { background: linear-gradient(270deg, var(--rx-bank-soft), var(--rx-book-soft)); border-color: #e3e6f0; gap: 7px; }
.rx-seam::before { border-top: 2px dotted rgba(17,26,46,.12); }
.rx-pair.has-fee .rx-seam { background: linear-gradient(270deg, var(--rx-bank-soft), var(--rx-low-soft)); }
.rx-why { background: transparent; font-size: .7rem; color: #5b6478; }

.rx-conf { position: relative; z-index: 1; font: inherit; font-size: .8rem; font-weight: 700; border-radius: 99px;
  padding: 6px 16px; border: 1.5px solid; cursor: pointer; display: inline-grid; place-items: center; min-width: 118px;
  transition: background .15s, color .15s; }
.rx-conf > span { grid-area: 1 / 1; transition: opacity .15s; }
.rx-conf .c-ok { opacity: 0; }
button.rx-conf:hover .c-label, button.rx-conf:focus-visible .c-label { opacity: 0; }
button.rx-conf:hover .c-ok, button.rx-conf:focus-visible .c-ok { opacity: 1; }
.conf-high { color: var(--rx-high); background: var(--rx-high-soft); border-color: #9be3c5; }
.conf-medium { color: var(--rx-med); background: var(--rx-med-soft); border-color: #b5cbfb; }
.conf-low { color: #b45309; background: var(--rx-low-soft); border-color: #f6cf8a; }
button.conf-high:hover { background: var(--rx-high); color: #fff; border-color: var(--rx-high); }
button.conf-medium:hover { background: var(--rx-med); color: #fff; border-color: var(--rx-med); }
button.conf-low:hover { background: var(--rx-low); color: #fff; border-color: var(--rx-low); }
button.rx-conf:active { transform: scale(.97); }
button.rx-conf:focus-visible { outline: 2px solid var(--rx-bank); outline-offset: 2px; }

.rx-lone .rx-card.bank { border-radius: 12px; }
.rx-empty { border-radius: 14px; background: linear-gradient(135deg, #f6fdfb, #fafaff); }
@media (max-width: 900px) {
  .rx-bulk { flex-direction: column; align-items: flex-start; }
  .rx-tabs { display: flex; }
  .rx-seam { background: none; }
}
@media (prefers-reduced-motion: reduce) { .rx-conf, .rx-conf > span { transition: none; } button.rx-conf:active { transform: none; } }
.rx-pair:hover .rx-card { border-top-color: #cfd4e6; border-bottom-color: #cfd4e6; }
.rx-pair:hover .rx-card.bank { border-right-color: var(--rx-bank); }
.rx-pair:hover .rx-card.book { border-left-color: var(--rx-book); }

/* ==========================================================================
   پوستهٔ تازهٔ برنامه (رنگ‌بندی کلی، منو، تمام‌عرض)
   ========================================================================== */
:root {
  --bg: #f3f5fa; --surface: #ffffff; --surface-2: #f7f8fc; --border: #e4e7ef;
  --text: #131b2e; --muted: #5f6b85; --faint: #98a1b5;
  --accent: #0d9488; --accent-soft: #e3f7f4; --accent-2: #4f46e5; --accent-2-soft: #eef0ff;
  --ok: #059669; --ok-soft: #d9f6ea; --warn: #b45309; --warn-soft: #fff1d6;
  --danger: #dc2626; --danger-soft: #fdeceb;
  --radius: 14px; --shadow: 0 1px 2px rgba(19,27,46,.04), 0 4px 14px -6px rgba(19,27,46,.08);
  --side-width: 264px;
}
body { background: var(--bg); }
.content { max-width: none; padding: 28px 32px 56px; }

/* منوی کناری */
.sidebar { background: linear-gradient(180deg, #141b38 0%, #111f35 55%, #0e2a33 100%); color: #c9d1e4;
  padding: 18px 14px 14px; display: flex; flex-direction: column; border-left: 1px solid rgba(255,255,255,.04); }
.brand { padding: 6px 8px 18px; gap: 12px; border-bottom: 1px solid rgba(255,255,255,.07); margin-bottom: 8px; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(135deg, #6366f1, #14b8a6);
  color: #fff; box-shadow: 0 6px 18px -6px rgba(20,184,166,.7); }
.brand-text { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.brand-text b { font-size: .98rem; color: #fff; }
.brand-text small { font-size: .74rem; color: #8f9bb8; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { flex: 1; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.nav-group { margin-top: 16px; }
.nav-group-title { font-size: .72rem; color: #7180a2; padding: 0 12px 6px; font-weight: 600; }
.nav-item { justify-content: flex-start; gap: 11px; padding: 9px 12px; border-radius: 10px; color: #c9d1e4; font-size: .92rem;
  margin-bottom: 2px; transition: background .15s, color .15s; }
.nav-item .ico { flex-shrink: 0; opacity: .8; }
a.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
a.nav-item:hover .ico { opacity: 1; }
.nav-item.is-current { background: linear-gradient(90deg, rgba(20,184,166,.22), rgba(99,102,241,.32)); color: #fff;
  box-shadow: inset -3px 0 0 #5eead4; font-weight: 600; }
.nav-item.is-current .ico { opacity: 1; color: #5eead4; }
a.nav-item:focus-visible { outline: 2px solid #5eead4; outline-offset: 1px; }
.nav-roadmap { margin-top: 18px; border-top: 1px solid rgba(255,255,255,.07); padding-top: 10px; }
.nav-roadmap summary { cursor: pointer; list-style: none; font-size: .78rem; color: #7180a2; padding: 6px 12px; border-radius: 8px; }
.nav-roadmap summary::-webkit-details-marker { display: none; }
.nav-roadmap summary::after { content: " ▾"; }
.nav-roadmap[open] summary::after { content: " ▴"; }
.nav-roadmap summary:hover { color: #c9d1e4; }
.nav-item.is-planned { color: #6b7896; font-size: .84rem; padding: 6px 12px; }
.nav-item.is-planned .ico { opacity: .55; }
.nav-badge { margin-right: auto; font-style: normal; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 12px 8px 2px; margin-top: 10px; border-top: 1px solid rgba(255,255,255,.07); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .85rem;
  color: #fff; background: linear-gradient(135deg, #6366f1, #14b8a6); flex-shrink: 0; }
.who { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; flex: 1; }
.who b { font-size: .85rem; color: #fff; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who small { font-size: .72rem; color: #8f9bb8; }
.side-logout { font: inherit; font-size: .76rem; background: rgba(255,255,255,.06); color: #c9d1e4; border: 0; border-radius: 8px;
  padding: 5px 10px; cursor: pointer; }
.side-logout:hover { background: rgba(239,68,68,.2); color: #fecaca; }
.scrim { display: none; }

/* نوار بالا */
.topbar { background: rgba(255,255,255,.85); backdrop-filter: blur(8px); padding: 12px 32px; border-bottom: 1px solid var(--border); }
.context-select { border-radius: 10px; background: var(--surface); padding: 6px 12px 6px 30px; font-weight: 500; }
.context-select:hover { border-color: #c9cfdd; }

/* اجزای عمومی */
.page-head h1 { font-size: 1.6rem; font-weight: 800; letter-spacing: -.2px; }
.card { border-radius: var(--radius); border-color: var(--border); box-shadow: var(--shadow); }
.btn { border-radius: 10px; padding: 7px 16px; border-color: var(--border); }
.btn:hover { border-color: #c9cfdd; }
.btn-primary { background: linear-gradient(135deg, #14a89a, #0d8278); border-color: #0d8278; color: #fff;
  box-shadow: 0 4px 12px -6px rgba(13,148,136,.7); }
.btn-primary:hover { background: linear-gradient(135deg, #0f998c, #0b7369); border-color: #0b7369; }
.table th { background: var(--surface-2); color: var(--muted); font-weight: 600; }
.table tbody tr:hover { background: #f8f9fe; }
.pill { border-radius: 99px; padding: 2px 10px; }
.pill.active { background: var(--ok-soft); color: var(--ok); }
.stat { position: relative; overflow: hidden; }
.stat::after { content: ""; position: absolute; inset: auto 0 0 0; height: 3px; background: linear-gradient(90deg, #14b8a6, #6366f1); opacity: .7; }
.stat strong { font-size: 1.3rem; font-weight: 800; }
.tabs { border-bottom: 1px solid var(--border); gap: 4px; }
.tabs a { border-radius: 10px 10px 0 0; padding: 9px 16px; }
.tabs a:hover { background: var(--surface-2); }
.tabs a.on { color: var(--accent-2); border-bottom-color: var(--accent-2); }
.form-field input[type=text], .form-field input[type=password], .form-field input[type=email],
.form-field input[type=number], .form-field input:not([type]), .form-field select, .form-field textarea { border-radius: 10px; padding: 8px 12px; }
.messages li { border-radius: 12px; padding: 12px 16px; }
.module.active { border-color: #b9e6df; }
.module { border-radius: 12px; }

/* موبایل */
@media (max-width: 860px) {
  .sidebar { position: fixed; top: 0; right: 0; bottom: 0; height: 100vh; z-index: 30; transform: translateX(100%);
    transition: transform .22s ease; box-shadow: -10px 0 30px rgba(0,0,0,.25); }
  .sidebar.open { transform: none; }
  .sidebar.open + .scrim { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 25; }
  .topbar { padding: 10px 14px; }
  .content { padding: 18px 14px 40px; }
  .btn.menu-toggle { font-size: 1.1rem; padding: 4px 12px; }
}
@media (prefers-reduced-motion: reduce) { .sidebar, .nav-item { transition: none; } }
.rx-status { max-width: 900px; }

/* ==========================================================================
   صورت مغایرت
   ========================================================================== */
.rp-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.rp-toolbar label { font-size: .88rem; color: var(--muted); }
.rp-toolbar input { font: inherit; padding: 7px 12px; border: 1px solid var(--border); border-radius: 10px; width: 130px; background: #fff; }
.rp-toolbar .rp-print { margin-right: auto; }

.rp-verdict { display: flex; justify-content: space-between; align-items: center; gap: 20px; border-radius: 16px; padding: 22px 26px;
  margin-bottom: 20px; border: 1px solid; }
.rp-verdict h2 { margin: 0 0 4px; font-size: 1.4rem; font-weight: 800; }
.rp-verdict p { margin: 0; font-size: .9rem; max-width: 72ch; }
.rp-verdict.ok { background: linear-gradient(120deg, #e6f8f1, #effaf6 60%, #f3fbff); border-color: #b5e8d2; color: #065f46; }
.rp-verdict.bad { background: linear-gradient(120deg, #fdeceb, #fff4f2 60%, #fff); border-color: #f5c2bd; color: #9f1d1d; }
.rp-verdict.unknown { background: linear-gradient(120deg, #fff4dc, #fffaf0); border-color: #f3d7a1; color: #8a5a00; }
.rp-badge { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; font-size: 1.8rem; font-weight: 800;
  flex-shrink: 0; color: #fff; }
.rp-verdict.ok .rp-badge { background: linear-gradient(135deg, #10b981, #0d9488); box-shadow: 0 8px 20px -8px rgba(16,185,129,.8); }
.rp-verdict.bad .rp-badge { background: linear-gradient(135deg, #fb7185, #dc2626); box-shadow: 0 8px 20px -8px rgba(220,38,38,.7); }
.rp-verdict.unknown .rp-badge { background: linear-gradient(135deg, #fbbf24, #d97706); }

.rp-doc { background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 26px 28px; box-shadow: var(--shadow); }
.rp-head { display: flex; justify-content: space-between; gap: 24px; padding-bottom: 16px; margin-bottom: 20px; border-bottom: 2px solid var(--text); }
.rp-head h1 { font-size: 1.35rem; margin: 0; }
.rp-head p { margin: 2px 0 0; color: var(--muted); }
.rp-head dl { margin: 0; display: grid; gap: 2px; font-size: .86rem; }
.rp-head dl div { display: flex; gap: 10px; }
.rp-head dt { color: var(--muted); min-width: 70px; }
.rp-head dd { margin: 0; }

.rp-bridge { display: grid; grid-template-columns: minmax(0, 1fr) 56px minmax(0, 1fr); align-items: stretch; }
.rp-col { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; }
.rp-col h3 { margin: 0; padding: 12px 18px; font-size: .9rem; color: #fff; }
.rp-col.bank h3 { background: linear-gradient(90deg, #6366f1, #4f46e5); }
.rp-col.book h3 { background: linear-gradient(90deg, #14b8a6, #0d9488); }
.rp-line { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 13px 18px; }
.rp-line > span { min-width: 0; }
.rp-line b { font-size: 1.02rem; font-weight: 800; white-space: nowrap; }
.rp-line small { display: block; font-size: .74rem; color: var(--muted); font-weight: 400; }
.rp-line.start { background: var(--surface-2); border-bottom: 1px solid var(--border); font-weight: 600; }
.rp-line.end { margin-top: auto; border-top: 2px solid var(--text); font-weight: 700; background: #fff; }
.rp-col.bank .rp-line.end b { color: #4338ca; }
.rp-col.book .rp-line.end b { color: #0f766e; }
.rp-line.end b { font-size: 1.2rem; }

.rp-sec { border-bottom: 1px solid var(--border); }
.rp-sec summary { list-style: none; cursor: pointer; }
.rp-sec summary::-webkit-details-marker { display: none; }
.rp-sec summary:hover { background: #fafbfe; }
.rp-sec summary > span { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; }
.rp-sec summary small { flex-basis: 100%; padding-right: 30px; }
.rp-sec i { font-style: normal; width: 22px; height: 22px; border-radius: 7px; display: inline-grid; place-items: center; font-weight: 800; }
.rp-sign-plus { background: var(--ok-soft); color: var(--ok); }
.rp-sign-minus { background: var(--danger-soft); color: var(--danger); }
.rp-sec ul { list-style: none; margin: 0; padding: 0 18px 10px; }
.rp-sec li { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 10px; padding: 6px 0; font-size: .82rem;
  border-top: 1px dashed var(--border); }
.rp-sec li .d { color: var(--muted); }
.rp-sec li .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.rp-eq { display: grid; place-items: center; }
.rp-eq span { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-size: 1.4rem; font-weight: 800;
  color: #fff; background: linear-gradient(135deg, #10b981, #0d9488); box-shadow: 0 0 0 6px #e6f8f1; }
.rp-eq.bad span { background: linear-gradient(135deg, #fb7185, #dc2626); box-shadow: 0 0 0 6px #fdeceb; }
.rp-eq.unknown span { background: linear-gradient(135deg, #fbbf24, #d97706); box-shadow: 0 0 0 6px #fff4dc; }
.rp-note { color: var(--muted); font-size: .8rem; margin: 16px 0 0; }
.rp-sign { display: flex; justify-content: space-around; margin-top: 56px; color: var(--muted); font-size: .88rem; }
.rp-sign span { border-top: 1px solid var(--text); padding-top: 6px; min-width: 180px; text-align: center; }

@media (max-width: 900px) {
  .rp-bridge { grid-template-columns: 1fr; gap: 12px; }
  .rp-eq { padding: 4px 0; }
  .rp-head { flex-direction: column; }
  .rp-verdict { padding: 18px; }
}
@media print {
  .rp-verdict { display: none; }
  .rp-doc { border: 0; box-shadow: none; padding: 0; }
  .rp-sec { break-inside: avoid; }
  .rp-sec:not([open]) ul { display: block; }
  .rp-col h3 { color: #000 !important; background: none !important; border-bottom: 1px solid #000; }
  .rp-eq span { box-shadow: none; color: #000; background: none !important; border: 2px solid #000; }
  .rp-col { border-color: #999; }
  body, .main, .content { background: #fff !important; }
  @page { size: A4; margin: 14mm; }
}

/* ==========================================================================
   گزارش‌های تحلیلی
   ========================================================================== */
.an-head { align-items: flex-end; }
.an-filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; background: #e9ecf3; border-radius: 11px; padding: 3px; }
.seg button { font: inherit; font-size: .84rem; border: 0; background: none; padding: 6px 14px; border-radius: 8px; color: var(--muted); cursor: pointer; }
.seg button.on { background: #fff; color: var(--text); font-weight: 700; box-shadow: 0 1px 3px rgba(19,27,46,.12); }
.an-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 2px; border-top: 3px solid #cbd2e1; }
.kpi span { font-size: .8rem; color: var(--muted); }
.kpi b { font-size: 1.35rem; font-weight: 800; letter-spacing: .2px; }
.kpi small { font-size: .74rem; color: var(--faint); }
.kpi.in { border-top-color: #0d9488; } .kpi.out { border-top-color: #4f46e5; }
.kpi.pos { border-top-color: #10b981; } .kpi.pos b { color: #047857; }
.kpi.neg { border-top-color: #e5484d; } .kpi.neg b { color: #c62828; }
.kpi.fee { border-top-color: #d97706; }
.an-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.an-grid .card + .card { margin-top: 0; }
.an-card.span-2 { grid-column: span 2; } .an-card.span-3 { grid-column: 1 / -1; }
.an-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.an-card-head h2 { margin: 0; font-size: 1rem; }
.an-card-head p { margin: 2px 0 0; font-size: .8rem; color: var(--muted); }
.an-legend { list-style: none; display: flex; gap: 14px; margin: 0; padding: 0; font-size: .8rem; color: var(--muted); flex-wrap: wrap; }
.an-legend i, .ch-tip i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: 6px; vertical-align: -1px; }
.chart { width: 100%; min-height: 200px; }
.ch-svg { display: block; width: 100%; height: auto; overflow: visible; }
.ch-grid { stroke: #eceff5; } .ch-zero { stroke: #b8c0d0; }
.ch-axis { font: 11px Vazirmatn, Tahoma, sans-serif; fill: #8a93a8; }
.ch-hit { fill: transparent; cursor: crosshair; } .ch-hit.on { fill: rgba(79,70,229,.05); }
.ch-cross { stroke: #9aa3b8; stroke-dasharray: 3 3; }
.ch-dot { stroke: #fff; stroke-width: 2; }
.ch-tip { position: absolute; pointer-events: none; background: #131b2e; color: #fff; font-size: .78rem; line-height: 1.7;
  padding: 8px 12px; border-radius: 10px; box-shadow: 0 8px 22px -8px rgba(0,0,0,.45); white-space: nowrap; direction: rtl; z-index: 3; }
.ch-tip b { display: block; margin-bottom: 2px; }
.an-table summary { cursor: pointer; font-size: .8rem; color: var(--accent-2); margin-top: 8px; }
.an-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.an-bars li { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: .84rem; }
.an-bars.compact { gap: 7px; } .an-bars.compact li { grid-template-columns: 120px minmax(0, 1fr) 42px; font-size: .8rem; }
.an-bars .lbl { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.an-bars .track { height: 10px; background: #f0f2f8; border-radius: 99px; overflow: hidden; }
.an-bars .fill { display: block; height: 100%; border-radius: 99px; min-width: 2px; }
.fill.in { background: #0d9488; } .fill.out { background: #4f46e5; } .fill.fee { background: #d97706; }
.an-bars b { font-weight: 700; font-size: .82rem; }
.an-bars .none { display: block; color: var(--muted); }
.an-sub { font-size: .82rem; margin: 10px 0 8px; } .an-sub.in { color: #0f766e; } .an-sub.out { color: #4338ca; }
.an-aging td small { display: block; color: var(--muted); font-size: .72rem; }
.an-aging .sev { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-left: 8px; }
.lvl-0 .sev { background: #10b981; } .lvl-1 .sev { background: #f59e0b; } .lvl-2 .sev { background: #f97316; } .lvl-3 .sev { background: #dc2626; }
.an-progress { display: inline-block; width: 120px; height: 8px; background: #eef0f6; border-radius: 99px; overflow: hidden; vertical-align: middle; }
.an-progress span { display: block; height: 100%; background: linear-gradient(90deg, #14b8a6, #0d9488); border-radius: 99px; }
@media (max-width: 1200px) { .an-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .an-grid { grid-template-columns: 1fr; } .an-card.span-2 { grid-column: auto; }
  .an-kpis { grid-template-columns: 1fr 1fr; }
}

/* ---------- دریافت و پرداخت ---------- */
.rv-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rv-add { margin-bottom: 18px; }
.rv-add-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 12px; }
.rv-add-head h2 { margin: 0; font-size: 1rem; }
.rv-kind label { font-size: .86rem; padding: 6px 18px; border-radius: 8px; cursor: pointer; color: var(--muted); }
.rv-kind input { display: none; }
.rv-kind label.on { background: #fff; color: var(--text); font-weight: 700; box-shadow: 0 1px 3px rgba(19,27,46,.12); }
.rv-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 16px; }
.rv-actions { display: flex; justify-content: flex-start; margin-top: 16px; }
.rv-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.rv-filters .rc-search { flex: 1 1 260px; }
.rv-date { width: 110px; font: inherit; font-size: .84rem; padding: 6px 10px; border: 1px solid var(--border); border-radius: 10px; }
.pill.rv-in { background: #d9f6ea; color: #047857; } .pill.rv-out { background: #eef0ff; color: #4338ca; }
@media (max-width: 1100px) { .rv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .rv-grid, .rv-kpis { grid-template-columns: 1fr; } }

/* ---------- بازهٔ تطبیق و منبع دفاتر ---------- */
.rx-period{display:flex;flex-wrap:wrap;gap:12px;align-items:stretch;margin:0 0 16px}
.rx-period-form{display:flex;flex-wrap:wrap;gap:10px;align-items:center;background:var(--card,#fff);
  border:1px solid var(--line,#e5e7eb);border-radius:14px;padding:10px 14px;flex:1 1 420px}
.rx-period-form label{display:flex;align-items:center;gap:6px;font-size:.9rem;color:var(--muted,#64748b)}
.rx-period-form input{width:130px}
.rx-period-title{font-weight:700;margin-inline-end:4px}
.rx-period-form .err{color:#b91c1c;font-size:.85rem}
.rx-source{flex:1 1 360px;border-radius:14px;padding:10px 14px;display:flex;flex-direction:column;gap:4px;
  border:1px solid;font-size:.9rem}
.rx-source.ok{background:#f0fdfa;border-color:#99f6e4;color:#115e59}
.rx-source.warn{background:#fffbeb;border-color:#fcd34d;color:#92400e}
.rx-source a{font-weight:600}
.btn.btn-sm{padding:4px 10px;font-size:.85rem;margin-inline-start:6px}
