/* Account Managed Service drawer — height chain for Workspace97 EntityActionDrawer */

.account-ms-drawer-header {
    min-width: 0;
}

.account-ms-drawer-title-block {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 0;
}

/*
  Body fills the drawer content slot. Spine scrolls independently;
  main pane scrolls on .account-ms-content.
*/
.entity-action-drawer .drawer-content-full-height > .account-ms-drawer-body,
.account-ms-drawer-body {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 0 !important;
    min-height: 0 !important;
    height: 100% !important;
    width: 100%;
    margin: 0 !important;
    padding: 0.75rem !important;
    overflow: hidden !important;
    background: var(--mud-palette-background);
    box-sizing: border-box;
}

.account-ms-console {
    display: flex !important;
    align-items: stretch !important;
    gap: 1rem !important;
    flex: 1 1 0 !important;
    min-height: 0 !important;
    height: 100% !important;
    width: 100%;
    overflow: hidden !important;
    box-sizing: border-box;
}

/* Grouped spine (mirrors Support Setup rail patterns; MS-prefixed classes) */
.account-ms-spine {
    width: 15.5rem !important;
    flex: 0 0 15.5rem !important;
    min-height: 0 !important;
    overflow: auto !important;
    -webkit-overflow-scrolling: touch;
    padding: 0.75rem 0.5rem;
    box-sizing: border-box;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--mud-default-borderradius);
    background: var(--mud-palette-surface);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.account-ms-spine__group {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.account-ms-spine__group-label {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary);
    padding: 0 0.65rem 0.35rem;
}

.account-ms-spine__item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.35rem;
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0.55rem 0.65rem;
    border-radius: var(--mud-default-borderradius);
    color: var(--mud-palette-text-primary);
    position: relative;
    transition: background-color 120ms ease;
}

.account-ms-spine__item:hover:not(:disabled) {
    background-color: var(--mud-palette-action-default-hover);
}

.account-ms-spine__item:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.account-ms-spine__item--active {
    background-color: var(--mud-palette-action-default-hover);
    font-weight: 600;
}

.account-ms-spine__item--active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.45rem;
    bottom: 0.45rem;
    width: 3px;
    border-radius: 2px;
    background: var(--mud-palette-primary);
}

.account-ms-spine__item--locked {
    color: var(--mud-palette-text-secondary);
}

.account-ms-spine__text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.05rem;
    min-width: 0;
    flex: 1 1 auto;
    text-align: left;
}

.account-ms-spine__title {
    font-size: 0.875rem;
    line-height: 1.25;
    text-align: left;
}

.account-ms-spine__hint {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--mud-palette-text-secondary);
    line-height: 1.2;
    text-align: left;
}

.account-ms-spine__meta {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    padding-top: 0.1rem;
}

.account-ms-content {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    min-height: 0 !important;
    overflow: auto !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 1.5rem;
}

/*
  Customer shared asset detail (CT-9) embeds EntityViewLayout with nucleus-detail-shell
  inside this scroll host. Standalone layout binds height via h-full; here the parent
  only has a flex-sized scroll area — h-full + flex:1 1 0 + grid minmax(0,1fr)
  collapses the main/rail to ~0 height so only the header/tab strip paints.
  Let account-ms-content own scrolling and size the detail panel to content.
*/
.account-ms-content .account-ms-asset-detail-host,
.account-ms-content .account-ms-asset-detail-host > .mud-stack,
.account-ms-content .org-asset-card--full-detail {
    min-height: 0;
    max-height: none;
    overflow: visible;
}

.account-ms-content .org-asset-record-detail-panel.entity-view-layout,
.account-ms-content .org-asset-card--full-detail .entity-view-layout {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    flex: 0 0 auto !important;
    overflow: visible !important;
}

.account-ms-content .org-asset-record-detail-panel .entity-view-layout-container,
.account-ms-content .org-asset-record-detail-panel .module-main-column,
.account-ms-content .org-asset-card--full-detail .entity-view-layout-container,
.account-ms-content .org-asset-card--full-detail .module-main-column {
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow: visible !important;
    flex: 0 0 auto !important;
}

.account-ms-content .org-asset-record-detail-panel .module-content-region,
.account-ms-content .org-asset-card--full-detail .module-content-region {
    display: block !important;
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow: visible !important;
    flex: 0 0 auto !important;
}

.account-ms-content .org-asset-record-detail-panel .workspace-main-body,
.account-ms-content .org-asset-card--full-detail .workspace-main-body {
    display: block !important;
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow: visible !important;
    flex: none !important;
}

.account-ms-content .org-asset-record-detail-panel .module-content-region:has(.nucleus-detail-shell) .workspace-main-body > *,
.account-ms-content .org-asset-card--full-detail .module-content-region:has(.nucleus-detail-shell) .workspace-main-body > * {
    flex: none !important;
    min-height: 0 !important;
    height: auto !important;
}

.account-ms-content .org-asset-record-detail-panel .nucleus-detail-host,
.account-ms-content .org-asset-card--full-detail .nucleus-detail-host,
.account-ms-content .org-asset-record-detail-panel .nucleus-detail-shell,
.account-ms-content .org-asset-card--full-detail .nucleus-detail-shell,
.account-ms-content .org-asset-record-detail-panel .nucleus-detail-split-layout--independent-scroll.nucleus-detail-split-layout--with-side-panel,
.account-ms-content .org-asset-card--full-detail .nucleus-detail-split-layout--independent-scroll.nucleus-detail-split-layout--with-side-panel {
    flex: none !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
}

/* Natural rows instead of minmax(0,1fr) which collapses without a bound height */
.account-ms-content .org-asset-record-detail-panel .nucleus-detail-shell,
.account-ms-content .org-asset-card--full-detail .nucleus-detail-shell,
.account-ms-content .org-asset-record-detail-panel .nucleus-detail-split-layout,
.account-ms-content .org-asset-card--full-detail .nucleus-detail-split-layout {
    grid-template-rows: auto auto !important;
}

.account-ms-content .org-asset-record-detail-panel .nucleus-detail-shell__main,
.account-ms-content .org-asset-card--full-detail .nucleus-detail-shell__main,
.account-ms-content .org-asset-record-detail-panel .nucleus-detail-split-layout__main-content,
.account-ms-content .org-asset-card--full-detail .nucleus-detail-split-layout__main-content {
    min-height: 0 !important;
    height: auto !important;
    overflow: visible !important;
}

.account-ms-content .org-asset-record-detail-panel .nucleus-detail-rail-card,
.account-ms-content .org-asset-card--full-detail .nucleus-detail-rail-card,
.account-ms-content .org-asset-record-detail-panel .nucleus-detail-split-layout__side-panel-host,
.account-ms-content .org-asset-card--full-detail .nucleus-detail-split-layout__side-panel-host {
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow: visible !important;
    transform: none !important;
    align-self: start;
}

.account-ms-content .org-asset-record-detail-panel .nucleus-detail-rail-card::before,
.account-ms-content .org-asset-card--full-detail .nucleus-detail-rail-card::before {
    display: none !important;
    height: 0 !important;
}

.account-ms-content .org-asset-record-detail-panel .nucleus-detail-side-panel,
.account-ms-content .org-asset-card--full-detail .nucleus-detail-side-panel,
.account-ms-content .org-asset-record-detail-panel .nucleus-context-panel-content,
.account-ms-content .org-asset-card--full-detail .nucleus-context-panel-content {
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow: visible !important;
    flex: none !important;
}

@media (max-width: 959.98px) {
    .account-ms-content .org-asset-record-detail-panel .nucleus-detail-shell,
    .account-ms-content .org-asset-card--full-detail .nucleus-detail-shell {
        grid-template-columns: minmax(0, 1fr) !important;
        grid-template-rows: auto auto auto !important;
    }
}

/* Section chrome */
.account-ms-section-chrome {
    margin-bottom: 1rem;
}

.account-ms-section-chrome__row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.account-ms-section-chrome__titles {
    min-width: 0;
    flex: 1 1 auto;
}

/* Home bands */
.account-ms-home-attention {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
    gap: 0.75rem;
}

.account-ms-home-attention__card {
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--mud-default-borderradius);
    background: var(--mud-palette-surface);
    padding: 0.85rem 1rem;
    text-align: left;
    cursor: pointer;
    width: 100%;
    transition: border-color 120ms ease, background-color 120ms ease;
}

.account-ms-home-attention__card:hover {
    border-color: var(--mud-palette-primary);
    background-color: var(--mud-palette-action-default-hover);
}

.account-ms-home-attention__card--quiet {
    opacity: 0.72;
}

.account-ms-home-attention__card--attention {
    border-color: var(--mud-palette-primary);
}

.account-ms-home-attention__value {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.2;
}

.account-ms-home-stack-row {
    display: grid;
    grid-template-columns: minmax(7rem, 10rem) minmax(5rem, auto) 1fr auto;
    gap: 0.75rem;
    align-items: center;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

.account-ms-home-stack-row:last-child {
    border-bottom: none;
}

/* Guided lock */
.account-ms-locked {
    max-width: 36rem;
    margin: 1rem auto;
    padding: 1.5rem 1.25rem;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--mud-default-borderradius);
    background: var(--mud-palette-surface);
}

.account-ms-locked__steps {
    margin: 0 0 1rem;
    padding-left: 1.25rem;
    color: var(--mud-palette-text-secondary);
}

.account-ms-locked__steps li {
    margin-bottom: 0.35rem;
}

/* Tenant tab: ensure danger-zone purge block sits in the scroll flow after manage form */
.account-ms-tenant-tab {
    min-height: 100%;
}

.account-ms-tenant-danger-zone {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
}

.account-ms-drawer-body > .mud-progress-linear,
.account-ms-drawer-body > .mud-alert {
    flex: 0 0 auto;
}

@media (max-width: 960px) {
    .account-ms-console {
        flex-direction: column !important;
        overflow: auto !important;
    }

    .account-ms-spine {
        width: 100% !important;
        flex: 0 0 auto !important;
        max-height: 40vh;
    }

    .account-ms-content {
        flex: 1 1 auto !important;
        overflow: visible !important;
    }

    .account-ms-home-stack-row {
        grid-template-columns: 1fr;
        gap: 0.35rem;
    }
}

/* Account-scoped Service Management full page */
.account-service-management-page {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
    height: 100%;
    box-sizing: border-box;
    padding: 0.75rem 1rem 1rem;
    background: var(--mud-palette-background);
}

.account-service-management-page__header {
    flex: 0 0 auto;
    margin-bottom: 0.75rem;
}

.account-service-management-page__body {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none;
    /* Full page already pads via .account-service-management-page; drop drawer-body inset so spine/cards align with the title. */
    padding: 0 !important;
    background: transparent;
}

/* Account CRM overview — KPI cards use project-kpi-* (module.projects-detail.css) */
.account-crm-kpi-action {
    display: block;
    width: 100%;
    font: inherit;
    text-align: left;
    cursor: pointer;
    color: inherit;
    appearance: none;
}

.account-crm-kpi-action:hover {
    border-color: var(--mud-palette-primary);
}

/* Full-width stack: Places / People / Profile (avoid 2-col table squeeze) */
.account-crm-content-stack {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.account-crm-card {
    align-self: stretch;
    height: auto;
}

.account-crm-card__count {
    margin-left: 0.35rem;
    font-weight: 500;
    color: var(--mud-palette-text-secondary);
    font-size: 0.875rem;
}

.account-crm-entity-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

.account-crm-entity-row:first-child {
    padding-top: 0;
}

.account-crm-entity-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.account-crm-entity-row__main {
    min-width: 0;
    flex: 1 1 auto;
}

.account-crm-entity-row__sub,
.account-crm-entity-row__meta {
    margin-top: 0.15rem;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.account-crm-entity-row__actions {
    flex: 0 0 auto;
    margin-top: -0.15rem;
}

@media (max-width: 960px) {
    .account-service-management-page {
        height: auto;
        min-height: 70vh;
    }
}
