/* -------------------------------------------------------
   Accounting Module — سیستم حسابداری
------------------------------------------------------- */

/* ---- Section Navigator (4 flash cards) ---- */

/* ظرف اصلی - همچنان گرید برای چیدمان کارت‌ها */
.acc-nav {
    display: grid;
    /* عرض کارت‌ها را کمی بیشتر می‌گیریم چون محتوا افقی شده است */
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
    padding: 16px 0;
}

.acc-nav-card {
    display: flex; /* تغییر به حالت افقی */
    align-items: center; /* تراز عمودی در مرکز */
    gap: 12px; /* فاصله بین آیکون و متن‌ها */
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 16px; /* پدینگ کمتر برای فشرده شدن */
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.acc-nav-card:hover {
    border-color: #3b82f6;
    background-color: #f8fafc;
    transform: translateX(4px); /* حرکت به سمت راست به جای بالا (جذاب‌تر برای لیست افقی) */
}

.acc-nav-card--active {
    border-color: #2563eb;
    background: #eff6ff;
}

/* بخش آیکون */
.acc-nav-card__icon {
    font-size: 24px; /* اندازه کوچکتر و فشرده */
    flex-shrink: 0; /* جلوگیری از تغییر سایز آیکون */
}

/* ظرف متن‌ها برای کنترل چیدمان داخلی */
.acc-nav-card__content {
    display: flex;
    flex-direction: column; /* عنوان و توضیح همچنان روی هم باشند ولی کنار آیکون */
    text-align: left; /* تراز متن به چپ (یا right برای فارسی) */
}

.acc-nav-card__title {
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    line-height: 1.2;
}

.acc-nav-card__desc {
    font-size: 11px;
    color: #64748b;
    margin-top: 2px;
    white-space: nowrap; /* جلوگیری از شکستن خط برای فشرده ماندن */
    overflow: hidden;
    text-overflow: ellipsis; /* اگر متن طولانی بود سه نقطه بخورد */
}

/* ---- Section Container ---- */

.acc-section {
    display: none;
    padding: 8px 0;
    animation: acc-fadein 0.2s ease;
}

.acc-section--active {
    display: block;
}

@keyframes acc-fadein {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- Chart of Accounts (CoA) ---- */

.coa-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.coa-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #475569;
    flex: 1;
    flex-wrap: wrap;
}

.coa-breadcrumb__item {
    cursor: pointer;
    color: #2563eb;
    text-decoration: underline dotted;
}

.coa-breadcrumb__item:hover {
    color: #1d4ed8;
}

.coa-breadcrumb__sep {
    color: #94a3b8;
}

.coa-breadcrumb__current {
    color: #1e293b;
    font-weight: 600;
}

.coa-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
}

.coa-card {
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 18px 16px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
    position: relative;
}

.coa-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 3px 14px rgba(59, 130, 246, 0.15);
    transform: translateY(-2px);
}

.coa-card--has-children {
    border-color: #dbeafe;
    background: #f8faff;
}

.coa-card--leaf {
    border-style: dashed;
}

.coa-card__code {
    font-size: 11px;
    color: #94a3b8;
    font-family: monospace;
    margin-bottom: 4px;
}

.coa-card__name {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 6px;
}

.coa-card__type {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    display: inline-block;
    background: #f1f5f9;
    color: #475569;
}

.coa-card__children-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #2563eb;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: 10px;
    padding: 1px 7px;
    min-width: 20px;
    text-align: center;
}

.coa-card__actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    opacity: 0;
    transition: opacity 0.15s;
}

.coa-card:hover .coa-card__actions {
    opacity: 1;
}

.coa-card__action-btn {
    background: #f1f5f9;
    border: none;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 11px;
    cursor: pointer;
    color: #475569;
    transition: background 0.15s;
}

.coa-card__action-btn:hover {
    background: #e2e8f0;
}

.coa-card__action-btn--danger:hover {
    background: #fee2e2;
    color: #dc2626;
}

/* ---- CoA Empty & Loading ---- */

.coa-empty, .coa-loading, .coa-error {
    text-align: center;
    padding: 48px 24px;
    color: #94a3b8;
    font-size: 14px;
}

/* ---- Shared Form / Modal ---- */

.acc-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    animation: acc-fadein 0.15s ease;
}

.acc-modal {
    background: #fff;
    border-radius: 16px;
    padding: 28px 32px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    position: relative;
}

.acc-modal__title {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 20px;
}

.acc-modal__close {
    position: absolute;
    top: 16px;
    left: 20px;
    background: none;
    border: none;
    font-size: 18px;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}

.acc-modal__close:hover {
    color: #475569;
}

.acc-form-group {
    margin-bottom: 16px;
}

.acc-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.acc-form-group input,
.acc-form-group select,
.acc-form-group textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    color: #1e293b;
    background: #fff;
    transition: border-color 0.15s;
    box-sizing: border-box;
    font-family: inherit;
}

.acc-form-group input:focus,
.acc-form-group select:focus,
.acc-form-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.acc-modal__actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* ---- Buttons ---- */

.acc-btn {
    padding: 9px 20px;
    border-radius: 8px;
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
}

.acc-btn--primary {
    background: #2563eb;
    color: #fff;
}

.acc-btn--primary:hover {
    background: #1d4ed8;
}

.acc-btn--secondary {
    background: #f1f5f9;
    color: #475569;
}

.acc-btn--secondary:hover {
    background: #e2e8f0;
}

.acc-btn--danger {
    background: #dc2626;
    color: #fff;
}

.acc-btn--danger:hover {
    background: #b91c1c;
}

.acc-btn--success {
    background: #059669;
    color: #fff;
}

.acc-btn--success:hover {
    background: #047857;
}

.acc-btn--sm {
    padding: 5px 12px;
    font-size: 12px;
}

.acc-btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ---- Event Definition ---- */

.event-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.event-type-filter {
    padding: 7px 12px;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: 13px;
    color: #374151;
    background: #fff;
    cursor: pointer;
}

.event-type-group {
    margin-bottom: 24px;
}

.event-type-group__header {
    font-size: 13px;
    font-weight: 700;
    color: #374151;
    padding: 8px 14px;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 10px;
    border-right: 4px solid #3b82f6;
}

.rule-row {
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 8px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.rule-row__main {
    flex: 1;
}

.rule-row__title {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 4px;
}

.rule-row__meta {
    font-size: 12px;
    color: #64748b;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.rule-row__logic {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 6px;
    background: #ede9fe;
    color: #7c3aed;
}

.rule-row__actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* ---- Document Issuance ---- */

.doc-form {
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    padding: 24px;
    margin-bottom: 20px;
}

.doc-form__title {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
}

.doc-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

.doc-form-row--3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.doc-metadata {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    padding: 16px;
    margin-top: 12px;
}

.doc-metadata__title {
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.doc-metadata-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 8px;
}

.doc-metadata-row:last-child {
    margin-bottom: 0;
}

/* ---- Flow Preview Table ---- */

.flows-preview {
    margin-top: 20px;
}

.flows-preview__title {
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.flows-preview__badge {
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 8px;
}

.flows-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.flows-table th {
    background: #f8fafc;
    padding: 10px 12px;
    text-align: right;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}

.flows-table td {
    padding: 10px 12px;
    color: #1e293b;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.flows-table tr:last-child td {
    border-bottom: none;
}

.flows-table tr:hover td {
    background: #f8faff;
}

.flow-direction {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.flow-direction__from {
    background: #fee2e2;
    color: #991b1b;
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 600;
}

.flow-direction__arrow {
    color: #94a3b8;
}

.flow-direction__to {
    background: #dcfce7;
    color: #14532d;
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 600;
}

.flow-amount {
    font-family: monospace;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
}

/* ---- Status Badge ---- */

.status-badge {
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.status-badge--draft {
    background: #fef9c3;
    color: #854d0e;
}

.status-badge--confirmed {
    background: #dcfce7;
    color: #14532d;
}

.status-badge--cancelled {
    background: #fee2e2;
    color: #991b1b;
}

.status-badge--pending {
    background: #ede9fe;
    color: #5b21b6;
}

/* ---- Financial Reports ---- */

.reports-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0;
}

.reports-tab-btn {
    background: none;
    border: none;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    border-radius: 6px 6px 0 0;
    transition: color 0.15s;
}

.reports-tab-btn:hover {
    color: #2563eb;
}

.reports-tab-btn--active {
    color: #2563eb;
    border-bottom-color: #2563eb;
    background: #eff6ff;
}

.reports-content {
    display: none;
}

.reports-content--active {
    display: block;
    animation: acc-fadein 0.2s ease;
}

/* ---- Report Filter Bar ---- */

.report-filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 16px;
}

.report-filter-bar label {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    white-space: nowrap;
}

.report-filter-bar input,
.report-filter-bar select {
    padding: 6px 10px;
    border: 1.5px solid #d1d5db;
    border-radius: 7px;
    font-size: 13px;
    color: #1e293b;
    background: #fff;
}

/* ---- Trial Balance Table ---- */

.tb-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.tb-table th {
    background: #1e293b;
    color: #fff;
    padding: 11px 14px;
    text-align: right;
    font-weight: 600;
    white-space: nowrap;
}

.tb-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
    vertical-align: middle;
}

.tb-table tr:hover td {
    background: #f8faff;
}

.tb-table__footer td {
    font-weight: 700;
    background: #f8fafc;
    border-top: 2px solid #e2e8f0;
}

.tb-positive {
    color: #059669;
}

.tb-negative {
    color: #dc2626;
}

/* ---- Ledger ---- */

.ledger-account-filter {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.ledger-header {
    background: #1e293b;
    color: #fff;
    border-radius: 10px 10px 0 0;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ledger-header__title {
    font-size: 15px;
    font-weight: 700;
}

.ledger-header__balance {
    font-size: 14px;
}

/* ---- Shared: numbers ---- */

.num {
    font-family: monospace;
    font-weight: 600;
}

/* ---- Loading spinner ---- */

.acc-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #94a3b8;
    font-size: 14px;
    gap: 10px;
}

.acc-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: acc-spin 0.7s linear infinite;
}

@keyframes acc-spin {
    to { transform: rotate(360deg); }
}

.acc-error {
    background: #fee2e2;
    color: #991b1b;
    border-radius: 10px;
    padding: 14px 18px;
    font-size: 13px;
    margin: 10px 0;
}

.acc-empty {
    text-align: center;
    padding: 40px;
    color: #94a3b8;
    font-size: 14px;
}

/* ================================================================
   Accounting Graph Section
================================================================ */

.acc-graph-wrap {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 220px);
    min-height: 480px;
    background: #f8fafc;
    border-radius: 12px;
    overflow: hidden;
    border: 1.5px solid #e2e8f0;
}

.acc-graph-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: #fff;
    border-bottom: 1.5px solid #e2e8f0;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.acc-graph-mode-toggle {
    display: flex;
    gap: 4px;
    background: #f1f5f9;
    padding: 3px;
    border-radius: 8px;
}

.acc-graph-mode-btn {
    padding: 5px 14px;
    border-radius: 6px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    transition: all .15s;
}

.acc-graph-mode-btn--active {
    background: #fff;
    color: #1e293b;
    box-shadow: 0 1px 4px rgba(0,0,0,.1);
}

.acc-graph-legend {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 11px;
    color: #475569;
    margin-right: auto;
    align-items: center;
}

.acc-graph-legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-left: 4px;
    vertical-align: middle;
}

.acc-graph-canvas {
    flex: 1;
    overflow: hidden;
    position: relative;
    background: #fff;
}

.acc-graph-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    height: 100%;
    color: #64748b;
    font-size: 13px;
}

.acc-graph-info {
    padding: 6px 16px;
    font-size: 11px;
    color: #94a3b8;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    text-align: left;
    direction: ltr;
    flex-shrink: 0;
}

.acc-graph-tooltip {
    position: fixed;
    background: rgba(15, 23, 42, .88);
    color: #fff;
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 6px;
    pointer-events: none;
    z-index: 9999;
    white-space: pre-line;
    max-width: 240px;
    direction: rtl;
    line-height: 1.6;
}

/* ─── COA detail modal (فاز ۱) ─── */
.coa-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 14px;
}
.coa-tab {
    border: none;
    background: none;
    padding: 8px 12px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    color: #64748b;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    border-radius: 6px 6px 0 0;
}
.coa-tab:hover { background: #f8fafc; }
.coa-tab--active { color: #2563eb; border-bottom-color: #2563eb; font-weight: 700; }
.coa-tabpane { display: none; }
.coa-tabpane--active { display: block; }

.coa-art-row {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
    background: #f8fafc;
}
.coa-art-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.coa-art-event { font-size: 13px; font-weight: 700; color: #1e293b; }
.coa-art-role { font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 8px; }
.coa-art-src  { font-size: 11px; color: #94a3b8; }
.coa-art-desc { font-size: 12px; color: #475569; margin-top: 4px; }
.coa-art-flow { font-size: 12px; color: #334155; margin-top: 6px; direction: rtl; }

.coa-bal-grid { display: flex; gap: 8px; flex-wrap: wrap; }
.coa-bal-box {
    flex: 1; min-width: 110px;
    border: 2px solid #e2e8f0; border-radius: 10px;
    padding: 12px 8px; text-align: center; background: #f8fafc;
}
.coa-bal-v { font-size: 18px; font-weight: 800; direction: ltr; }
.coa-bal-l { font-size: 11px; color: #64748b; margin-top: 3px; }

.coa-kv {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 0; border-bottom: 1px solid #f1f5f9; font-size: 13px; color: #475569;
}
.coa-kv:last-child { border-bottom: none; }
.coa-kv b { color: #1e293b; }

/* ─── Article Bank (فاز ۲) ─── */
.article-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
}
.article-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
    transition: box-shadow .15s, transform .15s;
}
.article-card:hover { box-shadow: 0 6px 18px rgba(0,0,0,.08); transform: translateY(-1px); }
.article-card__head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.article-card__code { font-family: monospace; font-size: 12px; font-weight: 700; color: #2563eb; }
.article-card__cat {
    font-size: 10px; background: #f1f5f9; color: #475569;
    padding: 1px 8px; border-radius: 8px;
}
.article-card__usage { font-size: 11px; color: #f59e0b; margin-right: auto; font-weight: 600; }
.article-card__label { font-size: 14px; font-weight: 700; color: #1e293b; margin-bottom: 10px; }
.article-card__flow {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    background: #f8fafc; border-radius: 8px; padding: 8px 10px;
    font-size: 12px; margin-bottom: 10px;
}
.article-card__arrow { color: #94a3b8; font-weight: 700; }
.article-card__foot { display: flex; align-items: center; justify-content: space-between; }
.article-card__src { font-size: 11px; color: #94a3b8; font-family: monospace; }

/* ─── Document suggestion panel (فاز ۳) ─── */
.doc-suggest {
    border: 1px solid #c7d2fe;
    background: #eef2ff;
    border-radius: 10px;
    padding: 12px 14px;
    margin: 4px 0 14px;
}
.doc-sg-head { font-size: 13px; font-weight: 700; color: #3730a3; }
.doc-sg-head small { font-weight: 400; color: #6366f1; margin-right: 6px; }
.doc-sg-arts { display: flex; flex-direction: column; gap: 5px; margin-top: 8px; }
.doc-sg-art {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
    background: #fff; border: 1px solid #e0e7ff; border-radius: 8px;
    padding: 5px 9px; font-size: 12px;
}
.doc-sg-src  { font-size: 11px; color: #94a3b8; font-family: monospace; }
.doc-sg-link { font-size: 11px; color: #2563eb; margin-right: auto; font-family: monospace; }

/* ─── Financial statements (فاز ۴) ─── */
.tb-table .is-section td {
    background: #f1f5f9;
    font-weight: 700;
    color: #334155;
    font-size: 12px;
    padding-top: 10px;
}
.tb-table .is-subtotal td {
    font-weight: 700;
    border-top: 1px solid #e2e8f0;
}
.tb-table .is-net td {
    background: #eff6ff;
    font-weight: 700;
    color: #1e40af;
}
.tb-table .is-final td {
    background: #1e293b;
    color: #f8fafc;
    font-weight: 800;
    font-size: 14px;
}
.tb-table .is-final td.num { color: #f8fafc; }

/* ─── Continuous audit (فاز ۵) ─── */
.audit-grid { display: flex; flex-direction: column; gap: 10px; }
.audit-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.audit-card__head {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px; cursor: pointer;
}
.audit-card__head:hover { background: #f8fafc; }
.audit-card__title { font-size: 14px; font-weight: 700; color: #1e293b; }
.audit-card__toggle { margin-right: auto; color: #94a3b8; transition: transform .15s; }
.audit-card--open .audit-card__toggle { transform: rotate(180deg); }
.audit-card__summary { padding: 0 14px 12px; font-size: 12px; color: #64748b; }
.audit-card__body { display: none; padding: 0 14px 14px; }
.audit-card--open .audit-card__body { display: block; }
.audit-overall { font-size: 13px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ─── Dimensions tree (گروه ← بُعد ← مقدار) ─── */
.dim-tree { display: flex; flex-direction: column; gap: 12px; }
.dim-actions { display: flex; gap: 6px; align-items: center; }
.dim-grp { border: 1px solid #e2e8f0; border-radius: 12px; overflow: hidden; background: #fff; }
.dim-grp__head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 11px 14px; background: #f1f5f9; border-bottom: 1px solid #e2e8f0;
}
.dim-grp__name { font-size: 14px; font-weight: 700; color: #1e293b; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dim-grp__body { padding: 10px 14px; display: flex; flex-direction: column; gap: 8px; }
.dim-def { border: 1px solid #eef2f7; border-radius: 10px; background: #fafcff; }
.dim-def__head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 9px 12px;
}
.dim-def__name { font-size: 13px; font-weight: 600; color: #334155; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dim-vals { padding: 0 12px 10px 28px; display: flex; flex-direction: column; gap: 5px; }
.dim-val {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    font-size: 12px; color: #475569; padding: 4px 8px; background: #fff; border: 1px solid #f1f5f9; border-radius: 8px;
}
.dim-empty { font-size: 12px; color: #94a3b8; padding: 4px 2px; }

/* ── SRD Wizard Modal ─────────────────────────────────────── */
body.svc-srd-open { overflow: hidden; }

.svc-srd-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: acc-fadein 0.2s ease;
}

.svc-srd-modal {
    background: #fff;
    border-radius: 18px;
    width: 100%;
    max-width: 720px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
    overflow: hidden;
    animation: svc-srd-slide 0.25s ease;
}

@keyframes svc-srd-slide {
    from { opacity: 0; transform: translateY(24px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.svc-srd-modal-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
}
.svc-srd-modal-head h3 { margin: 0; font-size: 1.05rem; color: #1e40af; }
.svc-srd-modal-head small { color: #64748b; font-size: 11px; }
.svc-srd-close {
    border: none; background: #fff; color: #64748b; width: 32px; height: 32px;
    border-radius: 8px; cursor: pointer; font-size: 16px; line-height: 1;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.svc-srd-close:hover { color: #1e293b; background: #f1f5f9; }

.svc-srd-stepper {
    padding: 14px 20px 12px;
    border-bottom: 1px solid #f1f5f9;
    background: #fafbfc;
}
.svc-srd-step-meta {
    display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap;
}
.svc-srd-step-badge {
    font-size: 11px; font-weight: 700; color: #1d4ed8;
    background: #dbeafe; padding: 3px 10px; border-radius: 20px;
}
.svc-srd-step-name { font-size: 14px; color: #1e293b; }
.svc-srd-progress {
    height: 4px; background: #e2e8f0; border-radius: 4px; overflow: hidden; margin-bottom: 12px;
}
.svc-srd-progress-bar {
    height: 100%; background: linear-gradient(90deg, #3b82f6, #1d4ed8);
    border-radius: 4px; transition: width 0.3s ease;
}
.svc-srd-dots {
    display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px;
}
.svc-srd-dot {
    flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%;
    border: 2px solid #e2e8f0; background: #fff; color: #94a3b8;
    font-size: 11px; font-weight: 700; cursor: pointer; padding: 0;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s ease;
}
.svc-srd-dot.is-done { border-color: #86efac; background: #f0fdf4; color: #059669; }
.svc-srd-dot.is-active { border-color: #1d4ed8; background: #1d4ed8; color: #fff; box-shadow: 0 0 0 3px rgba(29,78,216,.2); }
.svc-srd-dot:hover:not(.is-active) { border-color: #93c5fd; color: #1d4ed8; background: #eff6ff; }

.svc-srd-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.svc-srd-type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}
.svc-srd-type-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 18px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    background: #fff;
    cursor: pointer;
    text-align: center;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
    min-height: 110px;
}
.svc-srd-type-card:hover {
    border-color: #93c5fd;
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.12);
    transform: translateY(-2px);
}
.svc-srd-type-card.is-selected {
    border-color: #1d4ed8;
    background: linear-gradient(160deg, #eff6ff 0%, #fff 100%);
    box-shadow: 0 8px 24px rgba(29, 78, 216, 0.18);
}
.svc-srd-type-card input { position: absolute; opacity: 0; pointer-events: none; }
.svc-srd-type-icon { font-size: 28px; line-height: 1; }
.svc-srd-type-label { font-size: 12px; font-weight: 700; color: #334155; line-height: 1.4; }

.svc-srd-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}
.svc-srd-footer-hint { font-size: 12px; color: #64748b; flex: 1; text-align: center; }

@media (max-width: 640px) {
    .svc-srd-overlay { padding: 0; align-items: flex-end; }
    .svc-srd-modal { max-height: 95vh; border-radius: 18px 18px 0 0; }
    .svc-srd-type-grid { grid-template-columns: repeat(2, 1fr); }
}
