/* MySales: integrazione Bootstrap + contenuti legacy dentro il guscio S.AI.LS */

.topbar-inner {
    flex-wrap: wrap;
    row-gap: 8px;
}

.mysales-main .mysales-panel {
    padding: 16px 18px 22px;
}

/* Contenuto principale: niente overflow orizzontale della pagina per griglie/tabelle larghe */
main.main-content.mysales-main {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.mysales-panel {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.mysales-panel .row > [class*="col-"] {
    min-width: 0;
}

.mysales-panel .card {
    max-width: 100%;
    min-width: 0;
}

.mysales-panel .table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.mysales-panel .container,
.mysales-panel .container-fluid {
    max-width: 100%;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

/**
 * Pannelli form mostra/nascondi (evita classe Bootstrap `collapse`: Tailwind CDN usa `.collapse` per visibility).
 */
.mysales-reveal {
    display: none !important;
}

.mysales-reveal.is-open {
    display: block !important;
}

/** Liste marketing: vista dedicata solo import (?v=import o errore validazione import) */
.lm-liste-layout--import-only .lm-liste-hide-when-import {
    display: none !important;
}

.lm-liste-layout--import-only #listeMarketingImportCollapse.mysales-reveal {
    display: block !important;
}

.submenu-link-active {
    background: var(--app-orange-light, #fff7ed) !important;
    color: var(--app-orange-border, #c2410c) !important;
    font-weight: 600;
}

.submenu-link-disabled {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

.mysales-no-policy {
    display: inline-block;
    margin-left: 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: #b91c1c;
}

.mysales-top-icons {
    flex-wrap: nowrap;
    justify-content: flex-end;
    margin-left: auto;
    flex-shrink: 0;
}

.mysales-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: var(--app-text-muted, #475569);
    text-decoration: none;
    border-radius: 10px;
    border: 1px solid transparent;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.mysales-bell:hover {
    background: #f1f5f9;
    color: var(--app-accent, #0e7ab8);
    border-color: var(--app-border, #e2e8f0);
}

.mysales-bell i {
    font-size: 1.25rem;
}

.mysales-bell--hot {
    color: var(--app-orange-border, #c2410c);
}

.mysales-bell-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    color: #fff;
    background: #dc2626;
    border-radius: 999px;
}

.mysales-bell-badge--info {
    background: #2563eb;
}

/* Esci: subito a destra delle icone bustina (barra rapida desktop / mobile bar) */
.mysales-top-esci {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.05rem;
    min-width: 44px;
    min-height: 40px;
    padding: 0.2rem 0.45rem 0.15rem;
    margin-left: 0.15rem;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.02em;
    color: var(--app-text-muted, #475569);
    text-decoration: none;
    border-radius: 10px;
    border: 1px solid transparent;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.mysales-top-esci:hover {
    background: #f1f5f9;
    color: var(--app-accent, #0e7ab8);
    border-color: var(--app-border, #e2e8f0);
}

.mysales-top-esci:focus-visible {
    outline: 2px solid var(--app-accent, #0e7ab8);
    outline-offset: 2px;
}

.mysales-top-esci i {
    font-size: 1.05rem;
    line-height: 1;
}

.mysales-top-esci__label {
    display: block;
    margin-top: 0.02rem;
}

.mysales-top-esci--compact {
    min-width: 40px;
    min-height: 36px;
    padding: 0.12rem 0.25rem 0.08rem;
    margin-left: 0.1rem;
}

.mysales-top-esci--compact i {
    font-size: 0.95rem;
}

.mysales-top-esci--compact .mysales-top-esci__label {
    font-size: 0.58rem;
}

/* Benvenuto utente (striscia desktop + barra mobile) */
.mysales-top-welcome {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
    flex: 0 1 auto;
    padding: 0.2rem 0.65rem 0.2rem 0.35rem;
    margin-right: 0.25rem;
    background: linear-gradient(135deg, var(--app-panel-bg, #fff) 0%, var(--app-orange-light, #fff7ed) 100%);
    border: 1px solid var(--app-border, #e2e8f0);
    border-radius: 12px;
    border-left: 3px solid var(--app-orange, #ea580c);
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.05);
}

.mysales-top-welcome__icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--app-orange-light, #fff7ed);
    border: 1px solid var(--app-orange-soft, #fed7aa);
    color: var(--app-orange-border, #c2410c);
    font-size: 1.25rem;
}

.mysales-top-welcome__main {
    min-width: 0;
    line-height: 1.15;
}

.mysales-top-welcome__label {
    margin: 0;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--app-text-soft, #64748b);
}

.mysales-top-welcome__name {
    margin: 0.12rem 0 0;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--app-heading, #0f172a);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 14rem;
}

.mysales-top-welcome__accent {
    color: var(--app-accent, #0e7ab8);
}

.mysales-top-welcome__time {
    margin-left: auto;
    flex-shrink: 0;
    text-align: right;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--app-text-muted, #475569);
    line-height: 1.25;
    min-width: 7.5rem;
    max-width: 10rem;
}

.mysales-top-welcome__date {
    display: block;
    font-weight: 500;
    color: var(--app-text-soft, #64748b);
}

.mysales-top-welcome__clock {
    display: block;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--app-heading, #0f172a);
    font-size: 0.72rem;
}

.mysales-top-welcome--compact {
    flex: 1 1 auto;
    margin-right: 0.15rem;
    padding: 0.15rem 0.4rem 0.15rem 0.25rem;
    gap: 0.45rem;
    border-radius: 10px;
    border-left-width: 2px;
    box-shadow: none;
}

.mysales-top-welcome--compact .mysales-top-welcome__icon {
    width: 32px;
    height: 32px;
    font-size: 1rem;
    border-radius: 8px;
}

.mysales-top-welcome--compact .mysales-top-welcome__label {
    font-size: 0.52rem;
    letter-spacing: 0.05em;
}

.mysales-top-welcome--compact .mysales-top-welcome__name {
    font-size: 0.8rem;
    max-width: 42vw;
}

@media (max-width: 380px) {
    .mysales-top-welcome--compact .mysales-top-welcome__label {
        display: none;
    }
}

/* Benvenuto affiancato al titolo pagina (page-head --split) */
.mysales-top-welcome--page-head {
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    border-radius: 0;
    border-left: 0;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.65rem;
    max-width: min(100%, 26rem);
}

.mysales-top-welcome--page-head .mysales-top-welcome__icon {
    width: 38px;
    height: 38px;
    font-size: 1.15rem;
    background: color-mix(in srgb, var(--app-panel-bg, #fff) 55%, var(--app-orange-light, #fff7ed));
    border-color: var(--app-orange-soft, #fed7aa);
}

.mysales-top-welcome--page-head .mysales-top-welcome__label {
    color: var(--app-text-muted, #475569);
}

.mysales-top-welcome--page-head .mysales-top-welcome__name {
    max-width: 12rem;
}

.mysales-top-welcome--page-head .mysales-top-welcome__time {
    min-width: 6.5rem;
    max-width: 9rem;
    margin-left: 0.35rem;
}

@media (max-width: 575.98px) {
    .mysales-top-welcome--page-head .mysales-top-welcome__time {
        display: none;
    }

    .mysales-top-welcome--page-head {
        max-width: 100%;
        justify-content: flex-start;
    }
}

/* Tabelle Bootstrap: accento coerente con tema Sails */
.mysales-panel .table thead th {
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    color: #fff !important;
    font-weight: 600;
    border-color: #334155;
}

.mysales-panel .card {
    border-radius: 12px;
    border: 1px solid var(--app-border, #e2e8f0);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.mysales-panel .card-header {
    font-weight: 600;
    background: var(--app-orange-light, #fff7ed);
    border-bottom: 1px solid var(--app-orange-soft, #fed7aa);
    color: var(--app-heading, #0f172a);
}

.mysales-panel .btn-primary {
    background-color: var(--app-accent, #0e7ab8);
    border-color: var(--app-accent-hover, #0b6a9e);
}

.mysales-panel .btn-primary:hover {
    background-color: var(--app-accent-hover, #0b6a9e);
    border-color: #095a85;
}

/* Testo elenchi: stack di sistema, più nitido del solo Montserrat */
.mysales-panel .container-fluid {
    font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
}

.mysales-panel .badge.bg-info {
    background-color: #e9ecef !important;
    color: #495057 !important;
    font-weight: 500;
}

.mysales-panel .table {
    background: var(--mysales-table-wrap-bg, #fff);
    border-radius: 0.7rem;
    overflow: hidden;
}

.mysales-panel .table th,
.mysales-panel .table td {
    font-family: "Segoe UI", system-ui, sans-serif !important;
    font-weight: 400 !important;
    font-size: 0.8125rem;
    vertical-align: middle;
}

/* Corpo tabella su sfondo bianco: mai --app-text (nei temi blu/scuri è chiaro → illeggibile) */
.mysales-panel .table tbody td,
.mysales-panel .table tbody th,
.mysales-panel .table tfoot td,
.mysales-panel .table tfoot th {
    color: var(--mysales-table-cell-color, #1e293b) !important;
}

.mysales-panel .table-striped > tbody > tr:nth-of-type(odd) {
    background-color: #f5f6fa;
}

.mysales-panel .btn-info,
.mysales-panel .btn-warning,
.mysales-panel .btn-danger {
    font-weight: 500;
}

.ricerca-filtri-mini .form-control,
.ricerca-filtri-mini .form-select {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    font-size: 0.8125rem;
    border: 1px solid var(--app-border, #e2e8f0);
    background: #fff;
}

.ricerca-filtri-mini label.form-label {
    margin-bottom: 0.15rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--app-text-muted, #475569);
}

.ricerca-filtri-mini .btn {
    margin-right: 0.3rem;
}

@media (max-width: 991.98px) {
    .mysales-panel .card {
        padding-left: 1vw;
        padding-right: 1vw;
    }
}

/*
 * Modali Bootstrap sopra barra menu (nav-top sticky z-index ~20), bustine (fino a ~1200)
 * e drawer mobile (~2000). Senza questo, un contesto di stacking su .app-layout__content
 * poteva tenere backdrop/modal sotto la header e bloccare tutti i click.
 */
body.app-shell .modal-backdrop {
    z-index: 12040 !important;
}

body.app-shell .modal {
    z-index: 12050 !important;
}

/* Popup blacklist: centrato, cerchio rosso decorativo, dimensioni un po’ più grandi, sopra modali CRM */
.ms-bl-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 12160;
    background: rgba(15, 23, 42, 0.48);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    box-sizing: border-box;
}

.ms-bl-popup-overlay.d-none {
    display: none !important;
}

.ms-bl-popup-card {
    position: relative;
    background: #fff;
    border-radius: 16px;
    box-shadow:
        0 0 0 4px #dc2626,
        0 16px 48px rgba(0, 0, 0, 0.24);
    padding: 1.5rem 1.65rem 1.4rem;
    max-width: min(400px, calc(100vw - 2rem));
    min-width: min(280px, calc(100vw - 2rem));
    text-align: center;
}

.ms-bl-popup-img {
    display: block;
    width: min(100%, 300px);
    max-width: 100%;
    height: auto;
    max-height: 9.5rem;
    margin: 0 auto 0.85rem;
    object-fit: contain;
}

.ms-bl-popup-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 2.35rem;
    height: 2.35rem;
    border: 0;
    background: transparent;
    color: #64748b;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.ms-bl-popup-close:hover {
    background: #fee2e2;
    color: #b91c1c;
}

.ms-bl-popup-text {
    margin: 0;
    padding: 0.1rem 2rem 0 0.35rem;
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.5;
}
