/* پرونده‌یار v3 — customers, sessions, admin, account. Same tokens as app.css (MASTER.md). */

/* contextual side column */
.side-head { display: grid; gap: var(--sp-2); padding-inline: var(--sp-1); }
.back-link { display: inline-flex; align-items: center; gap: var(--sp-1); font-size: var(--fs-sm); color: var(--muted); width: fit-content; border: 0; background: none; padding: var(--sp-half) 0; }
.back-link:hover { color: var(--primary-ink); }
.back-link .i { width: 14px; height: 14px; }
.side-case { display: grid; gap: var(--sp-half); }
.side-case b { font-size: var(--fs-base); line-height: var(--lh-ui); }
.side-case small { color: var(--faint); font-size: var(--fs-xs); display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.side-case a { color: var(--primary-ink); }
.si { display: grid; gap: var(--sp-1); padding: var(--sp-3) var(--sp-3); border-radius: var(--r-2); color: var(--fg); border: 1px solid transparent; transition: background var(--t-fast); }
.si:hover { background: var(--hover); }
.si[aria-current="true"] { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 30%, transparent); }
.si-title { font-weight: 600; font-size: var(--fs-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.si-meta { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-3); font-size: var(--fs-xs); color: var(--faint); }
.si-meta span { display: inline-flex; align-items: center; gap: var(--sp-1); }
.si-meta .i { width: 12px; height: 12px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--muted); padding-inline: var(--sp-1); }
.toggle-row label { display: inline-flex; align-items: center; gap: var(--sp-2); cursor: pointer; }
.toggle-row input { accent-color: var(--primary); }

/* chat header breadcrumb */
.crumbs { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; flex: 1; font-size: var(--fs-sm); color: var(--muted); overflow: hidden; }
.crumbs a { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 26ch; }
.crumbs a:hover { color: var(--primary-ink); }
.crumbs .sep { color: var(--border-strong); flex: none; }
.crumbs .cur { color: var(--fg); font-weight: 700; font-size: var(--fs-base); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.crumbs input { font: inherit; font-weight: 700; font-size: var(--fs-base); min-height: 32px; min-width: 0; flex: 1; }
.head-actions { display: flex; gap: var(--sp-half); align-items: center; flex: none; }
.author { display: flex; gap: var(--sp-2); align-items: center; font-size: var(--fs-xs); color: var(--faint); }
.author b { color: var(--muted); font-weight: 600; }

/* page tables */
.dtable { width: 100%; border-collapse: collapse; font-size: var(--fs-md); font-variant-numeric: tabular-nums; }
.dtable th { text-align: start; color: var(--muted); font-weight: 600; font-size: var(--fs-sm); padding: var(--sp-3) var(--sp-3); border-bottom: 1px solid var(--border); background: var(--surface-2); position: sticky; top: 0; z-index: 1; white-space: nowrap; }
.dtable td { padding: var(--sp-3) var(--sp-3); border-bottom: 1px solid var(--border); vertical-align: middle; }
.dtable tbody tr { transition: background var(--t-fast); }
.dtable tbody tr.link { cursor: pointer; }
.dtable tbody tr.link:hover { background: var(--hover); }
.dtable td.num, .dtable th.num { text-align: end; }
.dtable .name { font-weight: 600; }
.dtable .sub { display: block; color: var(--faint); font-size: var(--fs-xs); font-weight: 400; }
.twrap { border: 1px solid var(--border); border-radius: var(--r-2); overflow: auto; background: var(--surface); max-height: calc(100vh - 250px); }
.toolbar { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.toolbar .search { flex: 1; min-width: 220px; max-width: 420px; }
.toolbar select { min-height: 36px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--muted); flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--r-1); overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 0 var(--sp-3); min-height: 34px; font-size: var(--fs-sm); color: var(--muted); border-inline-start: 1px solid var(--border); }
.seg button:first-child { border-inline-start: 0; }
.seg button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }
.tabs-line { display: flex; gap: var(--sp-half); border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs-line button { display: inline-flex; gap: var(--sp-1); align-items: center; border: 0; background: none; padding: var(--sp-3) var(--sp-3) var(--sp-2); font-size: var(--fs-md); color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.tabs-line button[aria-selected="true"] { color: var(--primary-ink); border-bottom-color: var(--primary); }
.tabs-line b { font-size: var(--fs-xs); color: var(--faint); }
.hero-c { display: grid; gap: var(--sp-2); }
.hero-c h1 { font-size: var(--fs-2xl); }
.hero-c .meta { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; color: var(--muted); font-size: var(--fs-sm); }

/* audit action chips */
.act-chip { display: inline-flex; align-items: center; gap: var(--sp-1); height: 22px; padding: 0 var(--sp-2); border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--fg-2); border: 1px solid var(--border); }
.act-chip.g-auth { background: var(--primary-soft); color: var(--primary-ink); border-color: transparent; }
.act-chip.g-chat { background: var(--violet-soft); color: var(--violet); border-color: transparent; }
.act-chip.g-money { background: var(--success-soft); color: var(--success); border-color: transparent; }
.act-chip.g-denied { background: var(--danger-soft); color: var(--danger-ink); border-color: transparent; }
.act-chip.g-admin { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.detail-row td { background: var(--surface-2); }
.detail-row pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font: var(--fs-xs)/var(--lh-ui) var(--mono); direction: ltr; text-align: left; max-height: 280px; overflow: auto; }

/* roles */
.roles { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--sp-4); }
.role { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-2); padding: var(--sp-4) var(--sp-4); display: grid; gap: var(--sp-3); align-content: start; }
.role-h { display: flex; justify-content: space-between; gap: var(--sp-2); align-items: flex-start; }
.role-h h3 { font-size: var(--fs-base); }
.role-h p { color: var(--muted); font-size: var(--fs-sm); }
.perm-group { display: grid; gap: var(--sp-half); }
.perm-group h4 { margin: 0 0 var(--sp-half); font-size: var(--fs-xs); color: var(--faint); font-weight: 600; }
.perm { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); padding: var(--sp-1) 0; cursor: pointer; }
.perm input { width: 16px; height: 16px; accent-color: var(--primary); flex: none; }
.role-foot { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); border-top: 1px solid var(--border); padding-top: var(--sp-3); }

/* small dialogs */
.modal-card.sm { width: min(480px, 100%); height: auto; max-height: 92vh; grid-template-rows: auto minmax(0, 1fr) auto; }
.form { display: grid; gap: var(--sp-4); padding: var(--sp-4); overflow: auto; }
.form .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.form input, .form select { width: 100%; }
.form-foot { display: flex; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4) var(--sp-4); border-top: 1px solid var(--border); }
.secret { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-3); border-radius: var(--r-2); background: var(--warning-soft); color: var(--fg); }
.secret code { font: 600 var(--fs-lg) var(--mono); direction: ltr; flex: 1; letter-spacing: .03em; user-select: all; }
.help { font-size: var(--fs-sm); color: var(--muted); }
.status-dot { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); }
.status-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--success); }
.status-dot.off::before { background: var(--faint); }

/* phone: tables turn into cards */
.cards-m { display: none; }
@media (max-width: 1023px) {
  .twrap.mcards { display: none; }
  .cards-m { display: grid; gap: var(--sp-2); }
  .cards-m .mc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-2); padding: var(--sp-3) var(--sp-4); display: grid; gap: var(--sp-1); color: var(--fg); }
  .cards-m .mc small { color: var(--faint); }
  .form .row2 { grid-template-columns: 1fr; }
  .crumbs a { display: none; } .crumbs .sep { display: none; }
}

/* v3 wiring: links inside tables, rail account link, phone nav, odds and ends */
.dtable a.name { color: var(--fg); font-weight: 600; }
.dtable a.name:hover { color: var(--primary-ink); text-decoration: underline; }
.dtable td a:not(.name):not(.btn) { color: var(--primary-ink); }
.dtable .head-actions { flex-wrap: wrap; }
.dtable .head-actions .btn { white-space: nowrap; }
.me a.me-text { color: var(--fg); border-radius: var(--r-1); padding: var(--sp-half) var(--sp-1); }
.me a.me-text:hover b { color: var(--primary-ink); }
.crumbs .sep { display: inline-flex; align-items: center; }
.crumbs .sep .i { width: 14px; height: 14px; }
.crumbs a.mono { font-size: var(--fs-sm); }
.msg.me .author { padding-inline: var(--sp-1); }
.page-in > .back-link { margin-bottom: calc(var(--sp-2) * -1); }
.hero-c .meta a { color: var(--primary-ink); }
.toolbar .toggle-row { padding: 0 var(--sp-1); min-height: 36px; }
.perm .i { color: var(--success); flex: none; }
.cards-m .mc .actions { display: flex; flex-wrap: wrap; gap: var(--sp-1); margin-top: var(--sp-1); }
#auChips .chip { cursor: pointer; }
.m-only { display: none; }
#caseSide .cases { margin-top: var(--sp-half); }
@media (max-width: 1023px) {
  .bottomnav { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
  .m-only { display: flex; }
  .head-actions .icon-btn { width: 40px; height: 40px; }
  .crumbs a, .crumbs .sep { display: none; }      /* phone: only the session title; customer and case are one tap back */
}
/* the conversation column never grows past its grid cell, whatever the breadcrumb or a long line holds */
.chat { grid-template-columns: minmax(0, 1fr); }
/* headings get focus on page change (screen readers announce the page); no ring for that programmatic focus */
h1[tabindex="-1"]:focus { outline: none; }

/* insights */
.ins-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: var(--sp-4); align-items: start; }
.ins { padding: var(--sp-4) var(--sp-4); display: grid; gap: var(--sp-3); }
.ins.is-rejected { opacity: .6; }
.ins h3 { font-size: var(--fs-lg); line-height: var(--lh-ui); }
.ins p { margin: 0; line-height: var(--lh-loose); }
.ins-top { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.ins-no { margin-inline-start: auto; font-size: var(--fs-xs); color: var(--faint); }
.ins-rule { display: flex; gap: var(--sp-2); align-items: flex-start; padding: var(--sp-3) var(--sp-3); border-radius: var(--r-1); background: var(--primary-soft); color: var(--fg); font-size: var(--fs-md); line-height: var(--lh-base); }
.ins-rule .i { color: var(--primary-ink); flex: none; margin-top: var(--sp-1); }
.ins-act { display: flex; gap: var(--sp-2); align-items: flex-start; font-size: var(--fs-md); line-height: var(--lh-base); color: var(--fg-2); }
.ins-act .i { color: var(--violet); flex: none; margin-top: var(--sp-1); }
.ins-nums { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.ins-nums span { display: grid; gap: 1px; padding: var(--sp-2) var(--sp-3); border: 1px solid var(--border); border-radius: var(--r-1); background: var(--surface-2); min-width: 92px; }
.ins-nums small { font-size: var(--fs-xs); color: var(--muted); }
.ins-nums b { font-size: var(--fs-base); font-variant-numeric: tabular-nums; }
.ins-check { display: flex; gap: var(--sp-2); align-items: center; color: var(--warning); }
.ins-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--sp-2); align-items: center; border-top: 1px solid var(--border); padding-top: var(--sp-3); }
.ins-ev { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.ins-ev .chip { cursor: pointer; }
.ins-foot .btn[aria-pressed="true"] { background: var(--primary-soft); color: var(--primary-ink); }
.modal-card.fd { width: min(1000px, 100%); height: auto; max-height: 92vh; grid-template-rows: auto minmax(0, 1fr); }
.modal-card.fd .form h4 { margin: var(--sp-2) 0 var(--sp-1); font-size: var(--fs-sm); color: var(--muted); }
.cibar { position: relative; display: block; width: 140px; height: 14px; background: var(--surface-2); border-radius: var(--r-pill); }
.cibar i { position: absolute; top: 0; bottom: 0; }
.cibar .ci { background: color-mix(in srgb, var(--primary) 25%, transparent); border-radius: var(--r-pill); }
.cibar .pt { width: 4px; margin-inline-start: calc(var(--sp-half) * -1); background: var(--fg-2); border-radius: var(--r-0); }
.cibar .pt.up { background: var(--success); } .cibar .pt.down { background: var(--danger); }
.cibar .base { width: 1px; background: var(--fg); opacity: .5; }
.dtable.heat td.hm { text-align: center; cursor: pointer; min-width: 74px; }
.dtable.heat td.hm b { display: block; font-size: var(--fs-md); }
.dtable.heat td.hm small { color: var(--muted); font-size: var(--fs-xs); }
.dtable.heat td.hm.weak { color: var(--faint); }
.dtable.heat td.hm.empty { color: var(--faint); cursor: default; }
.dtable.heat td.hm:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.dtable.heat th[scope="row"] { position: sticky; inset-inline-start: 0; background: var(--surface); z-index: 1; white-space: nowrap; }
.dtable.heat tr.tot td, .dtable.heat tr.tot th { border-top: 2px solid var(--border-strong); }
#insBody .toolbar .field { min-width: 180px; }
@media (max-width: 1023px) { .ins-grid { grid-template-columns: minmax(0, 1fr); } }

/* sessions are independent; their links to cases and customers show as chips under the title */
#chatHead { flex-direction: column; align-items: stretch; gap: var(--sp-2); }
#chatHead h2 { font-size: var(--fs-lg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.links-row { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.lchip { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: var(--r-pill); background: var(--surface); font-size: var(--fs-sm); max-width: 100%; }
.lchip > button, .lchip > a { display: inline-flex; align-items: center; gap: var(--sp-1); border: 0; background: none; padding: var(--sp-1) var(--sp-3); min-height: 28px; color: var(--fg-2); border-radius: var(--r-pill); min-width: 0; }
.lchip > button:hover, .lchip > a:hover { background: var(--hover); color: var(--fg); }
.lchip .lc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 18ch; color: var(--muted); }
.lchip .stage { gap: 0; }
.lchip.on { border-color: color-mix(in srgb, var(--primary) 45%, transparent); background: var(--primary-soft); }
.lchip.on > button { color: var(--primary-ink); }
.lchip .x { border: 0; background: none; color: var(--faint); width: 26px; height: 26px; display: inline-grid; place-items: center; border-radius: var(--r-pill); margin-inline-start: calc(var(--sp-1) * -1); }
.lchip .x:hover { color: var(--danger-ink); background: var(--danger-soft); }
.lchip.add { border-style: dashed; color: var(--muted); padding: var(--sp-1) var(--sp-3); min-height: 30px; gap: var(--sp-1); cursor: pointer; }
.lchip.add:hover { color: var(--primary-ink); border-color: var(--primary); }
.lchip.none { color: var(--faint); padding: var(--sp-1) var(--sp-3); border-style: dashed; }
.side-switch { display: flex; width: 100%; }
.side-switch button { flex: 1; }
.si-meta .lk { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.lrow { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); padding: var(--sp-2) 0; border-bottom: 1px solid var(--border); font-size: var(--fs-md); }
.lrow > span { display: inline-flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; min-width: 0; }
.lh { margin: var(--sp-3) 0 var(--sp-half); font-size: var(--fs-sm); color: var(--muted); font-weight: 600; }
@media (max-width: 1023px) { .lchip .lc { max-width: 12ch; } }

/* case page (#/case/7): the same renderer as the side panel, laid out as a card */
.case-page.page-in { gap: 0; }
.case-page > .back-link { margin-bottom: var(--sp-4); }
.case-page .case-hero { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-2) var(--r-2) 0 0; padding: var(--sp-4) var(--sp-5) var(--sp-4); gap: var(--sp-3); }
.case-page .case-hero .page-head { align-items: flex-start; }
.case-page .case-hero h1 { font-size: var(--fs-2xl); }
.case-page .case-hero .meta { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); align-items: center; color: var(--muted); font-size: var(--fs-sm); }
.case-page .case-hero .meta a { color: var(--primary-ink); }
.case-page .stepper li { font-size: var(--fs-xs); }
.case-page .figs b { font-size: var(--fs-lg); }
.case-page .ptabs { background: var(--surface); border-inline: 1px solid var(--border); padding: 0 var(--sp-4); }
.case-page .pbody { background: var(--surface); border: 1px solid var(--border); border-top: 0; border-radius: 0 0 var(--r-2) var(--r-2); padding: var(--sp-4) var(--sp-5) var(--sp-7); font-size: var(--fs-md); }
.case-page .dl { grid-template-columns: 150px minmax(0, 1fr); }
.case-page .up-res:empty { display: none; }
.sess-list { display: grid; gap: var(--sp-2); }
.sess-list .si { border: 1px solid var(--border); }
.quick a { text-decoration: none; }
@media (max-width: 1023px) { .case-page .case-hero { padding: var(--sp-4); } .case-page .pbody { padding: var(--sp-4); } .case-page .dl { grid-template-columns: 110px minmax(0, 1fr); } }
.quick a { display: grid; gap: var(--sp-2); text-align: start; padding: var(--sp-4); border-radius: var(--r-2); border: 1px solid var(--border); background: var(--surface); color: var(--fg); transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.quick a:hover { border-color: var(--primary); box-shadow: var(--sh-1); }

/* collapsible rail, session list and side panel (choices remembered per browser; phones keep their one-column layout) */
.panel-toggle { display: inline-flex; }
@media (max-width: 1023px) { .only-wide { display: none !important; } }
@media (min-width: 1024px) {
  body.lay-rail-mini { --rail: 60px; }
  .lay-rail-mini .rail-name, .lay-rail-mini .rail-item > span:not(.ic), .lay-rail-mini .me-text { display: none; }
  .lay-rail-mini .rail-item { padding: var(--sp-3) var(--sp-1); }
  .lay-rail-mini .rail-tools { flex-direction: column; }
  .lay-rail-mini .rail-badge { inset-inline-end: 4px; top: 2px; }
  .lay-rail-mini .me > span:last-child { flex-direction: column; align-items: center; }
  .lay-list-off #sessSide { display: none; }
}
@media (min-width: 1024px) and (max-width: 1279px) {
  .lay-list-off .work { grid-template-columns: minmax(0, 1fr); }
}
@media (min-width: 1280px) {
  .lay-list-off .work { grid-template-columns: minmax(0, 1fr) var(--panel); }
  .lay-panel-off .work { grid-template-columns: var(--list) minmax(0, 1fr); }
  .lay-list-off.lay-panel-off .work { grid-template-columns: minmax(0, 1fr); }
  .lay-panel-off #panel { display: none; }
}
#listToggle[aria-expanded="false"], .panel-toggle[aria-expanded="false"] { color: var(--primary-ink); background: var(--primary-soft); }

/* side-by-side boxes keep their own height (a long list beside a short table used to stretch it into an empty column) */
.grid2 { align-items: start; }

/* ملی مس inquiries (#/nicico) */
.nq-sync { display: grid; gap: var(--sp-3); }
.nq-status { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); align-items: center; font-size: var(--fs-md); color: var(--fg-2); }
.nq-status .spacer { flex: 1; }
.nq-steps { margin: 0; padding-inline-start: var(--sp-6); display: grid; gap: var(--sp-1); font-size: var(--fs-md); line-height: var(--lh-loose); color: var(--fg-2); }
.nq-bm-name { display: inline-block; padding: 0 var(--sp-2); border-radius: var(--r-1); background: var(--surface-2); border: 1px solid var(--border); font-weight: 600; color: var(--fg); }
.nq-setup { border-top: 1px solid var(--border); padding-top: var(--sp-3); }
.nq-setup summary { cursor: pointer; display: inline-flex; gap: var(--sp-2); align-items: center; font-weight: 600; font-size: var(--fs-md); }
.nq-setup p { margin: var(--sp-2) 0 0; font-size: var(--fs-md); line-height: var(--lh-loose); color: var(--fg-2); }
.nq-bm-row { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; margin-top: var(--sp-3); }
.nq-bm { cursor: grab; border: 2px dashed var(--primary); color: var(--primary-ink); background: var(--primary-soft); font-weight: 700; }
.nq-list { display: grid; gap: var(--sp-3); }
.nq { border-inline-start: 4px solid var(--border-strong); padding: var(--sp-4) var(--sp-4); display: grid; gap: var(--sp-2); }
.nq.rel-high { border-inline-start-color: var(--success); }
.nq.rel-maybe { border-inline-start-color: var(--warning); }
.nq.is-off, .nq.rel-no { opacity: .7; }
.nq h3 { font-size: var(--fs-lg); line-height: var(--lh-base); }
.nq-meta { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); font-size: var(--fs-sm); color: var(--muted); }
.nq-meta > span { display: inline-flex; gap: var(--sp-1); align-items: center; }
.nq-due.warn { color: var(--warning); font-weight: 600; }
.nq-due.bad { color: var(--danger-ink); font-weight: 700; }
.nq .ins-act small { color: var(--muted); }
.nq-more summary { cursor: pointer; font-size: var(--fs-sm); color: var(--primary-ink); width: fit-content; }
.nq-more dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--sp-1) var(--sp-3); margin: var(--sp-2) 0 0; font-size: var(--fs-sm); line-height: var(--lh-loose); }
.nq-more dt { color: var(--muted); }
.nq-more dd { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
@media (max-width: 640px) { .nq-more dl { grid-template-columns: minmax(0, 1fr); } .nq-more dd { margin-bottom: var(--sp-2); } }
.nq-list, .nq, .nq-sync { min-width: 0; }
.nq .head-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); flex: 1 1 auto; justify-content: flex-end; min-width: 0; }
@media (max-width: 640px) { .nq .ins-foot { flex-direction: column; align-items: stretch; } .nq .head-actions .btn { flex: 1 1 auto; justify-content: center; } }
.nq-cursor { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); align-items: center; color: var(--fg-2); }
.nq-cursor .i { color: var(--muted); }
.nq-sub { font-size: var(--fs-md); margin: var(--sp-4) 0 var(--sp-2); }
.nq-setup code { font-family: var(--mono); font-size: var(--fs-sm); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-0); padding: 0 var(--sp-1); }

/* استعلام‌ها (#/inquiries) */
.iq-sortbar { display: none; }
.th-sort { display: inline-flex; align-items: center; gap: var(--sp-1); border: 0; background: none; padding: var(--sp-1) var(--sp-half); font: inherit; font-weight: 600; color: inherit; cursor: pointer; border-radius: var(--r-1); }
.th-sort:hover { color: var(--primary-ink); }
.iq-date { font-variant-numeric: tabular-nums; white-space: nowrap; }
.iq-table td:first-child { width: 1%; white-space: nowrap; }
.iq-table td:nth-child(2) { min-width: 280px; }
.iq-table .dtable a.name { font-weight: 500; line-height: var(--lh-base); display: inline-block; padding-block: var(--sp-half); }              /* long inquiry texts: the table's name-link style, lighter */
.iq-src { display: inline-flex; flex-direction: column; align-items: flex-start; gap: var(--sp-half); }
.iq-ref { font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 1023px) { .iq-sortbar { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--muted); margin-bottom: var(--sp-2); } }

/* سامانه‌ها (#/systems) */
.sys-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--sp-4); align-items: start; }
.sys-card { padding: var(--sp-4); display: grid; gap: var(--sp-3); min-width: 0; }
.sys-card.is-auto { border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); }
.sys-head { display: flex; gap: var(--sp-3); align-items: flex-start; }
.sys-icon { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-2); background: var(--primary-soft); color: var(--primary-ink); flex: none; }
.sys-title { display: grid; gap: var(--sp-half); min-width: 0; }
.sys-title h2 { font-size: var(--fs-lg); line-height: var(--lh-ui); margin: 0; }
.sys-title small { font-size: var(--fs-sm); color: var(--muted); }
.sys-state { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); align-items: center; }
.sys-state small { font-size: var(--fs-sm); color: var(--muted); }
.sys-note { margin: 0; font-size: var(--fs-md); line-height: var(--lh-loose); color: var(--fg-2); }
.sys-url { margin: 0; font-size: var(--fs-sm); color: var(--muted); overflow-wrap: anywhere; }
.sys-foot { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; border-top: 1px solid var(--border); padding-top: var(--sp-3); }
.sys-foot .spacer { flex: 1; }
.sys-empty { border-style: dashed; background: transparent; }
.sys-empty p { margin: 0; font-size: var(--fs-md); line-height: var(--lh-loose); color: var(--muted); }
.nq-ai { color: var(--violet); vertical-align: middle; }
@media (max-width: 640px) { .sys-grid { grid-template-columns: minmax(0, 1fr); } }
.iq-list .mc b { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }   /* the case page has the full text */
.nq h3 .nq-ai { display: inline-flex; vertical-align: -2px; margin-inline-start: var(--sp-1); }
.nq h3 .nq-ai svg { width: 14px; height: 14px; }

/* مدیریت ← راهنمای طراحی */
.dg-sec h2 { font-size: var(--fs-xl); }
.dg-sec code, .dg-row code, .dg-sw code { font-family: var(--mono); font-size: var(--fs-xs); color: var(--muted); }
.dg-h { font-size: var(--fs-sm); color: var(--muted); font-weight: 600; margin-top: var(--sp-2); }
.dg-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: var(--sp-3); }
.dg-sw { display: flex; gap: var(--sp-3); align-items: center; min-width: 0; }
.dg-sw > span:last-child { display: grid; gap: 0; min-width: 0; font-size: var(--fs-sm); line-height: var(--lh-ui); }
.dg-sw small { color: var(--faint); font-size: var(--fs-xs); }
.dg-chip, .dg-rad { width: 44px; height: 44px; flex: none; border-radius: var(--r-2); border: 1px solid var(--border-strong); }
.dg-rad { background: var(--surface); }
.dg-type { display: grid; gap: var(--sp-2); }
.dg-row { display: grid; grid-template-columns: 96px 32px minmax(0, 1fr) auto; gap: var(--sp-3); align-items: center; min-height: 32px; }
.dg-px { color: var(--faint); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.dg-sample { line-height: var(--lh-tight); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dg-row small { color: var(--muted); font-size: var(--fs-xs); }
.dg-bar { display: block; height: 12px; background: var(--primary); border-radius: var(--r-0); }
.dg-form { padding: 0; max-width: 520px; }
.dg-rules { margin: 0; padding-inline-start: var(--sp-5); display: grid; gap: var(--sp-1); line-height: var(--lh-base); }
@media (max-width: 640px) { .dg-row { grid-template-columns: 72px 24px minmax(0, 1fr); } .dg-row small { display: none; } }
