/* Profile audit v8 — responsive hardening for desktop, tablet, and mobile. */
.profile-center-page{--profile-gap:18px}
.profile-center-page .profile-primary-grid{display:grid!important;grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important;gap:var(--profile-gap)!important;align-items:stretch!important}
.profile-center-page .profile-primary-grid>#profile-center,.profile-center-page .profile-primary-grid>#profile-owner{height:100%!important;max-width:none!important;margin:0!important}

/* A single active profile tab must consume the full content width. The hidden sibling
   used to leave the two-column primary grid intact, producing a half-width center/owner card. */
.profile-center-page[data-profile-active-tab="center"] .profile-primary-grid,
.profile-center-page[data-profile-active-tab="owner"] .profile-primary-grid{grid-template-columns:minmax(0,1fr)!important}
.profile-center-page #profile-center .profile-entity-form{grid-template-columns:repeat(12,minmax(0,1fr))!important;gap:15px!important}
.profile-center-page #profile-center .profile-entity-form>.field{min-width:0!important}
.profile-center-page #profile-center .profile-entity-form>.profile-province-field{grid-column:span 4!important}
.profile-center-page #profile-center .profile-entity-form>.field .input,.profile-center-page #profile-center .profile-entity-form>.field .select,.profile-center-page #profile-center .profile-entity-form>.field .profile-file-control{min-height:48px!important;height:48px!important;width:100%!important;box-sizing:border-box!important}
.profile-center-page #profile-center .profile-entity-form>.field .input:disabled,.profile-center-page #profile-center .profile-entity-form>.field .select:disabled{background:#f7f6f9!important;color:#9b94a3!important;cursor:not-allowed!important;border-color:#ece8f0!important}
.profile-center-page .profile-logo-hint{display:block!important;margin-top:6px!important;color:#8b8492!important}
.profile-center-page #profile-structure .profile-tree{direction:rtl!important;grid-template-columns:240px minmax(0,1fr)!important;grid-template-areas:"center branches"!important}
.profile-center-page #profile-structure .profile-tree__center{grid-area:center!important;text-align:right!important;direction:rtl!important;align-self:start!important}
.profile-center-page #profile-structure .profile-tree__branches{grid-area:branches!important;min-width:0!important}
.profile-center-page #profile-structure .profile-tree__group-main{min-width:220px!important}
.profile-center-page #profile-structure .profile-tree__actions{gap:7px!important}
.profile-center-page #profile-structure .profile-tree__actions .btn{white-space:nowrap!important;min-height:36px!important}
.profile-center-page #profile-structure .profile-tree__actions .workspace-backup-action{background:#f5f3ff!important;color:#6d28d9!important;border-color:#ddd6fe!important}
.profile-center-page #profile-structure .profile-tree__actions .workspace-delete{margin-inline-start:2px!important}
.profile-center-page #profile-structure .profile-tree__department-title .profile-tree__node-icon{background:#f1edff!important;color:#6d28d9!important}
.profile-center-page #profile-structure .profile-tree__group.is-active{background:#faf8ff!important}
.profile-center-page #profile-center .profile-entity-save .btn:disabled,.profile-center-page #profile-owner .btn:disabled{opacity:.66!important;cursor:wait!important}
.profile-center-page input:focus,.profile-center-page select:focus,.profile-center-page button:focus-visible{outline:2px solid rgba(124,58,237,.24)!important;outline-offset:2px!important}

/* Guided center identity flow */
.profile-center-page .profile-center-identity-head{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:16px 17px;border:1px solid #e5def5;border-radius:16px;background:linear-gradient(135deg,#fcfbff 0%,#f8f5ff 100%)}
.profile-center-page .profile-center-identity-head__copy{display:flex;align-items:center;gap:11px;min-width:0}
.profile-center-page .profile-center-identity-head__icon{width:40px;height:40px;border-radius:12px;display:grid;place-items:center;flex:0 0 auto;background:#ede9fe;color:#6d28d9;font-size:16px}
.profile-center-page .profile-center-identity-head__text{display:flex;flex-direction:column;gap:3px;min-width:0}
.profile-center-page .profile-center-identity-head b{font-size:14px;color:#312e46}
.profile-center-page .profile-center-identity-head span{font-size:12px;color:#777184;line-height:1.8}
.profile-center-page .profile-center-link-badge{display:inline-flex;align-items:center;gap:7px;flex:0 0 auto;padding:8px 11px;border-radius:999px;background:#f1eff4;color:#716a79;font-size:11px;font-weight:800;white-space:nowrap;border:1px solid #e7e2eb}
.profile-center-page .profile-center-link-badge.is-linked{background:#ecfdf3;color:#18794e;border-color:#ccebd9}
.profile-center-page .profile-center-step{padding:3px 1px 0}
.profile-center-page .profile-center-step .field__label{font-weight:800!important;color:#3f3947!important}
.profile-center-page .profile-center-step .field__hint{min-height:36px;line-height:1.8!important}
.profile-center-page .profile-center-search-field{position:relative}
.profile-center-page .profile-center-search-control{position:relative}
.profile-center-page .profile-center-search-control>i{position:absolute;inset-inline-start:14px;top:50%;transform:translateY(-50%);color:#8f86a7;z-index:2}
.profile-center-page .profile-center-search-control .input{padding-inline-start:40px!important;padding-inline-end:42px!important;font-weight:650!important}
.profile-center-page .profile-center-search-spinner{position:absolute;inset-inline-end:14px;top:50%;transform:translateY(-50%);color:#7c3aed}
.profile-center-page .profile-center-results{margin-top:9px;border:1px solid #e4ddec;border-radius:15px;background:#fff;box-shadow:0 16px 38px rgba(53,38,83,.13);overflow:hidden;max-height:330px;overflow-y:auto;position:relative;z-index:8}
.profile-center-page .profile-center-result{width:100%;border:0;border-bottom:1px solid #f0ecf5;background:#fff;padding:12px 13px;display:grid;grid-template-columns:40px minmax(0,1fr) auto;gap:11px;align-items:center;text-align:right;cursor:pointer;font-family:inherit;transition:background .16s ease,transform .16s ease}
.profile-center-page .profile-center-result:last-child{border-bottom:0}
.profile-center-page .profile-center-result:hover,.profile-center-page .profile-center-result:focus-visible{background:#faf8ff}
.profile-center-page .profile-center-result:hover{transform:translateX(-1px)}
.profile-center-page .profile-center-result__icon{width:38px;height:38px;border-radius:11px;display:grid;place-items:center;background:#f1edff;color:#6d28d9}
.profile-center-page .profile-center-result__body{display:flex;flex-direction:column;gap:2px;min-width:0}
.profile-center-page .profile-center-result__body b{font-size:13px;color:#312e46;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.profile-center-page .profile-center-result__body small{font-size:11px;color:#857e90;line-height:1.6}
.profile-center-page .profile-center-result__action{display:inline-flex;align-items:center;gap:6px;color:#6d28d9;font-size:11px;font-weight:800;white-space:nowrap}
.profile-center-page .profile-center-results-empty{display:flex;align-items:center;gap:10px;padding:16px;color:#746d7f}
.profile-center-page .profile-center-results-empty>i{font-size:20px;color:#9c91b7}
.profile-center-page .profile-center-results-empty>div{display:flex;flex-direction:column;gap:2px}
.profile-center-page .profile-center-results-empty b{font-size:12px;color:#40384d}
.profile-center-page .profile-center-results-empty span{font-size:11px;line-height:1.7}
.profile-center-page .profile-center-results-empty.is-error{color:#b42318;background:#fff8f7}
.profile-center-page .profile-center-create-row{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-top:10px;padding:12px 13px;border:1px dashed #d9d0e7;border-radius:13px;background:#fcfbfe}
.profile-center-page .profile-center-create-copy{display:flex;align-items:center;gap:10px;min-width:0}
.profile-center-page .profile-center-create-copy>i{width:32px;height:32px;border-radius:10px;display:grid;place-items:center;flex:0 0 auto;background:#f1edff;color:#6d28d9}
.profile-center-page .profile-center-create-copy>div{display:flex;flex-direction:column;gap:1px;min-width:0}
.profile-center-page .profile-center-create-copy b{font-size:12px;color:#433b4d}
.profile-center-page .profile-center-create-copy span{font-size:11px;color:#89818f;line-height:1.7}
.profile-center-page .profile-center-create-row .btn{flex:0 0 auto;white-space:nowrap}
.profile-center-page .profile-center-create-row .btn:disabled{opacity:.5;cursor:not-allowed}
.profile-center-page .profile-center-section-label{display:flex;align-items:center;gap:9px;margin-top:3px;padding-top:3px;color:#4c4455;font-size:12px;font-weight:900}
.profile-center-page .profile-center-section-label:after{content:"";height:1px;background:#ece7f1;flex:1;margin-inline-start:3px}
.profile-center-page .profile-center-section-label i{color:#7c3aed}

/* Logo preview */
.profile-center-page .profile-logo-field{grid-column:1/-1!important}
.profile-center-page .profile-logo-panel{display:flex;align-items:center;justify-content:space-between;gap:15px;padding:13px 14px;border:1px solid #e7e2ec;border-radius:14px;background:#fbfafc;min-height:82px}
.profile-center-page .profile-logo-empty{display:flex;align-items:center;gap:11px;min-width:0}
.profile-center-page .profile-logo-empty__icon{width:46px;height:46px;border-radius:13px;display:grid;place-items:center;background:#f1edff;color:#6d28d9;font-size:17px;flex:0 0 auto}
.profile-center-page .profile-logo-empty__copy{display:flex;flex-direction:column;gap:2px;min-width:0}
.profile-center-page .profile-logo-empty__copy b{font-size:12px;color:#40384d}
.profile-center-page .profile-logo-empty__copy span{font-size:11px;color:#8a8291;line-height:1.7}
.profile-center-page .profile-logo-current{display:flex;align-items:center;gap:12px;min-width:0}
.profile-center-page .profile-logo-preview{width:62px;height:62px;border-radius:14px;object-fit:contain;background:#fff;border:1px solid #e4deea;padding:5px;box-sizing:border-box;box-shadow:0 5px 16px rgba(44,34,58,.07);flex:0 0 auto}
.profile-center-page .profile-logo-current__copy{display:flex;flex-direction:column;gap:2px;min-width:0}
.profile-center-page .profile-logo-current__copy b{font-size:12px;color:#40384d}
.profile-center-page .profile-logo-current__copy span{font-size:11px;color:#8a8291;line-height:1.7}
.profile-center-page .profile-logo-actions{display:flex;align-items:center;gap:8px;flex:0 0 auto}
.profile-center-page .profile-logo-actions label{cursor:pointer}
.profile-center-page .profile-logo-actions input{display:none!important}
.profile-center-page .profile-logo-remove{color:#b42318!important;background:#fff7f6!important;border-color:#f1d5d1!important}

@media (max-width:1180px){
  .profile-center-page .profile-primary-grid{grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important}
  .profile-center-page #profile-structure .profile-tree{grid-template-columns:210px minmax(0,1fr)!important}
  .profile-center-page #profile-structure .profile-tree__group{grid-template-columns:1fr!important;gap:10px!important}
  .profile-center-page #profile-structure .profile-tree__actions{justify-content:flex-start!important}
}

@media (max-width:900px){
  .profile-center-page .profile-primary-grid{grid-template-columns:1fr!important}
  .profile-center-page #profile-center{order:1!important}.profile-center-page #profile-owner{order:2!important}
  .profile-center-page #profile-structure .profile-tree{grid-template-columns:1fr!important;grid-template-areas:"center" "branches"!important;gap:14px!important}
  .profile-center-page #profile-structure .profile-tree__center{position:static!important;width:100%!important}
  .profile-center-page #profile-structure .profile-structure-head{align-items:stretch!important}
  .profile-center-page #profile-structure .profile-structure-head .toolbar{width:100%!important;display:grid!important;grid-template-columns:1fr 1fr!important}
  .profile-center-page #profile-structure .profile-tree__actions{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;width:100%!important}
  .profile-center-page #profile-structure .profile-tree__actions .btn,.profile-center-page #profile-structure .profile-tree__active{width:100%!important;justify-content:center!important}
}

@media (max-width:680px){
  .profile-center-page{--profile-gap:12px}
  .profile-center-page .page-head h2{font-size:22px!important}
  .profile-center-page #profile-center .profile-entity-form{grid-template-columns:1fr!important}
  .profile-center-page #profile-center .profile-entity-form>[class*=span-],.profile-center-page #profile-center .profile-entity-form>.profile-province-field{grid-column:1/-1!important}
  .profile-center-page #profile-structure .profile-structure-head .toolbar{grid-template-columns:1fr!important}
  .profile-center-page #profile-structure .profile-tree__department-head{align-items:flex-start!important;flex-direction:column!important}
  .profile-center-page #profile-structure .profile-tree__group{padding:12px!important}
  .profile-center-page #profile-structure .profile-tree__group-main{min-width:0!important}
  .profile-center-page #profile-structure .profile-tree__actions{grid-template-columns:1fr 1fr!important}
  .profile-center-page #profile-structure .profile-tree__actions .workspace-delete{grid-column:1/-1!important}
  .profile-center-page #profile-center .profile-entity-save,.profile-center-page #profile-owner .profile-save-row{align-items:stretch!important;flex-direction:column!important}
  .profile-center-page #profile-center .profile-entity-save .btn,.profile-center-page #profile-owner .profile-save-row .btn{width:100%!important;min-height:46px!important}
  .profile-center-page .profile-center-identity-head{align-items:flex-start;flex-direction:column}
  .profile-center-page .profile-center-link-badge{white-space:normal}
  .profile-center-page .profile-center-create-row{align-items:stretch;flex-direction:column}
  .profile-center-page .profile-center-create-row .btn{width:100%;justify-content:center}
  .profile-center-page .profile-center-result{grid-template-columns:36px minmax(0,1fr)}
  .profile-center-page .profile-center-result__action{grid-column:2;justify-self:start}
  .profile-center-page .profile-logo-panel{align-items:stretch;flex-direction:column}
  .profile-center-page .profile-logo-actions{width:100%;display:grid;grid-template-columns:1fr 1fr}
  .profile-center-page .profile-logo-actions .btn{width:100%;justify-content:center}
}

@media (max-width:420px){
  .profile-center-page #profile-structure .profile-tree__actions{grid-template-columns:1fr!important}
  .profile-center-page #profile-structure .profile-tree__actions .workspace-delete{grid-column:auto!important}
  .profile-center-page #profile-structure .profile-tree__department-title b{font-size:15px!important}
  .profile-center-page #profile-structure .profile-tree__group-main b{font-size:13px!important}
  .profile-center-page .profile-center-identity-head__copy{align-items:flex-start}
  .profile-center-page .profile-logo-current{align-items:flex-start}
  .profile-center-page .profile-logo-actions{grid-template-columns:1fr!important}
}
