.legacy-profile-dropdown summary {
    list-style: none;
}

.erp-layout input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="range"]):not([type="file"]):not([type="image"]),
.erp-layout select,
.crm-shell input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="range"]):not([type="file"]):not([type="image"]),
.crm-shell select,
.inv-shell input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="range"]):not([type="file"]):not([type="image"]),
.inv-shell select,
.login-shell input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="range"]):not([type="file"]):not([type="image"]),
.login-shell select {
    box-sizing: border-box;
}

.legacy-profile-dropdown summary::-webkit-details-marker {
    display: none;
}

.legacy-profile-dropdown > .erp-profile-menu {
    display: grid;
    z-index: 110;
}

.erp-top-actions,
.crm-top-actions,
.inv-top-actions {
    justify-self: end;
    margin-left: auto;
    gap: 12px;
    position: relative;
    z-index: 90;
}

.erp-profile-wrap,
.crm-popover-wrap,
.inv-popover-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    z-index: 90;
}

.crm-user-button,
.inv-user-button {
    min-width: 158px;
    display: grid;
    grid-template-columns: 40px 1fr 16px;
    align-items: center;
    gap: 10px;
    align-self: center;
    border: 0;
    padding: 0;
    color: #0a1a3f;
    text-align: left;
    background: transparent;
    cursor: pointer;
}

.crm-user-button {
    min-height: 44px;
    margin-left: 10px;
}

.inv-user-button {
    min-height: 44px;
}

.crm-profile-popover,
.inv-profile-popover {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    z-index: 110;
    width: 252px;
    display: grid;
    gap: 12px;
    border: 1px solid rgba(16, 39, 83, 0.1);
    border-radius: 16px;
    padding: 18px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(247, 249, 253, 0.98));
    box-shadow: 0 22px 40px rgba(11, 29, 64, 0.18);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-8px) scale(0.98);
    transform-origin: top right;
    transition: opacity 180ms ease, transform 180ms ease, visibility 180ms ease;
}

.legacy-profile-dropdown.is-open .crm-profile-popover,
.legacy-profile-dropdown.is-open .inv-profile-popover {
    display: grid;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.erp-profile-menu form {
    margin-top: 0;
}

.crm-profile-popover form,
.inv-profile-popover form {
    margin: 0;
}

.erp-profile-menu form button,
.crm-profile-popover form button,
.inv-profile-popover form button {
    width: 100%;
}

.shared-profile-identity {
    display: grid;
    gap: 6px;
    border: 1px solid rgba(15, 52, 110, 0.09);
    border-radius: 12px;
    padding: 12px 14px 10px;
    background: rgba(240, 244, 251, 0.9);
}

.shared-profile-email {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #26416f;
    font-size: 13px;
    font-weight: 700;
}

.shared-profile-email svg,
.shared-profile-role svg {
    flex: 0 0 auto;
    color: #8c99ae;
}

.shared-profile-email svg {
    width: 14px;
    height: 14px;
}

.shared-profile-email span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.shared-profile-role {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 14px;
    color: #7a869a;
    font-size: 11px;
    line-height: 1;
}

.shared-profile-role > span {
    display: block;
    line-height: 1;
}

.shared-profile-role svg {
    width: 12px;
    height: 12px;
    color: #9aa6ba;
}

.shared-profile-logout {
    width: 100%;
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border: 0;
    border-radius: 12px;
    padding: 0 14px;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.crm-profile-popover .shared-profile-logout,
.inv-profile-popover .shared-profile-logout,
.shared-profile-logout {
    color: #fff;
    background: linear-gradient(135deg, #0b2f6b, #163f88);
    box-shadow: 0 14px 24px rgba(9, 42, 96, 0.22);
    cursor: pointer;
}

.crm-profile-popover .shared-profile-logout:hover,
.inv-profile-popover .shared-profile-logout:hover,
.shared-profile-logout:hover {
    background: linear-gradient(135deg, #123978, #1a4997);
}

.shared-profile-logout-icon {
    width: 26px;
    height: 26px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: 999px;
}

.crm-profile-popover .shared-profile-logout-icon,
.inv-profile-popover .shared-profile-logout-icon,
.shared-profile-logout-icon {
    background: rgba(255, 255, 255, 0.14);
}

.shared-profile-logout svg {
    width: 15px;
    height: 15px;
}

.crm-user-button > .crm-avatar,
.inv-user-button > .inv-avatar {
    display: grid;
    place-items: center;
    width: 39px;
    height: 39px;
    overflow: hidden;
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(145deg, #163e83, #001a4d);
    box-shadow: none;
}

.crm-user-button > .crm-avatar svg,
.inv-user-button > .inv-avatar svg {
    width: 26px;
    height: 26px;
    transform: translateY(4px);
}

.crm-user-button > span:nth-child(2),
.inv-user-button > span:nth-child(2) {
    min-width: 0;
    display: grid;
    align-content: center;
    gap: 3px;
}

.crm-user-button b,
.inv-user-button b {
    display: block;
    overflow: hidden;
    font-size: 12px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-user-button small,
.inv-user-button small {
    display: block;
    color: #616b7d;
    font-size: 10px;
    line-height: 1.2;
    text-transform: none;
}

.crm-user-button > svg,
.inv-user-button > svg {
    width: 14px;
    height: 14px;
    color: #0a1a3f;
    transition: transform 180ms ease;
}

.legacy-profile-dropdown.is-open .crm-user-button > svg,
.legacy-profile-dropdown.is-open .inv-user-button > svg {
    transform: rotate(180deg);
}

.login-form .form-message.is-error {
    color: #ffd7d7;
}

.login-form .form-message.is-success {
    color: #f5c448;
}

.legacy-workspace-main {
    min-height: 100svh;
    padding: calc(var(--crm-topbar-height, var(--inv-topbar-height, 58px)) + 22px) 28px 32px;
}

.crm-shell .legacy-workspace-main {
    margin-left: var(--crm-sidebar-width);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(245, 247, 251, 0.96)),
        var(--crm-canvas);
}

.inv-shell .legacy-workspace-main {
    margin-left: var(--inv-sidebar-width);
}

.legacy-module-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 24px;
    padding: 24px 26px;
    border: 1px solid #dbe3ee;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 20px 42px rgba(8, 33, 71, 0.08);
}

.legacy-module-header > :first-child {
    min-width: 0;
    flex: 1 1 560px;
    display: grid;
    gap: 10px;
}

.legacy-module-header h1 {
    margin: 0;
    color: #17345d;
    font-size: 26px;
    line-height: 1.05;
    letter-spacing: -0.03em;
}

/* Shared page hero title scale across CRM, inventory, settings, and dashboard workspaces. */
.legacy-module-header h1,
.crm-page-header h1,
.inv-page-header h1,
.int-page-heading h1,
.erp-welcome-row h1 {
    font-size: 26px !important;
}

/* Shared page hero treatment based on the User Management access-control header. */
.legacy-module-header,
.crm-page-header,
.inv-page-header,
.int-page-heading,
.erp-welcome-row,
.order-status-title {
    position: relative;
    overflow: hidden;
    border-color: #d9e5f1 !important;
    background: linear-gradient(112deg, #fff 0%, #f5f9ff 100%) !important;
    box-shadow: 0 14px 32px rgba(19, 52, 92, 0.055) !important;
}

.legacy-module-header::after,
.crm-page-header::after,
.inv-page-header::after,
.int-page-heading::after,
.erp-welcome-row::after,
.order-status-title::after {
    position: absolute;
    top: -88px;
    right: -72px;
    width: 240px;
    height: 240px;
    border: 34px solid rgba(41, 103, 182, 0.07);
    border-radius: 50%;
    content: "";
    pointer-events: none;
}

.legacy-module-header > *,
.crm-page-header > *,
.inv-page-header > *,
.int-page-heading > *,
.erp-welcome-row > *,
.order-status-title > * {
    position: relative;
    z-index: 1;
}

.legacy-module-header p {
    max-width: 720px;
    margin: 0;
    color: #61708a;
    line-height: 1.6;
}

.legacy-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #b47b10;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.legacy-kicker svg {
    width: 16px;
    height: 16px;
}

.legacy-action-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 12px;
}

.legacy-action-row a,
.legacy-action-row button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(8, 47, 101, 0.12);
    border-radius: 12px;
    padding: 0 16px;
    color: #0a1d46;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    background: #fff;
    box-shadow: 0 10px 24px rgba(13, 34, 67, 0.06);
    white-space: nowrap;
}

.legacy-action-row svg {
    width: 16px;
    height: 16px;
}

.legacy-stat-grid,
.legacy-module-grid {
    display: grid;
    gap: 20px;
}

.legacy-stat-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    margin-bottom: 24px;
}

.legacy-module-grid {
    grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.86fr);
}

.legacy-stat-card,
.legacy-module-card {
    border: 1px solid #dbe3ee;
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 16px 40px rgba(16, 35, 63, 0.08);
}

.legacy-stat-card {
    padding: 22px;
}

.legacy-stat-card small {
    display: block;
    color: #6e7c94;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.legacy-stat-card strong {
    display: block;
    margin-top: 14px;
    color: #0b2f76;
    font-size: clamp(28px, 2vw, 36px);
    line-height: 1;
}

.legacy-stat-card p {
    margin: 14px 0 0;
    color: #5f718c;
    line-height: 1.5;
}

.legacy-module-card {
    padding: 24px;
}

.legacy-module-card h2 {
    margin: 0 0 10px;
    color: #10233f;
    font-size: 20px;
}

.legacy-module-card p {
    margin: 0;
    color: #627188;
    line-height: 1.6;
}

/* .legacy-module-card + .legacy-module-card {
    margin-top: 20px;
} */

.legacy-list {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

.legacy-list-item {
    display: grid;
    grid-template-columns: 40px 1fr auto;
    align-items: center;
    gap: 12px;
    border: 1px solid #e6ecf3;
    border-radius: 16px;
    padding: 14px 16px;
    background: #fbfcfe;
}

.legacy-list-item svg {
    width: 18px;
    height: 18px;
}

.legacy-list-item strong,
.legacy-list-item b {
    display: block;
    margin-bottom: 4px;
    color: #0f2448;
}

.legacy-list-item small,
.legacy-list-item span {
    color: #66738a;
}

.legacy-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.legacy-pill.green {
    color: #0f6c4d;
    background: #e9f8f1;
}

.legacy-pill.blue {
    color: #0d4ea5;
    background: #edf4ff;
}

.legacy-pill.gold {
    color: #8b5d00;
    background: #fff6df;
}

.legacy-note-card {
    margin-top: 20px;
    border: 1px solid #f0dfaa;
    border-radius: 18px;
    padding: 18px 20px;
    color: #6e5313;
    background: #fff8e9;
}

.legacy-note-card code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.legacy-settings-form {
    display: grid;
    gap: 16px;
    margin-top: 18px;
}

.legacy-settings-form label {
    display: grid;
    gap: 8px;
    color: #0f2448;
    font-size: 13px;
    font-weight: 700;
}

.legacy-settings-form input,
.legacy-settings-form select,
.legacy-settings-form textarea {
    width: 100%;
    border: 1px solid #d9e2ee;
    border-radius: 12px;
    padding: 12px 14px;
    color: #10233f;
    background: #fff;
}

.legacy-settings-form textarea {
    min-height: 110px;
    resize: vertical;
}

@media (max-width: 1100px) {
    .legacy-module-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 780px) {
    .crm-shell .legacy-workspace-main,
    .inv-shell .legacy-workspace-main {
        margin-left: 0;
    }

    .legacy-workspace-main {
        padding: calc(var(--crm-topbar-height, var(--inv-topbar-height, 54px)) + 16px) 16px 24px;
    }

    .legacy-module-header {
        flex-direction: column;
        align-items: stretch;
        padding: 18px;
    }

    .legacy-module-header > :first-child {
        flex-basis: auto;
    }

    .legacy-action-row {
        flex-wrap: wrap;
    }
}

@media (max-width: 560px) {
    .legacy-module-header {
        padding: 16px;
        border-radius: 18px;
    }

    .legacy-module-header h1 {
        font-size: 26px;
    }

    .legacy-action-row a,
    .legacy-action-row button {
        flex: 1 1 100%;
        justify-content: center;
    }
}
