/* ---------------- کارت «تنظیمات» پایین منو (به‌جای پروفایل) */
.sidebar .settings-card .sc-gear { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none;
                                   background: var(--k-grad); color: #fff; font-size: 1rem; box-shadow: 0 6px 16px rgba(47, 125, 225, .3); }
.sidebar .settings-card .sc-gear i { transition: transform .6s var(--k-ease); }
.sidebar .settings-card:hover .sc-gear i, .sidebar .settings-card.active .sc-gear i { transform: rotate(90deg); }

/* ---------------- صفحه‌ی تنظیمات */
.hub-hero { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; padding: 20px 24px; margin-bottom: 18px; border-radius: 18px; color: #fff;
            background: radial-gradient(1px 1px at 1px 1px, rgba(255, 255, 255, .08) 1px, transparent 0) 0 0 / 20px 20px,
                        radial-gradient(80% 120% at 0% 0%, rgba(47, 125, 225, .45), transparent 60%), linear-gradient(120deg, #0f2747, #0b1d38 60%, #0a2a3a); }
.hub-hero .hh-ico { width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; font-size: 1.5rem; background: rgba(255, 255, 255, .1); }
.hub-hero .hh-ico i { animation: gearSpin 12s linear infinite; }
@keyframes gearSpin { to { transform: rotate(360deg); } }
.hub-hero h2 { font-size: 1.3rem; font-weight: 700; margin: 0 0 4px; }
.hub-hero p { margin: 0; color: #c6d3ea; font-size: .88rem; }
.hh-search { position: relative; min-width: 240px; }
.hh-search i { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: #8fa3c7; }
.hh-search input { width: 100%; padding: 9px 36px 9px 12px; border-radius: 99px; border: 1px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .08); color: #fff; }
.hh-search input::placeholder { color: #9fb2d4; }
.hub-sec { margin-bottom: 20px; }
.hub-sec h3 { font-size: .9rem; font-weight: 700; color: var(--ink-2); margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.hub-sec h3 i { color: var(--k-blue); }
.hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.hub-card { position: relative; display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 16px; background: var(--surface);
            border: 1px solid var(--line); color: var(--ink); box-shadow: var(--shadow); transition: transform .2s var(--k-ease), box-shadow .2s, border-color .2s; }
.hub-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); border-color: rgba(47, 125, 225, .45); color: var(--ink); }
.hub-card .hc-ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; flex: none; font-size: 1.1rem;
                    background: rgba(47, 125, 225, .1); color: var(--k-blue); transition: transform .3s var(--k-ease); }
.hub-card:hover .hc-ico { transform: rotate(-8deg) scale(1.06); }
.hub-card .hc-ico.blue { background: var(--k-grad); color: #fff; }
.hub-card .hc-ico.green { background: rgba(140, 198, 63, .16); color: var(--k-green-d); }
.hub-card .hc-ico.amber { background: rgba(240, 140, 0, .13); color: #e67700; }
.hub-card .hc-ico.violet { background: rgba(124, 92, 252, .13); color: #6a4ce0; }
.hub-card .hc-ico.red { background: rgba(224, 49, 49, .12); color: #e03131; }
.hub-card .hc-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hub-card .hc-body b { font-size: .92rem; }
.hub-card .hc-body small { color: var(--muted); font-size: .76rem; }
.hub-card .hc-n { font-size: .72rem; font-weight: 700; background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; padding: 1px 9px; }
.hub-card .hc-go { color: var(--muted); font-size: .7rem; transition: transform .2s; }
.hub-card:hover .hc-go { transform: translateX(-3px); color: var(--k-blue); }
.company-logo { width: 140px; height: 140px; margin: 0 auto; border-radius: 24px; display: grid; place-items: center; background: var(--surface-2); border: 1px dashed var(--line); }
.company-logo img { max-width: 110px; max-height: 110px; }
.search-inline { position: relative; min-width: 220px; margin: 0; }
.search-inline i { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .8rem; }
.search-inline input { padding-right: 32px; border-radius: 99px; }

/* نقش‌ها و ماتریس دسترسی */
.role-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; padding: 14px; }
.role-chip { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); }
.role-chip .rc-ico { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none; background: rgba(124, 92, 252, .13); color: #6a4ce0; }
.role-chip.builtin .rc-ico { background: rgba(47, 125, 225, .12); color: var(--k-blue); }
.role-chip b { display: block; font-size: .88rem; }
.role-chip small { display: block; color: var(--muted); font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.matrix-wrap { overflow: auto; max-height: 70vh; }
.matrix th.mx-role { position: sticky; top: 0; z-index: 2; cursor: pointer; min-width: 92px; background: var(--surface-2); }
.matrix th.mx-role:hover { color: var(--k-blue); }
.matrix th.mx-perm { position: sticky; top: 0; right: 0; z-index: 3; background: var(--surface-2); text-align: right !important; }
.matrix td.mx-perm { position: sticky; right: 0; background: var(--surface); z-index: 1; min-width: 260px; font-size: .84rem; }
.matrix td.mx-perm small { font-size: .66rem; }
.matrix .mx-group td { background: var(--surface-2); font-weight: 700; font-size: .8rem; color: var(--k-blue-d); }
[data-bs-theme="dark"] .matrix .mx-group td { color: var(--k-sky); }
.matrix td.mx-cell { text-align: center; }
.mx-box { position: relative; display: inline-grid; cursor: pointer; margin: 0; }
.mx-box input { position: absolute; opacity: 0; }
.mx-box span { width: 24px; height: 24px; border-radius: 8px; border: 2px solid var(--line); background: var(--surface); display: grid; place-items: center;
               transition: all .2s var(--k-ease); }
.mx-box input:checked + span { background: var(--k-grad); border-color: transparent; transform: scale(1.05); }
.mx-box input:checked + span::after { content: "\f00c"; font: var(--fa-font-solid); color: #fff; font-size: .7rem; }
.mx-box input:focus-visible + span { box-shadow: 0 0 0 3px rgba(47, 125, 225, .3); }

/* فرآیند تأیید: خط مرحله‌ها */
.proc-line { display: flex; flex-direction: column; align-items: stretch; }
.pl-node { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--surface);
           border: 1.5px solid var(--line); box-shadow: var(--shadow); animation: fadeUp .45s var(--k-ease) both; }
.pl-node > i { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; background: rgba(47, 125, 225, .1); color: var(--k-blue); }
.pl-node > span { flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 2px; }
.pl-node small { color: var(--muted); font-size: .74rem; display: flex; gap: 6px; align-items: center; }
.pl-node small.cond { color: #b86e00; } .pl-node small.sign { color: var(--k-green-d); } .pl-node small.busy { color: var(--k-blue); font-weight: 700; }
.pl-node.start > i { background: rgba(245, 159, 0, .14); color: #e67700; }
.pl-node.end > i { background: rgba(140, 198, 63, .18); color: var(--k-green-d); }
.pl-node.off { opacity: .5; border-style: dashed; }
.pl-seq { position: absolute; top: -9px; right: 12px; background: var(--k-grad); color: #fff; font-size: .68rem; font-weight: 700; border-radius: 99px; padding: 0 8px; }
.pl-tools { display: flex; gap: 4px; }
.pl-arrow { height: 26px; width: 2px; margin: 0 auto; background: linear-gradient(var(--k-blue), var(--k-green)); position: relative; }
.pl-arrow::after { content: ""; position: absolute; bottom: -2px; left: -5px; border: 6px solid transparent; border-top-color: var(--k-green); }
.role-picks, .icon-picks { display: flex; flex-wrap: wrap; gap: 4px; }
.role-picks .btn-check:checked + .btn, .icon-picks .btn-check:checked + .btn { background: var(--k-grad); color: #fff; border-color: transparent; }

/* امضای الکترونیکی */
.k-sign { position: relative; border: 2px dashed var(--line); border-radius: 14px; background: #fff; height: 180px; transition: border-color .2s; }
.k-sign.signed { border-color: var(--k-green); border-style: solid; }
.k-sign canvas { position: relative; z-index: 1; width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; border-radius: 12px; }
.k-sign .ks-hint { position: absolute; inset: 0; display: grid; place-items: center; color: #9aa7bd; pointer-events: none; font-size: .9rem; transition: opacity .2s; }
.k-sign.signed .ks-hint { opacity: 0; }
.k-sign [data-sign-clear] { position: absolute; top: 8px; left: 8px; z-index: 2; }
.k-sign::after { content: ""; position: absolute; right: 18px; left: 18px; bottom: 38px; border-bottom: 1px solid #dfe5ef; pointer-events: none; }
.saved-sign { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 12px; background: #fff; border: 1px solid var(--line); }
.saved-sign img { height: 70px; max-width: 240px; object-fit: contain; }
.saved-sign span { color: var(--k-green-d); font-size: .82rem; }
.sign-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.sign-item { border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; background: var(--surface-2); }
.sign-item img { width: 100%; height: 70px; object-fit: contain; background: #fff; border-radius: 8px; }
.sign-item.bad { border-color: rgba(224, 49, 49, .45); }
.sign-item .code { font-family: monospace; font-size: .72rem; direction: ltr; }

/* جستجوی زنده‌ی نوار بالا */
.topbar .search { flex: 0 1 300px; }
.topbar .search .ts-spin { position: absolute; left: 12px; top: 50%; width: 14px; height: 14px; margin-top: -7px; border-radius: 50%;
                           border: 2px solid var(--line); border-top-color: var(--k-blue); animation: tsSpin .7s linear infinite; }
@keyframes tsSpin { to { transform: rotate(360deg); } }
.top-results { position: absolute; top: calc(100% + 8px); right: 0; width: min(420px, 90vw); max-height: 62vh; overflow-y: auto; z-index: 1050;
               background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 20px 50px rgba(11, 22, 48, .2);
               padding: 6px; animation: popIn .2s var(--k-ease) both; }
@keyframes popIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.top-results .tr-group { font-size: .68rem; color: var(--muted); padding: 8px 10px 3px; }
.top-results .tr-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px; color: var(--ink); animation: fadeUp .25s var(--k-ease) both; }
.top-results .tr-item:hover, .top-results .tr-item.on { background: rgba(47, 125, 225, .1); color: var(--ink); }
.top-results .tr-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; background: rgba(47, 125, 225, .1); color: var(--k-blue); font-size: .8rem; }
.top-results .tr-item.on .tr-ico { background: var(--k-grad); color: #fff; }
.top-results .tr-tx { display: flex; flex-direction: column; min-width: 0; }
.top-results .tr-tx b { font-size: .86rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-results .tr-tx small { font-size: .72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-results .tr-empty { padding: 14px; text-align: center; color: var(--muted); font-size: .84rem; }

/* سرستون ثابت فهرست برگه‌ها: زیر نوار بالا می‌ماند و بالاتر نمی‌رود */
.sticky-card { overflow: visible; }
.table-sticky { overflow: visible; }
.sticky-head thead th { position: sticky; top: var(--topbar-h, 64px); z-index: 20; background: var(--surface-2);
                        box-shadow: inset 0 -1px 0 var(--line), 0 6px 10px -8px rgba(11, 22, 48, .25); }
.sticky-head thead th:first-child { border-top-right-radius: var(--k-radius); }
.sticky-head thead th:last-child { border-top-left-radius: var(--k-radius); }
@media (max-width: 991.98px) {
  .table-sticky { overflow: auto; max-height: calc(100vh - var(--topbar-h, 64px) - 24px); }
  .sticky-head thead th { top: 0; }
}
.sticky-head tbody tr:focus { outline: 2px solid rgba(47, 125, 225, .4); outline-offset: -2px; }
.sticky-head tbody tr.flow-sel { background: rgba(47, 125, 225, .1); box-shadow: inset -4px 0 0 var(--k-blue); }
.qnum { color: inherit; }
.qnum:hover { color: var(--k-blue); text-decoration: underline; }

/* ---------------- کشوی فلوچارت فرآیند */
.flow-veil { position: fixed; inset: 0; z-index: 1060; background: rgba(5, 12, 29, .35); opacity: 0; pointer-events: none; transition: opacity .3s; }
.flow-veil.open { opacity: 1; pointer-events: auto; }
.flow-drawer { position: fixed; top: 0; bottom: 0; left: 0; z-index: 1061; width: min(440px, 100vw); display: flex; flex-direction: column;
               background: var(--bg); border-right: 1px solid var(--line); box-shadow: 20px 0 60px rgba(5, 12, 29, .25);
               transform: translateX(-105%); transition: transform .45s var(--k-ease); }
.flow-drawer.open { transform: none; }
.fd-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; color: #fff;
           background: radial-gradient(90% 140% at 0% 0%, rgba(47, 125, 225, .5), transparent 60%), linear-gradient(120deg, #0f2747, #0b1d38); }
.fd-title { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.fd-title > div { min-width: 0; flex: 1; }
.fd-title b { display: block; } .fd-title small { display: block; color: #b9c7e2; font-size: .76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fd-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: rgba(255, 255, 255, .12); flex: none; }
.fd-ico i { animation: float 3s ease-in-out infinite; }
.fd-x { border: 0; background: rgba(255, 255, 255, .1); color: #fff; width: 34px; height: 34px; border-radius: 10px; font-size: 1.3rem; line-height: 1; }
.fd-meter { height: 5px; background: var(--line); }
.fd-meter span { display: block; height: 100%; width: 0; background: var(--k-grad); transition: width 1s var(--k-ease) .2s; }
.fd-body { flex: 1; overflow-y: auto; padding: 16px 18px 24px; }
.flow-drawer.loading .fd-body { opacity: .4; }
.fd-sum { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 16px; }
.fd-sum > div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px; text-align: center; min-width: 0; }
.fd-sum span { display: block; font-size: .66rem; color: var(--muted); }
.fd-sum b { font-size: .8rem; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fd-foot { display: flex; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface); }
.flow { list-style: none; margin: 0; padding: 0; }
.flow .fl { position: relative; display: flex; gap: 12px; padding-bottom: 14px; opacity: 0; animation: flIn .5s var(--k-ease) forwards; animation-delay: var(--d); }
@keyframes flIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.fl-line { position: absolute; right: 21px; top: 44px; bottom: -2px; width: 3px; border-radius: 3px; background: var(--line); overflow: hidden; }
.fl:last-child .fl-line { display: none; }
.fl.done .fl-line::after { content: ""; position: absolute; inset: 0; background: linear-gradient(var(--k-green), var(--k-blue));
                           transform-origin: top; animation: lineGrow .6s var(--k-ease) both; animation-delay: calc(var(--d) + .25s); }
@keyframes lineGrow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.fl-node { position: relative; z-index: 1; width: 45px; height: 45px; border-radius: 14px; display: grid; place-items: center; flex: none; font-size: 1rem;
           background: var(--surface-2); border: 2px solid var(--line); color: var(--muted); }
.fl.done .fl-node { background: rgba(140, 198, 63, .16); border-color: var(--k-green); color: var(--k-green-d); }
.fl.now .fl-node { background: var(--k-grad); border-color: transparent; color: #fff; box-shadow: 0 8px 22px rgba(47, 125, 225, .4); animation: flPulse 2s ease-in-out infinite; }
.fl.fail .fl-node { background: rgba(224, 49, 49, .12); border-color: #e03131; color: #e03131; }
@keyframes flPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(47, 125, 225, .45); } 50% { box-shadow: 0 0 0 10px rgba(47, 125, 225, 0); } }
.fl-check { position: absolute; bottom: -5px; left: -5px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: .55rem;
            background: var(--k-green-d); color: #fff; box-shadow: 0 0 0 2px var(--bg); animation: bump .5s var(--k-ease) both; animation-delay: calc(var(--d) + .3s); }
.fl-card { flex: 1; min-width: 0; padding: 9px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.fl.todo .fl-card { background: transparent; border-style: dashed; }
.fl.todo .fl-top b { color: var(--muted); font-weight: 500; }
.fl.now .fl-card { border-color: rgba(47, 125, 225, .5); box-shadow: 0 6px 18px rgba(47, 125, 225, .12); }
.fl.fail .fl-card { border-color: rgba(224, 49, 49, .45); }
.fl-top { display: flex; align-items: center; gap: 8px; }
.fl-top b { flex: 1; font-size: .88rem; }
.fl-state { font-size: .64rem; border-radius: 99px; padding: 1px 8px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.fl.done .fl-state { background: rgba(140, 198, 63, .16); color: var(--k-green-d); }
.fl.now .fl-state { background: rgba(47, 125, 225, .14); color: var(--k-blue); }
.fl.fail .fl-state { background: rgba(224, 49, 49, .12); color: #e03131; }
.fl-sub { font-size: .72rem; color: var(--muted); margin-top: 2px; }
.fl-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .72rem; color: var(--muted); margin-top: 4px; }
.fl-meta i { margin-left: 4px; }
.fl-note { font-size: .74rem; margin-top: 5px; padding: 4px 8px; border-radius: 8px; background: var(--surface-2); }
.fl-note i { margin-left: 4px; color: var(--muted); }
.fl-sign { display: flex; align-items: center; gap: 8px; margin-top: 6px; padding: 4px 8px; border-radius: 10px; background: #fff; border: 1px solid rgba(140, 198, 63, .5); color: #0b1630; font-size: .74rem; }
.fl-sign.bad { border-color: rgba(224, 49, 49, .5); }
.fl-sign img { height: 34px; max-width: 110px; object-fit: contain; }
.fl-sign small { display: block; color: #64748b; font-family: monospace; }
@media (max-width: 480px) { .fd-sum { grid-template-columns: repeat(2, 1fr); } }
.sign.signed { border-style: solid; border-color: #8cc63f; }
.pf-sign { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 10px; color: #333; }
.pf-sign img { height: 46px; max-width: 120px; object-fit: contain; }
