/* اجزای مشترک کاوش روی MDB 9 (RTL). رنگ‌ها و قلم فقط از tokens.css می‌آیند. */

html { font-size: var(--base-size); }
body { background: var(--bg); color: var(--ink); font-family: var(--font-body); line-height: 1.85; text-wrap: pretty; -webkit-font-smoothing: antialiased; --mdb-body-bg: var(--bg); --mdb-body-color: var(--ink); --mdb-surface-bg: var(--surface); --mdb-surface-color: var(--ink); --mdb-border-color: var(--border); --mdb-primary: var(--brand); --mdb-body-font-family: var(--font-body); }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { font-family: var(--font-heading); color: var(--ink); line-height: 1.5; margin: 0; }
h1, .h1 { font-size: var(--heading-size); font-weight: 700; }
h2, .h2 { font-size: 1.2rem; font-weight: 700; }
h3, .h3 { font-size: 1.02rem; font-weight: 700; }
p { margin: 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-hover); text-decoration: underline; }
button, input, select, textarea { font: inherit; }
[hidden] { display: none !important; }
:focus-visible, .btn:focus-visible, .btn-close:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; box-shadow: none; }
table { font-size: var(--table-size); }
.muted, .text-muted { color: var(--muted) !important; }
.small { font-size: .8125rem; }
.num, .code { font-variant-numeric: tabular-nums; }
.jalali-date { white-space: nowrap; }
[data-att-name], .fl .fn bdi { unicode-bidi: isolate; direction: ltr; }
.code { direction: ltr; unicode-bidi: isolate; display: inline-block; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.i.sm { width: 16px; height: 16px; }
.i.lg { width: 26px; height: 26px; }

/* ---------- چینش ---------- */
.rowf { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid { display: grid; gap: 20px; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.row2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.row3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.split { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.split > .col-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.split > .col-side { flex: 1 1 340px; max-width: 100%; display: flex; flex-direction: column; gap: 20px; }
.sticky-col { position: sticky; top: 16px; }
.divider { height: 1px; background: var(--border); border: 0; margin: 18px 0; }

/* ---------- سربرگ صفحه ---------- */
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .8125rem; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-head .lead { color: var(--muted); max-width: 64ch; margin-top: 4px; }
.head-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.eyebrow { font-size: .78rem; font-weight: 700; color: var(--brand-ink); }

/* ---------- دکمه‌ها (MDB) ---------- */
.btn { font-family: var(--font-body); text-transform: none; letter-spacing: 0; font-size: .95rem; font-weight: 700; line-height: 1.5; min-height: 44px; padding: 9px 18px; border-radius: 10px; box-shadow: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:hover, .btn:focus { box-shadow: none; }
.btn-lg { min-height: 52px; font-size: 1.02rem; padding: 12px 24px; }
.btn-sm { min-height: 36px; padding: 5px 12px; font-size: .85rem; }
.btn-primary { --mdb-btn-bg: var(--brand); --mdb-btn-border-color: var(--brand); --mdb-btn-hover-bg: var(--brand-hover); --mdb-btn-hover-border-color: var(--brand-hover); --mdb-btn-active-bg: var(--brand-hover); --mdb-btn-color: var(--on-brand); --mdb-btn-hover-color: var(--on-brand); background: var(--brand); border: 1px solid var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: var(--on-brand); text-decoration: none; }
.btn-outline-primary { background: var(--surface); color: var(--brand-ink); border: 1px solid var(--brand); --mdb-btn-color: var(--brand-ink); --mdb-btn-border-color: var(--brand); --mdb-btn-hover-bg: var(--brand-soft); --mdb-btn-hover-color: var(--brand-ink); }
.btn-outline-primary:hover { background: var(--brand-soft); color: var(--brand-ink); text-decoration: none; }
.btn-light, .btn-secondary, .btn-outline-secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--border-strong); --mdb-btn-bg: var(--surface); --mdb-btn-color: var(--ink); --mdb-btn-border-color: var(--border-strong); --mdb-btn-hover-bg: var(--surface-2); --mdb-btn-hover-color: var(--ink); }
.btn-light:hover, .btn-secondary:hover, .btn-outline-secondary:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.btn-danger { background: var(--bad); border: 1px solid var(--bad); color: var(--surface); --mdb-btn-bg: var(--bad); --mdb-btn-color: var(--surface); --mdb-btn-border-color: var(--bad); }
.btn-outline-danger { background: var(--surface); color: var(--bad); border: 1px solid var(--bad); --mdb-btn-color: var(--bad); --mdb-btn-border-color: var(--bad); --mdb-btn-hover-bg: var(--bad-soft); --mdb-btn-hover-color: var(--bad); }
.btn-ai { background: var(--ai-soft); color: var(--ai-ink); border: 1px solid transparent; --mdb-btn-bg: var(--ai-soft); --mdb-btn-color: var(--ai-ink); }
.btn-ai:hover { border-color: var(--ai); color: var(--ai-ink); text-decoration: none; }
.btn-link { color: var(--brand); font-weight: 700; text-decoration: none; background: none; border: 0; }
.btn[disabled], .btn.is-off { opacity: .55; cursor: not-allowed; }
.icon-btn { position: relative; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px; background: transparent; border: 1px solid transparent; color: var(--ink); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); border-color: var(--border); text-decoration: none; color: var(--ink); }

/* ---------- کارت و پنل ---------- */
.card { background: var(--surface); color: var(--ink); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); --mdb-card-bg: var(--surface); --mdb-card-border-color: var(--border); }
.card-body { padding: 22px 24px; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 24px 0; }
.card-head + .card-body { padding-top: 14px; }
.panel-side { border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.panel-side .ph { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.panel-side .pb { padding: 18px 20px; display: flex; flex-direction: column; gap: 16px; }
.panel-side .pf { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; flex-wrap: wrap; background: var(--surface-2); border-radius: 0 0 16px 16px; }

/* ---------- هشدار MDB ---------- */
.alert { border: 0; border-radius: 14px; padding: 12px 18px; margin-bottom: 14px; color: var(--ink); background: var(--surface-2); }
.alert-info { background: var(--info-soft); }
.alert-success { background: var(--ok-soft); }
.alert-warning { background: var(--warn-soft); }
.alert-danger { background: var(--bad-soft); }
.alert a { font-weight: 700; }

/* ---------- نشان‌ها ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 11px 2px 9px; border-radius: 999px; font-size: .8125rem; font-weight: 700; line-height: 1.7; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.plain::before { display: none; }
.pill.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.pill.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.pill.brand { background: var(--brand-soft); color: var(--brand-ink); border-color: transparent; }
.pill.ai { background: var(--ai-soft); color: var(--ai-ink); border-color: transparent; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); font-size: .85rem; color: var(--ink); }
.chip.brand { background: var(--brand-soft); border-color: transparent; color: var(--brand-ink); font-weight: 600; }
.tag-ico { flex: none; width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-ink); }
.tag-ico.ai { background: var(--ai-soft); color: var(--ai-ink); }
.tag-ico.warn { background: var(--warn-soft); color: var(--warn); }
.tag-ico.ok { background: var(--ok-soft); color: var(--ok); }

/* ---------- فرم (MDB form-control) ---------- */
.form-label, .flabel { display: block; font-weight: 700; font-size: .95rem; margin-bottom: 6px; color: var(--ink); }
.req { color: var(--bad); font-weight: 600; font-size: .78rem; margin-inline-start: 6px; }
.opt { color: var(--muted); font-weight: 500; font-size: .78rem; margin-inline-start: 6px; }
.hint { color: var(--muted); font-size: .8125rem; margin-top: 6px; }
.form-control, .form-select { font-family: var(--font-body); font-size: 1rem; min-height: 48px; padding: 9px 14px; background-color: var(--surface); color: var(--ink); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: none; line-height: 1.6; }
textarea.form-control { min-height: 110px; }
input[type=file].form-control { padding: 6px; cursor: pointer; }
input[type=file].form-control::file-selector-button { margin-inline-end: 12px; padding: 7px 16px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface-2); color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; transition: border-color .15s, background .15s; }
input[type=file].form-control:hover::file-selector-button { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: var(--focus); background-color: var(--surface); color: var(--ink); }
.form-control::placeholder { color: var(--muted); opacity: .8; }
.form-control.is-invalid, .form-control.is-bad { border-color: var(--bad); }
.errorlist { list-style: none; margin: 6px 0 0; padding: 0; color: var(--bad); font-size: .8125rem; font-weight: 600; }
.ltr { direction: ltr; text-align: left; font-variant-numeric: tabular-nums; letter-spacing: .08em; }
.valid-note, .err-note { display: flex; align-items: center; gap: 6px; font-size: .8125rem; margin-top: 6px; font-weight: 600; }
.valid-note { color: var(--ok); }
.err-note { color: var(--bad); }
.opts { display: flex; flex-wrap: wrap; gap: 10px; }
.opts.scroll { max-height: 300px; overflow: auto; }
.opt-card { display: inline-flex; align-items: center; gap: 10px; padding: 9px 16px; min-height: 44px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); cursor: pointer; font-weight: 500; }
.opt-card input { width: 18px; height: 18px; accent-color: var(--brand); margin: 0; }
.opt-card.is-on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; }
.seg { display: inline-flex; padding: 4px; gap: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; }
.seg a, .seg button { display: inline-flex; align-items: center; gap: 8px; padding: 9px 18px; min-height: 44px; border-radius: 10px; border: 0; background: transparent; color: var(--muted); font-weight: 700; text-decoration: none; cursor: pointer; }
.seg .on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg .on.ai { color: var(--ai-ink); }
.decide { display: grid; gap: 10px; border: 0; padding: 0; margin: 0; }
.decide label { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border: 1.5px solid var(--border); border-radius: 14px; cursor: pointer; background: var(--surface); }
.decide input { margin-top: 6px; width: 18px; height: 18px; accent-color: var(--brand); }
.decide label.is-on { border-color: var(--brand); background: var(--brand-soft); }
.decide label.is-on.no { border-color: var(--bad); background: var(--bad-soft); }
.decide label.is-on.back { border-color: var(--warn); background: var(--warn-soft); }
.decide b, .decide small { display: block; }
.decide small { color: var(--muted); font-size: .8125rem; line-height: 1.7; }

/* ---------- بخش‌های شمارهٔ فرم و کارت انتخاب ---------- */
.sect { display: flex; gap: 16px; }
.sect-n { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink); display: grid; place-items: center; font-weight: 700; margin-top: 2px; }
.sect.done .sect-n { background: var(--brand); color: var(--on-brand); }
.sect-body { flex: 1 1 auto; min-width: 0; }
.sect-body > h2 { margin-bottom: 2px; }
.sect-body > .muted { margin-bottom: 14px; }
.svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 12px; }
.choice { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; min-height: 92px; border: 1.5px solid var(--border); border-radius: 14px; background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s; }
.choice:hover { border-color: var(--border-strong); }
.choice input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; margin: 0; }
.choice .ico { flex: none; width: 40px; height: 40px; border-radius: 11px; background: var(--surface-2); color: var(--muted); display: grid; place-items: center; }
.choice b { display: block; line-height: 1.6; }
.choice small { display: block; color: var(--muted); font-size: .8125rem; line-height: 1.7; margin-top: 2px; }
.choice .tick { position: absolute; top: 12px; inset-inline-end: 12px; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--border-strong); display: grid; place-items: center; color: transparent; background: var(--surface); }
.choice.is-on { border-color: var(--brand); background: var(--brand-soft); }
.choice.is-on .ico, .choice.is-on .tick { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.choice.is-off { opacity: .6; cursor: not-allowed; background: var(--surface-2); }
.choice:focus-within { outline: 3px solid color-mix(in srgb, var(--brand) 40%, transparent); outline-offset: 2px; }

/* ---------- پیام راهنما ---------- */
.callout { display: flex; gap: 14px; align-items: flex-start; padding: 14px 18px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2); }
.callout .i { margin-top: 3px; }
.callout b { display: block; }
.callout .go { margin-inline-start: auto; align-self: center; flex: none; }
.callout.info { background: var(--info-soft); border-color: transparent; } .callout.info .i { color: var(--info); }
.callout.warn { background: var(--warn-soft); border-color: transparent; } .callout.warn .i { color: var(--warn); }
.callout.ok { background: var(--ok-soft); border-color: transparent; } .callout.ok .i { color: var(--ok); }
.callout.bad { background: var(--bad-soft); border-color: transparent; } .callout.bad .i { color: var(--bad); }
.callout.ai { background: var(--ai-soft); border-color: transparent; } .callout.ai .i { color: var(--ai); }
.callout.brand { background: var(--brand-soft); border-color: transparent; } .callout.brand .i { color: var(--brand); }

/* ---------- چک‌لیست، مراحل و خط زمان ---------- */
.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.checks li { display: flex; align-items: center; gap: 10px; }
.ck { flex: none; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--border-strong); display: grid; place-items: center; color: transparent; }
.ck.on { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.ck.todo { border-color: var(--warn); color: var(--warn); }
.steps { display: flex; list-style: none; margin: 0; padding: 0; }
.step { position: relative; flex: 1 1 0; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; min-width: 0; padding: 0 4px; }
.step:not(:last-child)::after { content: ""; position: absolute; top: 17px; left: calc(-50% + 26px); width: calc(100% - 52px); height: 2px; background: var(--border-strong); }
.step.done:not(:last-child)::after { background: var(--brand); }
.dotn { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--border-strong); color: var(--muted); font-weight: 700; z-index: 1; }
.step.now .dotn { border-color: var(--brand); color: var(--brand-ink); box-shadow: 0 0 0 5px color-mix(in srgb, var(--brand) 22%, transparent); }
.step.done .dotn { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.step.bad .dotn { border-color: var(--bad); color: var(--bad); }
.step b { font-size: .9rem; line-height: 1.5; }
.step small { color: var(--muted); font-size: .76rem; line-height: 1.5; }
.step.now b { color: var(--brand-ink); }
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { position: relative; padding-inline-start: 30px; padding-bottom: 18px; }
.tl li::before { content: ""; position: absolute; inset-inline-start: 5px; top: 8px; bottom: -8px; width: 2px; background: var(--border); }
.tl li:last-child::before { display: none; }
.tl li::after { content: ""; position: absolute; inset-inline-start: 0; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px var(--surface); }
.tl li.todo::after { background: var(--surface); border: 2px solid var(--border-strong); }
.tl li.now::after { box-shadow: 0 0 0 3px var(--surface), 0 0 0 6px color-mix(in srgb, var(--brand) 30%, transparent); }
.tl li.bad::after { background: var(--bad); }
.tl .when { display: block; color: var(--muted); font-size: .78rem; }

/* ---------- جدول، تب و اطلاعات ---------- */
.table { --mdb-table-bg: transparent; --mdb-table-color: var(--ink); --mdb-table-border-color: var(--border); width: 100%; margin: 0; color: var(--ink); }
.table th { font-size: .8125rem; font-weight: 700; color: var(--muted); background: var(--surface-2); white-space: nowrap; padding: 11px 16px; border-bottom: 1px solid var(--border); text-align: start; }
.table td { padding: 14px 16px; vertical-align: middle; border-bottom: 1px solid var(--border); background: transparent; color: var(--ink); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table-wrap { position: relative; overflow-x: auto; border-radius: 16px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--border); }
.tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 12px 16px; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; text-decoration: none; min-height: 48px; }
.tabs a.on { color: var(--brand-ink); border-bottom-color: var(--brand); font-weight: 700; }
.tabs a.ai.on { color: var(--ai-ink); border-bottom-color: var(--ai); }
.tabs > .tablist { display: flex; flex-wrap: wrap; gap: 4px; }
[data-tab-panel][hidden] { display: none; }
.tabs .cnt { background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px; padding: 0 8px; font-size: .75rem; line-height: 20px; color: var(--muted); }
.facts, .answers { display: grid; gap: 12px; margin: 0; }
.facts { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.answers { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.fact, .answer { padding: 12px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); min-width: 0; }
.fact dt, .answer dt { font-size: .78rem; color: var(--muted); font-weight: 500; }
.fact dd, .answer dd { margin: 0; overflow-wrap: anywhere; }
.fact dd { font-weight: 700; }
.answer.wide { grid-column: 1 / -1; }
.answer-value { white-space: pre-wrap; overflow-wrap: anywhere; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 14px; }
.kpi { padding: 16px 18px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: var(--ink); }
a.kpi:hover { border-color: var(--brand); text-decoration: none; }
.kpi .v { font-size: 1.9rem; font-weight: 700; line-height: 1.4; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--muted); font-size: .85rem; }
.kpi.warn .v { color: var(--warn); }
.action-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.action-row:last-child { border-bottom: 0; padding-bottom: 0; }
.action-row .t { flex: 1 1 260px; min-width: 0; }
.action-row .t b { display: block; }
.quick { display: flex; gap: 16px; align-items: flex-start; padding: 20px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); color: var(--ink); text-decoration: none; box-shadow: var(--shadow); }
.quick:hover { border-color: var(--brand); text-decoration: none; color: var(--ink); }
.quick.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.quick.primary .muted { color: color-mix(in srgb, var(--on-brand) 80%, transparent) !important; }
.quick.primary .tag-ico { background: color-mix(in srgb, var(--on-brand) 20%, transparent); color: var(--on-brand); }
.quick.ai:hover { border-color: var(--ai); }
.meter { height: 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.actionbar { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; justify-content: space-between; padding: 14px 20px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.actionbar.warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); background: var(--warn-soft); }
.bar-row { display: grid; grid-template-columns: 150px 1fr 64px; gap: 12px; align-items: center; }
.bar { height: 26px; border-radius: 4px 0 0 4px; background: var(--brand); }

/* ---------- ضمائم: آپلود AJAX با کشیدن و رها کردن ---------- */
.dz { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; padding: 26px 20px; border: 2px dashed var(--border-strong); border-radius: 16px; background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s; }
.dz:hover { border-color: var(--brand); }
.dz.is-over { border-color: var(--brand); border-style: solid; background: var(--brand-soft); }
.dz input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dz:focus-within { outline: 3px solid color-mix(in srgb, var(--brand) 40%, transparent); outline-offset: 2px; }
.dz .up-ico { width: 48px; height: 48px; border-radius: 14px; background: var(--brand-soft); color: var(--brand-ink); display: grid; place-items: center; margin-bottom: 4px; }
.dz.is-over .up-ico { background: var(--brand); color: var(--on-brand); }
.fl { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.fl .fi { flex: none; width: 38px; height: 38px; border-radius: 10px; background: var(--surface-2); color: var(--muted); display: grid; place-items: center; }
.fl .fb { flex: 1; min-width: 0; }
.fl .fn { font-weight: 600; overflow-wrap: anywhere; }
.fl.ok .fi { background: var(--ok-soft); color: var(--ok); }
.fl.err { border-color: var(--bad); background: var(--bad-soft); }
.fl.err .fi { background: transparent; color: var(--bad); }
.fl .meter { height: 6px; margin-top: 6px; }
.fl .st { font-size: .8125rem; font-weight: 600; }
.fl.ok .st { color: var(--ok); }
.fl.err .st { color: var(--bad); }
.fl .fn a { color: inherit; }

/* ---------- گفتگو ---------- */
.chat { display: flex; flex-direction: column; gap: 16px; }
.msg { display: flex; gap: 12px; align-items: flex-start; max-width: 92%; }
.msg .av { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; }
.msg.bot .av { background: var(--ai-soft); color: var(--ai-ink); }
.msg.me { align-self: flex-start; }
.msg.me .av { background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; font-size: .8rem; }
.bubble { padding: 12px 16px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); }
.msg.me .bubble { background: var(--brand-soft); border-color: transparent; }
.msg.bot .bubble { border-top-right-radius: 4px; }
.composer { display: flex; align-items: flex-end; gap: 10px; padding: 12px; border: 1.5px solid var(--border-strong); border-radius: 16px; background: var(--surface); }
.composer textarea { flex: 1; border: 0; resize: none; min-height: 48px; background: transparent; color: var(--ink); outline: 0; padding: 8px; }
.suggest { display: flex; flex-wrap: wrap; gap: 8px; }
.suggest a, .suggest button { padding: 7px 14px; min-height: 40px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); font-size: .875rem; text-decoration: none; cursor: pointer; display: inline-flex; align-items: center; }
.suggest a:hover, .suggest button:hover { border-color: var(--ai); color: var(--ai-ink); text-decoration: none; background: var(--ai-soft); }

/* ---------- قاعده و گردش ---------- */
.rule-card { display: flex; align-items: stretch; gap: 14px; padding: 16px 18px; border: 1.5px solid var(--border); border-radius: 16px; background: var(--surface); }
.rule-card.sel { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
.rule-no { flex: none; width: 36px; height: 36px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; font-weight: 700; }
.grip { flex: none; width: 26px; color: var(--muted); display: grid; place-items: center; cursor: grab; }
.sentence { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.sentence .w { color: var(--muted); }
.sentence .v { padding: 1px 10px; border-radius: 8px; background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.chain { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chain .st { padding: 6px 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); font-weight: 600; font-size: .875rem; }
.node { position: relative; padding: 16px 18px; border-radius: 16px; border: 1.5px solid var(--border-strong); background: var(--surface); box-shadow: var(--shadow); }
.node.sel { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 22%, transparent); }
.node.start, .node.end { background: var(--surface-2); text-align: center; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px; }
.node.end.ok { background: var(--ok-soft); border-color: transparent; }
.node.end.bad { background: var(--bad-soft); border-color: transparent; }

@media (max-width: 640px) {
  /* مراحل در موبایل زیر هم چیده می‌شوند تا بریده نشوند و پیمایش افقی لازم نباشد. */
  .steps { flex-direction: column; gap: 18px; }
  .step { display: grid; grid-template-columns: auto 1fr; column-gap: 14px; row-gap: 0; align-content: center; align-items: center; justify-items: start; text-align: start; padding: 0; }
  .step .dotn { grid-row: 1 / span 2; }
  .step b:last-child { grid-row: 1 / span 2; }
  .step:not(:last-child)::after { top: 36px; left: auto; inset-inline-start: 17px; width: 2px; height: calc(100% - 18px); }
}

/* ---------- نوار پیشرفت (مهلت): بدون style درون‌خطی، سازگار با CSP ---------- */
progress.meter { display: block; width: 100%; height: 8px; padding: 0; appearance: none; -webkit-appearance: none; border-radius: 99px; border: 1px solid var(--border); background: var(--surface-2); overflow: hidden; color: var(--brand); }
progress.meter::-webkit-progress-bar { background: transparent; }
progress.meter::-webkit-progress-value { background: var(--brand); border-radius: 99px; }
progress.meter::-moz-progress-bar { background: var(--brand); border-radius: 99px; }
progress.meter.warn::-webkit-progress-value { background: var(--warn); }
progress.meter.warn::-moz-progress-bar { background: var(--warn); }
progress.meter.bad::-webkit-progress-value { background: var(--bad); }
progress.meter.bad::-moz-progress-bar { background: var(--bad); }

/* ---------- جزئیات تاشو و ردیف انتخابی فهرست ---------- */
details.more { padding: 4px 0 0; }
details.more > summary { cursor: pointer; font-weight: 600; color: var(--muted); padding: 8px 0; }
details.more > summary:hover { color: var(--ink); }
.li { display: block; padding: 14px 16px; border-bottom: 1px solid var(--border); color: var(--ink); text-decoration: none; }
.li:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.li.on { background: var(--brand-soft); box-shadow: inset -4px 0 0 var(--brand); }
.tag-ico.bad { background: var(--bad-soft); color: var(--bad); }
.tag-ico.info { background: var(--info-soft); color: var(--info); }

/* ---------- اعلان‌ها: صندوق گروه‌بندی‌شده و منوی بالای صفحه ---------- */
.nt-group { padding: 14px 4px 0; font-size: .8125rem; font-weight: 700; color: var(--muted); }
.nt-group:first-child { padding-top: 10px; }
.nt { display: flex; gap: 14px; align-items: flex-start; padding: 16px 4px; border-bottom: 1px solid var(--border); }
.nt:last-child { border-bottom: 0; }
.nt .u { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--brand); margin-top: 12px; }
.nt .u.read { background: transparent; }
.nt-body { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; color: var(--ink); }
.nt-body > b { display: block; }
a.nt-body:hover { color: var(--ink); text-decoration: none; }
a.nt-body:hover > b { text-decoration: underline; }
.nt-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.nt-side form { margin: 0; }
.nt.compact { padding: 12px 16px; gap: 10px; align-items: center; }
.nt.compact .u { margin-top: 0; }
.nt.compact.is-unread { background: var(--brand-soft); }
.nt-list { max-height: min(470px, 65vh); overflow-y: auto; }
.dropdown-empty, .notification-error { padding: 24px 18px; color: var(--muted); font-size: .875rem; margin: 0; }
.notification-error { color: var(--bad); padding-top: 12px; }
.dropdown-footer { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 13px; font-size: .875rem; border-top: 1px solid var(--border); }

/* ---------- تعریف فرایند: قاعده، جابه‌جایی، برنامهٔ هفتگی ---------- */
.rule-card.win { border-color: var(--ok); }
.rule-card.also { border-style: dashed; border-color: var(--border-strong); }
.rule-card.is-dragging { opacity: .5; }
.rule-card.is-drop-target { box-shadow: 0 -3px 0 var(--brand); }
.rule-card.fixed { background: var(--surface-2); }
.rule-card .rule-body { flex: 1 1 auto; min-width: 0; gap: 8px; }
.rule-card .rule-side { align-items: flex-end; gap: 8px; }
button.grip { background: transparent; border: 0; padding: 0; }
.opt-card:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; }
.wk { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.wk:last-child { border-bottom: 0; }
.wk > b { flex: 0 0 90px; }
.condition-summary { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; padding: 4px 12px; border-inline-start: 3px solid var(--border-strong); overflow-wrap: anywhere; }

/* ---------- متن خام پاسخ منبع ---------- */
.result-text { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 28rem; overflow: auto; background: var(--surface-2); color: var(--ink); padding: 14px 16px; border-radius: 12px; border: 1px solid var(--border); font-size: .875rem; margin: 0; }

/* ---------- ستون مرتب‌شونده در جدول ---------- */
.sort-link { display: flex; align-items: center; justify-content: space-between; gap: 16px; color: inherit; white-space: nowrap; }
.sort-link:hover { color: var(--brand-hover); text-decoration: none; }
.sort-link.is-active { color: var(--brand-ink); }

/* ---------- پاسخ کارشناس: فهرست دوستونه، گروه کارتابل و کلاس‌های کمکی ---------- */
.gh { padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: .8125rem; font-weight: 700; color: var(--muted); }
.li.is-taken { opacity: .7; }
.split-wide { align-items: stretch; }
.list-pane { flex: 0 1 340px; min-width: 280px; overflow: hidden; padding: 0; }
.list-pane.is-wide { flex-basis: 390px; }
.list-pane .tabs { flex-wrap: nowrap; padding-inline: 8px; }
.list-pane .tabs a { padding-inline: 10px; gap: 6px; white-space: nowrap; }
.form-pane { flex: 1 1 640px; min-width: 0; }
.stack-lg { gap: 26px; }
.table-boxed { border: 1px solid var(--border); }
.nowrap { flex-wrap: nowrap; }
.justify-end { justify-content: flex-end; }
.compact-date { max-width: 130px; }
.text-ok { color: var(--ok); font-weight: 600; }
.text-warn { color: var(--warn); font-weight: 700; }
.text-bad { color: var(--bad); font-weight: 600; }
.table tbody tr.is-warn td { background: var(--warn-soft); }
.table tbody tr.is-mine td { background: var(--brand-soft); }
.card-body.flush { padding: 14px 0 0; }
.pane-tabs { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.seg-full { display: flex; }
.seg-full > a { flex: 1; justify-content: center; }
.pane-empty { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.pane-filters { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 10px 16px; border-bottom: 1px solid var(--border); font-size: .8125rem; }
.align-start { align-items: flex-start; }
.align-end { align-items: flex-end; }
.card-pad { padding: 14px 24px 22px; }
.return-form { padding: 12px 0 4px; min-width: 300px; text-align: start; }
details.more > summary.btn { display: inline-flex; padding: 5px 12px; color: var(--ink); }

/* ---------- فهرست ردیفی، صفحه‌بندی، حالت خالی، کادر کد و جزئیات تاشو (تحلیل هوشمند) ---------- */
.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { display: flex; align-items: center; gap: 14px; padding: 12px 4px; border-bottom: 1px solid var(--border); }
.rows > li:last-child { border-bottom: 0; }
.row-main { flex: 1; min-width: 0; }
.row-title { display: block; color: var(--ink); font-weight: 700; overflow-wrap: anywhere; }
a.row-title:hover { color: var(--brand-hover); }
.row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; color: var(--muted); font-size: .8125rem; }
.row-side { display: flex; align-items: center; gap: 10px; flex: none; }
.pager { display: flex; justify-content: center; align-items: center; gap: 20px; padding: 16px; color: var(--muted); font-size: .8125rem; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); border: 1px dashed var(--border-strong); border-radius: 16px; background: var(--surface-2); }
.empty .i { width: 34px; height: 34px; color: var(--border-strong); margin-bottom: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 20px 24px; align-items: start; }
.form-grid > fieldset, .form-grid > :has(textarea) { grid-column: 1 / -1; }
.table-scroll-hint { margin: 0; padding: 8px 16px; color: var(--muted); background: var(--surface-2); font-size: .85rem; }
@media (max-width: 700px) {
  .table.mobile-cards { min-width: 0; display: block; }
  .mobile-cards thead { display: none; }
  .mobile-cards tbody { display: block; }
  .mobile-cards tr { display: flex; flex-direction: column; }
  .mobile-cards tr { padding: 12px; border-bottom: 1px solid var(--border); }
  .mobile-cards td { display: block; width: 100%; white-space: normal; padding: 7px 4px; border: 0; }
  .mobile-cards td { order: 5; }
  .mobile-cards td:first-child { order: 0; }
  .mobile-cards td[data-label='وضعیت'] { order: 1; }
  .mobile-cards td[data-label='در انتظار'], .mobile-cards td[data-label='مرحله فعلی'] { order: 2; }
  .mobile-cards td[data-label='اقدام'] { order: 3; }
  .mobile-cards td[data-label]::before { content: attr(data-label) '：'; color: var(--muted); font-size: .82rem; margin-inline-end: 6px; }
  .mobile-cards td:last-child .rowf { justify-content: flex-start !important; }
}
.codebox { direction: ltr; text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 22rem; overflow: auto; background: var(--surface-2); color: var(--ink); border: 1px solid var(--border); border-radius: 10px; padding: 12px; font-size: .78rem; line-height: 1.7; }
.fold { border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.fold > summary { padding: 12px 16px; cursor: pointer; font-weight: 700; }
.fold > :not(summary) { margin-inline: 16px; }
.fold > :last-child { margin-bottom: 14px; }
.checkgrid, .checkgrid > div { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 6px 14px; }
.checkgrid label { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.checkgrid input { width: 18px; height: 18px; accent-color: var(--brand); margin: 0; }
.check-line { display: flex; align-items: center; gap: 9px; }
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.filter-bar .form-control, .filter-bar .form-select { width: auto; min-width: 160px; flex: 0 1 320px; }

/* ---------- سربرگ کارت فهرست: عنوان و وضعیت در کنار عمل‌ها ---------- */
.list-head { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.list-head > .info { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }

/* ---------- نمودار میله‌ای تک‌رنگ با برچسب مستقیم (داشبوردها) ---------- */
.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.hbars > li { display: grid; grid-template-columns: minmax(110px, 170px) minmax(0, 1fr) 56px; gap: 4px 12px; align-items: center; }
.hbars .num { text-align: end; }
.hbars .bar-note { grid-column: 1 / -1; }
progress.meter.bar { height: 22px; border-radius: 6px; }
progress.meter.bar::-webkit-progress-value { border-radius: 6px; }
progress.meter.bar::-moz-progress-bar { border-radius: 6px; }
.avatar.lg { width: 52px; height: 52px; font-size: 1.1rem; }
@media (max-width: 640px) {
  .hbars > li { grid-template-columns: minmax(0, 1fr) 48px; }
  .hbars > li > progress { grid-column: 1 / -1; grid-row: 2; }
}

/* ---------- وضعیت‌های خاص: خطا، دسترسی، نشست، خالی ---------- */
.state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 32px 24px; }
.state .big { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.state .big.warn { background: var(--warn-soft); color: var(--warn); }
.state .big.info { background: var(--info-soft); color: var(--info); }
.state .big.bad { background: var(--bad-soft); color: var(--bad); }
.state > p { max-width: 46ch; }
.state-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.state-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.state-card { width: 100%; max-width: 520px; }
