/* ═══════════════════════════════════════════════════════════════════
   صورت‌حساب (دفتر تفصیلی) — /account-statement   (Ctrl+F8 ِ WPF)
   روی توکن‌های automation.css (.atm-*)، نوارِ treasury.css (.trs-bar) و
   فیلتر و جدولِ trial-balance.css (.tb-*) ساخته شده؛ اینجا فقط .ast-* است.
   ═══════════════════════════════════════════════════════════════════ */

.ast { --ast-row: 34px; }

.ast .trs-bar__stats .bed i { color: #38bdf8; }
.ast .trs-bar__stats .bes i { color: #fbbf24; }
.ast .trs-bar__stats .ok i { color: #34d399; }

/* ─────────────── فرم ─────────────── */
.ast-f-acc { display: flex; flex-direction: column; gap: 4px; width: 340px; max-width: 100%; }
.ast-f-acc .trs-acc { margin: 0; }
.ast-warn { color: var(--atm-urgent); font-size: .74rem; display: inline-flex; gap: 4px; align-items: center; }
.ast-f-sort { display: flex; flex-direction: column; gap: 4px; }
.ast-f-sort > label { font-size: .75rem; font-weight: 700; color: var(--atm-muted); }
.ast-seg { display: inline-flex; border: 1px solid var(--atm-line); border-radius: 12px; overflow: hidden; height: 40px; }
.ast-seg button {
    padding: 0 12px; border: 0; cursor: pointer; font: inherit; font-size: .8rem; font-weight: 700;
    color: var(--atm-muted); background: var(--atm-surface);
}
.ast-seg button + button { border-inline-start: 1px solid var(--atm-line); }
.ast-seg button:hover { color: var(--atm-primary); }
.ast-seg button.is-on { color: #fff; background: var(--atm-primary); }

/* ─────────────── هشدارها ─────────────── */
.ast-alert {
    display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; padding: 10px 14px;
    border-radius: 14px; border: 1px solid var(--atm-line); background: var(--atm-surface); font-size: .84rem;
}
.ast-alert > i { font-size: 1.1rem; line-height: 1.4; }
.ast-alert > div, .ast-alert > span { flex: 1; min-width: 0; }
.ast-alert small { display: block; color: var(--atm-muted); margin-top: 2px; }
.ast-alert--bad { border-color: rgb(244 63 94 / .4); background: color-mix(in srgb, #f43f5e 8%, var(--atm-surface)); }
.ast-alert--bad > i { color: #f43f5e; }
.ast-alert--warn { border-color: rgb(245 158 11 / .45); background: color-mix(in srgb, #f59e0b 9%, var(--atm-surface)); }
.ast-alert--warn > i { color: #d97706; }
.ast-alert--root { border-color: color-mix(in srgb, var(--atm-primary) 45%, transparent); background: color-mix(in srgb, var(--atm-primary) 8%, var(--atm-surface)); align-items: center; }
.ast-alert--root > i { color: var(--atm-primary); }
.ast-alert--sm { padding: 6px 12px; font-size: .78rem; }
.ast-link {
    display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; cursor: pointer;
    font: inherit; font-weight: 700; color: var(--atm-primary);
}
.ast-issues { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; max-height: 220px; overflow: auto; }
.ast-issues li { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; }
.ast-issues li span { color: var(--atm-muted); font-variant-numeric: tabular-nums; }

/* ─────────────── ابزار و پالایه‌ها ─────────────── */
.ast-actions { display: flex; align-items: center; gap: 4px; }
.ast-actions .atm-btn { height: 36px; }
.ast-actions .atm-icon-btn:disabled { opacity: .4; cursor: not-allowed; }
.ast-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.ast-chip {
    display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 10px; border-radius: 999px;
    font-size: .76rem; color: #fff; background: var(--atm-primary);
}
.ast-chip button { display: grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; cursor: pointer; color: #fff; background: rgb(255 255 255 / .18); }
.ast-chip button:hover { background: rgb(255 255 255 / .32); }
@keyframes ast-spin { to { transform: rotate(360deg); } }
.ast-spin { display: inline-block; animation: ast-spin 1s linear infinite; }

/* ─────────────── جدول ─────────────── */
.ast-scroll {
    overflow: auto; max-height: calc(100vh - 360px); min-height: 220px;
    border-radius: 12px; border: 1px solid var(--atm-line); outline: none;
}
.ast-scroll:focus-visible { box-shadow: 0 0 0 2px color-mix(in srgb, var(--atm-primary) 45%, transparent); }
.ast-table th { cursor: pointer; }
/* ارتفاعِ ثابت: Virtualize و پیمایشِ صفحه‌کلید هر دو آن را فرض می‌کنند (RowHeight در صفحه). */
.ast-table tbody td { height: var(--ast-row); padding: 0 10px; line-height: calc(var(--ast-row) - 1px); overflow: hidden; }
.ast-table tbody tr { cursor: default; user-select: text; }
.ast-table .num { width: 84px; color: var(--atm-text); }
.ast-table .month { width: 80px; color: var(--atm-muted); }
.ast-table .tash { width: 48px; text-align: center; }
.ast-table .sharh { max-width: 520px; min-width: 240px; text-overflow: ellipsis; }
.ast-table .amt { min-width: 112px; }
.ast-table td.bed { color: var(--tb-bed); font-weight: 700; }
.ast-table td.bes { color: var(--tb-bes); font-weight: 700; }
.ast-table .act { width: 44px; }
.ast-table .act .atm-icon-btn { width: 28px; height: 28px; font-size: .85rem; }
.ast-table tbody tr.is-opening td { font-style: italic; color: var(--atm-muted); }
.ast-table tbody tr.is-open td { background: color-mix(in srgb, var(--atm-primary) 5%, transparent); }
.ast-table tbody tr.is-root td { background: color-mix(in srgb, var(--atm-primary) 16%, transparent); font-weight: 700; }
.ast-table tbody tr.is-sel td { background: color-mix(in srgb, var(--atm-primary) 13%, transparent); }
.ast-table tbody tr.is-cur td { box-shadow: inset 0 1px 0 var(--atm-primary), inset 0 -1px 0 var(--atm-primary); }
.ast-table tbody tr.is-cur td:first-child { box-shadow: inset 0 1px 0 var(--atm-primary), inset 0 -1px 0 var(--atm-primary), inset -3px 0 0 var(--atm-primary); }
.ast-table tbody tr.ast-month td {
    font-weight: 800; font-size: .8rem;
    background: color-mix(in srgb, var(--atm-text) 6%, var(--atm-surface));
    border-bottom: 2px solid color-mix(in srgb, var(--atm-text) 14%, transparent);
}
.ast-table tfoot td { padding: 8px 10px; }

.ast-selbar {
    position: sticky; bottom: 0; z-index: 2;
    display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 8px; padding: 8px 14px;
    border-radius: 12px; font-size: .82rem;
    background: color-mix(in srgb, var(--atm-primary) 12%, var(--atm-surface));
    border: 1px solid color-mix(in srgb, var(--atm-primary) 35%, transparent);
}
.ast-selbar b { font-variant-numeric: tabular-nums; }

/* ─────────────── منوی راست‌کلیک ─────────────── */
.ast-menu-back { position: fixed; inset: 0; z-index: 1400; }
.ast-menu {
    position: fixed; z-index: 1401;
    left: min(var(--x), calc(100vw - 290px)); top: min(var(--y), calc(100vh - 470px));
    width: 280px; padding: 6px; border-radius: 14px;
    background: var(--atm-surface); border: 1px solid var(--atm-line);
    box-shadow: 0 18px 40px rgb(15 23 42 / .22);
}
.ast-menu button {
    display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding: 0 10px;
    border: 0; border-radius: 9px; cursor: pointer; background: none; font: inherit; font-size: .82rem;
    color: var(--atm-text); text-align: start;
}
.ast-menu button:hover:not(:disabled) { background: var(--atm-soft); color: var(--atm-primary); }
.ast-menu button:disabled { opacity: .45; cursor: not-allowed; }
.ast-menu button i { width: 16px; text-align: center; }
.ast-menu kbd { margin-inline-start: auto; font: inherit; font-size: .7rem; color: var(--atm-muted); direction: ltr; }
.ast-menu hr { margin: 4px 6px; border: 0; border-top: 1px solid var(--atm-line); }

/* ─────────────── «پالودن سفارشی متنی» ─────────────── */
.ast-modal { position: fixed; inset: 0; z-index: 1450; display: grid; place-items: center; padding: 16px; background: rgb(15 23 42 / .45); }
.ast-modal__box {
    width: min(460px, 100%); padding: 18px; border-radius: 18px;
    background: var(--atm-surface); border: 1px solid var(--atm-line); box-shadow: 0 24px 60px rgb(15 23 42 / .3);
}
.ast-modal__box h4 { margin: 0 0 4px; font-size: 1rem; display: flex; gap: 8px; align-items: center; }
.ast-modal__box p { margin: 0 0 12px; font-size: .78rem; color: var(--atm-muted); }
.ast-modal__box .atm-input { width: 100%; height: 40px; }
.ast-modal__cols { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 12px 0; font-size: .8rem; }
.ast-modal__mode { display: flex; gap: 18px; font-size: .82rem; margin-bottom: 14px; }
.ast-modal__cols label, .ast-modal__mode label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.ast-modal__btns { display: flex; justify-content: flex-end; gap: 8px; }

@media (max-width: 720px) {
    .ast-f-acc { width: 100%; }
    .ast-f-sort { width: 100%; }
    .ast-seg { width: 100%; }
    .ast-seg button { flex: 1; }
    .ast-actions { width: 100%; flex-wrap: wrap; }
    .ast-scroll { max-height: 70vh; }
    .ast-table .sharh { min-width: 200px; }
}

/* ─────────────── چاپ (روی .trs-sheet خزانه) ─────────────── */
.ast-sheet__tbl { font-size: 8.5pt; }
.ast-sheet__tbl td.sharh { white-space: normal; }
.ast-sheet__tbl tr.month td { font-weight: 800; background: #f1f5f9; }
.ast-sheet__tbl tr.opening td { font-style: italic; }
.ast-sheet__sum { margin-top: 6mm; display: flex; gap: 10mm; justify-content: flex-end; font-size: 9.5pt; }
.ast-sheet__sum b { font-variant-numeric: tabular-nums; }
.ast-sheet__note { margin: 0 0 3mm; font-size: 8.5pt; color: #475569; display: flex; gap: 12px; flex-wrap: wrap; }
.ast-sheet__sign { margin-top: 14mm; display: flex; justify-content: space-around; font-size: 9pt; color: #334155; }
@media print {
    .ast-sheet__tbl thead { display: table-header-group; }
    .ast-sheet__tbl tr { break-inside: avoid; }
}
