/* Profile cleanup v7 — identity first, canonical tree second, no duplicate detail cards. */
.profile-center-page .profile-primary-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px;align-items:stretch}
.profile-center-page .profile-primary-grid>#profile-center,.profile-center-page .profile-primary-grid>#profile-owner{height:100%;margin:0}
.profile-center-page .profile-primary-grid .panel__head{min-height:72px}
.profile-center-page #profile-structure .profile-tree{display:grid!important;grid-template-columns:minmax(0,1fr) 240px!important;grid-template-areas:"branches center"!important;gap:18px!important;align-items:start!important;direction:ltr!important}
.profile-center-page #profile-structure .profile-tree__center{grid-area:center!important;direction:rtl!important;position:sticky!important;top:82px!important;display:flex!important;align-items:center!important;gap:12px!important;padding:18px!important;border:1px solid #ddd6fe!important;border-radius:18px!important;background:linear-gradient(145deg,#fff,#f8f5ff)!important;box-shadow:0 8px 24px rgba(124,58,237,.06)!important;text-align:right!important}
.profile-center-page #profile-structure .profile-tree__center>div{width:100%;text-align:right!important}
.profile-center-page #profile-structure .profile-tree__branches{grid-area:branches!important;direction:rtl!important;display:grid!important;gap:14px!important}
.profile-center-page #profile-structure .profile-tree__department{overflow:hidden!important;padding:0!important;border:1px solid #e7e2ef!important;border-radius:18px!important;background:#fff!important;box-shadow:0 6px 18px rgba(15,23,42,.035)!important}
.profile-center-page #profile-structure .profile-tree__department.is-active{border-color:#c4b5fd!important;box-shadow:0 8px 24px rgba(124,58,237,.08)!important}
.profile-center-page #profile-structure .profile-tree__department-head{display:flex!important;align-items:center!important;justify-content:space-between!important;gap:14px!important;padding:15px 16px!important;margin:0!important;border-bottom:1px solid #eee9f5!important;background:#faf9fc!important;border-radius:0!important}
.profile-center-page #profile-structure .profile-tree__department.is-active>.profile-tree__department-head{background:#f7f3ff!important}
.profile-center-page #profile-structure .profile-tree__department-title{display:flex!important;align-items:center!important;gap:11px!important}
.profile-center-page #profile-structure .profile-tree__department-title .profile-tree__node-icon{width:42px!important;height:42px!important;border-radius:12px!important;background:#ede9fe!important;color:#6d28d9!important;font-size:17px!important}
.profile-center-page #profile-structure .profile-tree__department-title>div{display:grid!important;gap:2px!important}
.profile-center-page #profile-structure .profile-tree__department-title>div::before{content:"بخش"!important;font-size:11px!important;font-weight:900!important;color:#7c3aed!important;line-height:1.2!important}
.profile-center-page #profile-structure .profile-tree__department-title b{font-size:16px!important;font-weight:950!important;color:#20162f!important}
.profile-center-page #profile-structure .profile-tree__department-title small{font-size:11px!important;color:#7b7484!important;margin:0!important}
.profile-center-page #profile-structure .profile-tree__groups{display:grid!important;gap:0!important;padding:0!important;background:#fff!important}
.profile-center-page #profile-structure .profile-tree__groups::before{content:"گروه‌های پرسنلی"!important;display:block!important;padding:10px 16px!important;border-bottom:1px solid #f0edf4!important;background:#fff!important;color:#6f6878!important;font-size:12px!important;font-weight:900!important}
.profile-center-page #profile-structure .profile-tree__group{display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;align-items:center!important;gap:14px!important;margin:0!important;padding:12px 14px!important;border:0!important;border-bottom:1px solid #f1eef5!important;border-radius:0!important;background:#fff!important}
.profile-center-page #profile-structure .profile-tree__group:last-child{border-bottom:0!important}
.profile-center-page #profile-structure .profile-tree__group.is-active{background:#faf7ff!important;box-shadow:inset -3px 0 0 #8b5cf6!important}
.profile-center-page #profile-structure .profile-tree__group--recovered{background:#fffdf8!important}
.profile-center-page #profile-structure .profile-tree__group-main{display:flex!important;align-items:center!important;gap:10px!important;min-width:0!important}
.profile-center-page #profile-structure .profile-tree__group-main .profile-tree__node-icon{width:38px!important;height:38px!important;border-radius:11px!important;background:#f2f6fb!important;color:#486b8c!important}
.profile-center-page #profile-structure .profile-tree__group-main>div::before{content:none!important}
.profile-center-page #profile-structure .profile-tree__group-main b{font-size:14px!important;font-weight:900!important;color:#272132!important}
.profile-center-page #profile-structure .profile-tree__group-main small{font-size:11px!important;color:#81798b!important;margin-top:2px!important}
.profile-center-page #profile-structure .profile-tree__actions{display:flex!important;align-items:center!important;justify-content:flex-end!important;gap:6px!important;flex-wrap:wrap!important}
.profile-center-page #profile-structure .profile-tree__actions .btn{min-height:34px!important;padding:6px 9px!important;font-size:11px!important;white-space:nowrap!important}
.profile-center-page #profile-structure .profile-tree__scope-badge,.profile-center-page #profile-structure .profile-tree__active{font-size:11px!important;font-weight:900!important}
.profile-center-page .profile-backup-dialog{max-width:520px!important}
.profile-backup-dialog__head{display:flex;align-items:center;gap:12px;margin-bottom:16px}
.profile-backup-dialog__icon{width:46px;height:46px;border-radius:13px;display:grid;place-items:center;background:#ecfdf5;color:#047857;font-size:18px}
.profile-backup-dialog__head h3{margin:0 0 4px;font-size:18px}
.profile-backup-dialog__head p{margin:0;color:#7b7484;font-size:12px}
.profile-backup-dialog__actions{display:flex;gap:8px;justify-content:flex-start;margin-top:16px;flex-wrap:wrap}

/* Canonical profile navigation: visuals come only from ui-tabs-canonical-v1.css. */
.profile-policy-tabs-wrap{display:flex;justify-content:flex-start;max-width:100%;margin:0 0 14px}
.profile-policy-tabs{max-width:100%}
.profile-policy-tabs__item{min-width:0}

/* Profile tab visibility is static CSS; JS only changes data-profile-active-tab. */
.profile-center-page[data-profile-active-tab="center"] #profile-owner,
.profile-center-page[data-profile-active-tab="center"] #profile-structure{display:none!important}
.profile-center-page[data-profile-active-tab="owner"] #profile-center,
.profile-center-page[data-profile-active-tab="owner"] #profile-structure{display:none!important}
.profile-center-page[data-profile-active-tab="structure"] .profile-primary-grid{display:none!important}
.profile-center-page[data-profile-active-tab="policies"] .profile-primary-grid,
.profile-center-page[data-profile-active-tab="policies"] #profile-structure{display:none!important}

/* Inline policies are a real tab panel, not a second page layered under Profile. */
.profile-policy-inline{display:none!important;margin-top:0}
.profile-center-page[data-profile-active-tab="policies"]>.profile-policy-inline{display:grid!important}
.profile-center-page:not([data-profile-active-tab="policies"])>.profile-policy-inline{display:none!important}
.profile-policy-inline .policy-page__hero{margin-top:0}
.profile-policy-inline__loading{min-height:180px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;text-align:center;border:1px solid #e8e0f3;border-radius:18px;background:#fff;color:#6b6477}
.profile-policy-inline__loading i{font-size:22px;color:#7c3aed}
.profile-policy-inline__loading b{color:#2f263c}
.profile-policy-inline__loading .btn{margin-top:6px}
.profile-policy-inline__diagnostic{max-width:760px;padding:7px 10px;border-radius:10px;background:#fff7ed;border:1px solid #fed7aa;color:#9a3412;font-size:10.5px;direction:ltr;text-align:left;word-break:break-word}
.profile-policy-future-note{margin:0 0 2px;padding:8px 11px;display:flex;align-items:center;gap:8px;border:1px solid #ece6f8;border-radius:11px;color:#6c6279;background:#fcfbff;font-size:10px;line-height:1.7;box-shadow:none}
.profile-policy-future-note i{margin-top:0;color:#8b5cf6}
.profile-policy-future-note b{color:#5b21b6;margin-inline-end:4px}
.profile-policy-future-note--prominent{margin:0 0 14px;padding:16px 18px;gap:14px;border:1px solid #d9cdf8;border-radius:16px;background:linear-gradient(135deg,#faf7ff 0%,#f4efff 100%);box-shadow:0 8px 24px rgba(109,40,217,.08);font-size:12px}
.profile-policy-future-note__icon{width:42px;height:42px;display:grid;place-items:center;flex:0 0 auto;border-radius:12px;background:#ede9fe;color:#6d28d9;font-size:17px}
.profile-policy-future-note__icon i{color:inherit}
.profile-policy-future-note__copy{display:flex;flex-direction:column;gap:3px;min-width:0;flex:1}
.profile-policy-future-note__copy b{margin:0;color:#4c1d95;font-size:14px;font-weight:950}
.profile-policy-future-note__copy span{color:#655c73;font-size:12px;line-height:1.9;font-weight:700}
.profile-policy-future-note__next{flex:0 0 auto;white-space:nowrap;min-height:40px}
@media(max-width:760px){.profile-policy-future-note--prominent{align-items:flex-start;flex-wrap:wrap}.profile-policy-future-note__next{width:100%;justify-content:center}.profile-policy-future-note__icon{width:38px;height:38px}}

@media(max-width:1180px){
  .profile-center-page .profile-primary-grid{grid-template-columns:1fr}
  .profile-center-page #profile-structure .profile-tree{grid-template-columns:1fr!important;grid-template-areas:"center" "branches"!important}
  .profile-center-page #profile-structure .profile-tree__center{position:static!important}
}
@media(max-width:760px){
  .profile-center-page #profile-structure .profile-tree__group{grid-template-columns:1fr!important}
  .profile-center-page #profile-structure .profile-tree__actions{justify-content:flex-start!important}
  .profile-center-page #profile-structure .profile-tree__actions .btn{flex:1 1 calc(50% - 6px)!important}
  .profile-backup-dialog__actions{display:grid;grid-template-columns:1fr}
  .profile-backup-dialog__actions .btn{width:100%}
  .profile-policy-tabs-wrap{margin-bottom:10px}
}
