/* ماژول مالی: قرارداد تسویه (تنظیمات مارکت‌پلیس)، گزارش تسویه‌ی دوره‌ها و ورودی نقدینگی.
   رنگ‌ها از متغیرهای پنل (--axp-*) می‌آیند تا در حالت تیره هم درست باشند. */
.fin-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; padding: 12px 16px; margin-bottom: 14px; }
.fin-field { display: grid; gap: 4px; font-size: 12px; color: var(--axp-muted, #64748b); min-width: 150px; }
.fin-field .select { min-width: 180px; }
.fin-date { min-width: 160px; }
.fin-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding-bottom: 8px; }
.fin-spacer { flex: 1 1 auto; }
.fin-segment { display: inline-flex; border: 1px solid var(--axp-line, #e5e7eb); border-radius: 10px; overflow: hidden; }
.fin-segment button { border: 0; background: transparent; color: inherit; padding: 8px 14px; font: inherit; font-size: 13px; cursor: pointer; }
.fin-segment button.active { background: var(--axp-accent, #2563eb); color: #fff; }

.fin-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 14px; transition: opacity .2s; }
.fin-stats.is-busy { opacity: .55; }
.fin-stats > div { background: var(--axp-card, #fff); border: 1px solid var(--axp-line, #e5e7eb); border-radius: 14px; padding: 12px 14px; display: grid; gap: 4px; }
.fin-stats small, .fin-stats span { color: var(--axp-muted, #64748b); font-size: 12px; }
.fin-stats strong { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }

.fin-tabs { margin-bottom: 12px; flex-wrap: wrap; }
.fin-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 14px; }
@media (max-width: 900px) { .fin-two { grid-template-columns: 1fr; } }

.fin-market { padding: 14px 16px; margin-bottom: 14px; display: grid; gap: 10px; }
.fin-market-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.fin-market-head h2 { margin: 0; font-size: 17px; }
.fin-market-head small { color: var(--axp-muted, #64748b); }
.fin-market-total { display: grid; text-align: left; }
.fin-market-total small { font-size: 12px; }
.fin-market-total b { font-size: 18px; font-variant-numeric: tabular-nums; }

.fin-periods td, .fin-periods th { white-space: nowrap; }
.fin-periods td { font-variant-numeric: tabular-nums; }
.fin-periods tfoot td { font-weight: 800; border-top: 2px solid var(--axp-line, #e5e7eb); }
.fin-period-row { cursor: pointer; }
.fin-period-row:hover td { background: var(--axp-soft, #f8fafc); }
.fin-period-row.is-open td { background: var(--axp-soft, #f1f5f9); font-weight: 600; }
.fin-sub-row td:nth-child(3) { padding-inline-start: 22px; }
.fin-caret { width: 24px; color: var(--axp-muted, #64748b); }
.fin-detail-row > td { background: var(--axp-bg, #f8fafc); padding: 10px 12px 14px; white-space: normal; }

.fin-status { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.fin-status.is-open { background: #e0f2fe; color: #075985; }
.fin-status.is-waiting { background: #fef3c7; color: #92400e; }
.fin-status.is-due { background: #dcfce7; color: #166534; }
.fin-chip { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 999px; }
.fin-chip.is-sale { background: #e0e7ff; color: #3730a3; }
.fin-chip.is-return { background: #fee2e2; color: #991b1b; }

.fin-breakdown { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 0 0 10px; }
.fin-breakdown > div { border: 1px solid var(--axp-line, #e5e7eb); border-radius: 10px; padding: 8px 10px; background: var(--axp-card, #fff); }
.fin-breakdown dt { font-size: 11px; color: var(--axp-muted, #64748b); }
.fin-breakdown dd { margin: 2px 0 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.fin-breakdown .is-net { border-color: #86efac; }
.fin-breakdown .is-net dd { color: #15803d; }

.fin-lines-wrap { max-height: 520px; overflow: auto; }
.fin-lines td, .fin-lines th { font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fin-lines tr.is-return td { color: #b91c1c; }
.fin-title { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.fin-title small { display: block; color: var(--axp-muted, #64748b); }
.fin-warn-dot { display: inline-grid; place-items: center; width: 15px; height: 15px; margin-inline-start: 4px; border-radius: 50%; background: #f59e0b; color: #fff; font-size: 10px; font-style: normal; font-weight: 800; }
.fin-more { margin-top: 8px; }

.fin-muted { color: var(--axp-muted, #64748b); font-size: 12px; line-height: 1.9; }
.fin-note { font-size: 13px; line-height: 1.9; background: var(--axp-soft, #f1f5f9); border-radius: 10px; padding: 8px 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fin-note.is-warn { background: #fef3c7; color: #92400e; }

/* قرارداد تسویه در تنظیمات مارکت‌پلیس */
.fin-contract-form { border: 1px solid var(--axp-line, #e5e7eb); border-radius: 12px; padding: 12px; display: grid; gap: 12px; margin-bottom: 12px; }
.fin-contract-form .span-2 { grid-column: span 2; }
.fin-preview { background: var(--axp-soft, #f8fafc); border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.fin-preview ul { margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.fin-preview li { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.fin-preview li span:first-child { min-width: 64px; color: var(--axp-muted, #64748b); }
.fin-form-actions { display: flex; gap: 8px; }

@media (max-width: 640px) {
  .fin-toolbar { padding: 10px 12px; }
  .fin-field, .fin-field .select, .fin-date { min-width: 0; width: 100%; }
  .fin-contract-form .span-2 { grid-column: auto; }
}

html[data-theme="dark"] .fin-status.is-open, .axp[data-theme="dark"] .fin-status.is-open { background: #0c4a6e; color: #bae6fd; }
html[data-theme="dark"] .fin-status.is-waiting, .axp[data-theme="dark"] .fin-status.is-waiting { background: #78350f; color: #fde68a; }
html[data-theme="dark"] .fin-status.is-due, .axp[data-theme="dark"] .fin-status.is-due { background: #14532d; color: #bbf7d0; }
html[data-theme="dark"] .fin-chip.is-sale, .axp[data-theme="dark"] .fin-chip.is-sale { background: #312e81; color: #e0e7ff; }
html[data-theme="dark"] .fin-chip.is-return, .axp[data-theme="dark"] .fin-chip.is-return { background: #7f1d1d; color: #fecaca; }
html[data-theme="dark"] .fin-lines tr.is-return td, .axp[data-theme="dark"] .fin-lines tr.is-return td { color: #fca5a5; }
html[data-theme="dark"] .fin-note.is-warn, .axp[data-theme="dark"] .fin-note.is-warn { background: #422006; color: #fde68a; }
html[data-theme="dark"] .fin-breakdown .is-net dd, .axp[data-theme="dark"] .fin-breakdown .is-net dd { color: #86efac; }

/* تأیید نهایی سفارش (مدیرکل) */
.fin-role-complete td { background: color-mix(in srgb, #22c55e 9%, transparent); }
