:root {
    color-scheme: dark;
    --mp-bg: #07111f;
    --mp-bg-soft: #0b1728;
    --mp-panel: #101f33;
    --mp-panel-2: #14253b;
    --mp-panel-3: #182c45;
    --mp-border: #253a55;
    --mp-border-soft: #1b2d45;
    --mp-text: #f3f7fc;
    --mp-muted: #9fb0c5;
    --mp-blue: #3b82f6;
    --mp-blue-soft: rgba(59, 130, 246, .14);
    --mp-red: #ef4444;
    --mp-red-soft: rgba(239, 68, 68, .15);
    --mp-orange: #f59e0b;
    --mp-orange-soft: rgba(245, 158, 11, .14);
    --mp-green: #22c55e;
    --mp-green-soft: rgba(34, 197, 94, .14);
    --mp-shadow: 0 18px 45px rgba(0, 0, 0, .28);
    --mp-radius: 14px;
    --mp-sidebar-width: 230px;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--mp-bg); }
body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at 85% 0%, rgba(37, 99, 235, .08), transparent 30%),
        linear-gradient(180deg, #081321 0%, #07111f 100%);
    color: var(--mp-text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
}
a { color: #5da4ff; text-decoration: none; }
a:hover { color: #8ec1ff; }
button, input { font: inherit; }

.mp-shell { min-height: 100vh; }
.mp-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    width: var(--mp-sidebar-width);
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #0c1a2d 0%, #0a1626 100%);
    border-right: 1px solid var(--mp-border-soft);
    box-shadow: 8px 0 30px rgba(0, 0, 0, .18);
}
.mp-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 78px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--mp-border-soft);
}
.mp-brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(145deg, #dc2626, #991b1b);
    box-shadow: 0 10px 25px rgba(220, 38, 38, .28);
    font-size: 23px;
}
.mp-brand-title { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.mp-brand-subtitle { margin-top: 1px; color: var(--mp-muted); font-size: 12px; }
.mp-nav { flex: 1; overflow-y: auto; padding: 16px 12px; }
.mp-nav-label {
    margin: 18px 9px 7px;
    color: #6f839c;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
}
.mp-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    margin: 3px 0;
    padding: 9px 11px;
    border: 1px solid transparent;
    border-radius: 9px;
    color: #d8e3ef;
    font-weight: 600;
    transition: .18s ease;
}
.mp-nav a:hover { background: rgba(255,255,255,.045); border-color: rgba(255,255,255,.055); }
.mp-nav a.active {
    color: #fff;
    background: linear-gradient(90deg, #b91c1c, #8f1515);
    box-shadow: 0 7px 18px rgba(185, 28, 28, .24);
}
.mp-nav-icon { width: 19px; text-align: center; opacity: .95; }
.mp-user {
    padding: 14px 17px;
    border-top: 1px solid var(--mp-border-soft);
    background: rgba(255,255,255,.018);
}
.mp-user strong { display: block; }
.mp-user span { color: var(--mp-muted); font-size: 12px; }

.mp-main { min-height: 100vh; margin-left: var(--mp-sidebar-width); }
.mp-topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 74px;
    padding: 13px 24px;
    background: rgba(7, 17, 31, .88);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--mp-border-soft);
}
.mp-title-wrap { display: flex; align-items: center; gap: 12px; }
.mp-page-icon { font-size: 22px; }
.mp-title { margin: 0; font-size: 23px; letter-spacing: -.02em; }
.mp-subtitle { margin: 3px 0 0; color: var(--mp-muted); font-size: 12px; }
.mp-container { width: 100%; max-width: 1660px; margin: 0 auto; padding: 20px 24px 30px; }

.mp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 38px;
    padding: 8px 13px;
    border: 1px solid var(--mp-border);
    border-radius: 8px;
    background: var(--mp-panel-2);
    color: var(--mp-text);
    cursor: pointer;
    font-weight: 800;
    white-space: nowrap;
    transition: .16s ease;
}
.mp-btn:hover { transform: translateY(-1px); background: var(--mp-panel-3); }
.mp-btn-primary { border-color: #2f76d2; background: #2468bd; }
.mp-btn-primary:hover { background: #2d78d7; }
.mp-btn-danger { border-color: #c92e38; background: #ad202a; }
.mp-btn-danger:hover { background: #c32833; }
.mp-btn-ghost { background: transparent; }
.mp-btn-small { min-height: 34px; padding: 7px 10px; font-size: 12px; }

.mp-flash {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 10px;
    font-weight: 700;
}
.mp-flash-success { border: 1px solid rgba(34,197,94,.4); background: var(--mp-green-soft); color: #86efac; }
.mp-flash-error { border: 1px solid rgba(239,68,68,.4); background: var(--mp-red-soft); color: #fda4af; }

.mp-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}
.mp-kpi {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 112px;
    padding: 18px;
    border: 1px solid var(--mp-border-soft);
    border-radius: var(--mp-radius);
    background: linear-gradient(145deg, rgba(20,37,59,.95), rgba(12,27,45,.95));
    box-shadow: var(--mp-shadow);
}
.mp-kpi-icon {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 58px;
    height: 58px;
    border-radius: 16px;
    font-size: 29px;
}
.mp-kpi-red .mp-kpi-icon { color: #fb7185; background: var(--mp-red-soft); }
.mp-kpi-orange .mp-kpi-icon { color: #fbbf24; background: var(--mp-orange-soft); }
.mp-kpi-green .mp-kpi-icon { color: #4ade80; background: var(--mp-green-soft); }
.mp-kpi-blue .mp-kpi-icon { color: #60a5fa; background: var(--mp-blue-soft); }
.mp-kpi-value { font-size: 26px; font-weight: 850; line-height: 1; }
.mp-kpi-label { margin-top: 7px; font-weight: 750; }
.mp-kpi-note { margin-top: 3px; color: var(--mp-muted); font-size: 12px; }

.mp-card {
    border: 1px solid var(--mp-border-soft);
    border-radius: var(--mp-radius);
    background: linear-gradient(145deg, rgba(16,31,51,.98), rgba(10,24,41,.98));
    box-shadow: var(--mp-shadow);
    overflow: hidden;
}
.mp-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 17px 18px;
    border-bottom: 1px solid var(--mp-border-soft);
}
.mp-card-title { margin: 0; font-size: 18px; }
.mp-search {
    width: min(300px, 100%);
    height: 39px;
    padding: 0 13px;
    border: 1px solid var(--mp-border);
    border-radius: 8px;
    outline: none;
    background: rgba(5,16,29,.5);
    color: var(--mp-text);
}
.mp-search:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.12); }
.mp-search::placeholder { color: #71849a; }

.mp-table-scroll { overflow-x: auto; }
.mp-table { width: 100%; min-width: 1120px; border-collapse: collapse; }
.mp-table th {
    padding: 12px 13px;
    border-bottom: 1px solid var(--mp-border);
    background: rgba(24,44,69,.7);
    color: #dce6f2;
    font-size: 11px;
    letter-spacing: .02em;
    text-align: left;
    text-transform: uppercase;
}
.mp-table td {
    padding: 15px 13px;
    border-bottom: 1px solid var(--mp-border-soft);
    vertical-align: top;
}
.mp-table tbody tr.account-row:hover { background: rgba(255,255,255,.018); }
.mp-email { font-weight: 800; overflow-wrap: anywhere; }
.mp-domain { margin-top: 4px; color: var(--mp-muted); font-size: 12px; }
.mp-muted { color: var(--mp-muted); }
.mp-small { font-size: 12px; }
.mp-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere; }
.mp-stack { display: grid; gap: 5px; }
.mp-split { display: grid; grid-template-columns: repeat(2, minmax(145px, 1fr)); gap: 10px; }
.mp-data-label { color: #8295aa; font-size: 11px; text-transform: uppercase; }
.mp-data-value { margin-top: 2px; font-weight: 650; overflow-wrap: anywhere; }

.mp-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 29px;
    padding: 5px 9px;
    border: 1px solid transparent;
    border-radius: 7px;
    font-size: 11px;
    font-weight: 850;
    letter-spacing: .02em;
    white-space: nowrap;
}
.mp-badge-red { color: #fff; border-color: #be2630; background: #a91e28; }
.mp-badge-green { color: #bbf7d0; border-color: rgba(34,197,94,.35); background: var(--mp-green-soft); }
.mp-badge-orange { color: #fde68a; border-color: rgba(245,158,11,.35); background: var(--mp-orange-soft); }
.mp-badge-blue { color: #bfdbfe; border-color: rgba(59,130,246,.35); background: var(--mp-blue-soft); }
.mp-number-red { color: #fb7185; font-size: 16px; font-weight: 850; }
.mp-number-green { color: #4ade80; font-size: 16px; font-weight: 850; }
.mp-accent-red { border-left: 3px solid var(--mp-red); padding-left: 10px; }
.mp-accent-green { border-left: 3px solid var(--mp-green); padding-left: 10px; }

.mp-actions { display: grid; gap: 7px; min-width: 118px; }
.mp-action-form { display: grid; gap: 7px; }
.mp-reason {
    width: 100%;
    min-width: 140px;
    height: 36px;
    padding: 0 9px;
    border: 1px solid var(--mp-border);
    border-radius: 7px;
    outline: none;
    background: #0a1728;
    color: var(--mp-text);
}
.mp-reason:focus { border-color: #3b82f6; }

.mp-history-row td { padding: 0 13px 14px; background: rgba(4,13,24,.34); }
.mp-history { display: none; margin-top: 3px; border: 1px solid var(--mp-border-soft); border-radius: 10px; overflow: hidden; }
.mp-history.open { display: block; }
.mp-history-title { padding: 12px 14px; background: rgba(24,44,69,.55); font-weight: 800; }
.mp-history table { width: 100%; border-collapse: collapse; }
.mp-history th, .mp-history td { padding: 10px 12px; border-bottom: 1px solid var(--mp-border-soft); text-align: left; }
.mp-history th { color: #9fb0c5; background: rgba(5,16,29,.28); font-size: 10px; text-transform: uppercase; }
.mp-history-empty { padding: 18px; color: var(--mp-muted); text-align: center; }

.mp-info {
    margin-top: 16px;
    padding: 14px 16px;
    border: 1px solid rgba(59,130,246,.32);
    border-radius: 10px;
    background: rgba(59,130,246,.065);
    color: #c8d7e9;
    line-height: 1.55;
}
.mp-footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 20px;
    padding: 16px 2px 2px;
    color: #6f839c;
    font-size: 12px;
}
.mp-empty { padding: 42px 20px !important; color: var(--mp-muted); text-align: center; }
.mp-mobile-toggle { display: none; }

@media (max-width: 1180px) {
    .mp-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
    :root { --mp-sidebar-width: 0px; }
    .mp-sidebar { transform: translateX(-100%); width: 235px; transition: transform .2s ease; }
    .mp-sidebar.open { transform: translateX(0); }
    .mp-mobile-toggle { display: inline-flex; }
    .mp-topbar { padding: 12px 14px; }
    .mp-container { padding: 15px 13px 25px; }
    .mp-title { font-size: 19px; }
    .mp-card-head { align-items: stretch; flex-direction: column; }
    .mp-search { width: 100%; }
    .mp-footer { flex-direction: column; }
}

@media (max-width: 580px) {
    .mp-kpis { grid-template-columns: 1fr; gap: 11px; }
    .mp-kpi { min-height: 92px; }
    .mp-topbar .mp-btn-primary { padding-inline: 10px; }
    .mp-topbar .mp-btn-primary span:last-child { display: none; }
}

/* Patch 0037: elenco compatto e scheda investigativa laterale */
body.mp-drawer-open { overflow: hidden; }
.mp-table-compact { min-width: 860px; table-layout: fixed; }
.mp-table-compact th:nth-child(1) { width: 30%; }
.mp-table-compact th:nth-child(2) { width: 13%; }
.mp-table-compact th:nth-child(3) { width: 11%; }
.mp-table-compact th:nth-child(4) { width: 13%; }
.mp-table-compact th:nth-child(5) { width: 18%; }
.mp-table-compact th:nth-child(6) { width: 15%; }
.mp-table-compact td { vertical-align: middle; padding-top: 13px; padding-bottom: 13px; }
.mp-number-neutral { color: #d6e1ed; font-size: 16px; }
.mp-event-date { margin-top: 6px; white-space: nowrap; }
.mp-row-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.mp-count-pill {
    min-width: 40px;
    min-height: 32px;
    padding: 4px 10px;
    border: 1px solid transparent;
    border-radius: 999px;
    color: #fff;
    cursor: pointer;
    font-weight: 900;
}
.mp-count-ok { border-color: rgba(34,197,94,.4); background: rgba(34,197,94,.16); color: #86efac; }
.mp-count-warning { border-color: rgba(245,158,11,.5); background: rgba(245,158,11,.17); color: #fde68a; }
.mp-count-danger { border-color: rgba(239,68,68,.55); background: rgba(239,68,68,.18); color: #fda4af; }
.mp-count-pill:hover { filter: brightness(1.13); }

.mp-drawer {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
}
.mp-drawer.open { display: block; }
.mp-drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(1, 7, 15, .72);
    backdrop-filter: blur(3px);
    opacity: 0;
    animation: mpFadeIn .18s ease forwards;
}
.mp-drawer-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: min(760px, 94vw);
    height: 100%;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--mp-border);
    background: linear-gradient(180deg, #0d1b2e 0%, #081522 100%);
    box-shadow: -20px 0 60px rgba(0,0,0,.45);
    transform: translateX(100%);
    animation: mpSlideIn .22s ease forwards;
}
.mp-drawer-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 22px 24px;
    border-bottom: 1px solid var(--mp-border-soft);
    background: rgba(17, 34, 55, .9);
}
.mp-drawer-head h2 { margin: 4px 0 0; font-size: 22px; overflow-wrap: anywhere; }
.mp-drawer-eyebrow { color: #6ea8f8; font-size: 11px; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
.mp-drawer-close {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border: 1px solid var(--mp-border);
    border-radius: 9px;
    background: var(--mp-panel-2);
    color: #fff;
    cursor: pointer;
    font-size: 27px;
    line-height: 1;
}
.mp-drawer-close:hover { background: var(--mp-panel-3); }
.mp-drawer-body { overflow-y: auto; padding: 20px 24px 30px; }
.mp-detail-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}
.mp-detail-summary article {
    min-height: 92px;
    padding: 13px;
    border: 1px solid var(--mp-border-soft);
    border-radius: 10px;
    background: rgba(20, 37, 59, .72);
}
.mp-detail-summary article > span,
.mp-detail-grid div > span {
    display: block;
    margin-bottom: 7px;
    color: #8295aa;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}
.mp-detail-summary article > strong { display: block; overflow-wrap: anywhere; }
.mp-detail-section {
    margin-top: 14px;
    padding: 17px;
    border: 1px solid var(--mp-border-soft);
    border-radius: 11px;
    background: rgba(13, 29, 48, .78);
}
.mp-detail-section h3 { margin: 0 0 14px; font-size: 15px; }
.mp-section-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.mp-section-title-row h3 { margin: 0; }
.mp-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.mp-detail-grid div {
    min-width: 0;
    padding: 11px 12px;
    border: 1px solid rgba(37,58,85,.68);
    border-radius: 8px;
    background: rgba(5,16,29,.34);
}
.mp-detail-grid div > strong { display: block; overflow-wrap: anywhere; }
.mp-detail-wide { grid-column: 1 / -1; }
.mp-map-link { display: inline-flex; margin-top: 13px; font-weight: 750; }
.mp-detail-table { width: 100%; min-width: 580px; border-collapse: collapse; }
.mp-detail-table th,
.mp-detail-table td { padding: 10px 11px; border-bottom: 1px solid var(--mp-border-soft); text-align: left; }
.mp-detail-table th { color: #9fb0c5; background: rgba(5,16,29,.4); font-size: 10px; text-transform: uppercase; }
.mp-detail-actions { position: sticky; bottom: -30px; background: rgba(13,29,48,.97); }
.mp-action-form-inline { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.mp-action-form-inline .mp-reason { min-width: 0; }

@keyframes mpFadeIn { to { opacity: 1; } }
@keyframes mpSlideIn { to { transform: translateX(0); } }

@media (max-width: 1050px) {
    .mp-detail-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
    .mp-drawer-panel { width: 100%; }
    .mp-drawer-head { padding: 17px; }
    .mp-drawer-body { padding: 15px 14px 24px; }
    .mp-detail-summary,
    .mp-detail-grid { grid-template-columns: 1fr; }
    .mp-detail-wide { grid-column: auto; }
    .mp-action-form-inline { grid-template-columns: 1fr; }
}

/* Variazione 0038: archivio incidenti e timeline */
.mp-btn-small{padding:.55rem .8rem;font-size:.82rem}
.mp-incident-timeline{display:grid;gap:0;margin-top:.5rem}
.mp-timeline-item{position:relative;display:grid;grid-template-columns:22px 1fr;gap:.75rem;padding:0 0 1.25rem}
.mp-timeline-item:not(:last-child)::before{content:"";position:absolute;left:6px;top:14px;bottom:0;width:2px;background:#28445f}
.mp-timeline-dot{position:relative;z-index:1;width:14px;height:14px;border-radius:50%;background:#ef4444;border:3px solid #12283d;box-shadow:0 0 0 2px #ef4444}
.mp-timeline-item div{display:grid;gap:.25rem}.mp-timeline-item span{color:#93a9bf;font-size:.86rem}

/* ==========================================================
   Framework condiviso MailPanel - variazione 0039
   ========================================================== */
.mp-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 79;
    background: rgba(1, 8, 18, .72);
    backdrop-filter: blur(3px);
}
.mp-topbar-actions { display: flex; align-items: center; gap: 10px; }
.mp-card-subtitle { margin: 5px 0 0; color: var(--mp-muted); font-size: 12px; }
.mp-kpis-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mp-table-incidents { min-width: 1280px; }
.mp-table-incidents td { vertical-align: middle; }
.mp-table tr[hidden] { display: none; }

.mp-incident-timeline {
    position: relative;
    display: grid;
    gap: 0;
    padding-left: 5px;
}
.mp-timeline-item {
    position: relative;
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 10px;
    min-height: 58px;
    padding-bottom: 15px;
}
.mp-timeline-item::before {
    content: "";
    position: absolute;
    top: 15px;
    bottom: -3px;
    left: 6px;
    width: 1px;
    background: var(--mp-border);
}
.mp-timeline-item:last-child::before { display: none; }
.mp-timeline-dot {
    position: relative;
    z-index: 1;
    width: 13px;
    height: 13px;
    margin-top: 3px;
    border: 3px solid #172b46;
    border-radius: 50%;
    background: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96,165,250,.12);
}
.mp-timeline-item strong { display: block; font-size: 13px; }
.mp-timeline-item span:not(.mp-timeline-dot) { display: block; margin-top: 4px; color: var(--mp-muted); font-size: 12px; line-height: 1.45; }
.mp-timeline-danger .mp-timeline-dot { background: #fb7185; box-shadow: 0 0 0 3px rgba(251,113,133,.12); }
.mp-timeline-warning .mp-timeline-dot { background: #fbbf24; box-shadow: 0 0 0 3px rgba(251,191,36,.12); }
.mp-timeline-success .mp-timeline-dot { background: #4ade80; box-shadow: 0 0 0 3px rgba(74,222,128,.12); }

@media (max-width: 1100px) {
    .mp-kpis,
    .mp-kpis-three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
    .mp-sidebar {
        transform: translateX(-102%);
        transition: transform .2s ease;
        z-index: 80;
    }
    .mp-sidebar.open { transform: translateX(0); }
    .mp-sidebar.open + .mp-main { pointer-events: none; }
    body.mp-sidebar-open .mp-sidebar-backdrop { display: block; }
    .mp-main { margin-left: 0; }
    .mp-mobile-toggle { display: inline-flex; }
    .mp-topbar { padding: 12px 14px; }
    .mp-container { padding: 16px 14px 24px; }
    .mp-title { font-size: 19px; }
    .mp-subtitle { max-width: 55vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .mp-btn-primary span:last-child { display: none; }
}

@media (max-width: 620px) {
    .mp-kpis,
    .mp-kpis-three { grid-template-columns: 1fr; }
    .mp-kpi { min-height: 94px; }
    .mp-card-head { align-items: stretch; flex-direction: column; }
    .mp-search { width: 100%; }
    .mp-footer { flex-direction: column; }
}

/* 0041: compatibility layer for all legacy administrative pages */
.mp-container > h1:first-child { display:none; }
.mp-container h2 { margin: 22px 0 12px; font-size: 18px; }
.mp-container h3 { margin: 18px 0 10px; font-size: 15px; }
.mp-container hr { height:1px; margin:20px 0; border:0; background:var(--mp-border-soft); }
.mp-container > p,
.mp-container > ul,
.mp-container > form,
.mp-container > table,
.mp-container > div:not(.mp-kpis):not(.mp-card):not(.mp-info):not(.mp-flash):not(.mp-footer) {
    max-width: 100%;
}
.mp-container ul { padding-left: 20px; color:#d8e3ef; }
.mp-container li { margin: 7px 0; }
.mp-container table:not(.mp-table) {
    width:100%;
    border-collapse:collapse;
    border:1px solid var(--mp-border-soft) !important;
    border-radius:12px;
    overflow:hidden;
    background:linear-gradient(145deg, rgba(16,31,51,.98), rgba(10,24,41,.98));
    box-shadow:var(--mp-shadow);
}
.mp-container table:not(.mp-table) th {
    padding:12px 13px;
    border:0 !important;
    border-bottom:1px solid var(--mp-border) !important;
    background:rgba(24,44,69,.7);
    color:#dce6f2;
    font-size:11px;
    letter-spacing:.02em;
    text-align:left;
    text-transform:uppercase;
}
.mp-container table:not(.mp-table) td {
    padding:13px;
    border:0 !important;
    border-bottom:1px solid var(--mp-border-soft) !important;
    vertical-align:top;
}
.mp-container table:not(.mp-table) tr:hover td { background:rgba(255,255,255,.018); }
.mp-container form:not(.mp-action-form) {
    padding:18px;
    border:1px solid var(--mp-border-soft);
    border-radius:12px;
    background:linear-gradient(145deg, rgba(16,31,51,.92), rgba(10,24,41,.92));
}
.mp-container form[style*="display:inline"],
.mp-container form[style*="display: inline"] { display:inline-flex !important; padding:0; border:0; background:none; }
.mp-container label { display:inline-block; margin-bottom:6px; color:#cbd7e5; font-weight:750; }
.mp-container input[type="text"],
.mp-container input[type="email"],
.mp-container input[type="password"],
.mp-container input[type="number"],
.mp-container select,
.mp-container textarea {
    width:100%;
    max-width:680px;
    min-height:40px;
    padding:9px 11px;
    border:1px solid var(--mp-border);
    border-radius:8px;
    outline:none;
    background:#091728;
    color:var(--mp-text);
}
.mp-container textarea { min-height:110px; resize:vertical; }
.mp-container input:focus,
.mp-container select:focus,
.mp-container textarea:focus { border-color:#3b82f6; box-shadow:0 0 0 3px rgba(59,130,246,.12); }
.mp-container button,
.mp-container input[type="submit"] {
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:7px;
    min-height:38px;
    padding:8px 13px;
    border:1px solid #2f76d2;
    border-radius:8px;
    background:#2468bd;
    color:#fff;
    cursor:pointer;
    font-weight:800;
}
.mp-container button:hover,
.mp-container input[type="submit"]:hover { background:#2d78d7; }
.mp-container a { font-weight:700; }
.mp-container code,
.mp-container pre { color:#dbeafe; }
.mp-container pre,
.mp-container .record-box {
    max-width:100%;
    overflow:auto;
    padding:13px;
    border:1px solid var(--mp-border-soft) !important;
    border-radius:9px;
    background:#071321 !important;
    color:#dbeafe;
}
.mp-container .card {
    margin:16px 0;
    padding:18px;
    border:1px solid var(--mp-border-soft) !important;
    border-radius:var(--mp-radius);
    background:linear-gradient(145deg, rgba(16,31,51,.98), rgba(10,24,41,.98)) !important;
    box-shadow:var(--mp-shadow);
}
.mp-container .ok { color:#4ade80 !important; }
.mp-container .bad { color:#fb7185 !important; }
.mp-container .warn { color:#fbbf24 !important; }
.mp-container .flash { border-radius:10px !important; }
.mp-container .flash-success { color:#86efac !important; border-color:rgba(34,197,94,.4) !important; background:var(--mp-green-soft) !important; }
.mp-container .flash-error { color:#fda4af !important; border-color:rgba(239,68,68,.4) !important; background:var(--mp-red-soft) !important; }
.mp-container .danger-button { color:#fff !important; border-color:#c92e38 !important; background:#ad202a !important; }
.mp-container .copy-button,
.mp-container .action-button { color:#fff !important; border-color:#2f76d2 !important; background:#2468bd !important; border-radius:8px; }
.mp-container dl { display:grid; grid-template-columns:minmax(140px,220px) 1fr; gap:8px 18px; }
.mp-container dt { color:var(--mp-muted); font-weight:800; }
.mp-container dd { margin:0; overflow-wrap:anywhere; }
.mp-quick-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:16px; margin:18px 0; }
.mp-quick-card { padding:18px; border:1px solid var(--mp-border-soft); border-radius:var(--mp-radius); background:linear-gradient(145deg,rgba(16,31,51,.98),rgba(10,24,41,.98)); box-shadow:var(--mp-shadow); }
.mp-quick-card strong { display:block; font-size:22px; margin-top:8px; }
@media (max-width:900px) {
  .mp-quick-grid { grid-template-columns:1fr; }
  .mp-container dl { grid-template-columns:1fr; }
}

/* Authentication screens */
.mp-auth-body {
    margin:0;
    min-height:100vh;
    display:grid;
    place-items:center;
    padding:24px;
    background:
      radial-gradient(circle at 20% 0%, rgba(185,28,28,.18), transparent 28%),
      radial-gradient(circle at 90% 15%, rgba(37,99,235,.12), transparent 25%),
      linear-gradient(180deg,#07111f 0%,#091827 100%);
}
.mp-auth-body .login-card,
.mp-auth-body .verify-card,
.mp-auth-body main {
    width:min(440px,100%);
    padding:30px;
    border:1px solid var(--mp-border-soft);
    border-radius:18px;
    background:linear-gradient(145deg,rgba(16,31,51,.98),rgba(10,24,41,.98));
    box-shadow:0 28px 70px rgba(0,0,0,.42);
}
.mp-auth-body h1 { margin:0 0 22px; font-size:26px; }
.mp-auth-body .field { margin-bottom:17px; }
.mp-auth-body label { display:block; margin-bottom:7px; font-weight:800; color:#dce6f2; }
.mp-auth-body input[type="text"],
.mp-auth-body input[type="password"],
.mp-auth-body input[type="number"] {
    width:100%; min-height:46px; padding:11px 13px; border:1px solid var(--mp-border);
    border-radius:9px; outline:none; background:#071522; color:var(--mp-text); font-size:16px;
}
.mp-auth-body input:focus { border-color:#3b82f6; box-shadow:0 0 0 3px rgba(59,130,246,.13); }
.mp-auth-body button { width:100%; min-height:46px; border:1px solid #b5232d; border-radius:9px; background:linear-gradient(90deg,#b91c1c,#8f1515); color:white; font-weight:850; cursor:pointer; }
.mp-auth-body button:hover { filter:brightness(1.08); }
.mp-auth-body .error { margin:0 0 16px; padding:12px 14px; border:1px solid rgba(239,68,68,.42); border-radius:9px; background:var(--mp-red-soft); color:#fda4af; font-weight:750; }


/* Patch 0042: ripristino funzionale login e dashboard reale */
.mp-auth-body .anti-bot-field {
    position: absolute !important;
    left: -10000px !important;
    top: auto !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
}
.mp-auth-body .captcha-image-row {
    display: grid;
    grid-template-columns: minmax(0,1fr) 48px;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
}
.mp-auth-body .captcha-image {
    display: block;
    width: 100%;
    height: 72px;
    object-fit: cover;
    border: 1px solid var(--mp-border);
    border-radius: 9px;
    background: #fff;
}
.mp-auth-body .refresh-button {
    width: 48px !important;
    min-width: 48px;
    height: 48px;
    min-height: 48px !important;
    padding: 0 !important;
    border-color: var(--mp-border) !important;
    background: var(--mp-panel-2) !important;
    font-size: 22px;
}
.mp-auth-body .captcha-input-wrap { position: relative; }
.mp-auth-body .captcha-input-wrap input { padding-right: 44px; transition: border-color .15s ease, box-shadow .15s ease; }
.mp-auth-body .captcha-status-dot {
    position: absolute;
    top: 50%;
    right: 15px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #64748b;
    box-shadow: 0 0 0 4px rgba(100,116,139,.12);
    transform: translateY(-50%);
    transition: .15s ease;
    pointer-events: none;
}
.mp-auth-body #captcha.is-invalid {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239,68,68,.14) !important;
}
.mp-auth-body #captcha.is-invalid + .captcha-status-dot {
    background: #ef4444;
    box-shadow: 0 0 0 4px rgba(239,68,68,.14);
}
.mp-auth-body #captcha.is-valid {
    border-color: #22c55e !important;
    box-shadow: 0 0 0 3px rgba(34,197,94,.14) !important;
}
.mp-auth-body #captcha.is-valid + .captcha-status-dot {
    background: #22c55e;
    box-shadow: 0 0 0 4px rgba(34,197,94,.14);
}
.mp-auth-body .captcha-message {
    min-height: 20px;
    margin-top: 7px;
    color: var(--mp-muted);
    font-size: 13px;
}
.mp-auth-body .captcha-message.is-invalid { color: #fda4af; }
.mp-auth-body .captcha-message.is-valid { color: #86efac; }
.mp-auth-body .captcha-message.is-checking { color: #93c5fd; }
.mp-auth-body .submit-button:disabled {
    border-color: #334155 !important;
    background: #334155 !important;
    color: #94a3b8 !important;
    cursor: not-allowed;
    filter: none !important;
}

.mp-dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(330px, .65fr);
    gap: 18px;
    margin-top: 18px;
}
.mp-service-list { display: grid; gap: 10px; padding: 16px 18px 18px; }
.mp-service-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 48px;
    padding: 10px 12px;
    border: 1px solid var(--mp-border-soft);
    border-radius: 10px;
    background: rgba(255,255,255,.018);
}
.mp-service-name { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.mp-service-dot { width: 10px; height: 10px; border-radius: 50%; }
.mp-service-dot.online { background: var(--mp-green); box-shadow: 0 0 0 4px var(--mp-green-soft); }
.mp-service-dot.offline { background: var(--mp-red); box-shadow: 0 0 0 4px var(--mp-red-soft); }
.mp-dashboard-actions {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 12px;
    padding: 16px 18px 18px;
}
.mp-dashboard-action {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 74px;
    padding: 14px;
    border: 1px solid var(--mp-border-soft);
    border-radius: 11px;
    background: rgba(255,255,255,.018);
    color: var(--mp-text);
    transition: .16s ease;
}
.mp-dashboard-action:hover { transform: translateY(-1px); border-color: #31547c; background: rgba(59,130,246,.065); }
.mp-dashboard-action-icon { display:grid; place-items:center; width:42px; height:42px; border-radius:10px; background:var(--mp-blue-soft); font-size:22px; }
.mp-dashboard-action strong { display:block; }
.mp-dashboard-action span:last-child { display:block; margin-top:3px; color:var(--mp-muted); font-size:12px; }
.mp-alert-stack { display:grid; gap:12px; margin-bottom:18px; }
.mp-alert-card {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:16px;
    padding:15px 17px;
    border:1px solid rgba(239,68,68,.36);
    border-radius:12px;
    background:var(--mp-red-soft);
}
.mp-alert-card strong { display:block; margin-bottom:4px; }
.mp-alert-card p { margin:0; color:#fecdd3; }
@media (max-width: 1050px) { .mp-dashboard-grid { grid-template-columns: 1fr; } }
@media (max-width: 620px) { .mp-dashboard-actions { grid-template-columns: 1fr; } }

/* 0047 - Framework Mail Security Stack */
.mp-stack-policy { margin-top: 18px; }
.mp-policy-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; padding:16px 18px 18px; }
.mp-policy-grid > div { padding:14px; border:1px solid var(--mp-border-soft); border-radius:11px; background:rgba(255,255,255,.018); }
.mp-policy-grid strong,.mp-policy-grid span { display:block; }
.mp-policy-grid span { margin-top:5px; color:var(--mp-muted); font-size:13px; line-height:1.45; }
.mp-stack-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:18px; margin-top:18px; }
.mp-stack-module-body { padding:16px 18px 18px; }
.mp-stack-module-body > p { min-height:44px; margin:0 0 15px; color:var(--mp-muted); line-height:1.5; }
.mp-stack-meta { display:grid; gap:9px; margin:0; }
.mp-stack-meta > div { display:flex; justify-content:space-between; gap:16px; padding-top:9px; border-top:1px solid var(--mp-border-soft); }
.mp-stack-meta dt { color:var(--mp-muted); }
.mp-stack-meta dd { margin:0; text-align:right; font-weight:800; }
.mp-badge-gray { border-color:#475569; background:rgba(71,85,105,.18); color:#cbd5e1; }
.mp-security-roadmap { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; padding:16px 18px 18px; }
.mp-security-roadmap > div { position:relative; min-height:130px; padding:16px; border:1px solid var(--mp-border-soft); border-radius:11px; background:rgba(255,255,255,.018); }
.mp-security-roadmap > div > span { display:grid; place-items:center; width:32px; height:32px; margin-bottom:13px; border-radius:9px; background:var(--mp-blue-soft); color:#93c5fd; font-weight:900; }
.mp-security-roadmap strong,.mp-security-roadmap small { display:block; }
.mp-security-roadmap small { margin-top:7px; color:var(--mp-muted); line-height:1.45; }
@media (max-width:1100px) { .mp-policy-grid,.mp-security-roadmap { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width:820px) { .mp-stack-grid { grid-template-columns:1fr; } }
@media (max-width:620px) { .mp-policy-grid,.mp-security-roadmap { grid-template-columns:1fr; } }

/* SMTP outgoing full width module */
.mp-smtp-module {
    grid-column: 1 / -1;
}

.mp-smtp-module .mp-smtp-form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    width: 100%;
}

.mp-smtp-module .mp-smtp-field {
    width: 100%;
}

.mp-smtp-module .mp-smtp-field input,
.mp-smtp-module .mp-smtp-field select {
    width: 100%;
    box-sizing: border-box;
}

.mp-smtp-module .mp-smtp-wide {
    grid-column: 1 / -1;
}

.mp-smtp-module .mp-smtp-actions {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

@media (max-width: 900px) {
    .mp-smtp-module .mp-smtp-form-grid {
        grid-template-columns: 1fr;
    }
}

